Trait 特性 yii\db\ConstraintFinderTrait
ConstraintFinderTrait 提供了取得表格約束資訊的方法。
公開屬性
屬性 | 類型 | 描述 | 定義於 |
---|---|---|---|
$schemaChecks | \yii\db\CheckConstraint[][] | 資料庫中所有表格的檢查約束。 | yii\db\ConstraintFinderTrait |
$schemaDefaultValues | yii\db\DefaultValueConstraint[] | 資料庫中所有表格的預設值約束。 | yii\db\ConstraintFinderTrait |
$schemaForeignKeys | \yii\db\ForeignKeyConstraint[][] | 資料庫中所有表格的外鍵。 | yii\db\ConstraintFinderTrait |
$schemaIndexes | \yii\db\IndexConstraint[][] | 資料庫中所有表格的索引。 | yii\db\ConstraintFinderTrait |
$schemaPrimaryKeys | yii\db\Constraint[] | 資料庫中所有表格的主鍵。 | yii\db\ConstraintFinderTrait |
$schemaUniques | \yii\db\IndexConstraint[][] | 資料庫中所有表格的唯一約束。 | yii\db\ConstraintFinderTrait |
公開方法
方法 | 描述 | 定義於 |
---|---|---|
getSchemaChecks() | 傳回資料庫中所有表格的檢查約束。 | yii\db\ConstraintFinderTrait |
getSchemaDefaultValues() | 傳回資料庫中所有表格的預設值約束。 | yii\db\ConstraintFinderTrait |
getSchemaForeignKeys() | 傳回資料庫中所有表格的外鍵。 | yii\db\ConstraintFinderTrait |
getSchemaIndexes() | 傳回資料庫中所有表格的索引。 | yii\db\ConstraintFinderTrait |
getSchemaPrimaryKeys() | 傳回資料庫中所有表格的主鍵。 | yii\db\ConstraintFinderTrait |
getSchemaUniques() | 傳回資料庫中所有表格的唯一約束。 | yii\db\ConstraintFinderTrait |
getTableChecks() | 取得指定表格的檢查約束資訊。 | yii\db\ConstraintFinderTrait |
getTableDefaultValues() | 取得指定表格的預設值約束資訊。 | yii\db\ConstraintFinderTrait |
getTableForeignKeys() | 取得指定表格的外鍵資訊。 | yii\db\ConstraintFinderTrait |
getTableIndexes() | 取得指定表格的索引資訊。 | yii\db\ConstraintFinderTrait |
getTablePrimaryKey() | 取得指定表格的主鍵。 | yii\db\ConstraintFinderTrait |
getTableUniques() | 取得指定表格的唯一約束資訊。 | yii\db\ConstraintFinderTrait |
受保護的方法
方法 | 描述 | 定義於 |
---|---|---|
getSchemaMetadata() | 傳回指定綱要中所有表格的給定類型metadata。 | yii\db\ConstraintFinderTrait |
getTableMetadata() | 傳回指定表格的給定類型metadata。 | yii\db\ConstraintFinderTrait |
loadTableChecks() | 載入指定表格的所有檢查約束。 | yii\db\ConstraintFinderTrait |
loadTableDefaultValues() | 載入指定表格的所有預設值約束。 | yii\db\ConstraintFinderTrait |
loadTableForeignKeys() | 載入指定表格的所有外鍵。 | yii\db\ConstraintFinderTrait |
loadTableIndexes() | 載入指定表格的所有索引。 | yii\db\ConstraintFinderTrait |
loadTablePrimaryKey() | 載入指定表格的主鍵。 | yii\db\ConstraintFinderTrait |
loadTableUniques() | 載入指定資料表的所有唯一約束。 | yii\db\ConstraintFinderTrait |
屬性詳情
資料庫中所有資料表的檢查約束。每個陣列元素都是 yii\db\CheckConstraint 或其子類別的陣列。此屬性為唯讀。
資料庫中所有資料表的預設值約束。每個陣列元素都是 yii\db\DefaultValueConstraint 或其子類別的陣列。此屬性為唯讀。
資料庫中所有資料表的外鍵。每個陣列元素都是 yii\db\ForeignKeyConstraint 或其子類別的陣列。此屬性為唯讀。
資料庫中所有資料表的索引。每個陣列元素都是 yii\db\IndexConstraint 或其子類別的陣列。此屬性為唯讀。
資料庫中所有資料表的主鍵。每個陣列元素都是 yii\db\Constraint 或其子類別的實例。此屬性為唯讀。
資料庫中所有資料表的唯一約束。每個陣列元素都是 yii\db\IndexConstraint 或其子類別的陣列。此屬性為唯讀。
方法詳情
傳回資料庫中所有表格的檢查約束。
public \yii\db\CheckConstraint[][] getSchemaChecks ( $schema = '', $refresh = false ) | ||
$schema | 字串 |
資料表的結構描述。預設為空字串,表示目前或預設的結構描述名稱。 |
$refresh | 布林值 |
是否擷取最新的可用資料表結構描述。如果為 false,則在可用的情況下可能會傳回快取資料。 |
回傳 | \yii\db\CheckConstraint[][] |
資料庫中所有資料表的檢查約束。每個陣列元素都是 yii\db\CheckConstraint 或其子類別的陣列。 |
---|
public function getSchemaChecks($schema = '', $refresh = false)
{
return $this->getSchemaMetadata($schema, 'checks', $refresh);
}
傳回資料庫中所有表格的預設值約束。
public yii\db\DefaultValueConstraint[] getSchemaDefaultValues ( $schema = '', $refresh = false ) | ||
$schema | 字串 |
資料表的結構描述。預設為空字串,表示目前或預設的結構描述名稱。 |
$refresh | 布林值 |
是否擷取最新的可用資料表結構描述。如果為 false,則在可用的情況下可能會傳回快取資料。 |
回傳 | yii\db\DefaultValueConstraint[] |
資料庫中所有資料表的預設值約束。每個陣列元素都是 yii\db\DefaultValueConstraint 或其子類別的陣列。 |
---|
public function getSchemaDefaultValues($schema = '', $refresh = false)
{
return $this->getSchemaMetadata($schema, 'defaultValues', $refresh);
}
傳回資料庫中所有表格的外鍵。
public \yii\db\ForeignKeyConstraint[][] getSchemaForeignKeys ( $schema = '', $refresh = false ) | ||
$schema | 字串 |
資料表的結構描述。預設為空字串,表示目前或預設的結構描述名稱。 |
$refresh | 布林值 |
是否擷取最新的可用資料表結構描述。如果為 false,則在可用的情況下可能會傳回快取資料。 |
回傳 | \yii\db\ForeignKeyConstraint[][] |
資料庫中所有資料表的外鍵。每個陣列元素都是 yii\db\ForeignKeyConstraint 或其子類別的陣列。 |
---|
public function getSchemaForeignKeys($schema = '', $refresh = false)
{
return $this->getSchemaMetadata($schema, 'foreignKeys', $refresh);
}
傳回資料庫中所有表格的索引。
public \yii\db\IndexConstraint[][] getSchemaIndexes ( $schema = '', $refresh = false ) | ||
$schema | 字串 |
資料表的結構描述。預設為空字串,表示目前或預設的結構描述名稱。 |
$refresh | 布林值 |
是否擷取最新的可用資料表結構描述。如果為 false,則在可用的情況下可能會傳回快取資料。 |
回傳 | \yii\db\IndexConstraint[][] |
資料庫中所有資料表的索引。每個陣列元素都是 yii\db\IndexConstraint 或其子類別的陣列。 |
---|
public function getSchemaIndexes($schema = '', $refresh = false)
{
return $this->getSchemaMetadata($schema, 'indexes', $refresh);
}
傳回指定綱要中所有表格的給定類型metadata。
protected abstract array getSchemaMetadata ( $schema, $type, $refresh ) | ||
$schema | 字串 |
metadata 的結構描述。預設為空字串,表示目前或預設的結構描述名稱。 |
$type | 字串 |
Metadata 類型。 |
$refresh | 布林值 |
是否擷取最新的可用資料表 metadata。如果為 |
回傳 | 陣列 |
Metadata 陣列。 |
---|
abstract protected function getSchemaMetadata($schema, $type, $refresh);
傳回資料庫中所有表格的主鍵。
public yii\db\Constraint[] getSchemaPrimaryKeys ( $schema = '', $refresh = false ) | ||
$schema | 字串 |
資料表的結構描述。預設為空字串,表示目前或預設的結構描述名稱。 |
$refresh | 布林值 |
是否擷取最新的可用資料表結構描述。如果為 |
回傳 | yii\db\Constraint[] |
資料庫中所有資料表的主鍵。每個陣列元素都是 yii\db\Constraint 或其子類別的實例。 |
---|
public function getSchemaPrimaryKeys($schema = '', $refresh = false)
{
return $this->getSchemaMetadata($schema, 'primaryKey', $refresh);
}
傳回資料庫中所有表格的唯一約束。
public \yii\db\Constraint[][] getSchemaUniques ( $schema = '', $refresh = false ) | ||
$schema | 字串 |
資料表的結構描述。預設為空字串,表示目前或預設的結構描述名稱。 |
$refresh | 布林值 |
是否擷取最新的可用資料表結構描述。如果為 false,則在可用的情況下可能會傳回快取資料。 |
回傳 | \yii\db\Constraint[][] |
資料庫中所有資料表的唯一約束。每個陣列元素都是 yii\db\Constraint 或其子類別的陣列。 |
---|
public function getSchemaUniques($schema = '', $refresh = false)
{
return $this->getSchemaMetadata($schema, 'uniques', $refresh);
}
取得指定表格的檢查約束資訊。
public yii\db\CheckConstraint[] getTableChecks ( $name, $refresh = false ) | ||
$name | 字串 |
資料表名稱。資料表名稱可以包含結構描述名稱(如果有的話)。請勿加上引號。 |
$refresh | 布林值 |
即使在快取中找到資訊,是否重新載入資訊。 |
回傳 | yii\db\CheckConstraint[] |
資料表檢查約束。 |
---|
public function getTableChecks($name, $refresh = false)
{
return $this->getTableMetadata($name, 'checks', $refresh);
}
取得指定表格的預設值約束資訊。
public yii\db\DefaultValueConstraint[] getTableDefaultValues ( $name, $refresh = false ) | ||
$name | 字串 |
資料表名稱。資料表名稱可以包含結構描述名稱(如果有的話)。請勿加上引號。 |
$refresh | 布林值 |
即使在快取中找到資訊,是否重新載入資訊。 |
回傳 | yii\db\DefaultValueConstraint[] |
資料表預設值約束。 |
---|
public function getTableDefaultValues($name, $refresh = false)
{
return $this->getTableMetadata($name, 'defaultValues', $refresh);
}
取得指定表格的外鍵資訊。
public yii\db\ForeignKeyConstraint[] getTableForeignKeys ( $name, $refresh = false ) | ||
$name | 字串 |
資料表名稱。資料表名稱可以包含結構描述名稱(如果有的話)。請勿加上引號。 |
$refresh | 布林值 |
即使在快取中找到資訊,是否重新載入資訊。 |
回傳 | yii\db\ForeignKeyConstraint[] |
資料表外鍵。 |
---|
public function getTableForeignKeys($name, $refresh = false)
{
return $this->getTableMetadata($name, 'foreignKeys', $refresh);
}
取得指定表格的索引資訊。
public yii\db\IndexConstraint[] getTableIndexes ( $name, $refresh = false ) | ||
$name | 字串 |
資料表名稱。資料表名稱可以包含結構描述名稱(如果有的話)。請勿加上引號。 |
$refresh | 布林值 |
即使在快取中找到資訊,是否重新載入資訊。 |
回傳 | yii\db\IndexConstraint[] |
資料表索引。 |
---|
public function getTableIndexes($name, $refresh = false)
{
return $this->getTableMetadata($name, 'indexes', $refresh);
}
傳回指定表格的給定類型metadata。
protected abstract mixed getTableMetadata ( $name, $type, $refresh ) | ||
$name | 字串 |
資料表名稱。資料表名稱可以包含結構描述名稱(如果有的話)。請勿加上引號。 |
$type | 字串 |
Metadata 類型。 |
$refresh | 布林值 |
即使在快取中找到資料表 metadata,是否重新載入資料表 metadata。 |
回傳 | mixed |
Metadata。 |
---|
abstract protected function getTableMetadata($name, $type, $refresh);
取得指定表格的主鍵。
public yii\db\Constraint|null getTablePrimaryKey ( $name, $refresh = false ) | ||
$name | 字串 |
資料表名稱。資料表名稱可以包含結構描述名稱(如果有的話)。請勿加上引號。 |
$refresh | 布林值 |
即使在快取中找到資訊,是否重新載入資訊。 |
回傳 | yii\db\Constraint|null |
資料表主鍵,如果資料表沒有主鍵,則為 `null`。 |
---|
public function getTablePrimaryKey($name, $refresh = false)
{
return $this->getTableMetadata($name, 'primaryKey', $refresh);
}
取得指定表格的唯一約束資訊。
public yii\db\Constraint[] getTableUniques ( $name, $refresh = false ) | ||
$name | 字串 |
資料表名稱。資料表名稱可以包含結構描述名稱(如果有的話)。請勿加上引號。 |
$refresh | 布林值 |
即使在快取中找到資訊,是否重新載入資訊。 |
回傳 | yii\db\Constraint[] |
資料表唯一約束。 |
---|
public function getTableUniques($name, $refresh = false)
{
return $this->getTableMetadata($name, 'uniques', $refresh);
}
載入指定表格的所有檢查約束。
protected abstract yii\db\CheckConstraint[] loadTableChecks ( $tableName ) | ||
$tableName | 字串 |
資料表名稱。 |
回傳 | yii\db\CheckConstraint[] |
指定資料表的檢查約束。 |
---|
abstract protected function loadTableChecks($tableName);
載入指定表格的所有預設值約束。
protected abstract yii\db\DefaultValueConstraint[] loadTableDefaultValues ( $tableName ) | ||
$tableName | 字串 |
資料表名稱。 |
回傳 | yii\db\DefaultValueConstraint[] |
指定資料表的預設值約束。 |
---|
abstract protected function loadTableDefaultValues($tableName);
載入指定表格的所有外鍵。
protected abstract yii\db\ForeignKeyConstraint[] loadTableForeignKeys ( $tableName ) | ||
$tableName | 字串 |
資料表名稱。 |
回傳 | yii\db\ForeignKeyConstraint[] |
指定資料表的外鍵。 |
---|
abstract protected function loadTableForeignKeys($tableName);
載入指定表格的所有索引。
protected abstract yii\db\IndexConstraint[] loadTableIndexes ( $tableName ) | ||
$tableName | 字串 |
資料表名稱。 |
回傳 | yii\db\IndexConstraint[] |
指定資料表的索引。 |
---|
abstract protected function loadTableIndexes($tableName);
載入指定表格的主鍵。
protected abstract yii\db\Constraint|null loadTablePrimaryKey ( $tableName ) | ||
$tableName | 字串 |
資料表名稱。 |
回傳 | yii\db\Constraint|null |
指定資料表的主鍵,如果資料表沒有主鍵,則為 `null`。 |
---|
abstract protected function loadTablePrimaryKey($tableName);
載入指定資料表的所有唯一約束。
protected abstract yii\db\Constraint[] loadTableUniques ( $tableName ) | ||
$tableName | 字串 |
資料表名稱。 |
回傳 | yii\db\Constraint[] |
指定資料表的唯一約束。 |
---|
abstract protected function loadTableUniques($tableName);
註冊 或 登入 以發表評論。