CMssqlSchema
包 | system.db.schema.mssql |
---|---|
继承 | class CMssqlSchema » CDbSchema » CComponent |
可用自 | 1.0.4 |
版本 | $Id$ |
CMssqlSchema is the class for retrieving metadata information from a MS SQL Server database.
公共属性
属性 | 类型 | 描述 | 被定义在 |
---|---|---|---|
commandBuilder | CDbCommandBuilder | the SQL command builder for this connection. | CDbSchema |
dbConnection | CDbConnection | database connection. | CDbSchema |
tableNames | array | Returns all table names in the database. | CDbSchema |
tables | array | Returns the metadata for all tables in the database. | CDbSchema |
公共方法
方法 | 描述 | 被定义在 |
---|---|---|
__call() | Calls the named method which is not a class method. | CComponent |
__construct() | Constructor. | CDbSchema |
__get() | Returns a property value, an event handler list or a behavior based on its name. | CComponent |
__isset() | Checks if a property value is null. | CComponent |
__set() | Sets value of a component property. | CComponent |
__unset() | Sets a component property to be null. | CComponent |
asa() | Returns the named behavior object. | CComponent |
attachBehavior() | Attaches a behavior to this component. | CComponent |
attachBehaviors() | Attaches a list of behaviors to the component. | CComponent |
attachEventHandler() | Attaches an event handler to an event. | CComponent |
canGetProperty() | Determines whether a property can be read. | CComponent |
canSetProperty() | Determines whether a property can be set. | CComponent |
compareTableNames() | Compares two table names. | CMssqlSchema |
detachBehavior() | Detaches a behavior from the component. | CComponent |
detachBehaviors() | Detaches all behaviors from the component. | CComponent |
detachEventHandler() | Detaches an existing event handler. | CComponent |
disableBehavior() | Disables an attached behavior. | CComponent |
disableBehaviors() | Disables all behaviors attached to this component. | CComponent |
enableBehavior() | Enables an attached behavior. | CComponent |
enableBehaviors() | Enables all behaviors attached to this component. | CComponent |
getCommandBuilder() | CDbSchema | |
getDbConnection() | CDbSchema | |
getEventHandlers() | Returns the list of attached event handlers for an event. | CComponent |
getTable() | Obtains the metadata for the named table. | CDbSchema |
getTableNames() | Returns all table names in the database. | CDbSchema |
getTables() | Returns the metadata for all tables in the database. | CDbSchema |
hasEvent() | Determines whether an event is defined. | CComponent |
hasEventHandler() | Checks whether the named event has attached handlers. | CComponent |
hasProperty() | Determines whether a property is defined. | CComponent |
quoteColumnName() | Quotes a column name for use in a query. | CMssqlSchema |
quoteTableName() | Quotes a table name for use in a query. | CMssqlSchema |
raiseEvent() | Raises an event. | CComponent |
refresh() | Refreshes the schema. | CDbSchema |
受保护的方法
方法 | 描述 | 被定义在 |
---|---|---|
createColumn() | Creates a table column. | CMssqlSchema |
createCommandBuilder() | Creates a command builder for the database. | CMssqlSchema |
createTable() | Creates a table instance representing the metadata for the named table. | CMssqlSchema |
findColumns() | Collects the table column metadata. | CMssqlSchema |
findForeignKeys() | Gets foreign relationship constraint keys and table name | CMssqlSchema |
findPrimaryKey() | Gets the primary key column(s) details for the given table. | CMssqlSchema |
findTableNames() | Returns all table names in the database. | CMssqlSchema |
resolveTableNames() | Generates various kinds of table names. | CMssqlSchema |
方法详情
compareTableNames()
方法
public boolean compareTableNames(string $name1, string $name2)
| ||
$name1 | string | table name 1 |
$name2 | string | table name 2 |
{return} | boolean | whether the two table names refer to the same table. |
Compares two table names. The table names can be either quoted or unquoted. This method will consider both cases.
createColumn()
方法
protected CDbColumnSchema createColumn(array $column)
| ||
$column | array | column metadata |
{return} | CDbColumnSchema | normalized column metadata |
Creates a table column.
createCommandBuilder()
方法
protected CDbCommandBuilder createCommandBuilder()
| ||
{return} | CDbCommandBuilder | command builder instance |
Creates a command builder for the database. This method overrides parent implementation in order to create a MSSQL specific command builder
createTable()
方法
protected CMssqlTableSchema createTable($name)
| ||
$name | ||
{return} | CMssqlTableSchema | driver dependent table metadata. Null if the table does not exist. |
Creates a table instance representing the metadata for the named table.
findColumns()
方法
protected boolean findColumns(CMssqlTableSchema $table)
| ||
$table | CMssqlTableSchema | the table metadata |
{return} | boolean | whether the table exists in the database |
Collects the table column metadata.
findForeignKeys()
方法
protected array findForeignKeys(CMssqlTableSchema $table)
| ||
$table | CMssqlTableSchema | table |
{return} | array | foreign relationship table name and keys. |
Gets foreign relationship constraint keys and table name
findPrimaryKey()
方法
protected mixed findPrimaryKey(CMssqlTableSchema $table)
| ||
$table | CMssqlTableSchema | table |
{return} | mixed | primary keys (null if no pk, string if only 1 column pk, or array if composite pk) |
Gets the primary key column(s) details for the given table.
findTableNames()
方法
(自版本 v1.0.4 可用)
protected array findTableNames($schema='')
| ||
$schema | ||
{return} | array | all table names in the database. |
Returns all table names in the database.
quoteColumnName()
方法
public string quoteColumnName(string $name)
| ||
$name | string | column name |
{return} | string | the properly quoted column name |
Quotes a column name for use in a query.
quoteTableName()
方法
public string quoteTableName(string $name)
| ||
$name | string | table name |
{return} | string | the properly quoted table name |
Quotes a table name for use in a query.
resolveTableNames()
方法
protected void resolveTableNames(CMssqlTableSchema $table, string $name)
| ||
$table | CMssqlTableSchema | the table instance |
$name | string | the unquoted table name |
Generates various kinds of table names.