$_driver
$_driver : \Cake\Database\Driver
The driver instance being used.
Schema management/reflection features for Sqlite
This class contains methods that are common across the various SQL dialects.
$_driver : \Cake\Database\Driver
The driver instance being used.
__construct(\Cake\Database\Driver $driver)
Constructor
This constructor will connect the driver so that methods like columnSql() and others will fail when the driver has not been connected.
\Cake\Database\Driver | $driver | The driver to use. |
dropTableSql(\Cake\Database\Schema\TableSchema $schema) : array
Generate the SQL to drop a table.
\Cake\Database\Schema\TableSchema | $schema | Schema instance |
SQL statements to drop a table.
describeForeignKeySql(string $tableName, array $config) : array
Generate the SQL to describe the foreign keys in a table.
string | $tableName | The table name to get information on. |
array | $config | The connection configuration. |
An array of (sql, params) to execute.
convertColumnDescription(\Cake\Database\Schema\TableSchema $schema, array $row) : void
Convert field description results into abstract schema fields.
\Cake\Database\Schema\TableSchema | $schema | The table object to append fields to. |
array | $row | The row data from |
convertIndexDescription(\Cake\Database\Schema\TableSchema $schema, array $row) : void
Convert an index description results into abstract schema indexes or constraints.
Since SQLite does not have a way to get metadata about all indexes at once, additional queries are done here. Sqlite constraint names are not stable, and the names for constraints will not match those used to create the table. This is a limitation in Sqlite's metadata features.
\Cake\Database\Schema\TableSchema | $schema | The table object to append an index or constraint to. |
array | $row | The row data from |
convertForeignKeyDescription(\Cake\Database\Schema\TableSchema $schema, array $row) : void
Convert a foreign key description into constraints on the Table object.
\Cake\Database\Schema\TableSchema | $schema | The table object to append a constraint to. |
array | $row | The row data from |
convertOptionsDescription(\Cake\Database\Schema\TableSchema $schema, array $row) : void
Convert options data into table options.
\Cake\Database\Schema\TableSchema | $schema | Table instance. |
array | $row | The row of data. |
createTableSql(\Cake\Database\Schema\TableSchema $schema, array $columns, array $constraints, array $indexes) : array
Generate the SQL to create a table.
\Cake\Database\Schema\TableSchema | $schema | Table instance. |
array | $columns | The columns to go inside the table. |
array | $constraints | The constraints for the table. |
array | $indexes | The indexes for the table. |
SQL statements to create a table.
columnSql(\Cake\Database\Schema\TableSchema $schema, string $name) : string
Generate the SQL fragment for a single column in a table.
\Cake\Database\Schema\TableSchema | $schema | The table instance the column is in. |
string | $name | The name of the column. |
when the column type is unknown
SQL fragment.
addConstraintSql(\Cake\Database\Schema\TableSchema $schema) : array
Generate the SQL queries needed to add foreign key constraints to the table
SQLite can not properly handle adding a constraint to an existing table. This method is no-op
\Cake\Database\Schema\TableSchema | $schema | The table instance the foreign key constraints are. |
SQL fragment.
dropConstraintSql(\Cake\Database\Schema\TableSchema $schema) : array
Generate the SQL queries needed to drop foreign key constraints from the table
SQLite can not properly handle dropping a constraint to an existing table. This method is no-op
\Cake\Database\Schema\TableSchema | $schema | The table instance the foreign key constraints are. |
SQL fragment.
constraintSql(\Cake\Database\Schema\TableSchema $schema, string $name) : string
Generate the SQL fragments for defining table constraints.
Note integer primary keys will return ''. This is intentional as Sqlite requires that integer primary keys be defined in the column definition.
\Cake\Database\Schema\TableSchema | $schema | The table instance the column is in. |
string | $name | The name of the column. |
SQL fragment.
indexSql(\Cake\Database\Schema\TableSchema $schema, string $name) : string
Generate the SQL fragment for a single index in a table.
\Cake\Database\Schema\TableSchema | $schema | The table object the column is in. |
string | $name | The name of the column. |
SQL fragment.
truncateTableSql(\Cake\Database\Schema\TableSchema $schema) : array
Generate the SQL to truncate a table.
\Cake\Database\Schema\TableSchema | $schema | Table instance. |
SQL statements to truncate a table.
_convertColumn(string $column) : array
Convert a column definition to the abstract types.
The returned type will be a type that Cake\Database\Type can handle.
string | $column | The column type + length |
when unable to parse column type
Array of column information.