class Database (View source)

Methods

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 the connexion name

static AbstractConnection|null
getConnectionAdapter()

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
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 the table name

static void
startTransaction()

Starting the start of a transaction

static bool
inTransaction()

Check if database execution is in the transaction

static void
commit()

Validate a transaction

static void
rollback()

Cancel a transaction

static mixed
transaction(callable $callback)

Starting the start of a transaction wrapper on top of the callback

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

Retrieves the identifier of the last record.

static PDO
getPdo()

PDO, returns the instance of the connection.

static void
setPdo(PDO $pdo)

Modify the PDO instance

mixed
__call(string $method, array $arguments)

__call

Details

static Database configure(array $config)

Load configuration

Parameters

array $config

Return Value

Database

static Database getInstance()

Returns the Database instance

Return Value

Database

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

Connection, starts the connection on the DB

Parameters

string|null $name

Return Value

Database|null

Exceptions

ConnectionException

static string|null getConnectionName()

Get the connexion name

Return Value

string|null

static AbstractConnection|null getConnectionAdapter()

Get adapter connexion instance

Return Value

AbstractConnection|null

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

Execute an UPDATE request

Parameters

string $sql_statement
array $data

Return Value

int

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

Execute a SELECT request

Parameters

string $sql_statement
array $data

Return Value

mixed

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

Executes a select query and returns a single record

Parameters

string $sql_statement
array $data

Return Value

mixed

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

Execute an insert query

Parameters

string $sql_statement
array $data

Return Value

int

static bool statement(string $sql_statement)

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

Parameters

string $sql_statement

Return Value

bool

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

Execute a delete request

Parameters

string $sql_statement
array $data

Return Value

int

static QueryBuilder table(string $table)

Load the query builder factory on the table name

Parameters

string $table

Return Value

QueryBuilder

static void startTransaction()

Starting the start of a transaction

Return Value

void

static bool inTransaction()

Check if database execution is in the transaction

Return Value

bool

static void commit()

Validate a transaction

Return Value

void

static void rollback()

Cancel a transaction

Return Value

void

static mixed transaction(callable $callback)

Starting the start of a transaction wrapper on top of the callback

Parameters

callable $callback

Return Value

mixed

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

Retrieves the identifier of the last record.

Parameters

string|null $name

Return Value

int|string|PDO

static PDO getPdo()

PDO, returns the instance of the connection.

Return Value

PDO

static void setPdo(PDO $pdo)

Modify the PDO instance

Parameters

PDO $pdo

Return Value

void

mixed __call(string $method, array $arguments)

__call

Parameters

string $method
array $arguments

Return Value

mixed

Exceptions

ErrorException