Property | Type | Description | |
---|---|---|---|
$typeMap | mapping from abstract column types (keys) to physical column types (values). |
Method | Description | |
---|---|---|
addCommentOnColumn ( $table, $column, $comment ) | ||
addCommentOnTable ( $table, $comment ) | ||
addForeignKey ( string $name, string $table, string | array $columns, string $refTable, string | array $refColumns, string $delete = null, string $update = null ) : string | Builds a SQL statement for adding a foreign key constraint to an existing table. | |
addPrimaryKey ( string $name, string $table, string | array $columns ) : string | Builds a SQL statement for adding a primary key constraint to an existing table. | |
alterColumn ( string $table, string $column, string $type ) : string | Builds a SQL statement for changing the definition of a column. | |
batchInsert ( string $table, array $columns, array $rows ) : string | Generates a batch INSERT SQL statement. | |
build ( $query, $params = [] ) | ||
buildLimit ( $limit, $offset ) | ||
buildUnion ( $unions, &$params ) | ||
checkIntegrity ( boolean $check = true, string $schema = '', string $table = '' ) : string | Enables or disables integrity check. | |
dropColumn ( string $table, string $column ) : string | Builds a SQL statement for dropping a DB column. | |
dropCommentFromColumn ( $table, $column ) | ||
dropCommentFromTable ( $table ) | ||
dropForeignKey ( string $name, string $table ) : string | Builds a SQL statement for dropping a foreign key constraint. | |
dropIndex ( string $name, string $table ) : string | Builds a SQL statement for dropping an index. | |
dropPrimaryKey ( string $name, string $table ) : string | Builds a SQL statement for removing a primary key constraint to an existing table. | |
renameColumn ( string $table, string $oldName, string $newName ) : string | Builds a SQL statement for renaming a column. | |
renameTable ( string $table, string $newName ) : string | Builds a SQL statement for renaming a DB table. | |
resetSequence ( string $tableName, mixed $value = null ) : string | Creates a SQL statement for resetting the sequence value of a table's primary key. | |
truncateTable ( string $table ) : string | Builds a SQL statement for truncating a DB table. |
Method | Description | |
---|---|---|
buildCompositeInCondition ( string $operator, array $columns, array $values, array &$params ) : string | Builds SQL for IN condition | |
buildSubqueryInCondition ( $operator, $columns, $values, &$params ) |
public addForeignKey ( string $name, string $table, string | array $columns, string $refTable, string | array $refColumns, string $delete = null, string $update = null ) : string | ||
$name | string | the name of the foreign key constraint. |
$table | string | the table that the foreign key constraint will be added to. |
$columns | string | array | the name of the column to that the constraint will be added on. If there are multiple columns, separate them with commas or use an array to represent them. |
$refTable | string | the table that the foreign key references to. |
$refColumns | string | array | the name of the column that the foreign key references to. If there are multiple columns, separate them with commas or use an array to represent them. |
$delete | string | the ON DELETE option. Most DBMS support these options: RESTRICT, CASCADE, NO ACTION, SET DEFAULT, SET NULL |
$update | string | the ON UPDATE option. Most DBMS support these options: RESTRICT, CASCADE, NO ACTION, SET DEFAULT, SET NULL |
return | string | the SQL statement for adding a foreign key constraint to an existing table. |
public addPrimaryKey ( string $name, string $table, string | array $columns ) : string | ||
$name | string | the name of the primary key constraint. |
$table | string | the table that the primary key constraint will be added to. |
$columns | string | array | comma separated string or array of columns that the primary key will consist of. |
return | string | the SQL statement for adding a primary key constraint to an existing table. |
public alterColumn ( string $table, string $column, string $type ) : string | ||
$table | string | the table whose column is to be changed. The table name will be properly quoted by the method. |
$column | string | the name of the column to be changed. The name will be properly quoted by the method. |
$type | string | the new column type. The [[getColumnType()]] method will be invoked to convert abstract column type (if any) into the physical one. Anything that is not recognized as abstract type will be kept in the generated SQL. For example, 'string' will be turned into 'varchar(255)', while 'string not null' will become 'varchar(255) not null'. |
return | string | the SQL statement for changing the definition of a column. |
protected buildSubqueryInCondition ( $operator, $columns, $values, &$params ) |
public checkIntegrity ( boolean $check = true, string $schema = '', string $table = '' ) : string | ||
$check | boolean | whether to turn on or off the integrity check. |
$schema | string | the schema of the tables. Meaningless for SQLite. |
$table | string | the table name. Meaningless for SQLite. |
return | string | the SQL statement for checking integrity |
public dropColumn ( string $table, string $column ) : string | ||
$table | string | the table whose column is to be dropped. The name will be properly quoted by the method. |
$column | string | the name of the column to be dropped. The name will be properly quoted by the method. |
return | string | the SQL statement for dropping a DB column. |
public dropForeignKey ( string $name, string $table ) : string | ||
$name | string | the name of the foreign key constraint to be dropped. The name will be properly quoted by the method. |
$table | string | the table whose foreign is to be dropped. The name will be properly quoted by the method. |
return | string | the SQL statement for dropping a foreign key constraint. |
public dropIndex ( string $name, string $table ) : string | ||
$name | string | the name of the index to be dropped. The name will be properly quoted by the method. |
$table | string | the table whose index is to be dropped. The name will be properly quoted by the method. |
return | string | the SQL statement for dropping an index. |
public dropPrimaryKey ( string $name, string $table ) : string | ||
$name | string | the name of the primary key constraint to be removed. |
$table | string | the table that the primary key constraint will be removed from. |
return | string | the SQL statement for removing a primary key constraint from an existing table. |
public renameColumn ( string $table, string $oldName, string $newName ) : string | ||
$table | string | the table whose column is to be renamed. The name will be properly quoted by the method. |
$oldName | string | the old name of the column. The name will be properly quoted by the method. |
$newName | string | the new name of the column. The name will be properly quoted by the method. |
return | string | the SQL statement for renaming a DB column. |
public resetSequence ( string $tableName, mixed $value = null ) : string | ||
$tableName | string | the name of the table 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. |
return | string | the SQL statement for resetting sequence |
public truncateTable ( string $table ) : string | ||
$table | string | the table to be truncated. The name will be properly quoted by the method. |
return | string | the SQL statement for truncating a DB table. |