SQLServer driver.
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
128
array<int>
[40613]
bool
Indicates whether the driver is doing automatic identifier quoting for all queries
array<string, mixed>
Base configuration settings for Sqlserver driver
array<string, mixed>
Configuration data.
PDO
Instance of PDO.
string
String used to end a database identifier quoting to make it safe
Cake\Database\Schema\SqlserverSchemaDialect|null
The schema dialect class for this driver
string
String used to start a database identifier quoting to make it safe
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
Apply translation steps to delete queries.
Returns an associative array of methods that will transform Expression objects to conform with the specific SQL dialect. Keys are class names and values a method in this class.
Apply translation steps to insert queries.
Generate a paging subquery for older versions of SQLserver.
Removes aliases from the WHERE
clause of a query.
Apply translation steps to select queries.
Returns the passed query after rewriting the DISTINCT clause, so that drivers that do not support the "ON" part can provide the actual way it should be done
Receives a FunctionExpression and changes it so that it conforms to this SQL dialect.
Receives a TupleExpression and changes it so that it conforms to this SQL dialect.
Apply translation steps to update queries.
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
Returns a SQL snippet for releasing a previously created save point
Returns a SQL snippet for rollbacking a previously created save point
Rollbacks a transaction.
Returns a SQL snippet for creating a new transaction savepoint
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
_deleteQueryTranslator(Cake\Database\Query $query): Cake\Database\Query
Apply translation steps to delete queries.
Chops out aliases on delete query conditions as most database dialects do not support aliases in delete queries. This also removes aliases in table names as they frequently don't work either.
We are intentionally not supporting deletes with joins as they have even poorer support.
Cake\Database\Query
$query The query to translate
Cake\Database\Query
_expressionTranslators(): array<string>
Returns an associative array of methods that will transform Expression objects to conform with the specific SQL dialect. Keys are class names and values a method in this class.
array<string>
_insertQueryTranslator(Cake\Database\Query $query): Cake\Database\Query
Apply translation steps to insert queries.
Cake\Database\Query
$query The query to translate
Cake\Database\Query
_pagingSubquery(Cake\Database\Query $original, int|null $limit, int|null $offset): Cake\Database\Query
Generate a paging subquery for older versions of SQLserver.
Prior to SQLServer 2012 there was no equivalent to LIMIT OFFSET, so a subquery must be used.
Cake\Database\Query
$original The query to wrap in a subquery.
int|null
$limit The number of rows to fetch.
int|null
$offset The number of rows to offset.
Cake\Database\Query
_removeAliasesFromConditions(Cake\Database\Query $query): Cake\Database\Query
Removes aliases from the WHERE
clause of a query.
Cake\Database\Query
$query The query to process.
Cake\Database\Query
RuntimeException
_selectQueryTranslator(Cake\Database\Query $query): Cake\Database\Query
Apply translation steps to select queries.
Cake\Database\Query
$query Cake\Database\Query
_transformDistinct(Cake\Database\Query $query): Cake\Database\Query
Returns the passed query after rewriting the DISTINCT clause, so that drivers that do not support the "ON" part can provide the actual way it should be done
Cake\Database\Query
$query Cake\Database\Query
_transformFunctionExpression(Cake\Database\Expression\FunctionExpression $expression): void
Receives a FunctionExpression and changes it so that it conforms to this SQL dialect.
Cake\Database\Expression\FunctionExpression
$expression The function expression to convert to TSQL.
void
_transformTupleComparison(Cake\Database\Expression\TupleComparison $expression, Cake\Database\Query $query): void
Receives a TupleExpression and changes it so that it conforms to this SQL dialect.
It transforms expressions looking like '(a, b) IN ((c, d), (e, f))' into an equivalent expression of the form '((a = c) AND (b = d)) OR ((a = e) AND (b = f))'.
It can also transform transform expressions where the right hand side is a query selecting the same amount of columns as the elements in the left hand side of the expression:
(a, b) IN (SELECT c, d FROM a_table) is transformed into
1 = (SELECT 1 FROM a_table WHERE (a = c) AND (b = d))
Cake\Database\Expression\TupleComparison
$expression The expression to transform
Cake\Database\Query
$query The query to update.
void
_updateQueryTranslator(Cake\Database\Query $query): Cake\Database\Query
Apply translation steps to update queries.
Chops out aliases on update query conditions as not all database dialects do support aliases in update queries.
Just like for delete queries, joins are currently not supported for update queries.
Cake\Database\Query
$query The query to translate
Cake\Database\Query
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.
Please note that the PDO::ATTR_PERSISTENT attribute is not supported by the SQL Server PHP PDO drivers. As a result you cannot use the persistent config option when connecting to a SQL Server (for more information see: https://github.com/Microsoft/msphpsql/issues/65).
bool
InvalidArgumentException
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\SqlserverCompiler
Returns an instance of a QueryCompiler.
Cake\Database\SqlserverCompiler
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 The query to prepare.
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 the type of query to be transformed (select, insert, update, delete)
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 The identifier to quote.
string
releaseSavePointSQL(string|int $name): string
Returns a SQL snippet for releasing a previously created save point
string|int
$name string
rollbackSavePointSQL(string|int $name): string
Returns a SQL snippet for rollbacking a previously created save point
string|int
$name string
rollbackTransaction(): bool
Rollbacks a transaction.
bool
savePointSQL(string|int $name): string
Returns a SQL snippet for creating a new transaction savepoint
string|int
$name 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 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 settings for Sqlserver driver
array<string, mixed>
Configuration data.
array<string, mixed>
Instance of PDO.
PDO
String used to end a database identifier quoting to make it safe
string
The schema dialect class for this driver
Cake\Database\Schema\SqlserverSchemaDialect|null
String used to start a database identifier quoting to make it safe
string
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.Sqlserver.html