PdoConnection
- Full name:
\Qubus\Expressive\Connection\PdoConnection - This class implements:
\Qubus\Expressive\Connection - This class is an Abstract class
Properties
pdo
driverName
transactionLevel
config
driver
schemaCompiler
schema
schemaCompilerOptions
Methods
__construct
Parameters:
| Parameter | Type | Description |
|---|---|---|
$config | array |
createPdo
Parameters:
| Parameter | Type | Description |
|---|---|---|
$config | array |
getDsn
Returns the DSN associated with this connection
query
Execute a query
Parameters:
| Parameter | Type | Description |
|---|---|---|
$sql | string | SQL Query. |
$params | array | (optional) Query params. |
command
Execute a non-query SQL command.
Parameters:
| Parameter | Type | Description |
|---|---|---|
$sql | string | SQL Command. |
$params | array | (optional) Command params. |
affectedRows
Execute a query and return the number of affected rows.
Parameters:
| Parameter | Type | Description |
|---|---|---|
$sql | string | SQL Query. |
$params | array | (optional) Query params. |
column
Execute a query and fetch the first column
Parameters:
| Parameter | Type | Description |
|---|---|---|
$sql | string | SQL Query |
$params | array | (optional) Query params |
queryBuilder
getDriver
Returns the driver's name.
getSchema
Returns the schema associated with this connection
schemaCompiler
Returns an instance of the schema compiler associated with this connection
Throws:
inTransaction
startTransaction
Start a transaction.
commitTransaction
rollbackTransaction
transaction
Run transactional queries.
Parameters:
| Parameter | Type | Description |
|---|---|---|
$callback | \Closure | transaction callback |
$that | mixed|null | |
$default | mixed|null |
Throws:
setCharset
Sets the connection encoding.
Parameters:
| Parameter | Type | Description |
|---|---|---|
$charset | string | Encoding. |
replaceParams
Replace placeholders with parameters.
Parameters:
| Parameter | Type | Description |
|---|---|---|
$query | string | SQL query |
$params | array | Query parameters |
prepare
Prepares a query.
protected prepare(string $query, array<int|string,scalar|null> $params): array{query: string, params: array<int|string,scalar|null>, statement: \PDOStatement}
Parameters:
| Parameter | Type | Description |
|---|---|---|
$query | string | SQL query |
$params | array | Query parameters |
bindValues
Parameters:
| Parameter | Type | Description |
|---|---|---|
$statement | \PDOStatement | |
$values | array |
pdoExecute
Executes a prepared query and returns true on success or false on failure.
protected pdoExecute(array{query: string, params: array<int|string,scalar|null>, statement: \PDOStatement} $prepared): bool
Parameters:
| Parameter | Type | Description |
|---|---|---|
$prepared | array{query: string, params: array |
supportsReturning
Driver feature detection.
supportsUpsert
supportsSavepoints
transactional
Parameters:
| Parameter | Type | Description |
|---|---|---|
$callback | \Closure |
Throws:
buildDsn
- This method is static. This method is abstract. Parameters:*
| Parameter | Type | Description |
|---|---|---|
$config | array |
listTables
- This method is abstract.
Inherited methods
quoteIdentifier
Parameters:
| Parameter | Type | Description |
|---|---|---|
$identifier | string |
quote
Quote a value for an SQL query.
public quote(float|array<array-key,float|bool|int|string|null>|bool|int|string|null $value = null): false|int|string
Objects passed to this function will be converted to strings. Expression objects will use the value of the expression. Query objects will be compiled and converted to a sub-query. Fnc objects will be sent of for compiling. All other objects will be converted using the __toString method.
Parameters:
| Parameter | Type | Description |
|---|---|---|
$value | float|array | any value to quote |