classe Database (Voir la source)

Méthodes

static Database
configure(array $config)

Load configuration

static Database
getInstance()

Returns the Database instance

static Database|null
connection(string|null $name = null)

Connection, starts the connection on the DB

static string|null
getConnectionName()

Get connexion name

static AbstractConnection|null
getAdapterConnection()

Get adapter connexion instance

static int
update(string $sql_statement, array $data = [])

Execute an UPDATE request

static mixed
select(string $sql_statement, array $data = [])

Execute a SELECT request

static mixed|null
selectOne(string $sql_statement, array $data = [])

Executes a select query and returns a single record

static int
insert(string $sql_statement, array $data = [])

Execute an insert query

static bool
statement(string $sql_statement)

Executes a request of type DROP | CREATE TABLE | TRUNCATE | ALTER Builder

static int
delete(string $sql_statement, array $data = [])

Execute a delete request

static QueryBuilder
table(string $table)

Load the query builder factory on table name

static void
startTransaction(callable|null $callback = null)

Starting the start of a transaction

static bool
inTransaction()

Check if database execution is in transaction

static void
commit()

Validate a transaction

static void
rollback()

Cancel a transaction

static int|string
lastInsertId(string|null $name = null)

Retrieves the identifier of the last record.

static PDO
getPdo()

PDO, returns the instance of the connection.

static 
setPdo(PDO $pdo)

Modify the PDO instance

mixed
__call(string $method, array $arguments)

__call

Détails

static Database configure(array $config)

Load configuration

Paramètres

array $config

Valeur de retour

Database

static Database getInstance()

Returns the Database instance

Valeur de retour

Database

static Database|null connection(string|null $name = null)

Connection, starts the connection on the DB

Paramètres

string|null $name

Valeur de retour

Database|null

Exceptions

ConnectionException

static string|null getConnectionName()

Get connexion name

Valeur de retour

string|null

static AbstractConnection|null getAdapterConnection()

Get adapter connexion instance

Valeur de retour

AbstractConnection|null

static int update(string $sql_statement, array $data = [])

Execute an UPDATE request

Paramètres

string $sql_statement
array $data

Valeur de retour

int

static mixed select(string $sql_statement, array $data = [])

Execute a SELECT request

Paramètres

string $sql_statement
array $data

Valeur de retour

mixed

static mixed|null selectOne(string $sql_statement, array $data = [])

Executes a select query and returns a single record

Paramètres

string $sql_statement
array $data

Valeur de retour

mixed|null

static int insert(string $sql_statement, array $data = [])

Execute an insert query

Paramètres

string $sql_statement
array $data

Valeur de retour

int

static bool statement(string $sql_statement)

Executes a request of type DROP | CREATE TABLE | TRUNCATE | ALTER Builder

Paramètres

string $sql_statement

Valeur de retour

bool

static int delete(string $sql_statement, array $data = [])

Execute a delete request

Paramètres

string $sql_statement
array $data

Valeur de retour

int

static QueryBuilder table(string $table)

Load the query builder factory on table name

Paramètres

string $table

Valeur de retour

QueryBuilder

static void startTransaction(callable|null $callback = null)

Starting the start of a transaction

Paramètres

callable|null $callback

Valeur de retour

void

static bool inTransaction()

Check if database execution is in transaction

Valeur de retour

bool

static void commit()

Validate a transaction

Valeur de retour

void

static void rollback()

Cancel a transaction

Valeur de retour

void

static int|string lastInsertId(string|null $name = null)

Retrieves the identifier of the last record.

Paramètres

string|null $name

Valeur de retour

int|string

static PDO getPdo()

PDO, returns the instance of the connection.

Valeur de retour

PDO

static setPdo(PDO $pdo)

Modify the PDO instance

Paramètres

PDO $pdo

mixed __call(string $method, array $arguments)

__call

Paramètres

string $method
array $arguments

Valeur de retour

mixed

Exceptions

DatabaseException