Represents a database driver containing all specificities for a database engine including its SQL dialect.
int|null
null
int[]
[]
bool
Indicates whether or not the driver is doing automatic identifier quoting for all queries
array
Base configuration that is merged into the user supplied configuration data.
array
Configuration data.
\PDO
Instance of PDO.
string|null
The server version
int
The last number of connection retry attempts.
bool|null
Whether or not the server supports common table expressions.
Returns an array that can be used to describe the internal state of this object.
Transforms the passed query to this Driver's dialect and returns an instance of the transformed query and the full compiled SQL string.
Sets whether or not this driver should automatically quote identifiers in queries.
Returns whether php is able to use this driver for connecting to database.
Returns whether or not this driver should automatically quote identifiers in queries.
Returns a callable function that will be used to transform a passed Query object.
Quotes a database identifier (a column name, table name, etc..) to be used safely in queries without the risk of using reserved words.
Returns whether the driver supports adding or dropping constraints to already created tables.
Returns whether this driver supports save points for nested transactions.
__construct(array $config)
Constructor
array
$config optional The configuration for the driver.
InvalidArgumentException
__debugInfo()
Returns an array that can be used to describe the internal state of this object.
array
__destruct()
Destructor
_connect(string $dsn, array $config)
Establishes a connection to the database server
string
$dsn A Driver-specific PDO-DSN
array
$config configuration to be used for creating connection
bool
true on success
beginTransaction()
Starts a transaction.
bool
True on success, false otherwise.
commitTransaction()
Commits a transaction.
bool
True on success, false otherwise.
compileQuery(\Cake\Database\Query $query, \Cake\Database\ValueBinder $generator)
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 The query to compile.
\Cake\Database\ValueBinder
$generator The value binder to use.
array
containing 2 entries. The first entity is the transformed query and the second one the compiled SQL.
connect()
Establishes a connection to the database server.
bool
True on success, false on failure.
Cake\Database\Exception\MissingConnectionException
disableAutoQuoting()
Disable auto quoting of identifiers in queries.
$this
disableForeignKeySQL()
Get the SQL for disabling foreign keys.
string
disconnect()
Disconnects from database server.
enableAutoQuoting(bool $enable)
Sets whether or not this driver should automatically quote identifiers in queries.
bool
$enable optional Whether to enable auto quoting
$this
enableForeignKeySQL()
Get the SQL for enabling foreign keys.
string
enabled()
Returns whether php is able to use this driver for connecting to database.
bool
True if it is valid to use this driver.
getConnectRetries()
Returns the number of connection retry attempts made.
int
getConnection()
Get the internal PDO connection instance.
\PDO
getMaxAliasLength()
Returns the maximum alias length allowed.
This can be different than the maximum identifier length for columns.
int|null
Maximum alias length or null if no limit
isAutoQuotingEnabled()
Returns whether or not this driver should automatically quote identifiers in queries.
bool
isConnected()
Checks whether or not the driver is connected.
bool
lastInsertId(?string $table, ?string $column)
Returns last id generated for a table or sequence in database.
string|null
$table optional table name or sequence to get last insert value from.
string|null
$column optional the name of the column representing the primary key.
string|int
newCompiler()
Returns an instance of a QueryCompiler.
\Cake\Database\QueryCompiler
newTableSchema(string $table, array $columns)
Constructs new TableSchema.
string
$table The table name.
array
$columns optional The list of columns for the schema.
\Cake\Database\Schema\TableSchema
prepare(mixed $query)
Prepares a sql statement to be executed.
string|\Cake\Database\Query
$query The query to turn into a prepared statement.
\Cake\Database\StatementInterface
queryTranslator(string $type)
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 The type of query to be transformed (select, insert, update, delete).
\Closure
quote(mixed $value, mixed $type)
Returns a value in a safe representation to be used in a query string
mixed
$value The value to quote.
int
$type optional Type to be used for determining kind of quoting to perform.
string
quoteIdentifier(string $identifier)
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 The identifier expression to quote.
string
releaseSavePointSQL(mixed $name)
Get the SQL for releasing a save point.
string|int
$name The table name.
string
rollbackSavePointSQL(mixed $name)
Get the SQL for rollingback a save point.
string|int
$name The table name.
string
rollbackTransaction()
Rollbacks a transaction.
bool
True on success, false otherwise.
savePointSQL(mixed $name)
Get the SQL for creating a save point.
string|int
$name The table name.
string
schema()
Returns the schema name that's being used.
string
schemaDialect()
Get the schema dialect.
Used by 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)
Escapes values for use in schema definitions.
mixed
$value The value to escape.
string
String for use in schema definitions.
setConnection(mixed $connection)
Set the internal PDO connection instance.
\PDO
$connection PDO instance.
$this
supportsCTEs()
Returns true if the server supports common table expressions.
bool
supportsDynamicConstraints()
Returns whether the driver supports adding or dropping constraints to already created tables.
bool
True if driver supports dynamic constraints.
supportsQuoting()
Checks if the driver supports quoting, as PDO_ODBC does not support it.
bool
supportsSavePoints()
Returns whether this driver supports save points for nested transactions.
bool
True if save points are supported, false otherwise.
version()
Returns connected server version.
string
Indicates whether or not the driver is doing automatic identifier quoting for all queries
bool
Base configuration that is merged into the user supplied configuration data.
array
Configuration data.
array
Instance of PDO.
\PDO
The server version
string|null
The last number of connection retry attempts.
int
Whether or not the server supports common table expressions.
bool|null
© 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.1/class-Cake.Database.Driver.html