没有命名空间的类 yii yii\base yii\behaviors yii\caching yii\captcha yii\console yii\console\controllers yii\console\widgets yii\data yii\db yii\db\conditions yii\db\cubrid yii\db\cubrid\conditions yii\db\mssql yii\db\mssql\conditions yii\db\mysql yii\db\oci yii\db\oci\conditions yii\db\pgsql yii\db\sqlite yii\db\sqlite\conditions yii\di yii\filters yii\filters\auth yii\grid yii\helpers yii\i18n yii\log yii\mail yii\mutex yii\rbac yii\rest yii\test yii\validators yii\web yii\widgets

Trait yii\db\ConstraintFinderTrait

实现yii\db\cubrid\Schema, yii\db\mssql\Schema, yii\db\mysql\Schema, yii\db\oci\Schema, yii\db\pgsql\Schema, yii\db\sqlite\Schema
可用版本自2.0.13
源码 https://github.com/yiichina/yii2/blob/api/framework/db/ConstraintFinderTrait.php

ConstraintFinderTrait provides methods for getting a table constraint information.

公共方法

隐藏继承的方法

方法描述被定义在
getSchemaChecks() Returns check constraints for all tables in the database. yii\db\ConstraintFinderTrait
getSchemaDefaultValues() Returns default value constraints for all tables in the database. yii\db\ConstraintFinderTrait
getSchemaForeignKeys() Returns foreign keys for all tables in the database. yii\db\ConstraintFinderTrait
getSchemaIndexes() Returns indexes for all tables in the database. yii\db\ConstraintFinderTrait
getSchemaPrimaryKeys() Returns primary keys for all tables in the database. yii\db\ConstraintFinderTrait
getSchemaUniques() Returns unique constraints for all tables in the database. yii\db\ConstraintFinderTrait
getTableChecks() Obtains the check constraints information for the named table. yii\db\ConstraintFinderTrait
getTableDefaultValues() Obtains the default value constraints information for the named table. yii\db\ConstraintFinderTrait
getTableForeignKeys() Obtains the foreign keys information for the named table. yii\db\ConstraintFinderTrait
getTableIndexes() Obtains the indexes information for the named table. yii\db\ConstraintFinderTrait
getTablePrimaryKey() Obtains the primary key for the named table. yii\db\ConstraintFinderTrait
getTableUniques() Obtains the unique constraints information for the named table. yii\db\ConstraintFinderTrait

受保护的方法

隐藏继承的方法

方法描述被定义在
getSchemaMetadata() Returns the metadata of the given type for all tables in the given schema. yii\db\ConstraintFinderTrait
getTableMetadata() Returns the metadata of the given type for the given table. yii\db\ConstraintFinderTrait
loadTableChecks() Loads all check constraints for the given table. yii\db\ConstraintFinderTrait
loadTableDefaultValues() Loads all default value constraints for the given table. yii\db\ConstraintFinderTrait
loadTableForeignKeys() Loads all foreign keys for the given table. yii\db\ConstraintFinderTrait
loadTableIndexes() Loads all indexes for the given table. yii\db\ConstraintFinderTrait
loadTablePrimaryKey() Loads a primary key for the given table. yii\db\ConstraintFinderTrait
loadTableUniques() Loads all unique constraints for the given table. yii\db\ConstraintFinderTrait

方法详情

getSchemaChecks() 公共 方法

Returns check constraints for all tables in the database.

public \yii\db\CheckConstraint[][] getSchemaChecks($schema '', $refresh false)
$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\CheckConstraint[][]

Check constraints for all tables in the database. Each array element is an array of yii\db\CheckConstraint or its child classes.

getSchemaDefaultValues() 公共 方法

Returns default value constraints for all tables in the database.

public yii\db\DefaultValueConstraint[] getSchemaDefaultValues($schema '', $refresh false)
$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\DefaultValueConstraint[]

Default value constraints for all tables in the database. Each array element is an array of yii\db\DefaultValueConstraint or its child classes.

getSchemaForeignKeys() 公共 方法

Returns foreign keys for all tables in the database.

public \yii\db\ForeignKeyConstraint[][] getSchemaForeignKeys($schema '', $refresh false)
$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\ForeignKeyConstraint[][]

Foreign keys for all tables in the database. Each array element is an array of yii\db\ForeignKeyConstraint or its child classes.

getSchemaIndexes() 公共 方法

Returns indexes for all tables in the database.

public \yii\db\IndexConstraint[][] getSchemaIndexes($schema '', $refresh false)
$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\IndexConstraint[][]

Indexes for all tables in the database. Each array element is an array of yii\db\IndexConstraint or its child classes.

getSchemaMetadata() 受保护 抽象 方法

Returns the metadata of the given type for all tables in the given schema.

protected abstract array getSchemaMetadata($schema, $type, $refresh)
$schema string

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

$type string

Metadata type.

$refresh boolean

Whether to fetch the latest available table metadata. If this is false, cached data may be returned if available.

return array

Array of metadata.

getSchemaPrimaryKeys() 公共 方法

Returns primary keys for all tables in the database.

public yii\db\Constraint[] getSchemaPrimaryKeys($schema '', $refresh false)
$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\Constraint[]

Primary keys for all tables in the database. Each array element is an instance of yii\db\Constraint or its child class.

getSchemaUniques() 公共 方法

Returns unique constraints for all tables in the database.

public \yii\db\Constraint[][] getSchemaUniques($schema '', $refresh false)
$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\Constraint[][]

Unique constraints for all tables in the database. Each array element is an array of yii\db\Constraint or its child classes.

getTableChecks() 公共 方法

Obtains the check constraints information for the named table.

public yii\db\CheckConstraint[] getTableChecks($name, $refresh false)
$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 information even if it is found in the cache.

return yii\db\CheckConstraint[]

Table check constraints.

getTableDefaultValues() 公共 方法

Obtains the default value constraints information for the named table.

public yii\db\DefaultValueConstraint[] getTableDefaultValues($name, $refresh false)
$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 information even if it is found in the cache.

return yii\db\DefaultValueConstraint[]

Table default value constraints.

getTableForeignKeys() 公共 方法

Obtains the foreign keys information for the named table.

public yii\db\ForeignKeyConstraint[] getTableForeignKeys($name, $refresh false)
$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 information even if it is found in the cache.

return yii\db\ForeignKeyConstraint[]

Table foreign keys.

getTableIndexes() 公共 方法

Obtains the indexes information for the named table.

public yii\db\IndexConstraint[] getTableIndexes($name, $refresh false)
$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 information even if it is found in the cache.

return yii\db\IndexConstraint[]

Table indexes.

getTableMetadata() 受保护 抽象 方法

Returns the metadata of the given type for the given table.

protected abstract mixed getTableMetadata($name, $type, $refresh)
$name string

Table name. The table name may contain schema name if any. Do not quote the table name.

$type string

Metadata type.

$refresh boolean

Whether to reload the table metadata even if it is found in the cache.

return mixed

Metadata.

getTablePrimaryKey() 公共 方法

Obtains the primary key for the named table.

public yii\db\Constraint|null getTablePrimaryKey($name, $refresh false)
$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 information even if it is found in the cache.

return yii\db\Constraint|null

Table primary key, null if the table has no primary key.

getTableUniques() 公共 方法

Obtains the unique constraints information for the named table.

public yii\db\Constraint[] getTableUniques($name, $refresh false)
$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 information even if it is found in the cache.

return yii\db\Constraint[]

Table unique constraints.

loadTableChecks() 受保护 抽象 方法

Loads all check constraints for the given table.

protected abstract yii\db\CheckConstraint[] loadTableChecks($tableName)
$tableName string

Table name.

return yii\db\CheckConstraint[]

Check constraints for the given table.

loadTableDefaultValues() 受保护 抽象 方法

Loads all default value constraints for the given table.

protected abstract yii\db\DefaultValueConstraint[] loadTableDefaultValues($tableName)
$tableName string

Table name.

return yii\db\DefaultValueConstraint[]

Default value constraints for the given table.

loadTableForeignKeys() 受保护 抽象 方法

Loads all foreign keys for the given table.

protected abstract yii\db\ForeignKeyConstraint[] loadTableForeignKeys($tableName)
$tableName string

Table name.

return yii\db\ForeignKeyConstraint[]

Foreign keys for the given table.

loadTableIndexes() 受保护 抽象 方法

Loads all indexes for the given table.

protected abstract yii\db\IndexConstraint[] loadTableIndexes($tableName)
$tableName string

Table name.

return yii\db\IndexConstraint[]

Indexes for the given table.

loadTablePrimaryKey() 受保护 抽象 方法

Loads a primary key for the given table.

protected abstract yii\db\Constraint|null loadTablePrimaryKey($tableName)
$tableName string

Table name.

return yii\db\Constraint|null

Primary key for the given table, null if the table has no primary key.

loadTableUniques() 受保护 抽象 方法

Loads all unique constraints for the given table.

protected abstract yii\db\Constraint[] loadTableUniques($tableName)
$tableName string

Table name.

return yii\db\Constraint[]

Unique constraints for the given table.