PHP Class yii\db\pgsql\QueryBuilder

Since: 2.0
Author: Gevik Babakhani ([email protected])
Inheritance: extends yii\db\QueryBuilder
Show file Open project: yiisoft/yii2

Public Properties

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

Protected Properties

Property Type Description
$conditionBuilders map of query condition to builder methods. These methods are used by [[buildCondition]] to build SQL conditions from array syntax.

Public Methods

Method Description
alterColumn ( string $table, string $column, string $type ) : string Builds a SQL statement for changing the definition of a column.
batchInsert ( $table, $columns, $rows )
checkIntegrity ( boolean $check = true, string $schema = '', string $table = '' ) : string Builds a SQL statement for enabling or disabling integrity check.
createIndex ( string $name, string $table, string | array $columns, boolean | string $unique = false ) : string Builds a SQL statement for creating a new index.
dropIndex ( string $name, string $table ) : string Builds a SQL statement for dropping an index.
insert ( $table, $columns, &$params )
renameTable ( string $oldName, 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.
update ( $table, $columns, $condition, &$params )

Private Methods

Method Description
normalizeTableRowData ( string $table, array $columns ) : array Normalizes data to be saved into the table, performing extra preparations and type converting, if necessary.

Method Details

alterColumn() public method

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'. You can also use PostgreSQL-specific syntax such as `SET NOT NULL`.
return string the SQL statement for changing the definition of a column.

batchInsert() public method

public batchInsert ( $table, $columns, $rows )

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.
$table string the table name.
return string the SQL statement for checking integrity

createIndex() public method

Builds a SQL statement for creating a new index.
See also: http://www.postgresql.org/docs/8.2/static/sql-createindex.html
public createIndex ( string $name, string $table, string | array $columns, boolean | string $unique = false ) : string
$name string the name of the index. The name will be properly quoted by the method.
$table string the table that the new index will be created for. The table name will be properly quoted by the method.
$columns string | array the column(s) that should be included in the index. If there are multiple columns, separate them with commas or use an array to represent them. Each column name will be properly quoted by the method, unless a parenthesis is found in the name.
$unique boolean | string whether to make this a UNIQUE index constraint. You can pass `true` or [[INDEX_UNIQUE]] to create a unique index, `false` to make a non-unique index using the default index type, or one of the following constants to specify the index method to use: [[INDEX_B_TREE]], [[INDEX_HASH]], [[INDEX_GIST]], [[INDEX_GIN]].
return string the SQL statement for creating a new index.

dropIndex() public method

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.
return string the SQL statement for dropping an index.

insert() public method

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

renameTable() public method

Builds a SQL statement for renaming a DB table.
public renameTable ( string $oldName, string $newName ) : string
$oldName 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.
return string the SQL statement for renaming a DB table.

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

update() public method

public update ( $table, $columns, $condition, &$params )

Property Details

$conditionBuilders protected property

map of query condition to builder methods. These methods are used by [[buildCondition]] to build SQL conditions from array syntax.
protected $conditionBuilders

$typeMap public property

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