eZ Publish  [trunk]
eZMysqlSchema Class Reference

Handles schemas for MySQL. More...

+ Inheritance diagram for eZMysqlSchema:
+ Collaboration diagram for eZMysqlSchema:

List of all members.

Public Member Functions

 escapeSQLString ($value)
 eZMysqlSchema ($params)
 generateTableOption ($tableName, $tableDef, $optionType, $optionValue, $params)
 generateTableSchema ($tableName, $table, $params)
 generateTableSQLList ($tableName, $table, $params, $separateTypes)
 isMultiInsertSupported ()
 parseType ($type_info, &$length_info)
 schema ($params=array())
 schemaName ()
 schemaType ()
 tableCharsetName ($charset)
 tableStorageTypeName ($type)

Private Member Functions

 fetchTableFields ($table, $params)
 fetchTableIndexes ($table, $params)
 generateAddFieldSql ($table_name, $field_name, $def, $params)
 generateAddIndexSql ($table_name, $index_name, $def, $params, $isEmbedded=false)
 generateAlterFieldSql ($table_name, $field_name, $def, $params)
 generateDropIndexSql ($table_name, $index_name, $def, $params)
 generateDropTable ($table, $params)
 generateFieldDef ($field_name, $def, &$skip_primary, $params=null)
 generateTableSQL ($tableName, $tableDef, $params, $asArray, $separateTypes=false)

Detailed Description

Handles schemas for MySQL.

Definition at line 18 of file ezmysqlschema.php.


Member Function Documentation

eZMysqlSchema::escapeSQLString ( value) [virtual]

This escapes the string according to the current database type and returns it.

Note:
The default just returns the value so it must be reimplemented.

Implements eZDBSchemaInterface.

Definition at line 662 of file ezmysqlschema.php.

Constructor

Parameters:
dbinstance

Definition at line 26 of file ezmysqlschema.php.

eZMysqlSchema::fetchTableFields ( table,
params 
) [private]
Parameters:
tablename

Definition at line 75 of file ezmysqlschema.php.

Referenced by schema().

eZMysqlSchema::fetchTableIndexes ( table,
params 
) [private]

Definition at line 177 of file ezmysqlschema.php.

Referenced by schema().

eZMysqlSchema::generateAddFieldSql ( table_name,
field_name,
def,
params 
) [private, virtual]

Implements eZDBSchemaInterface.

Definition at line 418 of file ezmysqlschema.php.

eZMysqlSchema::generateAddIndexSql ( table_name,
index_name,
def,
params,
isEmbedded = false 
) [private]

Definition at line 240 of file ezmysqlschema.php.

Referenced by generateTableSQL().

eZMysqlSchema::generateAlterFieldSql ( table_name,
field_name,
def,
params 
) [private, virtual]

Implements eZDBSchemaInterface.

Definition at line 429 of file ezmysqlschema.php.

eZMysqlSchema::generateDropIndexSql ( table_name,
index_name,
def,
params 
) [private]

Definition at line 340 of file ezmysqlschema.php.

eZMysqlSchema::generateDropTable ( table,
params 
) [private]

Definition at line 639 of file ezmysqlschema.php.

eZMysqlSchema::generateFieldDef ( field_name,
def,
&$  skip_primary,
params = null 
) [private]

Definition at line 359 of file ezmysqlschema.php.

Referenced by generateAddFieldSql(), generateAlterFieldSql(), and generateTableSQL().

eZMysqlSchema::generateTableOption ( tableName,
tableDef,
optionType,
optionValue,
params 
)

Detects known options and generates the MySQL SQL code for it.

Returns:
The SQL code as a string or false if not known.
Parameters:
$optionTypeThe type of option, the supported ones are:
  • delay_key_write - If $optionValue is true then adds DELAY_KEY_WRITE=1

Definition at line 567 of file ezmysqlschema.php.

Referenced by generateTableSQL().

eZMysqlSchema::generateTableSchema ( tableName,
table,
params 
) [virtual]
Note:
Calls generateTableSQL() with $asArray set to false

Implements eZDBSchemaInterface.

Definition at line 440 of file ezmysqlschema.php.

eZMysqlSchema::generateTableSQL ( tableName,
tableDef,
params,
asArray,
separateTypes = false 
) [private]
Parameters:
$asArrayIf true all SQLs are return in an array, if not they are returned as a string.
Note:
When returned as array the SQLs will not have a semi-colon to end the statement

Definition at line 460 of file ezmysqlschema.php.

Referenced by generateTableSchema(), and generateTableSQLList().

eZMysqlSchema::generateTableSQLList ( tableName,
table,
params,
separateTypes 
) [virtual]
Note:
Calls generateTableSQL() with $asArray set to true

Implements eZDBSchemaInterface.

Definition at line 448 of file ezmysqlschema.php.

MySQL 3.22.5 and higher support multi-insert queries so if the current database has sufficient version we return true. If no database is connected we return true.

Reimplemented from eZDBSchemaInterface.

Definition at line 649 of file ezmysqlschema.php.

eZMysqlSchema::parseType ( type_info,
&$  length_info 
)

Definition at line 225 of file ezmysqlschema.php.

Referenced by fetchTableFields().

eZMysqlSchema::schema ( params = array()) [virtual]

Gets SQL db schema definition by analyzing the current DB instance and return it in array format. NB: once the schema is generated, it might be cached.

Parameters:
$paramssupported options are 'meta_data' and 'format'
Returns:
DB schema array

Implements eZDBSchemaInterface.

Definition at line 31 of file ezmysqlschema.php.

Returns:
Displayable name for schema type as string. Examples: 'MySQL', 'PostgreSQL', 'Oracle'
See also:
schemaType()

Implements eZDBSchemaInterface.

Definition at line 677 of file ezmysqlschema.php.

Returns:
Identifier for schema type as string. Examples: 'mysql', 'postgresql', 'oracle'
See also:
schemaName()

Implements eZDBSchemaInterface.

Definition at line 672 of file ezmysqlschema.php.

Returns:
The name of the charset $charset in a format MySQL understands.

Definition at line 583 of file ezmysqlschema.php.

Referenced by generateTableSQL().

Returns:
The name of storage type $type or false if not supported.
Note:
Currently supports bdb, myisam and innodb.

See http://dev.mysql.com/doc/mysql/en/CREATE_TABLE.html for overview of the types MySQL supports

Definition at line 613 of file ezmysqlschema.php.

Referenced by generateTableSQL().


The documentation for this class was generated from the following file: