CDbSchema
CDbSchema is the base class for retrieving metadata information.
Property Details
commandBuilder
the SQL command builder for this connection.
database connection. The connection is active.
Returns all table names in the database.
Returns the metadata for all tables in the database.
Method Details
Constructor.
|
public void checkIntegrity(boolean $check=true, string $schema='')
|
| $check |
boolean |
whether to turn on or off the integrity check. |
| $schema |
string |
the schema of the tables. Defaults to empty string, meaning the current or default schema. |
Enables or disables integrity check.
|
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.
createCommandBuilder()
Creates a command builder for the database.
This method may be overridden by child classes to create a DBMS-specific command builder.
|
|
| $name |
|
|
| {return} |
CDbTableSchema |
driver dependent table metadata, null if the table does not exist. |
Creates a table instance representing the metadata for the named table.
|
protected array findTableNames(string $schema='')
|
| $schema |
string |
the schema of the tables. Defaults to empty string, meaning the current or default schema.
If not empty, the returned table names will be prefixed with the schema name. |
| {return} |
array |
all table names in the database. |
Returns all table names in the database.
This method should be overridden by child classes in order to support this feature
because the default implemenation simply throws an exception.
getCommandBuilder()
|
|
| {return} |
CDbConnection |
database connection. The connection is active. |
|
|
| $name |
string |
table name |
| {return} |
CDbTableSchema |
table metadata. Null if the named table does not exist. |
Obtains the metadata for the named table.
|
public array getTableNames(string $schema='')
|
| $schema |
string |
the schema of the tables. Defaults to empty string, meaning the current or default schema.
If not empty, the returned table names will be prefixed with the schema name. |
| {return} |
array |
all table names in the database. |
Returns all table names in the database.
|
public array getTables(string $schema='')
|
| $schema |
string |
the schema of the tables. Defaults to empty string, meaning the current or default schema. |
| {return} |
array |
the metadata for all tables in the database.
Each array element is an instance of CDbTableSchema (or its child class).
The array keys are table names. |
Returns the metadata for all tables 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.
|
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.
Refreshes the schema.
This method resets the loaded table metadata and command builder
so that they can be recreated to reflect the change of schema.
|
|
| $table |
CDbTableSchema |
the table schema whose primary key sequence will be reset |
| $value |
mixed |
the value for the primary key of the next new row inserted. If this is not set,
the next new row's primary key will have a value 1. |
Resets the sequence value of a table's primary key.
The sequence will be reset such that the primary key of the next new row inserted
will have the specified value or 1.