Method | 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. |
Method | 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. |
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(). |
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. |
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. |
protected _defaultPrimaryKeyType ( ) : string | ||
return | string | Primary key type definition. |
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(). |
public addPrimaryKey ( string $tableName, $columns ) | ||
$tableName | string | A table name. |
public createDatabase ( string $name, array $options = [] ) | ||
$name | string | A database name. |
$options | array | Database options. |
public currentDatabase ( ) : string | ||
return | string | The database name. |
public dropDatabase ( string $name ) | ||
$name | string | A database name. |
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. |
return | Horde_Db_Adapter_Base_Column | A column object. |
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). |
return | string | The generated INTERVAL clause. |
public nativeDatabaseTypes ( ) : array | ||
return | array | A database type map. |
public primaryKey ( string $tableName, string $name = null ) : Horde_Db_Adapter_Base_Index | ||
$tableName | string | A table name. |
$name | string | (can be removed?) |
return | Horde_Db_Adapter_Base_Index | The primary key index object. |
public quoteBinary ( $value ) : string | ||
return | string | The quoted binary value. |
public removeColumn ( string $tableName, string $columnName ) | ||
$tableName | string | A table name. |
$columnName | string | A column name. |
public removePrimaryKey ( string $tableName ) | ||
$tableName | string | A table name. |
public renameTable ( string $name, string $newName ) | ||
$name | string | A table name. |
$newName | string | The new table name. |