Represents a database driver containing all specificities for a database engine including its SQL dialect.
string
'cte'
Common Table Expressions (with clause) support.
string
'disable-constraint-without-transaction'
Disabling constraints without being in transaction support.
string
'json'
Native JSON data type support.
string
'quote'
PDO::quote() support.
string
'savepoint'
Transaction savepoint support.
string
'truncate-with-constraints'
Truncate with foreign keys attached support.
string
'window'
Window function support (all or partial clauses).
int|null
null
array<int>
[]
bool
Indicates whether the driver is doing automatic identifier quoting for all queries
array<string, mixed>
Base configuration that is merged into the user supplied configuration data.
array<string, mixed>
Configuration data.
PDO
Instance of PDO.
string|null
The server version
int
The last number of connection retry attempts.
Constructor
Returns an array that can be used to describe the internal state of this object.
Destructor
Establishes a connection to the database server
Starts a transaction.
Commits a transaction.
Transforms the passed query to this Driver's dialect and returns an instance of the transformed query and the full compiled SQL string.
Establishes a connection to the database server.
Disable auto quoting of identifiers in queries.
Get the SQL for disabling foreign keys.
Disconnects from database server.
Sets whether this driver should automatically quote identifiers in queries.
Get the SQL for enabling foreign keys.
Returns whether php is able to use this driver for connecting to database.
Returns the number of connection retry attempts made.
Get the internal PDO connection instance.
Returns the maximum alias length allowed. This can be different from the maximum identifier length for columns.
Returns whether a transaction is active for connection.
Returns whether this driver should automatically quote identifiers in queries.
Checks whether the driver is connected.
Returns last id generated for a table or sequence in database.
Returns an instance of a QueryCompiler.
Constructs new TableSchema.
Prepares a sql statement to be executed.
Returns a callable function that will be used to transform a passed Query object. This function, in turn, will return an instance of a Query object that has been transformed to accommodate any specificities of the SQL dialect in use.
Returns a value in a safe representation to be used in a query string
Quotes a database identifier (a column name, table name, etc..) to be used safely in queries without the risk of using reserved words.
Get the SQL for releasing a save point.
Get the SQL for rollingback a save point.
Rollbacks a transaction.
Get the SQL for creating a save point.
Returns the schema name that's being used.
Get the schema dialect.
Escapes values for use in schema definitions.
Set the internal PDO connection instance.
Returns whether the driver supports the feature.
Returns true if the server supports common table expressions.
Returns whether the driver supports adding or dropping constraints to already created tables.
Checks if the driver supports quoting, as PDO_ODBC does not support it.
Returns whether this driver supports save points for nested transactions.
Returns connected server version.
__construct(array<string, mixed> $config = [])
Constructor
array<string, mixed>
$config optional The configuration for the driver.
InvalidArgumentException
__debugInfo(): array<string, mixed>
Returns an array that can be used to describe the internal state of this object.
array<string, mixed>
__destruct()
Destructor
_connect(string $dsn, array<string, mixed> $config): bool
Establishes a connection to the database server
string
$dsn A Driver-specific PDO-DSN
array<string, mixed>
$config configuration to be used for creating connection
bool
beginTransaction(): bool
Starts a transaction.
bool
commitTransaction(): bool
Commits a transaction.
bool
compileQuery(Cake\Database\Query $query, Cake\Database\ValueBinder $binder): array
Transforms the passed query to this Driver's dialect and returns an instance of the transformed query and the full compiled SQL string.
Cake\Database\Query
$query Cake\Database\ValueBinder
$binder array
connect(): bool
Establishes a connection to the database server.
bool
disableAutoQuoting(): $this
Disable auto quoting of identifiers in queries.
$this
disableForeignKeySQL(): string
Get the SQL for disabling foreign keys.
string
disconnect(): void
Disconnects from database server.
void
enableAutoQuoting(bool $enable = true): $this
Sets whether this driver should automatically quote identifiers in queries.
bool
$enable optional $this
enableForeignKeySQL(): string
Get the SQL for enabling foreign keys.
string
enabled(): bool
Returns whether php is able to use this driver for connecting to database.
bool
getConnectRetries(): int
Returns the number of connection retry attempts made.
int
getConnection(): PDO
Get the internal PDO connection instance.
PDO
getMaxAliasLength(): int|null
Returns the maximum alias length allowed. This can be different from the maximum identifier length for columns.
int|null
inTransaction(): bool
Returns whether a transaction is active for connection.
bool
isAutoQuotingEnabled(): bool
Returns whether this driver should automatically quote identifiers in queries.
bool
isConnected(): bool
Checks whether the driver is connected.
bool
lastInsertId(string|null $table = null, string|null $column = null): string|int
Returns last id generated for a table or sequence in database.
string|null
$table optional string|null
$column optional string|int
newCompiler(): Cake\Database\QueryCompiler
Returns an instance of a QueryCompiler.
Cake\Database\QueryCompiler
newTableSchema(string $table, array $columns = []): Cake\Database\Schema\TableSchema
Constructs new TableSchema.
string
$table array
$columns optional Cake\Database\Schema\TableSchema
prepare(Cake\Database\Query|string $query): Cake\Database\StatementInterface
Prepares a sql statement to be executed.
Cake\Database\Query|string
$query Cake\Database\StatementInterface
queryTranslator(string $type): Closure
Returns a callable function that will be used to transform a passed Query object. This function, in turn, will return an instance of a Query object that has been transformed to accommodate any specificities of the SQL dialect in use.
string
$type Closure
quote(mixed $value, int $type = PDO::PARAM_STR): string
Returns a value in a safe representation to be used in a query string
mixed
$value int
$type optional string
quoteIdentifier(string $identifier): string
Quotes a database identifier (a column name, table name, etc..) to be used safely in queries without the risk of using reserved words.
string
$identifier string
releaseSavePointSQL(string|int $name): string
Get the SQL for releasing a save point.
string|int
$name Save point name or id
string
rollbackSavePointSQL(string|int $name): string
Get the SQL for rollingback a save point.
string|int
$name Save point name or id
string
rollbackTransaction(): bool
Rollbacks a transaction.
bool
savePointSQL(string|int $name): string
Get the SQL for creating a save point.
string|int
$name Save point name or id
string
schema(): string
Returns the schema name that's being used.
string
schemaDialect(): Cake\Database\Schema\SchemaDialect
Get the schema dialect.
Used by {@link \Cake\Database\Schema} package to reflect schema and generate schema.
If all the tables that use this Driver specify their own schemas, then this may return null.
Cake\Database\Schema\SchemaDialect
schemaValue(mixed $value): string
Escapes values for use in schema definitions.
mixed
$value string
setConnection(object $connection): $this
Set the internal PDO connection instance.
object
$connection PDO instance.
$this
supports(string $feature): bool
Returns whether the driver supports the feature.
Defaults to true for FEATURE_QUOTE and FEATURE_SAVEPOINT.
string
$feature Driver feature name
bool
supportsCTEs(): bool
Returns true if the server supports common table expressions.
bool
supportsDynamicConstraints(): bool
Returns whether the driver supports adding or dropping constraints to already created tables.
bool
supportsQuoting(): bool
Checks if the driver supports quoting, as PDO_ODBC does not support it.
bool
supportsSavePoints(): bool
Returns whether this driver supports save points for nested transactions.
bool
version(): string
Returns connected server version.
string
Indicates whether the driver is doing automatic identifier quoting for all queries
bool
Base configuration that is merged into the user supplied configuration data.
array<string, mixed>
Configuration data.
array<string, mixed>
Instance of PDO.
PDO
The server version
string|null
The last number of connection retry attempts.
int
© 2005–present The Cake Software Foundation, Inc.
Licensed under the MIT License.
CakePHP is a registered trademark of Cake Software Foundation, Inc.
We are not endorsed by or affiliated with CakePHP.
https://api.cakephp.org/4.4/class-Cake.Database.Driver.html