Methods summary
public
string
|
#
quoteSimpleTableName( string $name )
Quotes a table name for use in a query. A simple table name does not schema
prefix.
Quotes a table name for use in a query. A simple table name does not schema
prefix.
Parameters
- $name
string $name table name
Returns
string the properly quoted table name
Since
1.1.6
Overrides
|
public
string
|
#
quoteSimpleColumnName( string $name )
Quotes a column name for use in a query. A simple column name does not
contain prefix.
Quotes a column name for use in a query. A simple column name does not
contain prefix.
Parameters
- $name
string $name column name
Returns
string the properly quoted column name
Since
1.1.6
Overrides
|
public
boolean
|
#
compareTableNames( string $name1, string $name2 )
Compares two table names. The table names can be either quoted or unquoted.
This method will consider both cases.
Compares two table names. The table names can be either quoted or unquoted.
This method will consider both cases.
Parameters
- $name1
string $name1 table name 1
- $name2
string $name2 table name 2
Returns
boolean whether the two table names refer to the same table.
Overrides
|
public
|
#
resetSequence( CDbTableSchema $table, integer|null $value = null )
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).
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).
Parameters
- $table
CDbTableSchema
$table the table schema whose primary key sequence will be reset
- $value
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.6
Overrides
|
public
|
#
checkIntegrity( boolean $check = true, string $schema = '' )
Enables or disables integrity check.
Enables or disables integrity check.
Parameters
- $check
boolean $check whether to turn on or off the integrity check.
- $schema
string $schema the schema of the tables. Defaults to empty string, meaning the current
or default schema.
Since
1.1.6
Overrides
|
protected
CMssqlTableSchema
|
#
loadTable( string $name )
Loads the metadata for the specified table.
Loads the metadata for the specified table.
Parameters
- $name
string $name table name
Returns
|
protected
|
|
protected
mixed
|
#
findPrimaryKey( CMssqlTableSchema $table )
Gets the primary key column(s) details for the given table.
Gets the primary key column(s) details for the given table.
Parameters
Returns
mixed primary keys (null if no pk, string if only 1 column pk, or array if composite
pk)
|
protected
array
|
#
findForeignKeys( CMssqlTableSchema $table )
Gets foreign relationship constraint keys and table name
Gets foreign relationship constraint keys and table name
Parameters
Returns
array foreign relationship table name and keys.
|
protected
boolean
|
#
findColumns( CMssqlTableSchema $table )
Collects the table column metadata.
Collects the table column metadata.
Parameters
Returns
boolean whether the table exists in the database
|
protected
CDbColumnSchema
|
#
createColumn( array $column )
Creates a table column.
Parameters
- $column
array $column column metadata
Returns
|
protected
array
|
#
findTableNames( string $schema = '', boolean $includeViews = true )
Returns all table names in the database.
Returns all table names in the database.
Parameters
- $schema
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.
- $includeViews
boolean $includeViews whether to include views in the result. Defaults to true.
Returns
array all table names in the database.
Throws
CDbException
if current schema does not support fetching all table names
Overrides
|
protected
CDbCommandBuilder
|
#
createCommandBuilder( )
Creates a command builder for the database. This method overrides parent
implementation in order to create a MSSQL specific command builder
Creates a command builder for the database. This method overrides parent
implementation in order to create a MSSQL specific command builder
Returns
Overrides
|
public
string
|
#
renameTable( string $table, string $newName )
Builds a SQL statement for renaming a DB table.
Builds a SQL statement for renaming a DB table.
Parameters
- $table
string $table the table to be renamed. The name will be properly quoted by the method.
- $newName
string $newName the new table name. The name will be properly quoted by the method.
Returns
string the SQL statement for renaming a DB table.
Since
1.1.6
Overrides
|
public
string
|
#
renameColumn( string $table, string $name, string $newName )
Builds a SQL statement for renaming a column.
Builds a SQL statement for renaming a column.
Parameters
- $table
string $table the table whose column is to be renamed. The name will be properly quoted
by the method.
- $name
string $name the old name of the column. The name will be properly quoted by the
method.
- $newName
string $newName the new name of the column. The name will be properly quoted by the
method.
Returns
string the SQL statement for renaming a DB column.
Since
1.1.6
Overrides
|
public
string
|
#
alterColumn( string $table, string $column, string $type )
Builds a SQL statement for changing the definition of a column.
Builds a SQL statement for changing the definition of a column.
Parameters
- $table
string $table the table whose column is to be changed. The table name will be properly
quoted by the method.
- $column
string $column the name of the column to be changed. The name will be properly quoted
by the method.
- $type
string $type the new column type. The CDbSchema::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'.
Returns
string the SQL statement for changing the definition of a column.
Since
1.1.6
Overrides
|
Properties summary
public
array
|
$columnTypes
|
array(
'pk' => 'int IDENTITY PRIMARY KEY',
'bigpk' => 'bigint IDENTITY PRIMARY KEY',
'string' => 'varchar(255)',
'text' => 'text',
'integer' => 'int',
'bigint' => 'bigint',
'float' => 'float',
'decimal' => 'decimal',
'datetime' => 'datetime',
'timestamp' => 'timestamp',
'time' => 'time',
'date' => 'date',
'binary' => 'binary',
'boolean' => 'bit',
) |
#
the abstract column types mapped to physical column types.
the abstract column types mapped to physical column types.
Since
1.1.6
|