Property | Type | Description | |
---|---|---|---|
$columnSchemaClass | column schema class | ||
$db | the database connection | ||
$defaultSchema | the default schema name used for the current session. | ||
$exceptionMap | map of DB errors and corresponding exceptions If left part is found in DB error message exception class from the right part is used. |
Method | Description | |
---|---|---|
convertException ( |
Converts a DB exception to a more concrete one if possible. | |
createColumnSchemaBuilder ( string $type, integer | string | array $length = null ) : |
Create a column schema builder instance giving the type and value precision. | |
createQueryBuilder ( ) : |
Creates a query builder for the database. | |
createSavepoint ( string $name ) | Creates a new savepoint. | |
findUniqueIndexes ( yii\db\TableSchema $table ) : array | Returns all unique indexes for the given table. | |
getLastInsertID ( string $sequenceName = '' ) : string | Returns the ID of the last inserted row or sequence value. | |
getPdoType ( mixed $data ) : integer | Determines the PDO type for the given PHP data value. | |
getQueryBuilder ( ) : |
||
getRawTableName ( string $name ) : string | Returns the actual name of a given table name. | |
getSchemaNames ( boolean $refresh = false ) : string[] | Returns all schema names in the database, except system schemas. | |
getTableNames ( string $schema = '', boolean $refresh = false ) : string[] | Returns all table names in the database. | |
getTableSchema ( string $name, boolean $refresh = false ) : null | yii\db\TableSchema | Obtains the metadata for the named table. | |
getTableSchemas ( string $schema = '', boolean $refresh = false ) : yii\db\TableSchema[] | Returns the metadata for all tables in the database. | |
insert ( string $table, array $columns ) : array | false | Executes the INSERT command, returning primary key values. | |
isReadQuery ( string $sql ) : boolean | Returns a value indicating whether a SQL statement is for read purpose. | |
quoteColumnName ( string $name ) : string | Quotes a column name for use in a query. | |
quoteSimpleColumnName ( string $name ) : string | Quotes a simple column name for use in a query. | |
quoteSimpleTableName ( string $name ) : string | Quotes a simple table name for use in a query. | |
quoteTableName ( string $name ) : string | Quotes a table name for use in a query. | |
quoteValue ( string $str ) : string | Quotes a string value for use in a query. | |
refresh ( ) | Refreshes the schema. | |
refreshTableSchema ( string $name ) | Refreshes the particular table schema. | |
releaseSavepoint ( string $name ) | Releases an existing savepoint. | |
rollBackSavepoint ( string $name ) | Rolls back to a previously created savepoint. | |
setTransactionIsolationLevel ( string $level ) | Sets the isolation level of the current transaction. | |
supportsSavepoint ( ) : boolean |
Method | Description | |
---|---|---|
createColumnSchema ( ) : |
||
findSchemaNames ( ) : array | Returns all schema names in the database, including the default one but not system schemas. | |
findTableNames ( string $schema = '' ) : array | Returns all table names in the database. | |
getCacheKey ( string $name ) : mixed | Returns the cache key for the specified table name. | |
getCacheTag ( ) : string | Returns the cache tag name. | |
getColumnPhpType ( |
Extracts the PHP type from abstract DB type. | |
loadTableSchema ( string $name ) : null | yii\db\TableSchema | Loads the metadata for the specified table. |
public convertException ( |
||
$e | ||
$rawSql | string | SQL that produced exception |
return |
protected createColumnSchema ( ) : |
||
return |
public createColumnSchemaBuilder ( string $type, integer | string | array $length = null ) : |
||
$type | string | type of the column. See [[ColumnSchemaBuilder::$type]]. |
$length | integer | string | array | length or precision of the column. See [[ColumnSchemaBuilder::$length]]. |
return | column schema builder instance |
public createQueryBuilder ( ) : |
||
return | query builder instance |
public createSavepoint ( string $name ) | ||
$name | string | the savepoint name |
protected findSchemaNames ( ) : array | ||
return | array | all schema names in the database, except system schemas |
protected findTableNames ( string $schema = '' ) : array | ||
$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. |
public findUniqueIndexes ( yii\db\TableSchema $table ) : array | ||
$table | yii\db\TableSchema | the table metadata |
return | array | all unique indexes for the given table. |
protected getCacheKey ( string $name ) : mixed | ||
$name | string | the table name |
return | mixed | the cache key |
protected getCacheTag ( ) : string | ||
return | string | the cache tag name |
protected getColumnPhpType ( |
||
$column | the column schema information | |
return | string | PHP type name |
public getLastInsertID ( string $sequenceName = '' ) : string | ||
$sequenceName | string | name of the sequence object (required by some DBMS) |
return | string | the row ID of the last row inserted, or the last value retrieved from the sequence object |
public getPdoType ( mixed $data ) : integer | ||
$data | mixed | the data whose PDO type is to be determined |
return | integer | the PDO type |
public getQueryBuilder ( ) : |
||
return | the query builder for this connection. |
public getRawTableName ( string $name ) : string | ||
$name | string | the table name to be converted |
return | string | the real name of the given table name |
public getSchemaNames ( boolean $refresh = false ) : string[] | ||
$refresh | boolean | whether to fetch the latest available schema names. If this is false, schema names fetched previously (if available) will be returned. |
return | string[] | all schema names in the database, except system schemas. |
public getTableNames ( string $schema = '', boolean $refresh = false ) : string[] | ||
$schema | string | the schema of the tables. Defaults to empty string, meaning the current or default schema name. If not empty, the returned table names will be prefixed with the schema name. |
$refresh | boolean | whether to fetch the latest available table names. If this is false, table names fetched previously (if available) will be returned. |
return | string[] | all table names in the database. |
public getTableSchema ( string $name, boolean $refresh = false ) : null | yii\db\TableSchema | ||
$name | string | table name. The table name may contain schema name if any. Do not quote the table name. |
$refresh | boolean | whether to reload the table schema even if it is found in the cache. |
return | null | yii\db\TableSchema | table metadata. Null if the named table does not exist. |
public getTableSchemas ( string $schema = '', boolean $refresh = false ) : yii\db\TableSchema[] | ||
$schema | string | the schema of the tables. Defaults to empty string, meaning the current or default schema name. |
$refresh | boolean | whether to fetch the latest available table schemas. If this is false, cached data may be returned if available. |
return | yii\db\TableSchema[] | the metadata for all tables in the database. Each array element is an instance of [[TableSchema]] or its child class. |
public isReadQuery ( string $sql ) : boolean | ||
$sql | string | the SQL statement |
return | boolean | whether a SQL statement is for read purpose. |
abstract protected loadTableSchema ( string $name ) : null | yii\db\TableSchema | ||
$name | string | table name |
return | null | yii\db\TableSchema | DBMS-dependent table metadata, null if the table does not exist. |
public quoteColumnName ( string $name ) : string | ||
$name | string | column name |
return | string | the properly quoted column name |
public quoteSimpleColumnName ( string $name ) : string | ||
$name | string | column name |
return | string | the properly quoted column name |
public quoteSimpleTableName ( string $name ) : string | ||
$name | string | table name |
return | string | the properly quoted table name |
public quoteTableName ( string $name ) : string | ||
$name | string | table name |
return | string | the properly quoted table name |
public quoteValue ( string $str ) : string | ||
$str | string | string to be quoted |
return | string | the properly quoted string |
public refresh ( ) |
public refreshTableSchema ( string $name ) | ||
$name | string | table name. |
public releaseSavepoint ( string $name ) | ||
$name | string | the savepoint name |
public rollBackSavepoint ( string $name ) | ||
$name | string | the savepoint name |
public setTransactionIsolationLevel ( string $level ) | ||
$level | string | The transaction isolation level to use for this transaction. This can be one of [[Transaction::READ_UNCOMMITTED]], [[Transaction::READ_COMMITTED]], [[Transaction::REPEATABLE_READ]] and [[Transaction::SERIALIZABLE]] but also a string containing DBMS specific syntax to be used after `SET TRANSACTION ISOLATION LEVEL`. |
public supportsSavepoint ( ) : boolean | ||
return | boolean | whether this DBMS supports [savepoint](http://en.wikipedia.org/wiki/Savepoint). |
public $defaultSchema |