Class yii\db\sqlite\Schema

Inheritanceyii\db\sqlite\Schema » yii\db\Schema » yii\base\Object
Implementsyii\base\Configurable
Available since version2.0
Source Code https://github.com/yiisoft/yii2/blob/master/framework/db/sqlite/Schema.php

Schema is the class for retrieving metadata from a SQLite (2/3) database.

Public Properties

Hide inherited properties

PropertyTypeDescriptionDefined By
$columnSchemaClass string Column schema class yii\db\Schema
$db yii\db\Connection The database connection yii\db\Schema
$defaultSchema string The default schema name used for the current session. yii\db\Schema
$exceptionMap array Map of DB errors and corresponding exceptions If left part is found in DB error message exception class from the right part is used. yii\db\Schema
$lastInsertID string The row ID of the last row inserted, or the last value retrieved from the sequence object yii\db\Schema
$queryBuilder yii\db\QueryBuilder The query builder for this connection. yii\db\Schema
$schemaNames string[] All schema names in the database, except system schemas. yii\db\Schema
$tableNames string[] All table names in the database. yii\db\Schema
$tableSchemas yii\db\TableSchema[] The metadata for all tables in the database. yii\db\Schema
$transactionIsolationLevel string The transaction isolation level to use for this transaction. yii\db\sqlite\Schema
$typeMap array Mapping from physical column types (keys) to abstract column types (values) yii\db\sqlite\Schema

Public Methods

Hide inherited methods

MethodDescriptionDefined By
__call() Calls the named method which is not a class method. yii\base\Object
__construct() Constructor. yii\base\Object
__get() Returns the value of an object property. yii\base\Object
__isset() Checks if a property is set, i.e. defined and not null. yii\base\Object
__set() Sets value of an object property. yii\base\Object
__unset() Sets an object property to null. yii\base\Object
canGetProperty() Returns a value indicating whether a property can be read. yii\base\Object
canSetProperty() Returns a value indicating whether a property can be set. yii\base\Object
className() Returns the fully qualified name of this class. yii\base\Object
convertException() Converts a DB exception to a more concrete one if possible. yii\db\Schema
createColumnSchemaBuilder() Create a column schema builder instance giving the type and value precision. yii\db\sqlite\Schema
createQueryBuilder() Creates a query builder for the MySQL database. yii\db\sqlite\Schema
createSavepoint() Creates a new savepoint. yii\db\Schema
findUniqueIndexes() Returns all unique indexes for the given table. yii\db\sqlite\Schema
getLastInsertID() Returns the ID of the last inserted row or sequence value. yii\db\Schema
getPdoType() Determines the PDO type for the given PHP data value. yii\db\Schema
getQueryBuilder() yii\db\Schema
getRawTableName() Returns the actual name of a given table name. yii\db\Schema
getSchemaNames() Returns all schema names in the database, except system schemas. yii\db\Schema
getTableNames() Returns all table names in the database. yii\db\Schema
getTableSchema() Obtains the metadata for the named table. yii\db\Schema
getTableSchemas() Returns the metadata for all tables in the database. yii\db\Schema
hasMethod() Returns a value indicating whether a method is defined. yii\base\Object
hasProperty() Returns a value indicating whether a property is defined. yii\base\Object
init() Initializes the object. yii\base\Object
insert() Executes the INSERT command, returning primary key values. yii\db\Schema
isReadQuery() Returns a value indicating whether a SQL statement is for read purpose. yii\db\Schema
quoteColumnName() Quotes a column name for use in a query. yii\db\Schema
quoteSimpleColumnName() Quotes a column name for use in a query. yii\db\sqlite\Schema
quoteSimpleTableName() Quotes a table name for use in a query. yii\db\sqlite\Schema
quoteTableName() Quotes a table name for use in a query. yii\db\Schema
quoteValue() Quotes a string value for use in a query. yii\db\Schema
refresh() Refreshes the schema. yii\db\Schema
refreshTableSchema() Refreshes the particular table schema. yii\db\Schema
releaseSavepoint() Releases an existing savepoint. yii\db\Schema
rollBackSavepoint() Rolls back to a previously created savepoint. yii\db\Schema
setTransactionIsolationLevel() Sets the isolation level of the current transaction. yii\db\sqlite\Schema
supportsSavepoint() yii\db\Schema

Protected Methods

Hide inherited methods

MethodDescriptionDefined By
createColumnSchema() yii\db\Schema
findColumns() Collects the table column metadata. yii\db\sqlite\Schema
findConstraints() Collects the foreign key column details for the given table. yii\db\sqlite\Schema
findSchemaNames() Returns all schema names in the database, including the default one but not system schemas. yii\db\Schema
findTableNames() Returns all table names in the database. yii\db\sqlite\Schema
getCacheKey() Returns the cache key for the specified table name. yii\db\Schema
getCacheTag() Returns the cache tag name. yii\db\Schema
getColumnPhpType() Extracts the PHP type from abstract DB type. yii\db\Schema
loadColumnSchema() Loads the column information into a yii\db\ColumnSchema object. yii\db\sqlite\Schema
loadTableSchema() Loads the metadata for the specified table. yii\db\sqlite\Schema

Constants

Hide inherited constants

ConstantValueDescriptionDefined By
TYPE_BIGINT 'bigint' yii\db\Schema
TYPE_BIGPK 'bigpk' yii\db\Schema
TYPE_BINARY 'binary' yii\db\Schema
TYPE_BOOLEAN 'boolean' yii\db\Schema
TYPE_CHAR 'char' yii\db\Schema
TYPE_DATE 'date' yii\db\Schema
TYPE_DATETIME 'datetime' yii\db\Schema
TYPE_DECIMAL 'decimal' yii\db\Schema
TYPE_DOUBLE 'double' yii\db\Schema
TYPE_FLOAT 'float' yii\db\Schema
TYPE_INTEGER 'integer' yii\db\Schema
TYPE_MONEY 'money' yii\db\Schema
TYPE_PK 'pk' yii\db\Schema
TYPE_SMALLINT 'smallint' yii\db\Schema
TYPE_STRING 'string' yii\db\Schema
TYPE_TEXT 'text' yii\db\Schema
TYPE_TIME 'time' yii\db\Schema
TYPE_TIMESTAMP 'timestamp' yii\db\Schema
TYPE_UBIGPK 'ubigpk' yii\db\Schema
TYPE_UPK 'upk' yii\db\Schema

Property Details

$transactionIsolationLevel public write-only property

The transaction isolation level to use for this transaction. This can be either yii\db\Transaction::READ_UNCOMMITTED or yii\db\Transaction::SERIALIZABLE.

public void setTransactionIsolationLevel ( $level )
$typeMap public property

Mapping from physical column types (keys) to abstract column types (values)

public array $typeMap = ['tinyint' => self::TYPE_SMALLINT'bit' => self::TYPE_SMALLINT'boolean' => self::TYPE_BOOLEAN'bool' => self::TYPE_BOOLEAN'smallint' => self::TYPE_SMALLINT'mediumint' => self::TYPE_INTEGER'int' => self::TYPE_INTEGER'integer' => self::TYPE_INTEGER'bigint' => self::TYPE_BIGINT'float' => self::TYPE_FLOAT'double' => self::TYPE_DOUBLE'real' => self::TYPE_FLOAT'decimal' => self::TYPE_DECIMAL'numeric' => self::TYPE_DECIMAL'tinytext' => self::TYPE_TEXT'mediumtext' => self::TYPE_TEXT'longtext' => self::TYPE_TEXT'text' => self::TYPE_TEXT'varchar' => self::TYPE_STRING'string' => self::TYPE_STRING'char' => self::TYPE_CHAR'blob' => self::TYPE_BINARY'datetime' => self::TYPE_DATETIME'year' => self::TYPE_DATE'date' => self::TYPE_DATE'time' => self::TYPE_TIME'timestamp' => self::TYPE_TIMESTAMP'enum' => self::TYPE_STRING]

Method Details

createColumnSchemaBuilder() public method

Create a column schema builder instance giving the type and value precision.

This method may be overridden by child classes to create a DBMS-specific column schema builder.

public yii\db\sqlite\ColumnSchemaBuilder createColumnSchemaBuilder ( $type, $length null )
$type string

Type of the column. See yii\db\sqlite\ColumnSchemaBuilder::$type.

$length integer|string|array

Length or precision of the column. See yii\db\sqlite\ColumnSchemaBuilder::$length.

return yii\db\sqlite\ColumnSchemaBuilder

Column schema builder instance

createQueryBuilder() public method

Creates a query builder for the MySQL database.

This method may be overridden by child classes to create a DBMS-specific query builder.

public yii\db\sqlite\QueryBuilder createQueryBuilder ( )
return yii\db\sqlite\QueryBuilder

Query builder instance

findColumns() protected method

Collects the table column metadata.

protected boolean findColumns ( $table )
$table yii\db\TableSchema

The table metadata

return boolean

Whether the table exists in the database

findConstraints() protected method

Collects the foreign key column details for the given table.

protected void findConstraints ( $table )
$table yii\db\TableSchema

The table metadata

findTableNames() protected method

Returns all table names in the database.

protected array findTableNames ( $schema '' )
$schema string

The schema of the tables. Defaults to empty string, meaning the current or default schema.

return array

All table names in the database. The names have NO schema name prefix.

findUniqueIndexes() public method

Returns all unique indexes for the given table.

Each array element is of the following structure:

[
    'IndexName1' => ['col1' [, ...]],
    'IndexName2' => ['col2' [, ...]],
]
public array findUniqueIndexes ( $table )
$table yii\db\TableSchema

The table metadata

return array

All unique indexes for the given table.

loadColumnSchema() protected method

Loads the column information into a yii\db\ColumnSchema object.

protected yii\db\ColumnSchema loadColumnSchema ( $info )
$info array

Column information

return yii\db\ColumnSchema

The column schema object

loadTableSchema() protected method

Loads the metadata for the specified table.

protected yii\db\TableSchema loadTableSchema ( $name )
$name string

Table name

return yii\db\TableSchema

Driver dependent table metadata. Null if the table does not exist.

quoteSimpleColumnName() public method

Quotes a column name for use in a query.

A simple column name has no prefix.

public string quoteSimpleColumnName ( $name )
$name string

Column name

return string

The properly quoted column name

quoteSimpleTableName() public method

Quotes a table name for use in a query.

A simple table name has no schema prefix.

public string quoteSimpleTableName ( $name )
$name string

Table name

return string

The properly quoted table name

setTransactionIsolationLevel() public method

Sets the isolation level of the current transaction.

See also http://www.sqlite.org/pragma.html#pragma_read_uncommitted.

public void setTransactionIsolationLevel ( $level )
$level string

The transaction isolation level to use for this transaction. This can be either yii\db\Transaction::READ_UNCOMMITTED or yii\db\Transaction::SERIALIZABLE.

throws yii\base\NotSupportedException

when unsupported isolation levels are used. SQLite only supports SERIALIZABLE and READ UNCOMMITTED.