Overview

Packages

  • application
    • commands
    • components
      • actions
      • filters
      • leftWidget
      • permissions
      • sortableWidget
      • util
      • webupdater
      • x2flow
        • actions
        • triggers
      • X2GridView
      • X2Settings
    • controllers
    • models
      • embedded
    • modules
      • accounts
        • controllers
        • models
      • actions
        • controllers
        • models
      • calendar
        • controllers
        • models
      • charts
        • models
      • contacts
        • controllers
        • models
      • docs
        • components
        • controllers
        • models
      • groups
        • controllers
        • models
      • marketing
        • components
        • controllers
        • models
      • media
        • controllers
        • models
      • mobile
        • components
      • opportunities
        • controllers
        • models
      • products
        • controllers
        • models
      • quotes
        • controllers
        • models
      • services
        • controllers
        • models
      • template
        • models
      • users
        • controllers
        • models
      • workflow
        • controllers
        • models
      • x2Leads
        • controllers
        • models
  • Net
  • None
  • PHP
  • system
    • base
    • caching
      • dependencies
    • collections
    • console
    • db
      • ar
      • schema
        • cubrid
        • mssql
        • mysql
        • oci
        • pgsql
        • sqlite
    • i18n
      • gettext
    • logging
    • test
    • utils
    • validators
    • web
      • actions
      • auth
      • filters
      • form
      • helpers
      • renderers
      • services
      • widgets
        • captcha
        • pagers
  • Text
    • Highlighter
  • zii
    • behaviors
    • widgets
      • grid
      • jui

Classes

  • CMysqlColumnSchema
  • CMysqlCommandBuilder
  • CMysqlSchema
  • CMysqlTableSchema
  • Overview
  • Package
  • Class
  • Tree

Class CMysqlSchema

CMysqlSchema is the class for retrieving metadata information from a MySQL database (version 4.1.x and 5.x).

CComponent
Extended by CDbSchema
Extended by CMysqlSchema
Package: system\db\schema\mysql
Copyright: 2008-2013 Yii Software LLC
License: http://www.yiiframework.com/license/
Author: Qiang Xue <qiang.xue@gmail.com>
Since: 1.0
Located at x2engine/framework/db/schema/mysql/CMysqlSchema.php
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

CDbSchema::quoteSimpleTableName()
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

CDbSchema::quoteSimpleColumnName()
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

CDbSchema::compareTableNames()
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

Overrides

CDbSchema::resetSequence()
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

Overrides

CDbSchema::checkIntegrity()
protected CMysqlTableSchema
# loadTable( string $name )

Loads the metadata for the specified table.

Loads the metadata for the specified table.

Parameters

$name
string
$name table name

Returns

CMysqlTableSchema
driver dependent table metadata. Null if the table does not exist.
protected
# resolveTableNames( CMysqlTableSchema $table, string $name )

Generates various kinds of table names.

Generates various kinds of table names.

Parameters

$table
CMysqlTableSchema
$table the table instance
$name
string
$name the unquoted table name
protected boolean
# findColumns( CMysqlTableSchema $table )

Collects the table column metadata.

Collects the table column metadata.

Parameters

$table
CMysqlTableSchema
$table the table metadata

Returns

boolean
whether the table exists in the database
protected CDbColumnSchema
# createColumn( array $column )

Creates a table column.

Creates a table column.

Parameters

$column
array
$column column metadata

Returns

CDbColumnSchema
normalized column metadata
protected float
# getServerVersion( )

Returns

float
server version.
protected
# findConstraints( CMysqlTableSchema $table )

Collects the foreign key column details for the given table.

Collects the foreign key column details for the given table.

Parameters

$table
CMysqlTableSchema
$table the table metadata
protected array
# findTableNames( string $schema = '' )

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.

Returns

array
all table names in the database.

Throws

CDbException
if current schema does not support fetching all table names

Overrides

CDbSchema::findTableNames()
protected CDbCommandBuilder
# createCommandBuilder( )

Creates a command builder for the database. This method overrides parent implementation in order to create a MySQL specific command builder

Creates a command builder for the database. This method overrides parent implementation in order to create a MySQL specific command builder

Returns

CDbCommandBuilder
command builder instance

Since

1.1.13

Overrides

CDbSchema::createCommandBuilder()
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.

Throws

CDbException
if specified column is not found in given table

Since

1.1.6

Overrides

CDbSchema::renameColumn()
public string
# dropForeignKey( string $name, string $table )

Builds a SQL statement for dropping a foreign key constraint.

Builds a SQL statement for dropping a foreign key constraint.

Parameters

$name
string
$name the name of the foreign key constraint to be dropped. The name will be properly quoted by the method.
$table
string
$table the table whose foreign is to be dropped. The name will be properly quoted by the method.

Returns

string
the SQL statement for dropping a foreign key constraint.

Since

1.1.6

Overrides

CDbSchema::dropForeignKey()
public string
# dropPrimaryKey( string $name, string $table )

Builds a SQL statement for removing a primary key constraint to an existing table.

Builds a SQL statement for removing a primary key constraint to an existing table.

Parameters

$name
string
$name the name of the primary key constraint to be removed.
$table
string
$table the table that the primary key constraint will be removed from.

Returns

string
the SQL statement for removing a primary key constraint from an existing table.

Since

1.1.13

Overrides

CDbSchema::dropPrimaryKey()
public string
# addPrimaryKey( string $name, string $table, string|array $columns )

Builds a SQL statement for adding a primary key constraint to a table.

Builds a SQL statement for adding a primary key constraint to a table.

Parameters

$name
string
$name not used in the MySQL syntax, the primary key is always called PRIMARY and is reserved.
$table
string
$table the table that the primary key constraint will be added to.
$columns
string|array
$columns comma separated string or array of columns that the primary key will consist of.

Returns

string
the SQL statement for adding a primary key constraint to an existing table.

Since

1.1.14

Overrides

CDbSchema::addPrimaryKey()
Methods inherited from CDbSchema
__construct(), addColumn(), addForeignKey(), alterColumn(), createIndex(), createTable(), dropColumn(), dropIndex(), dropTable(), getColumnType(), getCommandBuilder(), getDbConnection(), getTable(), getTableNames(), getTables(), quoteColumnName(), quoteTableName(), refresh(), renameTable(), truncateTable()
Methods inherited from CComponent
__call(), __get(), __isset(), __set(), __unset(), asa(), attachBehavior(), attachBehaviors(), attachEventHandler(), canGetProperty(), canSetProperty(), detachBehavior(), detachBehaviors(), detachEventHandler(), disableBehavior(), disableBehaviors(), enableBehavior(), enableBehaviors(), evaluateExpression(), getEventHandlers(), hasEvent(), hasEventHandler(), hasProperty(), raiseEvent()
Properties summary
public array $columnTypes array( 'pk' => 'int(11) NOT NULL AUTO_INCREMENT PRIMARY KEY', 'bigpk' => 'bigint(20) NOT NULL AUTO_INCREMENT PRIMARY KEY', 'string' => 'varchar(255)', 'text' => 'text', 'integer' => 'int(11)', 'bigint' => 'bigint(20)', 'float' => 'float', 'decimal' => 'decimal', 'datetime' => 'datetime', 'timestamp' => 'timestamp', 'time' => 'time', 'date' => 'date', 'binary' => 'blob', 'boolean' => 'tinyint(1)', 'money' => 'decimal(19,4)', )
#

the abstract column types mapped to physical column types.

the abstract column types mapped to physical column types.

Since

1.1.6
Magic properties inherited from CDbSchema
$commandBuilder, $dbConnection, $tableNames, $tables
API documentation generated by ApiGen 2.8.0