Class Xyster_Db_Gateway_Pdo_Sqlite

Description

A gateway and abstraction layer for SQLite

  • copyright: Copyright (c) 2007-2008 Irrational Logic (http://irrationallogic.net)
  • license: New BSD License

Located in /Db/Gateway/Pdo/Sqlite.php (line 28)

Xyster_Db_Gateway_Abstract
   |
   --Xyster_Db_Gateway_Pdo_Sqlite
Method Summary
Xyster_Db_Gateway_Pdo_Sqlite __construct ([ $db = null])
void dropColumn (string $table, string $column, mixed $default)
void listForeignKeys ()
array listIndexes ()
void renameColumn (string $table, string $old, string $new)
void renameIndex (string $old, string $new, [string $table = null])
void setAdapter ( $db)
void setDefault (string $table, string $column, mixed $default)
void setUnique (string $table, mixed $cols)
boolean supportsForeignKeys ()
string _getAddPrimarySql (string $table,  $columns)
string _getDropIndexSql (string $name, [string $table = null])
string _getDropPrimarySql (string $table, [string $name = null])
string _getRenameColumnSql (string $table, string $old, string $new)
string _getRenameIndexSql (string $old, string $new, [string $table = null])
string _getRenameTableSql (string $old, string $new)
string _getSetNullSql (string $table, string $column, [boolean $null = true])
string _getSetTypeSql (string $table, string $column,  $type, [mixed $argument = null])
string _translateType ( $type, [mixed $argument = null])
Methods
Constructor __construct (line 35)

Creates a new MySQL DB gateway

  • access: public
Xyster_Db_Gateway_Pdo_Sqlite __construct ([ $db = null])
  • Zend_Db_Adapter_Pdo_Sqlite $db: The database adapter to use

Redefinition of:
Xyster_Db_Gateway_Abstract::__construct()
Creates a new DB gateway
dropColumn (line 60)

Drops a column

SQLite does not support dropping columns

  • throws: Xyster_Db_Gateway_Exception always
  • access: public
void dropColumn (string $table, string $column, mixed $default)
  • string $table: The table name
  • string $column: The column name
  • mixed $default: The new column default value

Redefinition of:
Xyster_Db_Gateway_Abstract::dropColumn()
Removes a column from a table
listForeignKeys (line 82)

Lists all foreign keys

The return value is an associative array keyed by the key name, as returned by the RDBMS.

The value of each array element is an associative array with the following keys:

KEY_NAME => string; foreign key name SCHEMA_NAME => string; name of database or schema TABLE_NAME => string; name of table COLUMNS => array; An array of the column names ON_UPDATE => string; ON_DELETE => string;

  • access: public
void listForeignKeys ()

Redefinition of:
Xyster_Db_Gateway_Abstract::listForeignKeys()
Lists all foreign keys
listIndexes (line 106)

Lists all indexes

The return value is an associative array keyed by the index name, as returned by the RDBMS. For now, we cannot easily calculate the primary key status in SQLite.

The value of each array element is an associative array with the following keys:

INDEX_NAME => string; index name SCHEMA_NAME => string; name of database or schema TABLE_NAME => string; name of table COLUMNS => array; An array of the column names PRIMARY => boolean; true if the index is a primary key UNIQUE => boolean; true if the index is a unique key

  • return: An array of string index names
  • access: public
array listIndexes ()

Redefinition of:
Xyster_Db_Gateway_Abstract::listIndexes()
Lists all indexes
renameColumn (line 149)

Renames a column

SQLite doesn't support renaming columns

  • throws: Xyster_Db_Gateway_Exception always
  • access: public
void renameColumn (string $table, string $old, string $new)
  • string $table: The table name
  • string $old: The current column name
  • string $new: The new column name

Redefinition of:
Xyster_Db_Gateway_Abstract::renameColumn()
Renames a column
renameIndex (line 162)

Renames an index

  • access: public
void renameIndex (string $old, string $new, [string $table = null])
  • string $old: The current index name
  • string $new: The new index name
  • string $table: The table name (not required on all databases)

Redefinition of:
Xyster_Db_Gateway_Abstract::renameIndex()
Renames an index
setAdapter (line 45)

Sets the database adapter

  • access: public
void setAdapter ( $db)
  • Zend_Db_Adapter_Pdo_Sqlite $db: The database adapter to use
setDefault (line 186)

Sets the default value for a column

SQLite does not support setting column default values

  • throws: Xyster_Db_Gateway_Exception always
  • access: public
void setDefault (string $table, string $column, mixed $default)
  • string $table: The table name
  • string $column: The column name
  • mixed $default: The new column default value

Redefinition of:
Xyster_Db_Gateway_Abstract::setDefault()
Sets the default value for a column
setUnique (line 201)

Creates a unique index on a column or columns

SQLite doesn't allow you to add unique indexes in this way after the fact; you should instead use the createIndex method.

  • access: public
void setUnique (string $table, mixed $cols)
  • string $table: The table name
  • mixed $cols: The string column name or an array of column names

Redefinition of:
Xyster_Db_Gateway_Abstract::setUnique()
Creates a unique index on a column or columns
supportsForeignKeys (line 212)

Whether the database supports foreign keys

  • access: public
boolean supportsForeignKeys ()

Redefinition of:
Xyster_Db_Gateway_Abstract::supportsForeignKeys()
Whether the database supports foreign keys
_getAddPrimarySql (line 227)

Gets the SQL statement to add a primary key to a table

SQLite doesn't support adding primary keys after table creation

  • throws: Xyster_Db_Gateway_Exception
  • access: protected
string _getAddPrimarySql (string $table,  $columns)
  • string $table: The table name
  • array $columns: The columns in the key

Redefinition of:
Xyster_Db_Gateway_Abstract::_getAddPrimarySql()
Gets the SQL statement to add a primary key to a table
_getCreateIndexSql (line 239)

Gets the SQL statement to create an index

  • access: protected
string _getCreateIndexSql (Xyster_Db_Gateway_IndexBuilder $builder)

Redefinition of:
Xyster_Db_Gateway_Abstract::_getCreateIndexSql()
Gets the SQL statement to create an index
_getDropIndexSql (line 260)

Gets the SQL statement to drop an index

  • access: protected
string _getDropIndexSql (string $name, [string $table = null])
  • string $name: The index name
  • string $table: The table (not all dbs require this)

Redefinition of:
Xyster_Db_Gateway_Abstract::_getDropIndexSql()
Gets the SQL statement to drop an index
_getDropPrimarySql (line 275)

Gets the SQL statement to drop a primary key from a table

Dropping a primary key is not supported by SQLite

  • throws: Xyster_Db_Gateway_Exception always
  • access: protected
string _getDropPrimarySql (string $table, [string $name = null])
  • string $table: The table name
  • string $name: The index name (not all dbs require this)

Redefinition of:
Xyster_Db_Gateway_Abstract::_getDropPrimarySql()
Gets the SQL statement to drop a primary key from a table
_getListSequencesSql (line 286)

Gets the SQL statement to list the sequences

  • access: protected
string _getListSequencesSql ()

Redefinition of:
Xyster_Db_Gateway_Abstract::_getListSequencesSql()
Gets the SQL statement to list the sequences
_getRenameColumnSql (line 330)

Gets the SQL statement to rename a column in a table

SQLite does not support renaming of columns; an exception will always be thrown.

  • throws: Xyster_Db_Gateway_Exception always
  • access: protected
string _getRenameColumnSql (string $table, string $old, string $new)
  • string $table: The table name
  • string $old: The current column name
  • string $new: The new column name

Redefinition of:
Xyster_Db_Gateway_Abstract::_getRenameColumnSql()
Gets the SQL statement to rename a column in a table
_getRenameIndexSql (line 301)

Gets the SQL statement to rename an index

This method is left empty because in this class we overwrite the renameIndex method in the abstract gateway, which calls this one.

  • access: protected
string _getRenameIndexSql (string $old, string $new, [string $table = null])
  • string $old: The current index name
  • string $new: The new index name
  • string $table: The table name (not all dbs require this)

Redefinition of:
Xyster_Db_Gateway_Abstract::_getRenameIndexSql()
Gets the SQL statement to rename an index
_getRenameTableSql (line 312)

Gets the SQL statement to rename a table

  • access: protected
string _getRenameTableSql (string $old, string $new)
  • string $old: The current table name
  • string $new: The new table name

Redefinition of:
Xyster_Db_Gateway_Abstract::_getRenameTableSql()
Gets the SQL statement to rename a table
_getSetNullSql (line 347)

Gets the SQL statement to set a column's NULL status

SQLite does not support altering the nullability of a column.

  • throws: Xyster_Db_Gateway_Exception
  • access: protected
string _getSetNullSql (string $table, string $column, [boolean $null = true])
  • string $table: The table name
  • string $column: The column name
  • boolean $null: True for NULL, false for NOT NULL

Redefinition of:
Xyster_Db_Gateway_Abstract::_getSetNullSql()
Gets the SQL statement to set a column's NULL status
_getSetTypeSql (line 365)

Gets the SQL statement to set the data type of a column

SQLite does not support altering the type of a column

  • throws: Xyster_Db_Gateway_Exception always
  • access: protected
string _getSetTypeSql (string $table, string $column,  $type, [mixed $argument = null])
  • string $table: The table name
  • string $column: The column name
  • Xyster_Db_DataType $type: The data type
  • mixed $argument: An argument for the data type

Redefinition of:
Xyster_Db_Gateway_Abstract::_getSetTypeSql()
Gets the SQL statement to set the data type of a column
_translateType (line 383)

Translates a DataType enum into the correct SQL syntax

SQLite has very interesting data type implemetation. As such, we have tried to convert the expected SQL:2003 data types into SQLite's type affinities. Date times are part of the TEXT type, boolean part of INTEGER.

  • access: protected
string _translateType ( $type, [mixed $argument = null])
  • Xyster_Db_DataType $type
  • mixed $argument

Redefinition of:
Xyster_Db_Gateway_Abstract::_translateType()
Translates a DataType enum into the correct SQL syntax

Inherited Methods

Inherited From Xyster_Db_Gateway_Abstract

Xyster_Db_Gateway_Abstract::__construct()
Xyster_Db_Gateway_Abstract::addColumn()
Xyster_Db_Gateway_Abstract::addForeign()
Xyster_Db_Gateway_Abstract::addPrimary()
Xyster_Db_Gateway_Abstract::createIndex()
Xyster_Db_Gateway_Abstract::createSequence()
Xyster_Db_Gateway_Abstract::createTable()
Xyster_Db_Gateway_Abstract::dropColumn()
Xyster_Db_Gateway_Abstract::dropForeign()
Xyster_Db_Gateway_Abstract::dropIndex()
Xyster_Db_Gateway_Abstract::dropPrimary()
Xyster_Db_Gateway_Abstract::dropSequence()
Xyster_Db_Gateway_Abstract::dropTable()
Xyster_Db_Gateway_Abstract::executeIndexBuilder()
Xyster_Db_Gateway_Abstract::executeTableBuilder()
Xyster_Db_Gateway_Abstract::getAdapter()
Xyster_Db_Gateway_Abstract::listForeignKeys()
Xyster_Db_Gateway_Abstract::listIndexes()
Xyster_Db_Gateway_Abstract::listSequences()
Xyster_Db_Gateway_Abstract::renameColumn()
Xyster_Db_Gateway_Abstract::renameIndex()
Xyster_Db_Gateway_Abstract::renameSequence()
Xyster_Db_Gateway_Abstract::renameTable()
Xyster_Db_Gateway_Abstract::setDefault()
Xyster_Db_Gateway_Abstract::setNull()
Xyster_Db_Gateway_Abstract::setType()
Xyster_Db_Gateway_Abstract::setUnique()
Xyster_Db_Gateway_Abstract::supportsForeignKeys()
Xyster_Db_Gateway_Abstract::supportsSequences()
Xyster_Db_Gateway_Abstract::_getAddColumnSql()
Xyster_Db_Gateway_Abstract::_getAddForeignSql()
Xyster_Db_Gateway_Abstract::_getAddPrimarySql()
Xyster_Db_Gateway_Abstract::_getCreateIndexSql()
Xyster_Db_Gateway_Abstract::_getCreateSequenceSql()
Xyster_Db_Gateway_Abstract::_getCreateTableSql()
Xyster_Db_Gateway_Abstract::_getDropColumnSql()
Xyster_Db_Gateway_Abstract::_getDropForeignSql()
Xyster_Db_Gateway_Abstract::_getDropIndexSql()
Xyster_Db_Gateway_Abstract::_getDropPrimarySql()
Xyster_Db_Gateway_Abstract::_getDropSequenceSql()
Xyster_Db_Gateway_Abstract::_getDropTableSql()
Xyster_Db_Gateway_Abstract::_getListSequencesSql()
Xyster_Db_Gateway_Abstract::_getRenameColumnSql()
Xyster_Db_Gateway_Abstract::_getRenameIndexSql()
Xyster_Db_Gateway_Abstract::_getRenameSequenceSql()
Xyster_Db_Gateway_Abstract::_getRenameTableSql()
Xyster_Db_Gateway_Abstract::_getSetDefaultSql()
Xyster_Db_Gateway_Abstract::_getSetNullSql()
Xyster_Db_Gateway_Abstract::_getSetTypeSql()
Xyster_Db_Gateway_Abstract::_getSetUniqueSql()
Xyster_Db_Gateway_Abstract::_makeArray()
Xyster_Db_Gateway_Abstract::_quote()
Xyster_Db_Gateway_Abstract::_setAdapter()
Xyster_Db_Gateway_Abstract::_translateType()

Documentation generated on Mon, 19 May 2008 17:08:34 -0400 by phpDocumentor 1.4.2