Backend
Backend
Interface for relational database driver backends.
interface BackendDefines the contract for database operations, error handling, attribute management, and query execution. Implementations must provide methods for creating databases, managing connections, executing queries, and handling driver-specific features.
Methods
createDatabase
Creates a new database with the specified name.
public createDatabase(string $name): boolReturns: bool
Parameters
| Parameter | Type | Description |
|---|---|---|
$name | string |
errorInfo
public errorInfo(): array|falseReturns: array|false
errorCode
Returns the error code for the last database operation.
public errorCode(): stringReturns: string
setTimezone
Sets the timezone for the database connection.
public setTimezone(string $tz): boolReturns: bool
Parameters
| Parameter | Type | Description |
|---|---|---|
$tz | string |
lastInsertId
Returns the ID of the last inserted row.
public lastInsertId(): stringReturns: string
getAttribute
Retrieves the value of a driver-specific attribute.
public getAttribute(int $attribute): mixedReturns: mixed
Parameters
| Parameter | Type | Description |
|---|---|---|
$attribute | int |
setAttribute
Sets the value of a driver-specific attribute.
public setAttribute(int $attribute, mixed $value): boolReturns: bool
Parameters
| Parameter | Type | Description |
|---|---|---|
$attribute | int | |
$value | mixed |
exec
Executes an SQL statement and returns the number of affected rows or false on failure.
public exec(string $sql): false|intReturns: false|int
Parameters
| Parameter | Type | Description |
|---|---|---|
$sql | string |
query
Executes a SQL query.
public query(string $sql, array $parameters): false|ResultReturns: false|Hazaar\DBI\Result
Parameters
| Parameter | Type | Description |
|---|---|---|
$sql | string | |
$parameters | array |
getQueryBuilder
Returns a query builder instance.
public getQueryBuilder(): QueryBuilderReturns: Hazaar\DBI\Interface\QueryBuilder
lastQueryString
Returns the last query string executed by the driver.
public lastQueryString(): stringReturns: string
Generated by Hazaar API Doc Generator on Fri, 04 Sep 2026 23:32:16 +0000