Interface for database driver.
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 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.
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.
getConnection()
Returns correct connection resource or object that is internally used.
object
Connection object used internally.
getMaxAliasLength()
Returns the maximum alias length allowed.
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 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 connection object.
object
$connection The connection instance.
$this
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.
bool
supportsSavePoints()
Returns whether this driver supports save points for nested transactions.
bool
True if save points are supported, false otherwise.
© 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/interface-Cake.Database.DriverInterface.html