Methods summary
public
Horde_Db_Adapter_Mysql_Column
|
#
makeColumn( string $name, string $default, string $sqlType = null, boolean $null = true )
Factory for Column objects.
Factory for Column objects.
Parameters
- $name
- <p>The column's name, such as "supplier_id" in
"supplier_id int(11)".</p>
- $default
- <p>The type-casted default value, such as "new" in
"sales_stage varchar(20) default 'new'".</p>
- $sqlType
- <p>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".</p>
- $null
- Whether this column allows NULL values.
Returns
Overrides
|
public
string
|
#
quoteColumnName( string $name )
Returns a quoted form of the column name.
Returns a quoted form of the column name.
Parameters
Returns
string The quoted column name.
|
public
string
|
#
quoteTableName( string $name )
Returns a quoted form of the table name.
Returns a quoted form of the table name.
Defaults to column name quoting.
Parameters
Returns
string The quoted table name.
Overrides
|
public
string
|
#
quoteTrue( )
Returns a quoted boolean true.
Returns a quoted boolean true.
Returns
string The quoted boolean true.
Overrides
|
public
string
|
#
quoteFalse( )
Returns a quoted boolean false.
Returns a quoted boolean false.
Returns
string The quoted boolean false.
Overrides
|
public
array
|
#
nativeDatabaseTypes( )
Returns a hash of mappings from the abstract data types to the native
database types.
Returns a hash of mappings from the abstract data types to the native
database types.
See TableDefinition::column() for details on the recognized abstract
data types.
Returns
array A database type map.
See
TableDefinition::column()
Overrides
|
public
array
|
#
tables( )
Returns a list of all tables of the current database.
Returns a list of all tables of the current database.
Returns
array A table list.
|
public
Horde_Db_Adapter_Base_Index
|
#
primaryKey( string $tableName, string $name = null )
Returns a table's primary key.
Returns a table's primary key.
Parameters
- $tableName
- A table name.
- $name
- (can be removed?)
Returns
|
public
array
|
#
indexes( string $tableName, string $name = null )
Returns a list of tables indexes.
Returns a list of tables indexes.
Parameters
- $tableName
- A table name.
- $name
- (can be removed?)
Returns
array A list of Horde_Db_Adapter_Base_Index objects.
|
public
array
|
#
columns( string $tableName, string $name = null )
Returns a list of table columns.
Returns a list of table columns.
Parameters
- $tableName
- A table name.
- $name
- (can be removed?)
Returns
array A list of Horde_Db_Adapter_Base_Column objects.
|
public
|
#
endTable( string|Horde_Db_Adapter_Base_TableDefinition $name, array $options = array() )
Finishes and executes table creation.
Finishes and executes table creation.
Parameters
- $name
- A table name or object.
- $options
- A list of options. See createTable().
Overrides
|
public
|
#
renameTable( string $name, string $newName )
Renames a table.
Parameters
- $name
- A table name.
- $newName
- The new table name.
|
public
|
#
changeColumn( string $tableName, string $columnName, string $type, array $options = array() )
Changes an existing column's definition.
Changes an existing column's definition.
Parameters
- $tableName
- A table name.
- $columnName
- A column name.
- $type
- A data type.
- $options
- <p>Column options. See
Horde_Db_Adapter_Base_TableDefinition#column()
for details.</p>
|
public
|
#
changeColumnDefault( string $tableName, string $columnName, mixed $default )
Sets a new default value for a column.
Sets a new default value for a column.
If you want to set the default value to NULL, you are out of luck. You
need to execute the apppropriate SQL statement yourself.
Parameters
- $tableName
- A table name.
- $columnName
- A column name.
- $default
- The new default value.
|
public
|
#
renameColumn( string $tableName, string $columnName, string $newColumnName )
Renames a column.
Parameters
- $tableName
- A table name.
- $columnName
- A column name.
- $newColumnName
- The new column name.
|
public
|
#
removePrimaryKey( string $tableName )
Removes a primary key from a table.
Removes a primary key from a table.
Parameters
Throws
Since
Horde_Db 1.1.0
|
public
|
#
indexName( string $tableName, string|array $options = array() )
Builds the name for an index.
Builds the name for an index.
Cuts the index name to the maximum length of 64 characters limited by
MySQL.
Parameters
- $tableName
- A table name.
- $options
- <p>Either a column name or index options:
- column: (string|array) column name(s).
- name: (string) the index name to fall
back to if no column names specified.</p>
Overrides
|
public
|
#
createDatabase( string $name, array $options = array() )
Creates a database.
Parameters
- $name
- A database name.
- $options
- Database options.
|
public
|
|
public
string
|
#
currentDatabase( )
Returns the name of the currently selected database.
Returns the name of the currently selected database.
Returns
string The database name.
|
public
string
|
#
typeToSql( string $type, integer $limit = null, integer $precision = null, integer $scale = null, boolean $unsigned = null )
Generates the SQL definition for a column type.
Generates the SQL definition for a column type.
Parameters
- $type
- A column type.
- $limit
- Maximum column length (non decimal type only)
- $precision
- The number precision (decimal type only).
- $scale
- The number scaling (decimal columns only).
- $unsigned
- <p>Whether the column is an unsigned number
(non decimal columns only).</p>
Returns
string The SQL definition. If $type is not one of the
internally supported types, $type is returned unchanged.
Overrides
|
public
string
|
#
addColumnOptions( string $sql, array $options )
Adds default/null options to column SQL definitions.
Adds default/null options to column SQL definitions.
Parameters
- $sql
- Existing SQL definition for a column.
- $options
- <p>Column options:
- null: (boolean) Whether to allow NULL values.
- default: (mixed) Default column value.
- autoincrement: (boolean) Whether the column is
an autoincrement column. Driver depedendent.
- after: (string) Insert column after this one.
MySQL specific.</p>
Returns
string The manipulated SQL definition.
Overrides
|
public
string|array
|
#
buildClause( string $lhs, string $op, string $rhs, boolean $bind = false, array $params = array() )
Returns an expression using the specified operator.
Returns an expression using the specified operator.
Parameters
- $lhs
- The column or expression to test.
- $op
- The operator.
- $rhs
- The comparison value.
- $bind
- <p>If true, the method returns the query and a list
of values suitable for binding as an array.</p>
- $params
- Any additional parameters for the operator.
Returns
string|array The SQL test fragment, or an array containing the
query and a list of values if $bind is true.
Overrides
|
public
string
|
#
getCharset( )
Returns the character set of query results.
Returns the character set of query results.
Returns
string The result's charset.
|
public
|
#
setCharset( string $charset )
Sets the client and result charset.
Sets the client and result charset.
Parameters
- $charset
- <p>The character set to use for client queries and
results.</p>
|
public
string
|
#
_mysqlCharsetName( string $charset )
Returns the MySQL name of a character set.
Returns the MySQL name of a character set.
Parameters
Returns
string MySQL-normalized charset.
|
public
string
|
#
getCollation( )
Returns the database collation strategy.
Returns the database collation strategy.
Returns
string Database collation.
|
public
string
|
#
showVariable( string $name )
Returns a database variable.
Returns a database variable.
Convenience wrapper around "SHOW VARIABLES LIKE 'name'".
Parameters
Returns
string The variable value.
Throws
|
public
|
|
public
|
|