PHP Class Horde_Db_Adapter_Sqlite_Schema, horde

Author: Mike Naberezny ([email protected])
Author: Derek DeVries ([email protected])
Author: Chuck Hagenbuch ([email protected])
Inheritance: extends Horde_Db_Adapter_Abstract_Schema
Afficher le fichier Open project: horde/horde

Méthodes publiques

Méthode Description
addColumn ( string $tableName, string $columnName, string $type, array $options = [] ) Adds a new column to a table.
addPrimaryKey ( string $tableName, $columns ) Adds a primary key to a table.
changeColumn ( string $tableName, string $columnName, string $type, array $options = [] ) Changes an existing column's definition.
changeColumnDefault ( string $tableName, string $columnName, mixed $default ) Sets a new default value for a column.
columns ( string $tableName, string $name = null ) : array Returns a list of table columns.
createDatabase ( string $name, array $options = [] ) Creates a database.
currentDatabase ( ) : string Returns the name of the currently selected database.
dropDatabase ( string $name ) Drops a database.
indexes ( string $tableName, string $name = null ) : array Returns a list of tables indexes.
makeColumn ( string $name, string $default, string $sqlType = null, boolean $null = true ) : Horde_Db_Adapter_Base_Column Factory for Column objects.
modifyDate ( string $reference, string $operator, integer $amount, string $interval ) : string Generates a modified date for SELECT queries.
nativeDatabaseTypes ( ) : array Returns a hash of mappings from the abstract data types to the native database types.
primaryKey ( string $tableName, string $name = null ) : Horde_Db_Adapter_Base_Index Returns a table's primary key.
quoteBinary ( $value ) : string Returns a quoted binary value.
removeColumn ( string $tableName, string $columnName ) Removes a column from a table.
removeIndex ( string $tableName, string | array $options = [] ) Removes an index from a table.
removePrimaryKey ( string $tableName ) Removes a primary key from a table.
renameColumn ( string $tableName, string $columnName, string $newColumnName ) Renames a column.
renameTable ( string $name, string $newName ) Renames a table.
tables ( ) : array Returns a list of all tables of the current database.

Méthodes protégées

Méthode Description
_alterTable ( string $tableName, array $options = [], function $callback = null ) Alters a table.
_copyTable ( string $from, string $to, array $options = [], function $callback = null ) Copies a table.
_copyTableContents ( string $from, string $to, array $columns, array $rename = [] ) Copies the content of one table to another.
_copyTableIndexes ( string $from, string $to, array $rename = [] ) Copies indexes from one table to another.
_defaultPrimaryKeyType ( ) : string Returns a column type definition to be use for primary keys.
_moveTable ( string $from, string $to, array $options = [], function $callback = null ) Moves a table.

Method Details

_alterTable() protected méthode

This is done by creating a temporary copy, applying changes and callback methods, and copying the table back.
protected _alterTable ( string $tableName, array $options = [], function $callback = null )
$tableName string A table name.
$options array Any options to apply when creating the temporary table. Supports a 'rename' key for the new table name, additionally to the options in createTable().
$callback function A callback function that can manipulate the Horde_Db_Adapter_Base_TableDefinition object available in $definition. See _copyTable().

_copyTable() protected méthode

Also applies changes and callback methods before creating the new table.
protected _copyTable ( string $from, string $to, array $options = [], function $callback = null )
$from string The name of the source table.
$to string The name of the target table.
$options array Any options to apply when creating the temporary table. Supports a 'rename' key for the new table name, additionally to the options in createTable().
$callback function A callback function that can manipulate the Horde_Db_Adapter_Base_TableDefinition object available in $definition.

_copyTableContents() protected méthode

Copies the content of one table to another.
protected _copyTableContents ( string $from, string $to, array $columns, array $rename = [] )
$from string The name of the source table.
$to string The name of the target table.
$columns array A list of columns to copy.
$rename array A hash of columns to rename during the copy, with original names as keys and the new names as values.

_copyTableIndexes() protected méthode

Copies indexes from one table to another.
protected _copyTableIndexes ( string $from, string $to, array $rename = [] )
$from string The name of the source table.
$to string The name of the target table.
$rename array A hash of columns to rename during the copy, with original names as keys and the new names as values.

_defaultPrimaryKeyType() protected méthode

Returns a column type definition to be use for primary keys.
protected _defaultPrimaryKeyType ( ) : string
Résultat string Primary key type definition.

_moveTable() protected méthode

This is done by creating a temporary copy, applying changes and callback methods, and dropping the original table.
protected _moveTable ( string $from, string $to, array $options = [], function $callback = null )
$from string The name of the source table.
$to string The name of the target table.
$options array Any options to apply when creating the temporary table. Supports a 'rename' key for the new table name, additionally to the options in createTable().
$callback function A callback function that can manipulate the Horde_Db_Adapter_Base_TableDefinition object available in $definition. See _copyTable().

addColumn() public méthode

Adds a new column to a table.
public addColumn ( string $tableName, string $columnName, string $type, array $options = [] )
$tableName string A table name.
$columnName string A column name.
$type string A data type.
$options array Column options. See Horde_Db_Adapter_Base_TableDefinition#column() for details.

addPrimaryKey() public méthode

Adds a primary key to a table.
public addPrimaryKey ( string $tableName, $columns )
$tableName string A table name.

changeColumn() public méthode

Changes an existing column's definition.
public changeColumn ( string $tableName, string $columnName, string $type, array $options = [] )
$tableName string A table name.
$columnName string A column name.
$type string A data type.
$options array Column options. See Horde_Db_Adapter_Base_TableDefinition#column() for details.

changeColumnDefault() public méthode

If you want to set the default value to NULL, you are out of luck. You need to execute the apppropriate SQL statement yourself.
public changeColumnDefault ( string $tableName, string $columnName, mixed $default )
$tableName string A table name.
$columnName string A column name.
$default mixed The new default value.

columns() public méthode

Returns a list of table columns.
public columns ( string $tableName, string $name = null ) : array
$tableName string A table name.
$name string (can be removed?)
Résultat array A list of Horde_Db_Adapter_Base_Column objects.

createDatabase() public méthode

Creates a database.
public createDatabase ( string $name, array $options = [] )
$name string A database name.
$options array Database options.

currentDatabase() public méthode

Returns the name of the currently selected database.
public currentDatabase ( ) : string
Résultat string The database name.

dropDatabase() public méthode

Drops a database.
public dropDatabase ( string $name )
$name string A database name.

indexes() public méthode

Returns a list of tables indexes.
public indexes ( string $tableName, string $name = null ) : array
$tableName string A table name.
$name string (can be removed?)
Résultat array A list of Horde_Db_Adapter_Base_Index objects.

makeColumn() public méthode

Factory for Column objects.
public makeColumn ( string $name, string $default, string $sqlType = null, boolean $null = true ) : Horde_Db_Adapter_Base_Column
$name string The column's name, such as "supplier_id" in "supplier_id int(11)".
$default string The type-casted default value, such as "new" in "sales_stage varchar(20) default 'new'".
$sqlType string Used to extract the column's type, length and signed status, if necessary. For example "varchar" and "60" in "company_name varchar(60)" or "unsigned => true" in "int(10) UNSIGNED".
$null boolean Whether this column allows NULL values.
Résultat Horde_Db_Adapter_Base_Column A column object.

modifyDate() public méthode

Generates a modified date for SELECT queries.
public modifyDate ( string $reference, string $operator, integer $amount, string $interval ) : string
$reference string The reference date - this is a column referenced in the SELECT.
$operator string Add or subtract time? (+/-)
$amount integer The shift amount (number of days if $interval is DAY, etc).
$interval string The interval (SECOND, MINUTE, HOUR, DAY, MONTH, YEAR).
Résultat string The generated INTERVAL clause.

nativeDatabaseTypes() public méthode

See TableDefinition::column() for details on the recognized abstract data types.
See also: TableDefinition::column()
public nativeDatabaseTypes ( ) : array
Résultat array A database type map.

primaryKey() public méthode

Returns a table's primary key.
public primaryKey ( string $tableName, string $name = null ) : Horde_Db_Adapter_Base_Index
$tableName string A table name.
$name string (can be removed?)
Résultat Horde_Db_Adapter_Base_Index The primary key index object.

quoteBinary() public méthode

Returns a quoted binary value.
public quoteBinary ( $value ) : string
Résultat string The quoted binary value.

removeColumn() public méthode

Removes a column from a table.
public removeColumn ( string $tableName, string $columnName )
$tableName string A table name.
$columnName string A column name.

removeIndex() public méthode

See parent class for examples.
public removeIndex ( string $tableName, string | array $options = [] )
$tableName string A table name.
$options string | array Either a column name or index options: - name: (string) the index name. - column: (string|array) column name(s).

removePrimaryKey() public méthode

Removes a primary key from a table.
public removePrimaryKey ( string $tableName )
$tableName string A table name.

renameColumn() public méthode

Renames a column.
public renameColumn ( string $tableName, string $columnName, string $newColumnName )
$tableName string A table name.
$columnName string A column name.
$newColumnName string The new column name.

renameTable() public méthode

Renames a table.
public renameTable ( string $name, string $newName )
$name string A table name.
$newName string The new table name.

tables() public méthode

Returns a list of all tables of the current database.
public tables ( ) : array
Résultat array A table list.