eZ Publish  [4.2]
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 36 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 680 of file ezmysqlschema.php.

eZMysqlSchema::eZMysqlSchema ( params)

Constructor

Parameters:
dbinstance

Definition at line 44 of file ezmysqlschema.php.

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

Definition at line 93 of file ezmysqlschema.php.

Referenced by schema().

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

Definition at line 195 of file ezmysqlschema.php.

Referenced by schema().

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

Implements eZDBSchemaInterface.

Definition at line 436 of file ezmysqlschema.php.

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

Definition at line 258 of file ezmysqlschema.php.

Referenced by generateTableSQL().

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

Implements eZDBSchemaInterface.

Definition at line 447 of file ezmysqlschema.php.

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

Definition at line 358 of file ezmysqlschema.php.

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

Definition at line 657 of file ezmysqlschema.php.

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

Definition at line 377 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 585 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 458 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 478 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 466 of file ezmysqlschema.php.

eZMysqlSchema::isMultiInsertSupported ( )

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 667 of file ezmysqlschema.php.

eZMysqlSchema::parseType ( type_info,
&$  length_info 
)

Definition at line 243 of file ezmysqlschema.php.

Referenced by fetchTableFields().

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

Get SQL db schema

Returns:
DB schema array

Implements eZDBSchemaInterface.

Definition at line 49 of file ezmysqlschema.php.

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

Implements eZDBSchemaInterface.

Definition at line 695 of file ezmysqlschema.php.

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

Implements eZDBSchemaInterface.

Definition at line 690 of file ezmysqlschema.php.

eZMysqlSchema::tableCharsetName ( charset)
Returns:
The name of the charset $charset in a format MySQL understands.

Definition at line 601 of file ezmysqlschema.php.

Referenced by generateTableSQL().

eZMysqlSchema::tableStorageTypeName ( type)
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 631 of file ezmysqlschema.php.

Referenced by generateTableSQL().


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