PHP Class yii\db\mysql\QueryBuilder

Since: 2.0
Author: Qiang Xue ([email protected])
Inheritance: extends yii\db\QueryBuilder
Show file Open project: yiisoft/yii2 Class Usage Examples

Public Properties

Property Type Description
$typeMap mapping from abstract column types (keys) to physical column types (values).

Public Methods

Method Description
addCommentOnColumn ( $table, $column, $comment )
addCommentOnTable ( $table, $comment )
buildLimit ( $limit, $offset )
checkIntegrity ( boolean $check = true, string $schema = '', string $table = '' ) : string Builds a SQL statement for enabling or disabling integrity check.
createIndex ( $name, $table, $columns, $unique = false )
dropCommentFromColumn ( $table, $column )
dropCommentFromTable ( $table )
dropForeignKey ( string $name, string $table ) : string Builds a SQL statement for dropping a foreign key constraint.
dropPrimaryKey ( string $name, string $table ) : string Builds a SQL statement for removing a primary key constraint to an existing table.
insert ( $table, $columns, &$params )
renameColumn ( string $table, string $oldName, string $newName ) : string Builds a SQL statement for renaming a column.
resetSequence ( string $tableName, mixed $value = null ) : string Creates a SQL statement for resetting the sequence value of a table's primary key.

Private Methods

Method Description
getColumnDefinition ( string $table, string $column ) : null | string Gets column definition.

Method Details

addCommentOnColumn() public method

Since: 2.0.8
public addCommentOnColumn ( $table, $column, $comment )

addCommentOnTable() public method

Since: 2.0.8
public addCommentOnTable ( $table, $comment )

buildLimit() public method

public buildLimit ( $limit, $offset )

checkIntegrity() public method

Builds a SQL statement for enabling or disabling integrity check.
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 MySQL.
$table string the table name. Meaningless for MySQL.
return string the SQL statement for checking integrity

createIndex() public method

See also: https://bugs.mysql.com/bug.php?id=48875
public createIndex ( $name, $table, $columns, $unique = false )

dropCommentFromColumn() public method

Since: 2.0.8
public dropCommentFromColumn ( $table, $column )

dropCommentFromTable() public method

Since: 2.0.8
public dropCommentFromTable ( $table )

dropForeignKey() public method

Builds a SQL statement for dropping a foreign key constraint.
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.

dropPrimaryKey() public method

Builds a SQL statement for removing a primary key constraint to an existing table.
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.

insert() public method

public insert ( $table, $columns, &$params )

renameColumn() public method

Builds a SQL statement for renaming a column.
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.

resetSequence() public method

The sequence will be reset such that the primary key of the next new row inserted will have the specified value or 1.
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

Property Details

$typeMap public property

mapping from abstract column types (keys) to physical column types (values).
public $typeMap