class Database

Class Database

Methods

__construct( ConnectionInterface|PDO|null $connection = null)

Create a new instance, using the provided connection information, either none for automatically a connection, a ConnectionWrapper instance (through ConnectionInterface) or a PDO connection.

insertSql( string $dbName = null, array $extraSqlFiles = null)

Insert all sql needed in database Default insert /install/thelia.sql and /install/insert.sql

execute( string $sql, array $args = array())

A simple wrapper around PDO::exec

backupDb( string $filename, string $tables = '*')

Backup the db OR just a table

restoreDb( string $filename)

Restore a file in the current db

createDatabase($dbName)

create database if not exists

PDO
getConnection()

No description

Details

at line 41
__construct( ConnectionInterface|PDO|null $connection = null)

Create a new instance, using the provided connection information, either none for automatically a connection, a ConnectionWrapper instance (through ConnectionInterface) or a PDO connection.

Parameters

ConnectionInterface|PDO|null $connection the connection object

Exceptions

InvalidArgumentException if $connection is not of the suitable type.

at line 67
insertSql( string $dbName = null, array $extraSqlFiles = null)

Insert all sql needed in database Default insert /install/thelia.sql and /install/insert.sql

Parameters

string $dbName Database name
array $extraSqlFiles SQL Files uri to insert

at line 105
PDOStatement execute( string $sql, array $args = array())

A simple wrapper around PDO::exec

Parameters

string $sql SQL query
array $args SQL request parameters (PDO style)

Return Value

PDOStatement

Exceptions

PDOException if something goes wrong.

at line 151
backupDb( string $filename, string $tables = '*')

Backup the db OR just a table

Parameters

string $filename
string $tables

at line 230
restoreDb( string $filename)

Restore a file in the current db

Parameters

string $filename the file containing sql queries

at line 254
createDatabase($dbName)

create database if not exists

Parameters

$dbName

at line 267
PDO getConnection()

Return Value

PDO