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

  • CSqliteColumnSchema
  • CSqliteCommandBuilder
  • CSqliteSchema
  • Overview
  • Package
  • Class
  • Tree

Class CSqliteSchema

CSqliteSchema is the class for retrieving metadata information from a SQLite (2/3) database.

CComponent
Extended by CDbSchema
Extended by CSqliteSchema
Package: system\db\schema\sqlite
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/sqlite/CSqliteSchema.php
Methods summary
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. Note that this method used to do nothing before 1.1.14. Since 1.1.14 it changes integrity check state as expected.

Enables or disables integrity check. Note that this method used to do nothing before 1.1.14. Since 1.1.14 it changes integrity check state as expected.

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 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. This is not used for sqlite database.

Returns

array
all table names in the database.

Throws

CDbException
if current schema does not support fetching all table names

Overrides

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

Creates a command builder for the database.

Creates a command builder for the database.

Returns

CSqliteCommandBuilder
command builder instance

Overrides

CDbSchema::createCommandBuilder()
protected CDbTableSchema
# loadTable( string $name )

Loads the metadata for the specified table.

Loads the metadata for the specified table.

Parameters

$name
string
$name table name

Returns

CDbTableSchema
driver dependent table metadata. Null if the table does not exist.
protected boolean
# findColumns( CDbTableSchema $table )

Collects the table column metadata.

Collects the table column metadata.

Parameters

$table
CDbTableSchema
$table the table metadata

Returns

boolean
whether the table exists in the database
protected
# findConstraints( CDbTableSchema $table )

Collects the foreign key column details for the given table.

Collects the foreign key column details for the given table.

Parameters

$table
CDbTableSchema
$table the table metadata
protected CDbColumnSchema
# createColumn( array $column )

Creates a table column.

Creates a table column.

Parameters

$column
array
$column column metadata

Returns

CDbColumnSchema
normalized column metadata
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.13

Overrides

CDbSchema::renameTable()
public string
# truncateTable( string $table )

Builds a SQL statement for truncating a DB table.

Builds a SQL statement for truncating a DB table.

Parameters

$table
string
$table the table to be truncated. The name will be properly quoted by the method.

Returns

string
the SQL statement for truncating a DB table.

Since

1.1.6

Overrides

CDbSchema::truncateTable()
public string
# dropColumn( string $table, string $column )

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.

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.

Parameters

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

Returns

string
the SQL statement for dropping a DB column.

Since

1.1.6

Overrides

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

Builds a SQL statement for renaming a column. Because SQLite does not support renaming a DB column, calling this method will throw an exception.

Builds a SQL statement for renaming a column. Because SQLite does not support renaming a DB column, calling this method will throw an exception.

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

CDbSchema::renameColumn()
public string
# addForeignKey( string $name, string $table, string $columns, string $refTable, string $refColumns, string $delete = null, string $update = null )

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.

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.

Parameters

$name
string
$name the name of the foreign key constraint.
$table
string
$table the table that the foreign key constraint will be added to.
$columns
string
$columns the name of the column to that the constraint will be added on. If there are multiple columns, separate them with commas.
$refTable
string
$refTable the table that the foreign key references to.
$refColumns
string
$refColumns the name of the column that the foreign key references to. If there are multiple columns, separate them with commas.
$delete
string
$delete the ON DELETE option. Most DBMS support these options: RESTRICT, CASCADE, NO ACTION, SET DEFAULT, SET NULL
$update
string
$update the ON UPDATE option. Most DBMS support these options: RESTRICT, CASCADE, NO ACTION, SET DEFAULT, SET NULL

Returns

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

Since

1.1.6

Overrides

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

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.

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.

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
# alterColumn( string $table, string $column, string $type )

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.

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.

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

CDbSchema::alterColumn()
public string
# dropIndex( string $name, string $table )

Builds a SQL statement for dropping an index.

Builds a SQL statement for dropping an index.

Parameters

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

Returns

string
the SQL statement for dropping an index.

Since

1.1.6

Overrides

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

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.

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.

Parameters

$name
string
$name the name of the primary key constraint.
$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.13

Overrides

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

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

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

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()
Methods inherited from CDbSchema
__construct(), addColumn(), compareTableNames(), createIndex(), createTable(), dropTable(), getColumnType(), getCommandBuilder(), getDbConnection(), getTable(), getTableNames(), getTables(), quoteColumnName(), quoteSimpleColumnName(), quoteSimpleTableName(), quoteTableName(), refresh()
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' => 'integer PRIMARY KEY AUTOINCREMENT NOT NULL', 'bigpk' => 'integer PRIMARY KEY AUTOINCREMENT NOT NULL', 'string' => 'varchar(255)', 'text' => 'text', 'integer' => 'integer', 'bigint' => 'integer', '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