interface Driver

dibi driver interface.

Methods

void
connect(array $config)

Connects to a database.

void
disconnect()

Disconnects from a database.

query($sql)

Internal: Executes the SQL query.

int|false
getAffectedRows()

Gets the number of affected rows by the last INSERT, UPDATE or DELETE query.

int|false
getInsertId($sequence)

Retrieves the ID generated for an AUTO_INCREMENT column by the previous INSERT query.

void
begin($savepoint = null)

Begins a transaction (if supported).

void
commit($savepoint = null)

Commits statements in a transaction.

void
rollback($savepoint = null)

Rollback changes in a transaction.

mixed
getResource()

Returns the connection resource.

getReflector()

Returns the connection reflector.

string
escapeText($value)

Encodes data for use in a SQL statement.

string
escapeBinary($value)

No description

string
escapeIdentifier($value)

No description

string
escapeBool($value)

No description

string
escapeDate($value)

No description

string
escapeDateTime($value)

No description

string
escapeLike($value, $pos)

Encodes string for use in a LIKE statement.

void
applyLimit($sql, $limit, $offset)

Injects LIMIT/OFFSET to the SQL query.

Details

at line 33
void connect(array $config)

Connects to a database.

Parameters

array $config

Return Value

void

Exceptions

Exception

at line 40
void disconnect()

Disconnects from a database.

Return Value

void

Exceptions

Exception

at line 48
ResultDriver|null query($sql)

Internal: Executes the SQL query.

Parameters

$sql

Return Value

ResultDriver|null

Exceptions

DriverException

at line 54
int|false getAffectedRows()

Gets the number of affected rows by the last INSERT, UPDATE or DELETE query.

Return Value

int|false

number of rows or false on error

at line 60
int|false getInsertId($sequence)

Retrieves the ID generated for an AUTO_INCREMENT column by the previous INSERT query.

Parameters

$sequence

Return Value

int|false

int on success or false on failure

at line 68
void begin($savepoint = null)

Begins a transaction (if supported).

Parameters

$savepoint

Return Value

void

Exceptions

DriverException

at line 76
void commit($savepoint = null)

Commits statements in a transaction.

Parameters

$savepoint

Return Value

void

Exceptions

DriverException

at line 84
void rollback($savepoint = null)

Rollback changes in a transaction.

Parameters

$savepoint

Return Value

void

Exceptions

DriverException

at line 90
mixed getResource()

Returns the connection resource.

Return Value

mixed

at line 96
Reflector getReflector()

Returns the connection reflector.

Return Value

Reflector

at line 103
string escapeText($value)

Encodes data for use in a SQL statement.

Parameters

$value

Return Value

string

encoded value

at line 109
string escapeBinary($value)

No description

Parameters

$value

Return Value

string

at line 115
string escapeIdentifier($value)

No description

Parameters

$value

Return Value

string

at line 121
string escapeBool($value)

No description

Parameters

$value

Return Value

string

at line 127
string escapeDate($value)

No description

Parameters

$value

Return Value

string

at line 133
string escapeDateTime($value)

No description

Parameters

$value

Return Value

string

at line 141
string escapeLike($value, $pos)

Encodes string for use in a LIKE statement.

Parameters

$value
$pos

Return Value

string

at line 150
void applyLimit($sql, $limit, $offset)

Injects LIMIT/OFFSET to the SQL query.

Parameters

$sql
$limit
$offset

Return Value

void