PHP Класс yii\db\sqlite\QueryBuilder

С версии: 2.0
Автор: Qiang Xue ([email protected])
Наследование: extends yii\db\QueryBuilder
Показать файл Открыть проект

Открытые свойства

Свойство Тип Описание
$typeMap mapping from abstract column types (keys) to physical column types (values).

Открытые методы

Метод Описание
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.

Защищенные методы

Метод Описание
buildCompositeInCondition ( string $operator, array $columns, array $values, array &$params ) : string Builds SQL for IN condition
buildSubqueryInCondition ( $operator, $columns, $values, &$params )

Описание методов

addCommentOnColumn() публичный Метод

С версии: 2.0.8
public addCommentOnColumn ( $table, $column, $comment )

addCommentOnTable() публичный Метод

С версии: 2.0.8
public addCommentOnTable ( $table, $comment )

addForeignKey() публичный Метод

The method will properly quote the table and column names.
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
Результат string the SQL statement for adding a foreign key constraint to an existing table.

addPrimaryKey() публичный Метод

Builds a SQL statement for adding a primary 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.
Результат string the SQL statement for adding a primary key constraint to an existing table.

alterColumn() публичный Метод

Builds a SQL statement for changing the definition of a column.
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'.
Результат string the SQL statement for changing the definition of a column.

batchInsert() публичный Метод

For example, php $connection->createCommand()->batchInsert('user', ['name', 'age'], [ ['Tom', 30], ['Jane', 20], ['Linda', 25], ])->execute(); Note that the values in each row must match the corresponding column names.
public batchInsert ( string $table, array $columns, array $rows ) : string
$table string the table that new rows will be inserted into.
$columns array the column names
$rows array the rows to be batch inserted into the table
Результат string the batch INSERT SQL statement

build() публичный Метод

public build ( $query, $params = [] )

buildCompositeInCondition() защищенный Метод

Builds SQL for IN condition
protected buildCompositeInCondition ( string $operator, array $columns, array $values, array &$params ) : string
$operator string
$columns array
$values array
$params array
Результат string SQL

buildLimit() публичный Метод

public buildLimit ( $limit, $offset )

buildSubqueryInCondition() защищенный Метод

protected buildSubqueryInCondition ( $operator, $columns, $values, &$params )

buildUnion() публичный Метод

public buildUnion ( $unions, &$params )

checkIntegrity() публичный Метод

Enables or disables 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 SQLite.
$table string the table name. Meaningless for SQLite.
Результат string the SQL statement for checking integrity

dropColumn() публичный Метод

Builds a SQL statement for dropping a DB column.
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.
Результат string the SQL statement for dropping a DB column.

dropCommentFromColumn() публичный Метод

С версии: 2.0.8
public dropCommentFromColumn ( $table, $column )

dropCommentFromTable() публичный Метод

С версии: 2.0.8
public dropCommentFromTable ( $table )

dropForeignKey() публичный Метод

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.
Результат string the SQL statement for dropping a foreign key constraint.

dropIndex() публичный Метод

Builds a SQL statement for dropping an index.
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.
Результат string the SQL statement for dropping an index.

dropPrimaryKey() публичный Метод

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.
Результат string the SQL statement for removing a primary key constraint from an existing table.

renameColumn() публичный Метод

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.
Результат string the SQL statement for renaming a DB column.

renameTable() публичный Метод

Builds a SQL statement for renaming a DB table.
public renameTable ( string $table, string $newName ) : string
$table string the table to be renamed. The name will be properly quoted by the method.
$newName string the new table name. The name will be properly quoted by the method.
Результат string the SQL statement for renaming a DB table.

resetSequence() публичный Метод

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.
Результат string the SQL statement for resetting sequence

truncateTable() публичный Метод

Builds a SQL statement for truncating a DB table.
public truncateTable ( string $table ) : string
$table string the table to be truncated. The name will be properly quoted by the method.
Результат string the SQL statement for truncating a DB table.

Описание свойств

$typeMap публичное свойство

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