Class Sqlite
Class Sqlite
Property Summary
- 
        $_autoQuoting protectedboolIndicates whether or not the driver is doing automatic identifier quoting for all queries 
- 
        $_baseConfig protectedarrayBase configuration settings for Sqlite driver 
- 
        $_config protectedarrayConfiguration data. 
- 
        $_connection protectedPDOInstance of PDO. 
- 
        $_dateParts protectedarrayMapping of date parts. 
- 
        $_endQuote protectedstringString used to end a database identifier quoting to make it safe 
- 
        $_schemaDialect protectedCake\Database\Schema\SqliteSchemaDialect|nullThe schema dialect class for this driver 
- 
        $_startQuote protectedstringString used to start a database identifier quoting to make it safe 
- 
        $_supportsWindowFunctions protectedbool|nullWhether or not the connected server supports window functions. 
- 
        $_version protectedstring|nullThe server version 
- 
        $connectRetries protectedintThe last number of connection retry attempts. 
- 
        $supportsCTEs protectedbool|nullWhether or not the server supports common table expressions. 
Method Summary
- 
          __construct() publicConstructor 
- 
          __debugInfo() publicReturns an array that can be used to describe the internal state of this object. 
- 
          __destruct() publicDestructor 
- 
          _connect() protectedEstablishes a connection to the database server 
- 
          _deleteQueryTranslator() protectedApply translation steps to delete queries. 
- 
          _expressionTranslators() protectedReturns 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. 
- 
          _insertQueryTranslator() protectedApply translation steps to insert queries. 
- 
          _removeAliasesFromConditions() protectedRemoves aliases from the WHEREclause of a query.
- 
          _selectQueryTranslator() protectedApply translation steps to select queries. 
- 
          _transformDistinct() protectedReturns 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 
- 
          _transformFunctionExpression() protectedReceives a FunctionExpression and changes it so that it conforms to this SQL dialect. 
- 
          _transformTupleComparison() protectedReceives a TupleExpression and changes it so that it conforms to this SQL dialect. 
- 
          _updateQueryTranslator() protectedApply translation steps to update queries. 
- 
          beginTransaction() publicStarts a transaction. 
- 
          commitTransaction() publicCommits a transaction. 
- 
          compileQuery() publicTransforms the passed query to this Driver's dialect and returns an instance of the transformed query and the full compiled SQL string. 
- 
          connect() publicEstablishes a connection to the database server 
- 
          disableAutoQuoting() publicDisable auto quoting of identifiers in queries. 
- 
          disableForeignKeySQL() publicGet the SQL for disabling foreign keys. 
- 
          disconnect() publicDisconnects from database server. 
- 
          enableAutoQuoting() publicSets whether or not this driver should automatically quote identifiers in queries. 
- 
          enableForeignKeySQL() publicGet the SQL for enabling foreign keys. 
- 
          enabled() publicReturns whether php is able to use this driver for connecting to database 
- 
          getConnectRetries() publicReturns the number of connection retry attempts made. 
- 
          getConnection() publicGet the internal PDO connection instance. 
- 
          getMaxAliasLength() publicReturns the maximum alias length allowed. This can be different than the maximum identifier length for columns. 
- 
          isAutoQuotingEnabled() publicReturns whether or not this driver should automatically quote identifiers in queries. 
- 
          isConnected() publicChecks whether or not the driver is connected. 
- 
          lastInsertId() publicReturns last id generated for a table or sequence in database. 
- 
          newCompiler() publicReturns an instance of a QueryCompiler. 
- 
          newTableSchema() publicConstructs new TableSchema. 
- 
          prepare() publicPrepares a sql statement to be executed 
- 
          queryTranslator() publicReturns 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. 
- 
          quote() publicReturns a value in a safe representation to be used in a query string 
- 
          quoteIdentifier() publicQuotes a database identifier (a column name, table name, etc..) to be used safely in queries without the risk of using reserved words 
- 
          releaseSavePointSQL() publicReturns a SQL snippet for releasing a previously created save point 
- 
          rollbackSavePointSQL() publicReturns a SQL snippet for rollbacking a previously created save point 
- 
          rollbackTransaction() publicRollbacks a transaction. 
- 
          savePointSQL() publicReturns a SQL snippet for creating a new transaction savepoint 
- 
          schema() publicReturns the schema name that's being used. 
- 
          schemaDialect() publicGet the schema dialect. 
- 
          schemaValue() publicEscapes values for use in schema definitions. 
- 
          setConnection() publicSet the internal PDO connection instance. 
- 
          supportsCTEs() publicReturns true if the server supports common table expressions. 
- 
          supportsDynamicConstraints() publicReturns whether the driver supports adding or dropping constraints to already created tables. 
- 
          supportsQuoting() publicChecks if the driver supports quoting, as PDO_ODBC does not support it. 
- 
          supportsSavePoints() publicReturns whether this driver supports save points for nested transactions. 
- 
          supportsWindowFunctions() publicReturns true if the connected server supports window functions. 
- 
          version() publicReturns connected server version. 
Method Detail
__construct() ¶ public
__construct(array $config = [])Constructor
Parameters
- 
                array$config optional
- The configuration for the driver. 
Throws
InvalidArgumentException__debugInfo() ¶ public
__debugInfo(): arrayReturns an array that can be used to describe the internal state of this object.
Returns
array_connect() ¶ protected
_connect(string $dsn, array $config): boolEstablishes a connection to the database server
Parameters
- 
                string$dsn
- A Driver-specific PDO-DSN 
- 
                array$config
- configuration to be used for creating connection 
Returns
booltrue on success
_deleteQueryTranslator() ¶ protected
_deleteQueryTranslator(Cake\Database\Query $query): Cake\Database\QueryApply 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.
Parameters
- 
                Cake\Database\Query$query
- The query to translate 
Returns
Cake\Database\QueryThe modified query
_expressionTranslators() ¶ protected
_expressionTranslators(): 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.
Returns
string[]_insertQueryTranslator() ¶ protected
_insertQueryTranslator(Cake\Database\Query $query): Cake\Database\QueryApply translation steps to insert queries.
Parameters
- 
                Cake\Database\Query$query
- The query to translate 
Returns
Cake\Database\QueryThe modified query
_removeAliasesFromConditions() ¶ protected
_removeAliasesFromConditions(Cake\Database\Query $query): Cake\Database\QueryRemoves aliases from the WHERE clause of a query.
Parameters
- 
                Cake\Database\Query$query
- The query to process. 
Returns
Cake\Database\QueryThe modified query.
Throws
RuntimeExceptionIn case the processed query contains any joins, as removing aliases from the conditions can break references to the joined tables.
_selectQueryTranslator() ¶ protected
_selectQueryTranslator(Cake\Database\Query $query): Cake\Database\QueryApply translation steps to select queries.
Parameters
- 
                Cake\Database\Query$query
- The query to translate 
Returns
Cake\Database\QueryThe modified query
_transformDistinct() ¶ protected
_transformDistinct(Cake\Database\Query $query): Cake\Database\QueryReturns 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
Parameters
- 
                Cake\Database\Query$query
- The query to be transformed 
Returns
Cake\Database\Query_transformFunctionExpression() ¶ protected
_transformFunctionExpression(Cake\Database\Expression\FunctionExpression $expression): voidReceives a FunctionExpression and changes it so that it conforms to this SQL dialect.
Parameters
- 
                Cake\Database\Expression\FunctionExpression$expression
- The function expression to convert to TSQL. 
Returns
void_transformTupleComparison() ¶ protected
_transformTupleComparison(Cake\Database\Expression\TupleComparison $expression, Cake\Database\Query $query): voidReceives 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))
Parameters
- 
                Cake\Database\Expression\TupleComparison$expression
- The expression to transform 
- 
                Cake\Database\Query$query
- The query to update. 
Returns
void_updateQueryTranslator() ¶ protected
_updateQueryTranslator(Cake\Database\Query $query): Cake\Database\QueryApply 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.
Parameters
- 
                Cake\Database\Query$query
- The query to translate 
Returns
Cake\Database\QueryThe modified query
compileQuery() ¶ public
compileQuery(Cake\Database\Query $query, Cake\Database\ValueBinder $binder): arrayTransforms the passed query to this Driver's dialect and returns an instance of the transformed query and the full compiled SQL string.
Parameters
- 
                Cake\Database\Query$query
- 
                Cake\Database\ValueBinder$binder
Returns
arrayconnect() ¶ public
connect(): boolEstablishes a connection to the database server
Returns
booltrue on success
disableAutoQuoting() ¶ public
disableAutoQuoting(): $thisDisable auto quoting of identifiers in queries.
Returns
$thisdisableForeignKeySQL() ¶ public
disableForeignKeySQL(): stringGet the SQL for disabling foreign keys.
Returns
stringenableAutoQuoting() ¶ public
enableAutoQuoting(bool $enable = true): $thisSets whether or not this driver should automatically quote identifiers in queries.
Parameters
- 
                bool$enable optional
Returns
$thisenableForeignKeySQL() ¶ public
enableForeignKeySQL(): stringGet the SQL for enabling foreign keys.
Returns
stringenabled() ¶ public
enabled(): boolReturns whether php is able to use this driver for connecting to database
Returns
booltrue if it is valid to use this driver
getConnectRetries() ¶ public
getConnectRetries(): intReturns the number of connection retry attempts made.
Returns
intgetMaxAliasLength() ¶ public
getMaxAliasLength(): int|nullReturns the maximum alias length allowed. This can be different than the maximum identifier length for columns.
Returns
int|nullMaximum alias length or null if no limit
isAutoQuotingEnabled() ¶ public
isAutoQuotingEnabled(): boolReturns whether or not this driver should automatically quote identifiers in queries.
Returns
boolisConnected() ¶ public
isConnected(): boolChecks whether or not the driver is connected.
Returns
boollastInsertId() ¶ public
lastInsertId(string|null $table = null, string|null $column = null): string|intReturns last id generated for a table or sequence in database.
Parameters
- 
                string|null$table optional
- 
                string|null$column optional
Returns
string|intnewCompiler() ¶ public
newCompiler(): Cake\Database\QueryCompilerReturns an instance of a QueryCompiler.
Returns
Cake\Database\QueryCompilernewTableSchema() ¶ public
newTableSchema(string $table, array $columns = []): Cake\Database\Schema\TableSchemaConstructs new TableSchema.
Parameters
- 
                string$table
- 
                array$columns optional
Returns
Cake\Database\Schema\TableSchemaprepare() ¶ public
prepare(string|Cake\Database\Query $query): Cake\Database\StatementInterfacePrepares a sql statement to be executed
Parameters
- 
                string|Cake\Database\Query$query
- The query to prepare. 
Returns
Cake\Database\StatementInterfacequeryTranslator() ¶ public
queryTranslator(string $type): ClosureReturns 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.
Parameters
- 
                string$type
- the type of query to be transformed (select, insert, update, delete) 
Returns
Closurequote() ¶ public
quote(mixed $value, int $type = PDO::PARAM_STR): stringReturns a value in a safe representation to be used in a query string
Parameters
- 
                mixed$value
- 
                int$type optional
Returns
stringquoteIdentifier() ¶ public
quoteIdentifier(string $identifier): stringQuotes a database identifier (a column name, table name, etc..) to be used safely in queries without the risk of using reserved words
Parameters
- 
                string$identifier
- The identifier to quote. 
Returns
stringreleaseSavePointSQL() ¶ public
releaseSavePointSQL(string|int $name): stringReturns a SQL snippet for releasing a previously created save point
Parameters
- 
                string|int$name
- save point name 
Returns
stringrollbackSavePointSQL() ¶ public
rollbackSavePointSQL(string|int $name): stringReturns a SQL snippet for rollbacking a previously created save point
Parameters
- 
                string|int$name
- save point name 
Returns
stringsavePointSQL() ¶ public
savePointSQL(string|int $name): stringReturns a SQL snippet for creating a new transaction savepoint
Parameters
- 
                string|int$name
- save point name 
Returns
stringschemaDialect() ¶ public
schemaDialect(): Cake\Database\Schema\SchemaDialectGet 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.
Returns
Cake\Database\Schema\SchemaDialectschemaValue() ¶ public
schemaValue(mixed $value): stringEscapes values for use in schema definitions.
Parameters
- 
                mixed$value
Returns
stringsetConnection() ¶ public
setConnection(object $connection): $thisSet the internal PDO connection instance.
Parameters
- 
                object$connection
- PDO instance. 
Returns
$thissupportsCTEs() ¶ public
supportsCTEs(): boolReturns true if the server supports common table expressions.
Returns
boolsupportsDynamicConstraints() ¶ public
supportsDynamicConstraints(): boolReturns whether the driver supports adding or dropping constraints to already created tables.
Returns
boolsupportsQuoting() ¶ public
supportsQuoting(): boolChecks if the driver supports quoting, as PDO_ODBC does not support it.
Returns
boolsupportsSavePoints() ¶ public
supportsSavePoints(): boolReturns whether this driver supports save points for nested transactions.
Returns
boolsupportsWindowFunctions() ¶ public
supportsWindowFunctions(): boolReturns true if the connected server supports window functions.
Returns
boolProperty Detail
$_autoQuoting ¶ protected
Indicates whether or not the driver is doing automatic identifier quoting for all queries
Type
bool$_baseConfig ¶ protected
Base configuration settings for Sqlite driver
- maskThe mask used for created database
Type
array$_schemaDialect ¶ protected
The schema dialect class for this driver
Type
Cake\Database\Schema\SqliteSchemaDialect|null$_startQuote ¶ protected
String used to start a database identifier quoting to make it safe
Type
string$_supportsWindowFunctions ¶ protected
Whether or not the connected server supports window functions.
Type
bool|null$supportsCTEs ¶ protected
Whether or not the server supports common table expressions.
Type
bool|null