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> []
boolIndicates 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.
PDOInstance of PDO.
string|nullThe server version
intThe 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
boolbeginTransaction(): bool
Starts a transaction.
boolcommitTransaction(): bool
Commits a transaction.
boolcompileQuery(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 arrayconnect(): bool
Establishes a connection to the database server.
booldisableAutoQuoting(): $this
Disable auto quoting of identifiers in queries.
$thisdisableForeignKeySQL(): string
Get the SQL for disabling foreign keys.
stringdisconnect(): void
Disconnects from database server.
voidenableAutoQuoting(bool $enable = true): $this
Sets whether this driver should automatically quote identifiers in queries.
bool $enable optional $thisenableForeignKeySQL(): string
Get the SQL for enabling foreign keys.
stringenabled(): bool
Returns whether php is able to use this driver for connecting to database.
boolgetConnectRetries(): int
Returns the number of connection retry attempts made.
intgetConnection(): PDO
Get the internal PDO connection instance.
PDOgetMaxAliasLength(): int|null
Returns the maximum alias length allowed. This can be different from the maximum identifier length for columns.
int|nullinTransaction(): bool
Returns whether a transaction is active for connection.
boolisAutoQuotingEnabled(): bool
Returns whether this driver should automatically quote identifiers in queries.
boolisConnected(): bool
Checks whether the driver is connected.
boollastInsertId(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|intnewCompiler(): Cake\Database\QueryCompiler
Returns an instance of a QueryCompiler.
Cake\Database\QueryCompilernewTableSchema(string $table, array $columns = []): Cake\Database\Schema\TableSchema
Constructs new TableSchema.
string $table array $columns optional Cake\Database\Schema\TableSchemaprepare(Cake\Database\Query|string $query): Cake\Database\StatementInterface
Prepares a sql statement to be executed.
Cake\Database\Query|string $query Cake\Database\StatementInterfacequeryTranslator(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 Closurequote(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 stringquoteIdentifier(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 stringreleaseSavePointSQL(string|int $name): string
Get the SQL for releasing a save point.
string|int $name Save point name or id
stringrollbackSavePointSQL(string|int $name): string
Get the SQL for rollingback a save point.
string|int $name Save point name or id
stringrollbackTransaction(): bool
Rollbacks a transaction.
boolsavePointSQL(string|int $name): string
Get the SQL for creating a save point.
string|int $name Save point name or id
stringschema(): string
Returns the schema name that's being used.
stringschemaDialect(): 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\SchemaDialectschemaValue(mixed $value): string
Escapes values for use in schema definitions.
mixed $value stringsetConnection(object $connection): $this
Set the internal PDO connection instance.
object $connection PDO instance.
$thissupports(string $feature): bool
Returns whether the driver supports the feature.
Defaults to true for FEATURE_QUOTE and FEATURE_SAVEPOINT.
string $feature Driver feature name
boolsupportsCTEs(): bool
Returns true if the server supports common table expressions.
boolsupportsDynamicConstraints(): bool
Returns whether the driver supports adding or dropping constraints to already created tables.
boolsupportsQuoting(): bool
Checks if the driver supports quoting, as PDO_ODBC does not support it.
boolsupportsSavePoints(): bool
Returns whether this driver supports save points for nested transactions.
boolversion(): string
Returns connected server version.
stringIndicates whether the driver is doing automatic identifier quoting for all queries
boolBase configuration that is merged into the user supplied configuration data.
array<string, mixed>Configuration data.
array<string, mixed>Instance of PDO.
PDOThe server version
string|nullThe 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