code
stringlengths
17
296k
docstring
stringlengths
30
30.3k
func_name
stringlengths
1
89
language
stringclasses
1 value
repo
stringlengths
7
63
path
stringlengths
7
153
url
stringlengths
51
209
license
stringclasses
4 values
public function checkIntegrity($check=true,$schema='') { }
Enables or disables integrity check. @param boolean $check whether to turn on or off the integrity check. @param string $schema the schema of the tables. Defaults to empty string, meaning the current or default schema. @since 1.1
checkIntegrity
php
yiisoft/yii
framework/db/schema/CDbSchema.php
https://github.com/yiisoft/yii/blob/master/framework/db/schema/CDbSchema.php
BSD-3-Clause
protected function createCommandBuilder() { return new CDbCommandBuilder($this); }
Creates a command builder for the database. This method may be overridden by child classes to create a DBMS-specific command builder. @return CDbCommandBuilder command builder instance
createCommandBuilder
php
yiisoft/yii
framework/db/schema/CDbSchema.php
https://github.com/yiisoft/yii/blob/master/framework/db/schema/CDbSchema.php
BSD-3-Clause
protected function findTableNames($schema='') { throw new CDbException(Yii::t('yii','{class} does not support fetching all table names.', array('{class}'=>get_class($this)))); }
Returns all table names in the database. This method should be overridden by child classes in order to support this feature because the default implementation simply throws an exception. @param string $schema 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. @throws CDbException if current schema does not support fetching all table names @return array all table names in the database.
findTableNames
php
yiisoft/yii
framework/db/schema/CDbSchema.php
https://github.com/yiisoft/yii/blob/master/framework/db/schema/CDbSchema.php
BSD-3-Clause
public function renameTable($table,$newName) { return 'RENAME TABLE ' . $this->quoteTableName($table) . ' TO ' . $this->quoteTableName($newName); }
Builds a SQL statement for renaming a DB table. @param string $table the table to be renamed. The name will be properly quoted by the method. @param string $newName the new table name. The name will be properly quoted by the method. @return string the SQL statement for renaming a DB table. @since 1.1.6
renameTable
php
yiisoft/yii
framework/db/schema/CDbSchema.php
https://github.com/yiisoft/yii/blob/master/framework/db/schema/CDbSchema.php
BSD-3-Clause
public function dropTable($table) { return "DROP TABLE ".$this->quoteTableName($table); }
Builds a SQL statement for dropping a DB table. @param string $table the table to be dropped. The name will be properly quoted by the method. @return string the SQL statement for dropping a DB table. @since 1.1.6
dropTable
php
yiisoft/yii
framework/db/schema/CDbSchema.php
https://github.com/yiisoft/yii/blob/master/framework/db/schema/CDbSchema.php
BSD-3-Clause
public function truncateTable($table) { return "TRUNCATE TABLE ".$this->quoteTableName($table); }
Builds a SQL statement for truncating a DB table. @param string $table the table to be truncated. The name will be properly quoted by the method. @return string the SQL statement for truncating a DB table. @since 1.1.6
truncateTable
php
yiisoft/yii
framework/db/schema/CDbSchema.php
https://github.com/yiisoft/yii/blob/master/framework/db/schema/CDbSchema.php
BSD-3-Clause
public function addColumn($table,$column,$type) { return 'ALTER TABLE ' . $this->quoteTableName($table) . ' ADD ' . $this->quoteColumnName($column) . ' ' . $this->getColumnType($type); }
Builds a SQL statement for adding a new DB column. @param string $table the table that the new column will be added to. The table name will be properly quoted by the method. @param string $column the name of the new column. The name will be properly quoted by the method. @param string $type the column type. The {@link 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 adding a new column. @since 1.1.6
addColumn
php
yiisoft/yii
framework/db/schema/CDbSchema.php
https://github.com/yiisoft/yii/blob/master/framework/db/schema/CDbSchema.php
BSD-3-Clause
public function dropColumn($table,$column) { return "ALTER TABLE ".$this->quoteTableName($table) ." DROP COLUMN ".$this->quoteColumnName($column); }
Builds a SQL statement for dropping a DB column. @param string $table the table whose column is to be dropped. The name will be properly quoted by the method. @param string $column 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. @since 1.1.6
dropColumn
php
yiisoft/yii
framework/db/schema/CDbSchema.php
https://github.com/yiisoft/yii/blob/master/framework/db/schema/CDbSchema.php
BSD-3-Clause
public function renameColumn($table,$name,$newName) { return "ALTER TABLE ".$this->quoteTableName($table) . " RENAME COLUMN ".$this->quoteColumnName($name) . " TO ".$this->quoteColumnName($newName); }
Builds a SQL statement for renaming a column. @param string $table the table whose column is to be renamed. The name will be properly quoted by the method. @param string $name the old name of the column. The name will be properly quoted by the method. @param string $newName 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. @since 1.1.6
renameColumn
php
yiisoft/yii
framework/db/schema/CDbSchema.php
https://github.com/yiisoft/yii/blob/master/framework/db/schema/CDbSchema.php
BSD-3-Clause
public function alterColumn($table,$column,$type) { return 'ALTER TABLE ' . $this->quoteTableName($table) . ' CHANGE ' . $this->quoteColumnName($column) . ' ' . $this->quoteColumnName($column) . ' ' . $this->getColumnType($type); }
Builds a SQL statement for changing the definition of a column. @param string $table the table whose column is to be changed. The table name will be properly quoted by the method. @param string $column the name of the column to be changed. The name will be properly quoted by the method. @param string $type the new column type. The {@link 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. @since 1.1.6
alterColumn
php
yiisoft/yii
framework/db/schema/CDbSchema.php
https://github.com/yiisoft/yii/blob/master/framework/db/schema/CDbSchema.php
BSD-3-Clause
public function addForeignKey($name,$table,$columns,$refTable,$refColumns,$delete=null,$update=null) { if(is_string($columns)) $columns=preg_split('/\s*,\s*/',$columns,-1,PREG_SPLIT_NO_EMPTY); foreach($columns as $i=>$col) $columns[$i]=$this->quoteColumnName($col); if(is_string($refColumns)) $refColumns=preg_split('/\s*,\s*/',$refColumns,-1,PREG_SPLIT_NO_EMPTY); foreach($refColumns as $i=>$col) $refColumns[$i]=$this->quoteColumnName($col); $sql='ALTER TABLE '.$this->quoteTableName($table) .' ADD CONSTRAINT '.$this->quoteColumnName($name) .' FOREIGN KEY ('.implode(', ',$columns).')' .' REFERENCES '.$this->quoteTableName($refTable) .' ('.implode(', ',$refColumns).')'; if($delete!==null) $sql.=' ON DELETE '.$delete; if($update!==null) $sql.=' ON UPDATE '.$update; return $sql; }
Builds a SQL statement for adding a foreign key constraint to an existing table. The method will properly quote the table and column names. @param string $name the name of the foreign key constraint. @param string $table the table that the foreign key constraint will be added to. @param string|array $columns the name of the column to that the constraint will be added on. If there are multiple columns, separate them with commas or pass as an array of column names. @param string $refTable the table that the foreign key references to. @param string|array $refColumns the name of the column that the foreign key references to. If there are multiple columns, separate them with commas or pass as an array of column names. @param string $delete the ON DELETE option. Most DBMS support these options: RESTRICT, CASCADE, NO ACTION, SET DEFAULT, SET NULL @param string $update 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. @since 1.1.6
addForeignKey
php
yiisoft/yii
framework/db/schema/CDbSchema.php
https://github.com/yiisoft/yii/blob/master/framework/db/schema/CDbSchema.php
BSD-3-Clause
public function dropForeignKey($name,$table) { return 'ALTER TABLE '.$this->quoteTableName($table) .' DROP CONSTRAINT '.$this->quoteColumnName($name); }
Builds a SQL statement for dropping a foreign key constraint. @param string $name the name of the foreign key constraint to be dropped. The name will be properly quoted by the method. @param string $table 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. @since 1.1.6
dropForeignKey
php
yiisoft/yii
framework/db/schema/CDbSchema.php
https://github.com/yiisoft/yii/blob/master/framework/db/schema/CDbSchema.php
BSD-3-Clause
public function dropIndex($name,$table) { return 'DROP INDEX '.$this->quoteTableName($name).' ON '.$this->quoteTableName($table); }
Builds a SQL statement for dropping an index. @param string $name the name of the index to be dropped. The name will be properly quoted by the method. @param string $table 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. @since 1.1.6
dropIndex
php
yiisoft/yii
framework/db/schema/CDbSchema.php
https://github.com/yiisoft/yii/blob/master/framework/db/schema/CDbSchema.php
BSD-3-Clause
public function addPrimaryKey($name,$table,$columns) { if(is_string($columns)) $columns=preg_split('/\s*,\s*/',$columns,-1,PREG_SPLIT_NO_EMPTY); foreach($columns as $i=>$col) $columns[$i]=$this->quoteColumnName($col); return 'ALTER TABLE ' . $this->quoteTableName($table) . ' ADD CONSTRAINT ' . $this->quoteColumnName($name) . ' PRIMARY KEY (' . implode(', ',$columns). ' )'; }
Builds a SQL statement for adding a primary key constraint to an existing table. @param string $name the name of the primary key constraint. @param string $table the table that the primary key constraint will be added to. @param string|array $columns comma separated string or array of columns that the primary key will consist of. Array value can be passed since 1.1.14. @return string the SQL statement for adding a primary key constraint to an existing table. @since 1.1.13
addPrimaryKey
php
yiisoft/yii
framework/db/schema/CDbSchema.php
https://github.com/yiisoft/yii/blob/master/framework/db/schema/CDbSchema.php
BSD-3-Clause
public function dropPrimaryKey($name,$table) { return 'ALTER TABLE ' . $this->quoteTableName($table) . ' DROP CONSTRAINT ' . $this->quoteColumnName($name); }
Builds a SQL statement for removing a primary key constraint to an existing table. @param string $name the name of the primary key constraint to be removed. @param string $table 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. @since 1.1.13
dropPrimaryKey
php
yiisoft/yii
framework/db/schema/CDbSchema.php
https://github.com/yiisoft/yii/blob/master/framework/db/schema/CDbSchema.php
BSD-3-Clause
public function addCondition($condition,$operator='AND') { if(is_array($condition)) { if($condition===array()) return $this; $condition='('.implode(') '.$operator.' (',$condition).')'; } if($this->condition==='') $this->condition=$condition; else $this->condition='('.$this->condition.') '.$operator.' ('.$condition.')'; return $this; }
Appends a condition to the existing {@link condition}. The new condition and the existing condition will be concatenated via the specified operator which defaults to 'AND'. The new condition can also be an array. In this case, all elements in the array will be concatenated together via the operator. This method handles the case when the existing condition is empty. After calling this method, the {@link condition} property will be modified. @param mixed $condition the new condition. It can be either a string or an array of strings. @param string $operator the operator to join different conditions. Defaults to 'AND'. @return static the criteria object itself
addCondition
php
yiisoft/yii
framework/db/schema/CDbCriteria.php
https://github.com/yiisoft/yii/blob/master/framework/db/schema/CDbCriteria.php
BSD-3-Clause
public function addNotInCondition($column,$values,$operator='AND') { if(($n=count($values))<1) return $this; if($n===1) { $value=reset($values); if($value===null) $condition=$column.' IS NOT NULL'; else { $condition=$column.'!='.self::PARAM_PREFIX.self::$paramCount; $this->params[self::PARAM_PREFIX.self::$paramCount++]=$value; } } else { $params=array(); foreach($values as $value) { $params[]=self::PARAM_PREFIX.self::$paramCount; $this->params[self::PARAM_PREFIX.self::$paramCount++]=$value; } $condition=$column.' NOT IN ('.implode(', ',$params).')'; } return $this->addCondition($condition,$operator); }
Appends an NOT IN condition to the existing {@link condition}. The NOT IN condition and the existing condition will be concatenated via the specified operator which defaults to 'AND'. The NOT IN condition is generated by using the SQL NOT IN operator which requires the specified column value to be among the given list of values. @param string $column the column name (or a valid SQL expression) @param array $values list of values that the column value should not be in @param string $operator the operator used to concatenate the new condition with the existing one. Defaults to 'AND'. @return static the criteria object itself @since 1.1.1
addNotInCondition
php
yiisoft/yii
framework/db/schema/CDbCriteria.php
https://github.com/yiisoft/yii/blob/master/framework/db/schema/CDbCriteria.php
BSD-3-Clause
public function compare($column, $value, $partialMatch=false, $operator='AND', $escape=true) { if(is_array($value)) { if($value===array()) return $this; return $this->addInCondition($column,$value,$operator); } else $value="$value"; if(preg_match('/^(?:\s*(<>|<=|>=|<|>|=))?(.*)$/',$value,$matches)) { $value=$matches[2]; $op=$matches[1]; } else $op=''; if($value==='') return $this; if($partialMatch) { if($op==='') return $this->addSearchCondition($column,$value,$escape,$operator); if($op==='<>') return $this->addSearchCondition($column,$value,$escape,$operator,'NOT LIKE'); } elseif($op==='') $op='='; $this->addCondition($column.$op.self::PARAM_PREFIX.self::$paramCount,$operator); $this->params[self::PARAM_PREFIX.self::$paramCount++]=$value; return $this; }
Adds a comparison expression to the {@link condition} property. This method is a helper that appends to the {@link condition} property with a new comparison expression. The comparison is done by comparing a column with the given value using some comparison operator. The comparison operator is intelligently determined based on the first few characters in the given value. In particular, it recognizes the following operators if they appear as the leading characters in the given value: <ul> <li><code>&lt;</code>: the column must be less than the given value.</li> <li><code>&gt;</code>: the column must be greater than the given value.</li> <li><code>&lt;=</code>: the column must be less than or equal to the given value.</li> <li><code>&gt;=</code>: the column must be greater than or equal to the given value.</li> <li><code>&lt;&gt;</code>: the column must not be the same as the given value. Note that when $partialMatch is true, this would mean the value must not be a substring of the column.</li> <li><code>=</code>: the column must be equal to the given value.</li> <li>none of the above: the column must be equal to the given value. Note that when $partialMatch is true, this would mean the value must be the same as the given value or be a substring of it.</li> </ul> Note that any surrounding white spaces will be removed from the value before comparison. When the value is empty, no comparison expression will be added to the search condition. @param string $column the name of the column to be searched @param mixed $value the column value to be compared with. If the value is a string, the aforementioned intelligent comparison will be conducted. If the value is an array, the comparison is done by exact match of any of the value in the array. If the string or the array is empty, the existing search condition will not be modified. @param boolean $partialMatch whether the value should consider partial text match (using LIKE and NOT LIKE operators). Defaults to false, meaning exact comparison. @param string $operator the operator used to concatenate the new condition with the existing one. Defaults to 'AND'. @param boolean $escape whether the value should be escaped if $partialMatch is true and the value contains characters % or _. When this parameter is true (default), the special characters % (matches 0 or more characters) and _ (matches a single character) will be escaped, and the value will be surrounded with a % character on both ends. When this parameter is false, the value will be directly used for matching without any change. @return static the criteria object itself @since 1.1.1
compare
php
yiisoft/yii
framework/db/schema/CDbCriteria.php
https://github.com/yiisoft/yii/blob/master/framework/db/schema/CDbCriteria.php
BSD-3-Clause
public function addBetweenCondition($column,$valueStart,$valueEnd,$operator='AND') { if($valueStart==='' || $valueEnd==='') return $this; $paramStart=self::PARAM_PREFIX.self::$paramCount++; $paramEnd=self::PARAM_PREFIX.self::$paramCount++; $this->params[$paramStart]=$valueStart; $this->params[$paramEnd]=$valueEnd; $condition="$column BETWEEN $paramStart AND $paramEnd"; return $this->addCondition($condition,$operator); }
Adds a between condition to the {@link condition} property. The new between condition and the existing condition will be concatenated via the specified operator which defaults to 'AND'. If one or both values are empty then the condition is not added to the existing condition. This method handles the case when the existing condition is empty. After calling this method, the {@link condition} property will be modified. @param string $column the name of the column to search between. @param string $valueStart the beginning value to start the between search. @param string $valueEnd the ending value to end the between search. @param string $operator the operator used to concatenate the new condition with the existing one. Defaults to 'AND'. @return static the criteria object itself @since 1.1.2
addBetweenCondition
php
yiisoft/yii
framework/db/schema/CDbCriteria.php
https://github.com/yiisoft/yii/blob/master/framework/db/schema/CDbCriteria.php
BSD-3-Clause
public function getLastInsertID($table) { $this->ensureTable($table); if($table->sequenceName!==null) return $this->_connection->getLastInsertID($table->sequenceName); else return null; }
Returns the last insertion ID for the specified table. @param mixed $table the table schema ({@link CDbTableSchema}) or the table name (string). @return mixed last insertion id. Null is returned if no sequence name.
getLastInsertID
php
yiisoft/yii
framework/db/schema/CDbCommandBuilder.php
https://github.com/yiisoft/yii/blob/master/framework/db/schema/CDbCommandBuilder.php
BSD-3-Clause
public function createFindCommand($table,$criteria,$alias='t') { $this->ensureTable($table); $select=is_array($criteria->select) ? implode(', ',$criteria->select) : $criteria->select; if($criteria->alias!='') $alias=$criteria->alias; $alias=$this->_schema->quoteTableName($alias); // issue 1432: need to expand * when SQL has JOIN if($select==='*' && !empty($criteria->join)) { $prefix=$alias.'.'; $select=array(); foreach($table->getColumnNames() as $name) $select[]=$prefix.$this->_schema->quoteColumnName($name); $select=implode(', ',$select); } $sql=($criteria->distinct ? 'SELECT DISTINCT':'SELECT')." {$select} FROM {$table->rawName} $alias"; $sql=$this->applyJoin($sql,$criteria->join); $sql=$this->applyCondition($sql,$criteria->condition); $sql=$this->applyGroup($sql,$criteria->group); $sql=$this->applyHaving($sql,$criteria->having); $sql=$this->applyOrder($sql,$criteria->order); $sql=$this->applyLimit($sql,$criteria->limit,$criteria->offset); $command=$this->_connection->createCommand($sql); $this->bindValues($command,$criteria->params); return $command; }
Creates a SELECT command for a single table. @param mixed $table the table schema ({@link CDbTableSchema}) or the table name (string). @param CDbCriteria $criteria the query criteria @param string $alias the alias name of the primary table. Defaults to 't'. @return CDbCommand query command.
createFindCommand
php
yiisoft/yii
framework/db/schema/CDbCommandBuilder.php
https://github.com/yiisoft/yii/blob/master/framework/db/schema/CDbCommandBuilder.php
BSD-3-Clause
public function createMultipleInsertCommand($table,array $data) { return $this->composeMultipleInsertCommand($table,$data); }
Creates a multiple INSERT command. This method could be used to achieve better performance during insertion of the large amount of data into the database tables. @param mixed $table the table schema ({@link CDbTableSchema}) or the table name (string). @param array[] $data list data to be inserted, each value should be an array in format (column name=>column value). If a key is not a valid column name, the corresponding value will be ignored. @return CDbCommand multiple insert command @since 1.1.14
createMultipleInsertCommand
php
yiisoft/yii
framework/db/schema/CDbCommandBuilder.php
https://github.com/yiisoft/yii/blob/master/framework/db/schema/CDbCommandBuilder.php
BSD-3-Clause
public function createUpdateCounterCommand($table,$counters,$criteria) { $this->ensureTable($table); $fields=array(); foreach($counters as $name=>$value) { if(($column=$table->getColumn($name))!==null) { $value=(float)$value; if($value<0) $fields[]="{$column->rawName}={$column->rawName}-".(-$value); else $fields[]="{$column->rawName}={$column->rawName}+".$value; } }
Creates an UPDATE command that increments/decrements certain columns. @param mixed $table the table schema ({@link CDbTableSchema}) or the table name (string). @param array $counters counters to be updated (counter increments/decrements indexed by column names.) @param CDbCriteria $criteria the query criteria @throws CDbException if no columns are being updated for the given table @return CDbCommand the created command
createUpdateCounterCommand
php
yiisoft/yii
framework/db/schema/CDbCommandBuilder.php
https://github.com/yiisoft/yii/blob/master/framework/db/schema/CDbCommandBuilder.php
BSD-3-Clause
public function applyJoin($sql,$join) { if($join!='') return $sql.' '.$join; else return $sql; }
Alters the SQL to apply JOIN clause. @param string $sql the SQL statement to be altered @param string $join the JOIN clause (starting with join type, such as INNER JOIN) @return string the altered SQL statement
applyJoin
php
yiisoft/yii
framework/db/schema/CDbCommandBuilder.php
https://github.com/yiisoft/yii/blob/master/framework/db/schema/CDbCommandBuilder.php
BSD-3-Clause
public function applyCondition($sql,$condition) { if($condition!='') return $sql.' WHERE '.$condition; else return $sql; }
Alters the SQL to apply WHERE clause. @param string $sql the SQL statement without WHERE clause @param string $condition the WHERE clause (without WHERE keyword) @return string the altered SQL statement
applyCondition
php
yiisoft/yii
framework/db/schema/CDbCommandBuilder.php
https://github.com/yiisoft/yii/blob/master/framework/db/schema/CDbCommandBuilder.php
BSD-3-Clause
public function applyOrder($sql,$orderBy) { if($orderBy!='') return $sql.' ORDER BY '.$orderBy; else return $sql; }
Alters the SQL to apply ORDER BY. @param string $sql SQL statement without ORDER BY. @param string $orderBy column ordering @return string modified SQL applied with ORDER BY.
applyOrder
php
yiisoft/yii
framework/db/schema/CDbCommandBuilder.php
https://github.com/yiisoft/yii/blob/master/framework/db/schema/CDbCommandBuilder.php
BSD-3-Clause
public function applyGroup($sql,$group) { if($group!='') return $sql.' GROUP BY '.$group; else return $sql; }
Alters the SQL to apply GROUP BY. @param string $sql SQL query string without GROUP BY. @param string $group GROUP BY @return string SQL with GROUP BY.
applyGroup
php
yiisoft/yii
framework/db/schema/CDbCommandBuilder.php
https://github.com/yiisoft/yii/blob/master/framework/db/schema/CDbCommandBuilder.php
BSD-3-Clause
public function applyHaving($sql,$having) { if($having!='') return $sql.' HAVING '.$having; else return $sql; }
Alters the SQL to apply HAVING. @param string $sql SQL query string without HAVING @param string $having HAVING @return string SQL with HAVING
applyHaving
php
yiisoft/yii
framework/db/schema/CDbCommandBuilder.php
https://github.com/yiisoft/yii/blob/master/framework/db/schema/CDbCommandBuilder.php
BSD-3-Clause
public function createPkCondition($table,$values,$prefix=null) { $this->ensureTable($table); return $this->createInCondition($table,$table->primaryKey,$values,$prefix); }
Generates the expression for selecting rows of specified primary key values. @param mixed $table the table schema ({@link CDbTableSchema}) or the table name (string). @param array $values list of primary key values to be selected within @param string $prefix column prefix (ended with dot). If null, it will be the table name @return string the expression for selection
createPkCondition
php
yiisoft/yii
framework/db/schema/CDbCommandBuilder.php
https://github.com/yiisoft/yii/blob/master/framework/db/schema/CDbCommandBuilder.php
BSD-3-Clause
protected function createCompositeInCondition($table,$values,$prefix) { $keyNames=array(); foreach(array_keys($values[0]) as $name) $keyNames[]=$prefix.$table->columns[$name]->rawName; $vs=array(); foreach($values as $value) $vs[]='('.implode(', ',$value).')'; return '('.implode(', ',$keyNames).') IN ('.implode(', ',$vs).')'; }
Generates the expression for selecting rows with specified composite key values. @param CDbTableSchema $table the table schema @param array $values list of primary key values to be selected within @param string $prefix column prefix (ended with dot) @return string the expression for selection
createCompositeInCondition
php
yiisoft/yii
framework/db/schema/CDbCommandBuilder.php
https://github.com/yiisoft/yii/blob/master/framework/db/schema/CDbCommandBuilder.php
BSD-3-Clause
protected function ensureTable(&$table) { if(is_string($table) && ($table=$this->_schema->getTable($tableName=$table))===null) throw new CDbException(Yii::t('yii','Table "{table}" does not exist.', array('{table}'=>$tableName))); }
Checks if the parameter is a valid table schema. If it is a string, the corresponding table schema will be retrieved. @param mixed $table table schema ({@link CDbTableSchema}) or table name (string). If this refers to a valid table name, this parameter will be returned with the corresponding table schema. @throws CDbException if the table name is not valid
ensureTable
php
yiisoft/yii
framework/db/schema/CDbCommandBuilder.php
https://github.com/yiisoft/yii/blob/master/framework/db/schema/CDbCommandBuilder.php
BSD-3-Clause
protected function getIntegerPrimaryKeyDefaultValue() { return 'NULL'; }
Returns default value of the integer/serial primary key. Default value means that the next autoincrement/sequence value would be used. @return string default value of the integer/serial primary key. @since 1.1.14
getIntegerPrimaryKeyDefaultValue
php
yiisoft/yii
framework/db/schema/CDbCommandBuilder.php
https://github.com/yiisoft/yii/blob/master/framework/db/schema/CDbCommandBuilder.php
BSD-3-Clause
public function init($dbType, $defaultValue) { $this->dbType=$dbType; $this->extractType($dbType); $this->extractLimit($dbType); if($defaultValue!==null) $this->extractDefault($defaultValue); }
Initializes the column with its DB type and default value. This sets up the column's PHP type, size, precision, scale as well as default value. @param string $dbType the column's DB type @param mixed $defaultValue the default value
init
php
yiisoft/yii
framework/db/schema/CDbColumnSchema.php
https://github.com/yiisoft/yii/blob/master/framework/db/schema/CDbColumnSchema.php
BSD-3-Clause
protected function extractType($dbType) { if(stripos($dbType,'int')!==false && stripos($dbType,'unsigned int')===false) $this->type='integer'; elseif(stripos($dbType,'bool')!==false) $this->type='boolean'; elseif(preg_match('/(real|floa|doub)/i',$dbType)) $this->type='double'; else $this->type='string'; }
Extracts the PHP type from DB type. @param string $dbType DB type
extractType
php
yiisoft/yii
framework/db/schema/CDbColumnSchema.php
https://github.com/yiisoft/yii/blob/master/framework/db/schema/CDbColumnSchema.php
BSD-3-Clause
protected function extractLimit($dbType) { if(strpos($dbType,'(') && preg_match('/\((.*)\)/',$dbType,$matches)) { $values=explode(',',$matches[1]); $this->size=$this->precision=(int)$values[0]; if(isset($values[1])) $this->scale=(int)$values[1]; } }
Extracts size, precision and scale information from column's DB type. @param string $dbType the column's DB type
extractLimit
php
yiisoft/yii
framework/db/schema/CDbColumnSchema.php
https://github.com/yiisoft/yii/blob/master/framework/db/schema/CDbColumnSchema.php
BSD-3-Clause
protected function extractDefault($defaultValue) { $this->defaultValue=$this->typecast($defaultValue); }
Extracts the default value for the column. The value is typecasted to correct PHP type. @param mixed $defaultValue the default value obtained from metadata
extractDefault
php
yiisoft/yii
framework/db/schema/CDbColumnSchema.php
https://github.com/yiisoft/yii/blob/master/framework/db/schema/CDbColumnSchema.php
BSD-3-Clause
public function typecast($value) { if(gettype($value)===$this->type || $value===null || $value instanceof CDbExpression) return $value; if($value==='' && $this->allowNull) return $this->type==='string' ? '' : null; switch($this->type) { case 'string': return (string)$value; case 'integer': return (integer)$value; case 'boolean': return (boolean)$value; case 'double': default: return $value; } }
Converts the input value to the type that this column is of. @param mixed $value input value @return mixed converted value
typecast
php
yiisoft/yii
framework/db/schema/CDbColumnSchema.php
https://github.com/yiisoft/yii/blob/master/framework/db/schema/CDbColumnSchema.php
BSD-3-Clause
public function applyLimit($sql,$limit,$offset) { // Ugly, but this is how MySQL recommends doing it: https://dev.mysql.com/doc/refman/5.0/en/select.html if($limit<=0 && $offset>0) $limit=PHP_INT_MAX; return parent::applyLimit($sql,$limit,$offset); }
Alters the SQL to apply LIMIT and OFFSET. @param string $sql SQL query string without LIMIT and OFFSET. @param integer $limit maximum number of rows, -1 to ignore limit. @param integer $offset row offset, -1 to ignore offset. @return string SQL with LIMIT and OFFSET
applyLimit
php
yiisoft/yii
framework/db/schema/mysql/CMysqlCommandBuilder.php
https://github.com/yiisoft/yii/blob/master/framework/db/schema/mysql/CMysqlCommandBuilder.php
BSD-3-Clause
protected function extractType($dbType) { if(strncmp($dbType,'enum',4)===0) $this->type='string'; elseif(strpos($dbType,'float')!==false || strpos($dbType,'double')!==false) $this->type='double'; elseif(strpos($dbType,'bool')!==false) $this->type='boolean'; elseif(strpos($dbType,'int')===0 && strpos($dbType,'unsigned')===false || preg_match('/(bit|tinyint|smallint|mediumint)/',$dbType)) $this->type='integer'; else $this->type='string'; }
Extracts the PHP type from DB type. @param string $dbType DB type
extractType
php
yiisoft/yii
framework/db/schema/mysql/CMysqlColumnSchema.php
https://github.com/yiisoft/yii/blob/master/framework/db/schema/mysql/CMysqlColumnSchema.php
BSD-3-Clause
protected function extractDefault($defaultValue) { if(strncmp($this->dbType,'bit',3)===0) $this->defaultValue=bindec(trim($defaultValue,'b\'')); elseif(($this->dbType==='timestamp' || $this->dbType==='datetime') && ($defaultValue==='CURRENT_TIMESTAMP' || $defaultValue==='current_timestamp()')) $this->defaultValue=null; else parent::extractDefault($defaultValue); }
Extracts the default value for the column. The value is typecasted to correct PHP type. @param mixed $defaultValue the default value obtained from metadata
extractDefault
php
yiisoft/yii
framework/db/schema/mysql/CMysqlColumnSchema.php
https://github.com/yiisoft/yii/blob/master/framework/db/schema/mysql/CMysqlColumnSchema.php
BSD-3-Clause
protected function extractLimit($dbType) { if (strncmp($dbType, 'enum', 4)===0 && preg_match('/\(([\'"])(.*)\\1\)/',$dbType,$matches)) { // explode by (single or double) quote and comma (ENUM values may contain commas) $values = explode($matches[1].','.$matches[1], $matches[2]); $size = 0; foreach($values as $value) { if(($n=strlen($value)) > $size) $size=$n; } $this->size = $this->precision = $size; } else parent::extractLimit($dbType); }
Extracts size, precision and scale information from column's DB type. @param string $dbType the column's DB type
extractLimit
php
yiisoft/yii
framework/db/schema/mysql/CMysqlColumnSchema.php
https://github.com/yiisoft/yii/blob/master/framework/db/schema/mysql/CMysqlColumnSchema.php
BSD-3-Clause
public function quoteSimpleTableName($name) { return '`'.$name.'`'; }
Quotes a table name for use in a query. A simple table name does not schema prefix. @param string $name table name @return string the properly quoted table name @since 1.1.6
quoteSimpleTableName
php
yiisoft/yii
framework/db/schema/mysql/CMysqlSchema.php
https://github.com/yiisoft/yii/blob/master/framework/db/schema/mysql/CMysqlSchema.php
BSD-3-Clause
public function quoteSimpleColumnName($name) { return '`'.$name.'`'; }
Quotes a column name for use in a query. A simple column name does not contain prefix. @param string $name column name @return string the properly quoted column name @since 1.1.6
quoteSimpleColumnName
php
yiisoft/yii
framework/db/schema/mysql/CMysqlSchema.php
https://github.com/yiisoft/yii/blob/master/framework/db/schema/mysql/CMysqlSchema.php
BSD-3-Clause
public function compareTableNames($name1,$name2) { return parent::compareTableNames(strtolower($name1),strtolower($name2)); }
Compares two table names. The table names can be either quoted or unquoted. This method will consider both cases. @param string $name1 table name 1 @param string $name2 table name 2 @return boolean whether the two table names refer to the same table.
compareTableNames
php
yiisoft/yii
framework/db/schema/mysql/CMysqlSchema.php
https://github.com/yiisoft/yii/blob/master/framework/db/schema/mysql/CMysqlSchema.php
BSD-3-Clause
public function resetSequence($table,$value=null) { if($table->sequenceName===null) return; if($value!==null) $value=(int)$value; else { $value=(int)$this->getDbConnection() ->createCommand("SELECT MAX(`{$table->primaryKey}`) FROM {$table->rawName}") ->queryScalar(); $value++; } $this->getDbConnection() ->createCommand("ALTER TABLE {$table->rawName} AUTO_INCREMENT=$value") ->execute(); }
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 max value of a primary key plus one (i.e. sequence trimming). @param CDbTableSchema $table the table schema whose primary key sequence will be reset @param integer|null $value 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 the max value of a primary key plus one (i.e. sequence trimming). @since 1.1
resetSequence
php
yiisoft/yii
framework/db/schema/mysql/CMysqlSchema.php
https://github.com/yiisoft/yii/blob/master/framework/db/schema/mysql/CMysqlSchema.php
BSD-3-Clause
protected function loadTable($name) { $table=new CMysqlTableSchema; $this->resolveTableNames($table,$name); if($this->findColumns($table)) { $this->findConstraints($table); return $table; } else return null; }
Loads the metadata for the specified table. @param string $name table name @return CMysqlTableSchema driver dependent table metadata. Null if the table does not exist.
loadTable
php
yiisoft/yii
framework/db/schema/mysql/CMysqlSchema.php
https://github.com/yiisoft/yii/blob/master/framework/db/schema/mysql/CMysqlSchema.php
BSD-3-Clause
protected function resolveTableNames($table,$name) { $parts=explode('.',str_replace(array('`','"'),'',$name)); if(isset($parts[1])) { $table->schemaName=$parts[0]; $table->name=$parts[1]; $table->rawName=$this->quoteTableName($table->schemaName).'.'.$this->quoteTableName($table->name); } else { $table->name=$parts[0]; $table->rawName=$this->quoteTableName($table->name); } }
Generates various kinds of table names. @param CMysqlTableSchema $table the table instance @param string $name the unquoted table name
resolveTableNames
php
yiisoft/yii
framework/db/schema/mysql/CMysqlSchema.php
https://github.com/yiisoft/yii/blob/master/framework/db/schema/mysql/CMysqlSchema.php
BSD-3-Clause
protected function findTableNames($schema='') { if($schema==='') return $this->getDbConnection()->createCommand('SHOW TABLES')->queryColumn(); $names=$this->getDbConnection()->createCommand('SHOW TABLES FROM '.$this->quoteTableName($schema))->queryColumn(); foreach($names as &$name) $name=$schema.'.'.$name; return $names; }
Returns all table names in the database. @param string $schema 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.
findTableNames
php
yiisoft/yii
framework/db/schema/mysql/CMysqlSchema.php
https://github.com/yiisoft/yii/blob/master/framework/db/schema/mysql/CMysqlSchema.php
BSD-3-Clause
protected function createCommandBuilder() { return new CMysqlCommandBuilder($this); }
Creates a command builder for the database. This method overrides parent implementation in order to create a MySQL specific command builder @return CDbCommandBuilder command builder instance @since 1.1.13
createCommandBuilder
php
yiisoft/yii
framework/db/schema/mysql/CMysqlSchema.php
https://github.com/yiisoft/yii/blob/master/framework/db/schema/mysql/CMysqlSchema.php
BSD-3-Clause
public function dropForeignKey($name, $table) { return 'ALTER TABLE '.$this->quoteTableName($table) .' DROP FOREIGN KEY '.$this->quoteColumnName($name); }
Builds a SQL statement for dropping a foreign key constraint. @param string $name the name of the foreign key constraint to be dropped. The name will be properly quoted by the method. @param string $table 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. @since 1.1.6
dropForeignKey
php
yiisoft/yii
framework/db/schema/mysql/CMysqlSchema.php
https://github.com/yiisoft/yii/blob/master/framework/db/schema/mysql/CMysqlSchema.php
BSD-3-Clause
public function dropPrimaryKey($name,$table) { return 'ALTER TABLE ' . $this->quoteTableName($table) . ' DROP PRIMARY KEY'; }
Builds a SQL statement for removing a primary key constraint to an existing table. @param string $name the name of the primary key constraint to be removed. @param string $table 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. @since 1.1.13
dropPrimaryKey
php
yiisoft/yii
framework/db/schema/mysql/CMysqlSchema.php
https://github.com/yiisoft/yii/blob/master/framework/db/schema/mysql/CMysqlSchema.php
BSD-3-Clause
public function addPrimaryKey($name,$table,$columns) { if(is_string($columns)) $columns=preg_split('/\s*,\s*/',$columns,-1,PREG_SPLIT_NO_EMPTY); foreach($columns as $i=>$col) $columns[$i]=$this->quoteColumnName($col); return 'ALTER TABLE ' . $this->quoteTableName($table) . ' ADD PRIMARY KEY (' . implode(', ', $columns). ' )'; }
Builds a SQL statement for adding a primary key constraint to a table. @param string $name not used in the MySQL syntax, the primary key is always called PRIMARY and is reserved. @param string $table the table that the primary key constraint will be added to. @param string|array $columns 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. @since 1.1.14
addPrimaryKey
php
yiisoft/yii
framework/db/schema/mysql/CMysqlSchema.php
https://github.com/yiisoft/yii/blob/master/framework/db/schema/mysql/CMysqlSchema.php
BSD-3-Clause
protected function extractOraType($dbType){ if(strpos($dbType,'FLOAT')!==false) return 'double'; if (strpos($dbType,'NUMBER')!==false || strpos($dbType,'INTEGER')!==false) { if(strpos($dbType,'(') && preg_match('/\((.*)\)/',$dbType,$matches)) { $values=explode(',',$matches[1]); if(isset($values[1]) and (((int)$values[1]) > 0)) return 'double'; else return 'integer'; } else return 'double'; } else return 'string'; }
Extracts the PHP type from DB type. @param string $dbType DB type @return string
extractOraType
php
yiisoft/yii
framework/db/schema/oci/COciColumnSchema.php
https://github.com/yiisoft/yii/blob/master/framework/db/schema/oci/COciColumnSchema.php
BSD-3-Clause
protected function extractType($dbType) { $this->type=$this->extractOraType($dbType); }
Extracts the PHP type from DB type. @param string $dbType DB type
extractType
php
yiisoft/yii
framework/db/schema/oci/COciColumnSchema.php
https://github.com/yiisoft/yii/blob/master/framework/db/schema/oci/COciColumnSchema.php
BSD-3-Clause
protected function extractDefault($defaultValue) { if(stripos($defaultValue,'timestamp')!==false) $this->defaultValue=null; else parent::extractDefault($defaultValue); }
Extracts the default value for the column. The value is typecasted to correct PHP type. @param mixed $defaultValue the default value obtained from metadata
extractDefault
php
yiisoft/yii
framework/db/schema/oci/COciColumnSchema.php
https://github.com/yiisoft/yii/blob/master/framework/db/schema/oci/COciColumnSchema.php
BSD-3-Clause
public function quoteSimpleTableName($name) { return '"'.$name.'"'; }
Quotes a table name for use in a query. A simple table name does not schema prefix. @param string $name table name @return string the properly quoted table name @since 1.1.6
quoteSimpleTableName
php
yiisoft/yii
framework/db/schema/oci/COciSchema.php
https://github.com/yiisoft/yii/blob/master/framework/db/schema/oci/COciSchema.php
BSD-3-Clause
public function quoteSimpleColumnName($name) { return '"'.$name.'"'; }
Quotes a column name for use in a query. A simple column name does not contain prefix. @param string $name column name @return string the properly quoted column name @since 1.1.6
quoteSimpleColumnName
php
yiisoft/yii
framework/db/schema/oci/COciSchema.php
https://github.com/yiisoft/yii/blob/master/framework/db/schema/oci/COciSchema.php
BSD-3-Clause
protected function createCommandBuilder() { return new COciCommandBuilder($this); }
Creates a command builder for the database. This method may be overridden by child classes to create a DBMS-specific command builder. @return CDbCommandBuilder command builder instance
createCommandBuilder
php
yiisoft/yii
framework/db/schema/oci/COciSchema.php
https://github.com/yiisoft/yii/blob/master/framework/db/schema/oci/COciSchema.php
BSD-3-Clause
protected function loadTable($name) { $table=new COciTableSchema; $this->resolveTableNames($table,$name); if(!$this->findColumns($table)) return null; $this->findConstraints($table); return $table; }
Loads the metadata for the specified table. @param string $name table name @return CDbTableSchema driver dependent table metadata.
loadTable
php
yiisoft/yii
framework/db/schema/oci/COciSchema.php
https://github.com/yiisoft/yii/blob/master/framework/db/schema/oci/COciSchema.php
BSD-3-Clause
protected function resolveTableNames($table,$name) { $parts=explode('.',str_replace('"','',$name)); if(isset($parts[1])) { $schemaName=$parts[0]; $tableName=$parts[1]; } else { $schemaName=$this->getDefaultSchema(); $tableName=$parts[0]; } $table->name=$tableName; $table->schemaName=$schemaName; if($schemaName===$this->getDefaultSchema()) $table->rawName=$this->quoteTableName($tableName); else $table->rawName=$this->quoteTableName($schemaName).'.'.$this->quoteTableName($tableName); }
Generates various kinds of table names. @param COciTableSchema $table the table instance @param string $name the unquoted table name
resolveTableNames
php
yiisoft/yii
framework/db/schema/oci/COciSchema.php
https://github.com/yiisoft/yii/blob/master/framework/db/schema/oci/COciSchema.php
BSD-3-Clause
protected function findConstraints($table) { $sql=<<<EOD SELECT D.constraint_type as CONSTRAINT_TYPE, C.COLUMN_NAME, C.position, D.r_constraint_name, E.table_name as table_ref, f.column_name as column_ref, C.table_name FROM ALL_CONS_COLUMNS C inner join ALL_constraints D on D.OWNER = C.OWNER and D.constraint_name = C.constraint_name left join ALL_constraints E on E.OWNER = D.r_OWNER and E.constraint_name = D.r_constraint_name left join ALL_cons_columns F on F.OWNER = E.OWNER and F.constraint_name = E.constraint_name and F.position = c.position WHERE C.OWNER = '{$table->schemaName}' and C.table_name = '{$table->name}' and D.constraint_type <> 'P' order by d.constraint_name, c.position EOD; $command=$this->getDbConnection()->createCommand($sql); foreach($command->queryAll() as $row) { if($row['CONSTRAINT_TYPE']==='R') // foreign key { $name = $row["COLUMN_NAME"]; $table->foreignKeys[$name]=array($row["TABLE_REF"], $row["COLUMN_REF"]); if(isset($table->columns[$name])) $table->columns[$name]->isForeignKey=true; } } }
Collects the primary and foreign key column details for the given table. @param COciTableSchema $table the table metadata
findConstraints
php
yiisoft/yii
framework/db/schema/oci/COciSchema.php
https://github.com/yiisoft/yii/blob/master/framework/db/schema/oci/COciSchema.php
BSD-3-Clause
protected function findTableNames($schema='') { if($schema==='') { $sql=<<<EOD SELECT table_name, '{$schema}' as table_schema FROM user_tables EOD; $command=$this->getDbConnection()->createCommand($sql); } else { $sql=<<<EOD SELECT object_name as table_name, owner as table_schema FROM all_objects WHERE object_type = 'TABLE' AND owner=:schema EOD; $command=$this->getDbConnection()->createCommand($sql); $command->bindParam(':schema',$schema); } $rows=$command->queryAll(); $names=array(); foreach($rows as $row) { if($schema===$this->getDefaultSchema() || $schema==='') $names[]=$row['TABLE_NAME']; else $names[]=$row['TABLE_SCHEMA'].'.'.$row['TABLE_NAME']; } return $names; }
Returns all table names in the database. @param string $schema 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.
findTableNames
php
yiisoft/yii
framework/db/schema/oci/COciSchema.php
https://github.com/yiisoft/yii/blob/master/framework/db/schema/oci/COciSchema.php
BSD-3-Clause
public function renameTable($table, $newName) { return 'ALTER TABLE ' . $this->quoteTableName($table) . ' RENAME TO ' . $this->quoteTableName($newName); }
Builds a SQL statement for renaming a DB table. @param string $table the table to be renamed. The name will be properly quoted by the method. @param string $newName the new table name. The name will be properly quoted by the method. @return string the SQL statement for renaming a DB table. @since 1.1.6
renameTable
php
yiisoft/yii
framework/db/schema/oci/COciSchema.php
https://github.com/yiisoft/yii/blob/master/framework/db/schema/oci/COciSchema.php
BSD-3-Clause
public function alterColumn($table, $column, $type) { $type=$this->getColumnType($type); $sql='ALTER TABLE ' . $this->quoteTableName($table) . ' MODIFY ' . $this->quoteColumnName($column) . ' ' . $this->getColumnType($type); return $sql; }
Builds a SQL statement for changing the definition of a column. @param string $table the table whose column is to be changed. The table name will be properly quoted by the method. @param string $column the name of the column to be changed. The name will be properly quoted by the method. @param string $type the new column type. The {@link 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. @since 1.1.6
alterColumn
php
yiisoft/yii
framework/db/schema/oci/COciSchema.php
https://github.com/yiisoft/yii/blob/master/framework/db/schema/oci/COciSchema.php
BSD-3-Clause
public function dropIndex($name, $table) { return 'DROP INDEX '.$this->quoteTableName($name); }
Builds a SQL statement for dropping an index. @param string $name the name of the index to be dropped. The name will be properly quoted by the method. @param string $table 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. @since 1.1.6
dropIndex
php
yiisoft/yii
framework/db/schema/oci/COciSchema.php
https://github.com/yiisoft/yii/blob/master/framework/db/schema/oci/COciSchema.php
BSD-3-Clause
public function getLastInsertID($table) { return $this->returnID; }
Returns the last insertion ID for the specified table. @param mixed $table the table schema ({@link CDbTableSchema}) or the table name (string). @return mixed last insertion id. Null is returned if no sequence name.
getLastInsertID
php
yiisoft/yii
framework/db/schema/oci/COciCommandBuilder.php
https://github.com/yiisoft/yii/blob/master/framework/db/schema/oci/COciCommandBuilder.php
BSD-3-Clause
public function applyLimit($sql,$limit,$offset) { if (($limit < 0) and ($offset < 0)) return $sql; $filters = array(); if($offset>0){ $filters[] = 'rowNumId > '.(int)$offset; }
Alters the SQL to apply LIMIT and OFFSET. @param string $sql SQL query string without LIMIT and OFFSET. @param integer $limit maximum number of rows, -1 to ignore limit. @param integer $offset row offset, -1 to ignore offset. @return string SQL with LIMIT and OFFSET
applyLimit
php
yiisoft/yii
framework/db/schema/oci/COciCommandBuilder.php
https://github.com/yiisoft/yii/blob/master/framework/db/schema/oci/COciCommandBuilder.php
BSD-3-Clause
public function createMultipleInsertCommand($table,array $data) { $templates=array( 'main'=>'INSERT ALL {{rowInsertValues}} SELECT * FROM dual', 'columnInsertValue'=>'{{value}}', 'columnInsertValueGlue'=>', ', 'rowInsertValue'=>'INTO {{tableName}} ({{columnInsertNames}}) VALUES ({{columnInsertValues}})', 'rowInsertValueGlue'=>' ', 'columnInsertNameGlue'=>', ', ); return $this->composeMultipleInsertCommand($table,$data,$templates); }
Creates a multiple INSERT command. This method could be used to achieve better performance during insertion of the large amount of data into the database tables. @param mixed $table the table schema ({@link CDbTableSchema}) or the table name (string). @param array[] $data list data to be inserted, each value should be an array in format (column name=>column value). If a key is not a valid column name, the corresponding value will be ignored. @return CDbCommand multiple insert command @since 1.1.14
createMultipleInsertCommand
php
yiisoft/yii
framework/db/schema/oci/COciCommandBuilder.php
https://github.com/yiisoft/yii/blob/master/framework/db/schema/oci/COciCommandBuilder.php
BSD-3-Clause
protected function extractDefault($defaultValue) { if($this->dbType==='timestamp' && $defaultValue==='CURRENT_TIMESTAMP') $this->defaultValue=null; else $this->defaultValue=$this->typecast(strcasecmp($defaultValue,'null') ? $defaultValue : null); if($this->type==='string' && $this->defaultValue!==null) // PHP 5.2.6 adds single quotes while 5.2.0 doesn't $this->defaultValue=trim($this->defaultValue,"'\""); }
Extracts the default value for the column. The value is typecasted to correct PHP type. @param mixed $defaultValue the default value obtained from metadata
extractDefault
php
yiisoft/yii
framework/db/schema/sqlite/CSqliteColumnSchema.php
https://github.com/yiisoft/yii/blob/master/framework/db/schema/sqlite/CSqliteColumnSchema.php
BSD-3-Clause
public function resetSequence($table,$value=null) { if($table->sequenceName===null) return; if($value!==null) $value=(int)($value)-1; else $value=(int)$this->getDbConnection() ->createCommand("SELECT MAX(`{$table->primaryKey}`) FROM {$table->rawName}") ->queryScalar(); try { // it's possible that 'sqlite_sequence' does not exist $this->getDbConnection() ->createCommand("UPDATE sqlite_sequence SET seq='$value' WHERE name='{$table->name}'") ->execute(); } catch(Exception $e) { } }
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 max value of a primary key plus one (i.e. sequence trimming). @param CDbTableSchema $table the table schema whose primary key sequence will be reset @param integer|null $value 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 the max value of a primary key plus one (i.e. sequence trimming). @since 1.1
resetSequence
php
yiisoft/yii
framework/db/schema/sqlite/CSqliteSchema.php
https://github.com/yiisoft/yii/blob/master/framework/db/schema/sqlite/CSqliteSchema.php
BSD-3-Clause
protected function findTableNames($schema='') { $sql="SELECT DISTINCT tbl_name FROM sqlite_master WHERE tbl_name<>'sqlite_sequence'"; return $this->getDbConnection()->createCommand($sql)->queryColumn(); }
Returns all table names in the database. @param string $schema the schema of the tables. This is not used for sqlite database. @return array all table names in the database.
findTableNames
php
yiisoft/yii
framework/db/schema/sqlite/CSqliteSchema.php
https://github.com/yiisoft/yii/blob/master/framework/db/schema/sqlite/CSqliteSchema.php
BSD-3-Clause
protected function createCommandBuilder() { return new CSqliteCommandBuilder($this); }
Creates a command builder for the database. @return CSqliteCommandBuilder command builder instance
createCommandBuilder
php
yiisoft/yii
framework/db/schema/sqlite/CSqliteSchema.php
https://github.com/yiisoft/yii/blob/master/framework/db/schema/sqlite/CSqliteSchema.php
BSD-3-Clause
protected function loadTable($name) { $table=new CDbTableSchema; $table->name=$name; $table->rawName=$this->quoteTableName($name); if($this->findColumns($table)) { $this->findConstraints($table); return $table; } else return null; }
Loads the metadata for the specified table. @param string $name table name @return CDbTableSchema driver dependent table metadata. Null if the table does not exist.
loadTable
php
yiisoft/yii
framework/db/schema/sqlite/CSqliteSchema.php
https://github.com/yiisoft/yii/blob/master/framework/db/schema/sqlite/CSqliteSchema.php
BSD-3-Clause
public function renameTable($table, $newName) { return 'ALTER TABLE ' . $this->quoteTableName($table) . ' RENAME TO ' . $this->quoteTableName($newName); }
Builds a SQL statement for renaming a DB table. @param string $table the table to be renamed. The name will be properly quoted by the method. @param string $newName the new table name. The name will be properly quoted by the method. @return string the SQL statement for renaming a DB table. @since 1.1.13
renameTable
php
yiisoft/yii
framework/db/schema/sqlite/CSqliteSchema.php
https://github.com/yiisoft/yii/blob/master/framework/db/schema/sqlite/CSqliteSchema.php
BSD-3-Clause
public function truncateTable($table) { return "DELETE FROM ".$this->quoteTableName($table); }
Builds a SQL statement for truncating a DB table. @param string $table the table to be truncated. The name will be properly quoted by the method. @return string the SQL statement for truncating a DB table. @since 1.1.6
truncateTable
php
yiisoft/yii
framework/db/schema/sqlite/CSqliteSchema.php
https://github.com/yiisoft/yii/blob/master/framework/db/schema/sqlite/CSqliteSchema.php
BSD-3-Clause
public function dropColumn($table, $column) { throw new CDbException(Yii::t('yii', 'Dropping DB column is not supported by SQLite.')); }
Builds a SQL statement for dropping a DB column. Because SQLite does not support dropping a DB column, calling this method will throw an exception. @param string $table the table whose column is to be dropped. The name will be properly quoted by the method. @param string $column 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. @since 1.1.6 @throws CDbException
dropColumn
php
yiisoft/yii
framework/db/schema/sqlite/CSqliteSchema.php
https://github.com/yiisoft/yii/blob/master/framework/db/schema/sqlite/CSqliteSchema.php
BSD-3-Clause
public function renameColumn($table, $name, $newName) { throw new CDbException(Yii::t('yii', 'Renaming a DB column is not supported by SQLite.')); }
Builds a SQL statement for renaming a column. Because SQLite does not support renaming a DB column, calling this method will throw an exception. @param string $table the table whose column is to be renamed. The name will be properly quoted by the method. @param string $name the old name of the column. The name will be properly quoted by the method. @param string $newName 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. @since 1.1.6 @throws CDbException
renameColumn
php
yiisoft/yii
framework/db/schema/sqlite/CSqliteSchema.php
https://github.com/yiisoft/yii/blob/master/framework/db/schema/sqlite/CSqliteSchema.php
BSD-3-Clause
public function addForeignKey($name, $table, $columns, $refTable, $refColumns, $delete=null, $update=null) { throw new CDbException(Yii::t('yii', 'Adding a foreign key constraint to an existing table is not supported by SQLite.')); }
Builds a SQL statement for adding a foreign key constraint to an existing table. Because SQLite does not support adding foreign key to an existing table, calling this method will throw an exception. @param string $name the name of the foreign key constraint. @param string $table the table that the foreign key constraint will be added to. @param string $columns the name of the column to that the constraint will be added on. If there are multiple columns, separate them with commas. @param string $refTable the table that the foreign key references to. @param string $refColumns the name of the column that the foreign key references to. If there are multiple columns, separate them with commas. @param string $delete the ON DELETE option. Most DBMS support these options: RESTRICT, CASCADE, NO ACTION, SET DEFAULT, SET NULL @param string $update 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. @since 1.1.6 @throws CDbException
addForeignKey
php
yiisoft/yii
framework/db/schema/sqlite/CSqliteSchema.php
https://github.com/yiisoft/yii/blob/master/framework/db/schema/sqlite/CSqliteSchema.php
BSD-3-Clause
public function dropForeignKey($name, $table) { throw new CDbException(Yii::t('yii', 'Dropping a foreign key constraint is not supported by SQLite.')); }
Builds a SQL statement for dropping a foreign key constraint. Because SQLite does not support dropping a foreign key constraint, calling this method will throw an exception. @param string $name the name of the foreign key constraint to be dropped. The name will be properly quoted by the method. @param string $table 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. @since 1.1.6 @throws CDbException
dropForeignKey
php
yiisoft/yii
framework/db/schema/sqlite/CSqliteSchema.php
https://github.com/yiisoft/yii/blob/master/framework/db/schema/sqlite/CSqliteSchema.php
BSD-3-Clause
public function alterColumn($table, $column, $type) { throw new CDbException(Yii::t('yii', 'Altering a DB column is not supported by SQLite.')); }
Builds a SQL statement for changing the definition of a column. Because SQLite does not support altering a DB column, calling this method will throw an exception. @param string $table the table whose column is to be changed. The table name will be properly quoted by the method. @param string $column the name of the column to be changed. The name will be properly quoted by the method. @param string $type the new column type. The {@link 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. @since 1.1.6 @throws CDbException
alterColumn
php
yiisoft/yii
framework/db/schema/sqlite/CSqliteSchema.php
https://github.com/yiisoft/yii/blob/master/framework/db/schema/sqlite/CSqliteSchema.php
BSD-3-Clause
public function dropIndex($name, $table) { return 'DROP INDEX '.$this->quoteTableName($name); }
Builds a SQL statement for dropping an index. @param string $name the name of the index to be dropped. The name will be properly quoted by the method. @param string $table 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. @since 1.1.6
dropIndex
php
yiisoft/yii
framework/db/schema/sqlite/CSqliteSchema.php
https://github.com/yiisoft/yii/blob/master/framework/db/schema/sqlite/CSqliteSchema.php
BSD-3-Clause
public function addPrimaryKey($name,$table,$columns) { throw new CDbException(Yii::t('yii', 'Adding a primary key after table has been created is not supported by SQLite.')); }
Builds a SQL statement for adding a primary key constraint to an existing table. Because SQLite does not support adding a primary key on an existing table this method will throw an exception. @param string $name the name of the primary key constraint. @param string $table the table that the primary key constraint will be added to. @param string|array $columns 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. @since 1.1.13 @throws CDbException
addPrimaryKey
php
yiisoft/yii
framework/db/schema/sqlite/CSqliteSchema.php
https://github.com/yiisoft/yii/blob/master/framework/db/schema/sqlite/CSqliteSchema.php
BSD-3-Clause
public function dropPrimaryKey($name,$table) { throw new CDbException(Yii::t('yii', 'Removing a primary key after table has been created is not supported by SQLite.')); }
Builds a SQL statement for removing a primary key constraint to an existing table. Because SQLite does not support dropping a primary key from an existing table this method will throw an exception @param string $name the name of the primary key constraint to be removed. @param string $table 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. @since 1.1.13 @throws CDbException
dropPrimaryKey
php
yiisoft/yii
framework/db/schema/sqlite/CSqliteSchema.php
https://github.com/yiisoft/yii/blob/master/framework/db/schema/sqlite/CSqliteSchema.php
BSD-3-Clause
protected function createCompositeInCondition($table,$values,$prefix) { $keyNames=array(); foreach(array_keys($values[0]) as $name) $keyNames[]=$prefix.$table->columns[$name]->rawName; $vs=array(); foreach($values as $value) $vs[]=implode("||','||",$value); return implode("||','||",$keyNames).' IN ('.implode(', ',$vs).')'; }
Generates the expression for selecting rows with specified composite key values. This method is overridden because SQLite does not support the default IN expression with composite columns. @param CDbTableSchema $table the table schema @param array $values list of primary key values to be selected within @param string $prefix column prefix (ended with dot) @return string the expression for selection
createCompositeInCondition
php
yiisoft/yii
framework/db/schema/sqlite/CSqliteCommandBuilder.php
https://github.com/yiisoft/yii/blob/master/framework/db/schema/sqlite/CSqliteCommandBuilder.php
BSD-3-Clause
public function createMultipleInsertCommand($table,array $data) { $templates=array( 'main'=>'INSERT INTO {{tableName}} ({{columnInsertNames}}) {{rowInsertValues}}', 'columnInsertValue'=>'{{value}} AS {{column}}', 'columnInsertValueGlue'=>', ', 'rowInsertValue'=>'SELECT {{columnInsertValues}}', 'rowInsertValueGlue'=>' UNION ', 'columnInsertNameGlue'=>', ', ); return $this->composeMultipleInsertCommand($table,$data,$templates); }
Creates a multiple INSERT command. This method could be used to achieve better performance during insertion of the large amount of data into the database tables. Note that SQLite does not keep original order of the inserted rows. @param mixed $table the table schema ({@link CDbTableSchema}) or the table name (string). @param array[] $data list data to be inserted, each value should be an array in format (column name=>column value). If a key is not a valid column name, the corresponding value will be ignored. @return CDbCommand multiple insert command @since 1.1.14
createMultipleInsertCommand
php
yiisoft/yii
framework/db/schema/sqlite/CSqliteCommandBuilder.php
https://github.com/yiisoft/yii/blob/master/framework/db/schema/sqlite/CSqliteCommandBuilder.php
BSD-3-Clause
public function quoteSimpleTableName($name) { return '`'.$name.'`'; }
Quotes a table name for use in a query. A simple table name does not schema prefix. @param string $name table name @return string the properly quoted table name
quoteSimpleTableName
php
yiisoft/yii
framework/db/schema/cubrid/CCubridSchema.php
https://github.com/yiisoft/yii/blob/master/framework/db/schema/cubrid/CCubridSchema.php
BSD-3-Clause
public function quoteSimpleColumnName($name) { return '`'.$name.'`'; }
Quotes a column name for use in a query. A simple column name does not contain prefix. @param string $name column name @return string the properly quoted column name
quoteSimpleColumnName
php
yiisoft/yii
framework/db/schema/cubrid/CCubridSchema.php
https://github.com/yiisoft/yii/blob/master/framework/db/schema/cubrid/CCubridSchema.php
BSD-3-Clause
public function compareTableNames($name1,$name2) { return parent::compareTableNames(strtolower($name1),strtolower($name2)); }
Compares two table names. The table names can be either quoted or unquoted. This method will consider both cases. @param string $name1 table name 1 @param string $name2 table name 2 @return boolean whether the two table names refer to the same table.
compareTableNames
php
yiisoft/yii
framework/db/schema/cubrid/CCubridSchema.php
https://github.com/yiisoft/yii/blob/master/framework/db/schema/cubrid/CCubridSchema.php
BSD-3-Clause
public function resetSequence($table,$value=null) { if($table->sequenceName!==null) { if($value===null) $value=$this->getDbConnection()->createCommand("SELECT MAX(`{$table->primaryKey}`) FROM {$table->rawName}")->queryScalar()+1; else $value=(int)$value; $this->getDbConnection()->createCommand("ALTER TABLE {$table->rawName} AUTO_INCREMENT=$value")->execute(); } }
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. @param CDbTableSchema $table the table schema whose primary key sequence will be reset @param mixed $value 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.
resetSequence
php
yiisoft/yii
framework/db/schema/cubrid/CCubridSchema.php
https://github.com/yiisoft/yii/blob/master/framework/db/schema/cubrid/CCubridSchema.php
BSD-3-Clause
protected function loadTable($name) { $table=new CCubridTableSchema; $this->resolveTableNames($table,$name); if($this->findColumns($table)) { $this->findPrimaryKeys($table); $this->findConstraints($table); return $table; } else return null; }
Creates a table instance representing the metadata for the named table. @param string $name table name @return CCubridTableSchema driver dependent table metadata. Null if the table does not exist.
loadTable
php
yiisoft/yii
framework/db/schema/cubrid/CCubridSchema.php
https://github.com/yiisoft/yii/blob/master/framework/db/schema/cubrid/CCubridSchema.php
BSD-3-Clause
protected function resolveTableNames($table,$name) { $parts=explode('.',str_replace('`','',$name)); if(isset($parts[1])) { $table->schemaName=$parts[0]; $table->name=$parts[1]; $table->rawName=$this->quoteTableName($table->schemaName).'.'.$this->quoteTableName($table->name); } else { $table->name=$parts[0]; $table->rawName=$this->quoteTableName($table->name); } }
Generates various kinds of table names. @param CCubridTableSchema $table the table instance @param string $name the unquoted table name
resolveTableNames
php
yiisoft/yii
framework/db/schema/cubrid/CCubridSchema.php
https://github.com/yiisoft/yii/blob/master/framework/db/schema/cubrid/CCubridSchema.php
BSD-3-Clause
protected function findTableNames($schema='') { // CUBRID does not allow to look into another database from within another connection. // If necessary user has to establish a connection to that particular database and // query to show all tables. For this reason if a user executes this funtion // we will return all table names of the currently connected database. return $this->getDbConnection()->createCommand('SHOW TABLES')->queryColumn(); }
Returns all table names in the database. @param string $schema 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.
findTableNames
php
yiisoft/yii
framework/db/schema/cubrid/CCubridSchema.php
https://github.com/yiisoft/yii/blob/master/framework/db/schema/cubrid/CCubridSchema.php
BSD-3-Clause
protected function extractType($dbType) { if(preg_match('/(FLO|REA|DOU|NUM|DEC)/',$dbType)) $this->type='double'; // The following "bool" and 'boolean" are for future compatibility. // As of CUBRID 9.0, they are not supported. elseif(strpos($dbType,'BOOL')!==false) $this->type='boolean'; elseif(preg_match('/(INT|BIT|SMA|SHO|NUM)/',$dbType)) $this->type='integer'; else $this->type='string'; }
Extracts the PHP type from DB type. @param string $dbType DB type
extractType
php
yiisoft/yii
framework/db/schema/cubrid/CCubridColumnSchema.php
https://github.com/yiisoft/yii/blob/master/framework/db/schema/cubrid/CCubridColumnSchema.php
BSD-3-Clause
protected function extractDefault($defaultValue) { if($this->dbType==='TIMESTAMP' && $defaultValue==='CURRENT_TIMESTAMP') $this->defaultValue=null; else parent::extractDefault($defaultValue); }
Extracts the default value for the column. The value is typecasted to correct PHP type. @param mixed $defaultValue the default value obtained from metadata
extractDefault
php
yiisoft/yii
framework/db/schema/cubrid/CCubridColumnSchema.php
https://github.com/yiisoft/yii/blob/master/framework/db/schema/cubrid/CCubridColumnSchema.php
BSD-3-Clause
protected function extractType($dbType) { if(strpos($dbType,'[')!==false || strpos($dbType,'char')!==false || strpos($dbType,'text')!==false) $this->type='string'; elseif(strpos($dbType,'bool')!==false) $this->type='boolean'; elseif(preg_match('/(real|float|double)/',$dbType)) $this->type='double'; elseif(preg_match('/(integer|oid|serial|smallint)/',$dbType)) $this->type='integer'; else $this->type='string'; }
Extracts the PHP type from DB type. @param string $dbType DB type
extractType
php
yiisoft/yii
framework/db/schema/pgsql/CPgsqlColumnSchema.php
https://github.com/yiisoft/yii/blob/master/framework/db/schema/pgsql/CPgsqlColumnSchema.php
BSD-3-Clause
protected function extractDefault($defaultValue) { if($defaultValue==='true') $this->defaultValue=true; elseif($defaultValue==='false') $this->defaultValue=false; elseif(strpos($defaultValue,'nextval')===0) $this->defaultValue=null; elseif(preg_match('/^\'(.*)\'::/',$defaultValue,$matches)) $this->defaultValue=$this->typecast(str_replace("''","'",$matches[1])); elseif(preg_match('/^(-?\d+(\.\d*)?)(::.*)?$/',$defaultValue,$matches)) $this->defaultValue=$this->typecast($matches[1]); // else is null }
Extracts the default value for the column. The value is typecasted to correct PHP type. @param mixed $defaultValue the default value obtained from metadata
extractDefault
php
yiisoft/yii
framework/db/schema/pgsql/CPgsqlColumnSchema.php
https://github.com/yiisoft/yii/blob/master/framework/db/schema/pgsql/CPgsqlColumnSchema.php
BSD-3-Clause
public function quoteSimpleTableName($name) { return '"'.$name.'"'; }
Quotes a table name for use in a query. A simple table name does not schema prefix. @param string $name table name @return string the properly quoted table name @since 1.1.6
quoteSimpleTableName
php
yiisoft/yii
framework/db/schema/pgsql/CPgsqlSchema.php
https://github.com/yiisoft/yii/blob/master/framework/db/schema/pgsql/CPgsqlSchema.php
BSD-3-Clause
public function resetSequence($table,$value=null) { if($table->sequenceName===null) return; $sequence='"'.$table->sequenceName.'"'; if(strpos($sequence,'.')!==false) $sequence=str_replace('.','"."',$sequence); if($value!==null) $value=(int)$value; else $value="(SELECT COALESCE(MAX(\"{$table->primaryKey}\"),0) FROM {$table->rawName})+1"; $this->getDbConnection() ->createCommand("SELECT SETVAL('$sequence',$value,false)") ->execute(); }
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 max value of a primary key plus one (i.e. sequence trimming). @param CDbTableSchema $table the table schema whose primary key sequence will be reset @param integer|null $value 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 the max value of a primary key plus one (i.e. sequence trimming). @since 1.1
resetSequence
php
yiisoft/yii
framework/db/schema/pgsql/CPgsqlSchema.php
https://github.com/yiisoft/yii/blob/master/framework/db/schema/pgsql/CPgsqlSchema.php
BSD-3-Clause
protected function loadTable($name) { $table=new CPgsqlTableSchema; $this->resolveTableNames($table,$name); if(!$this->findColumns($table)) return null; $this->findConstraints($table); if(is_string($table->primaryKey) && isset($this->_sequences[$table->rawName.'.'.$table->primaryKey])) $table->sequenceName=$this->_sequences[$table->rawName.'.'.$table->primaryKey]; elseif(is_array($table->primaryKey)) { foreach($table->primaryKey as $pk) { if(isset($this->_sequences[$table->rawName.'.'.$pk])) { $table->sequenceName=$this->_sequences[$table->rawName.'.'.$pk]; break; } } } return $table; }
Loads the metadata for the specified table. @param string $name table name @return CDbTableSchema driver dependent table metadata.
loadTable
php
yiisoft/yii
framework/db/schema/pgsql/CPgsqlSchema.php
https://github.com/yiisoft/yii/blob/master/framework/db/schema/pgsql/CPgsqlSchema.php
BSD-3-Clause
protected function resolveTableNames($table,$name) { $parts=explode('.',str_replace('"','',$name)); if(isset($parts[1])) { $schemaName=$parts[0]; $tableName=$parts[1]; } else { $schemaName=self::DEFAULT_SCHEMA; $tableName=$parts[0]; } $table->name=$tableName; $table->schemaName=$schemaName; if($schemaName===self::DEFAULT_SCHEMA) $table->rawName=$this->quoteTableName($tableName); else $table->rawName=$this->quoteTableName($schemaName).'.'.$this->quoteTableName($tableName); }
Generates various kinds of table names. @param CPgsqlTableSchema $table the table instance @param string $name the unquoted table name
resolveTableNames
php
yiisoft/yii
framework/db/schema/pgsql/CPgsqlSchema.php
https://github.com/yiisoft/yii/blob/master/framework/db/schema/pgsql/CPgsqlSchema.php
BSD-3-Clause