Overview

Packages

  • Db
    • Adapter
    • Migration

Classes

  • Horde_Db_Adapter_Base
  • Horde_Db_Adapter_Base_Column
  • Horde_Db_Adapter_Base_ColumnDefinition
  • Horde_Db_Adapter_Base_Index
  • Horde_Db_Adapter_Base_Schema
  • Horde_Db_Adapter_Base_Table
  • Horde_Db_Adapter_Base_TableDefinition
  • Horde_Db_Adapter_Mysql
  • Horde_Db_Adapter_Mysql_Column
  • Horde_Db_Adapter_Mysql_Result
  • Horde_Db_Adapter_Mysql_Schema
  • Horde_Db_Adapter_Mysqli
  • Horde_Db_Adapter_Mysqli_Result
  • Horde_Db_Adapter_Pdo_Base
  • Horde_Db_Adapter_Pdo_Mysql
  • Horde_Db_Adapter_Pdo_Pgsql
  • Horde_Db_Adapter_Pdo_Sqlite
  • Horde_Db_Adapter_Postgresql_Column
  • Horde_Db_Adapter_Postgresql_Schema
  • Horde_Db_Adapter_SplitRead
  • Horde_Db_Adapter_Sqlite_Column
  • Horde_Db_Adapter_Sqlite_Schema

Interfaces

  • Horde_Db_Adapter
  • Overview
  • Package
  • Class
  • Tree

Class Horde_Db_Adapter_Mysql_Schema

Horde_Db_Adapter_Base_Schema
Extended by Horde_Db_Adapter_Mysql_Schema
Package: Db\Adapter
Category: Horde
License: http://www.horde.org/licenses/bsd
Author: Mike Naberezny mike@maintainable.com
Author: Derek DeVries derek@maintainable.com
Author: Chuck Hagenbuch chuck@horde.org
Author: Jan Schneider jan@horde.org
Located at Horde/Db/Adapter/Mysql/Schema.php
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

Horde_Db_Adapter_Mysql_Column
A column object.

Overrides

Horde_Db_Adapter_Base_Schema::makeColumn()
public string
# quoteColumnName( string $name )

Returns a quoted form of the column name.

Returns a quoted form of the column name.

Parameters

$name
A column name.

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

$name
A table name.

Returns

string
The quoted table name.

Overrides

Horde_Db_Adapter_Base_Schema::quoteTableName()
public string
# quoteTrue( )

Returns a quoted boolean true.

Returns a quoted boolean true.

Returns

string
The quoted boolean true.

Overrides

Horde_Db_Adapter_Base_Schema::quoteTrue()
public string
# quoteFalse( )

Returns a quoted boolean false.

Returns a quoted boolean false.

Returns

string
The quoted boolean false.

Overrides

Horde_Db_Adapter_Base_Schema::quoteFalse()
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

Horde_Db_Adapter_Base_Schema::nativeDatabaseTypes()
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

Horde_Db_Adapter_Base_Index
The primary key index object.
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

Horde_Db_Adapter_Base_Schema::endTable()
public
# renameTable( string $name, string $newName )

Renames a table.

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.

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

$tableName
A table name.

Throws

Horde_Db_Exception

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

Horde_Db_Adapter_Base_Schema::indexName()
public
# createDatabase( string $name, array $options = array() )

Creates a database.

Creates a database.

Parameters

$name
A database name.
$options
Database options.
public
# dropDatabase( string $name )

Drops a database.

Drops a database.

Parameters

$name
A database name.
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

Horde_Db_Adapter_Base_Schema::typeToSql()
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

Horde_Db_Adapter_Base_Schema::addColumnOptions()
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

Horde_Db_Adapter_Base_Schema::buildClause()
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

$charset
A charset name.

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

$name
A variable name.

Returns

string
The variable value.

Throws

Horde_Db_Exception
public
# caseSensitiveEqualityOperator( )
public
# limitedUpdateConditions( mixed $whereSql, mixed $quotedTableName, mixed $quotedPrimaryKey )
Methods inherited from Horde_Db_Adapter_Base_Schema
__call(), __construct(), __get(), addColumn(), addIndex(), addOrderByForAssocLimiting(), addPrimaryKey(), createTable(), distinct(), dropTable(), makeColumnDefinition(), makeIndex(), makeTable(), makeTableDefinition(), modifyDate(), quote(), quoteBinary(), quoteDate(), quoteString(), recreateDatabase(), removeColumn(), removeIndex(), setAdapter(), table(), tableAliasFor(), tableAliasLength()
API documentation generated by ApiGen