PHP Класс Horde_Db_Adapter_Sqlite_Schema, horde

Автор: Mike Naberezny ([email protected])
Автор: Derek DeVries ([email protected])
Автор: Chuck Hagenbuch ([email protected])
Наследование: extends Horde_Db_Adapter_Abstract_Schema
Показать файл Открыть проект

Открытые методы

Метод Описание
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.

Защищенные методы

Метод Описание
_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.

Описание методов

_alterTable() защищенный Метод

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() защищенный Метод

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() защищенный Метод

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() защищенный Метод

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() защищенный Метод

Returns a column type definition to be use for primary keys.
protected _defaultPrimaryKeyType ( ) : string
Результат string Primary key type definition.

_moveTable() защищенный Метод

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() публичный Метод

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() публичный Метод

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

changeColumn() публичный Метод

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() публичный Метод

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() публичный Метод

Returns a list of table columns.
public columns ( string $tableName, string $name = null ) : array
$tableName string A table name.
$name string (can be removed?)
Результат array A list of Horde_Db_Adapter_Base_Column objects.

createDatabase() публичный Метод

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

currentDatabase() публичный Метод

Returns the name of the currently selected database.
public currentDatabase ( ) : string
Результат string The database name.

dropDatabase() публичный Метод

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

indexes() публичный Метод

Returns a list of tables indexes.
public indexes ( string $tableName, string $name = null ) : array
$tableName string A table name.
$name string (can be removed?)
Результат array A list of Horde_Db_Adapter_Base_Index objects.

makeColumn() публичный Метод

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.
Результат Horde_Db_Adapter_Base_Column A column object.

modifyDate() публичный Метод

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).
Результат string The generated INTERVAL clause.

nativeDatabaseTypes() публичный Метод

See TableDefinition::column() for details on the recognized abstract data types.
См. также: TableDefinition::column()
public nativeDatabaseTypes ( ) : array
Результат array A database type map.

primaryKey() публичный Метод

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?)
Результат Horde_Db_Adapter_Base_Index The primary key index object.

quoteBinary() публичный Метод

Returns a quoted binary value.
public quoteBinary ( $value ) : string
Результат string The quoted binary value.

removeColumn() публичный Метод

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

removeIndex() публичный Метод

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() публичный Метод

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

renameColumn() публичный Метод

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() публичный Метод

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

tables() публичный Метод

Returns a list of all tables of the current database.
public tables ( ) : array
Результат array A table list.