Exponential 6.0.13 Exponential Enterprise Open Source CMS - PHP Class Reference

Public Member Functions | Private Member Functions | List of all members
eZMysqlSchema Class Reference
Database schema abstraction layer

Handles schemas for MySQL. More...

Inheritance diagram for eZMysqlSchema:

## Public Member Functions
| schema ( $params=array())
| parseType ( $type_info, &$length_info)
| generateTableSchema ( $tableName, $table, $params)
| generateTableSQLList ( $tableName, $table, $params, $separateTypes)
| generateTableOption ( $tableName, $tableDef, $optionType, $optionValue, $params)
| tableCharsetName ( $charset)
| tableStorageTypeName ( $type)
| isMultiInsertSupported ()
| escapeSQLString ( $value)
| schemaType ()
| schemaName ()
Public Member Functions inherited from eZDBSchemaInterface
| __construct ( $params)
| data ( $schema=false, $tableNameList=false, $params=array())
| validate ()
| writeUpgradeFile ( $differences, $filename, $params=array())
| writeSQLSchemaFile ( $filename, $params=array())
| writeSerializedSchemaFile ( $filename, $params=array())
| writeArraySchemaFile ( $filename, $params=array())
| insertSchema ( $params=array())
| appendSQLComments ( $def, &$sql)

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

## Additional Inherited Members
Public Attributes inherited from eZDBSchemaInterface
| $DBInstance
| eZDB instance More...
| $Schema
| $Data
Protected Member Functions inherited from eZDBSchemaInterface
| fetchTableData ( $tableInfo, $offset=false, $limit=false)
| generateTableInsert ( $tableName, $tableDef, $dataEntries, $params)
| generateTableInsertSQLList ( $tableName, $tableDef, $dataEntries, $params, $withClosure=true)
| generateDataValueTextSQL ( $fieldDef, $value)
| transformSchema (&$schema, $toLocal)
| transformData (&$data, $toLocal)

## Detailed Description

Handles schemas for MySQL.

Definition at line 18 of file ezmysqlschema.php.

## Member Function Documentation

## ◆ escapeSQLString()

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

## ◆ fetchTableFields()

eZMysqlSchema::fetchTableFields | ( |  | $table,
|  |  | $params
| ) |  |
| private

Parameters

  table | name

Definition at line 64 of file ezmysqlschema.php.

References parseType().

Referenced by schema().

## ◆ fetchTableIndexes()

eZMysqlSchema::fetchTableIndexes | ( |  | $table,
|  |  | $params
| ) |  |
| private

Definition at line 166 of file ezmysqlschema.php.

Referenced by schema().

## ◆ generateAddFieldSql()

eZMysqlSchema::generateAddFieldSql | ( |  | $table_name,
|  |  | $field_name,
|  |  | $def,
|  |  | $params
| ) |  |
| private virtual

Implements eZDBSchemaInterface.

Definition at line 407 of file ezmysqlschema.php.

References generateFieldDef().

## ◆ generateAddIndexSql()

eZMysqlSchema::generateAddIndexSql | ( |  | $table_name,
|  |  | $index_name,
|  |  | $def,
|  |  | $params,
|  |  | $isEmbedded = `false`
| ) |  |
| private

Definition at line 229 of file ezmysqlschema.php.

Referenced by generateTableSQL().

## ◆ generateAlterFieldSql()

eZMysqlSchema::generateAlterFieldSql | ( |  | $table_name,
|  |  | $field_name,
|  |  | $def,
|  |  | $params
| ) |  |
| private virtual

Implements eZDBSchemaInterface.

Definition at line 418 of file ezmysqlschema.php.

References generateFieldDef().

## ◆ generateDropIndexSql()

eZMysqlSchema::generateDropIndexSql | ( |  | $table_name,
|  |  | $index_name,
|  |  | $def,
|  |  | $params
| ) |  |
| private

Definition at line 329 of file ezmysqlschema.php.

## ◆ generateDropTable()

eZMysqlSchema::generateDropTable | ( |  | $table,
|  |  | $params
| ) |  |
| private

Definition at line 628 of file ezmysqlschema.php.

## ◆ generateFieldDef()

eZMysqlSchema::generateFieldDef | ( |  | $field_name,
|  |  | $def,
|  | & | $skip_primary,
|  |  | $params = `null`
| ) |  |
| private

Definition at line 348 of file ezmysqlschema.php.

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

## ◆ generateTableOption()

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

  $optionType | The type of option, the supported ones are: delay_key_write - If $optionValue is true then adds DELAY_KEY_WRITE=1

Definition at line 556 of file ezmysqlschema.php.

Referenced by generateTableSQL().

## ◆ generateTableSchema()

eZMysqlSchema::generateTableSchema | ( |  | $tableName,
|  |  | $table,
|  |  | $params
| ) |  |
| virtual

Note
  Calls generateTableSQL() with $asArray set to `false`

Implements eZDBSchemaInterface.

Definition at line 429 of file ezmysqlschema.php.

References generateTableSQL().

## ◆ generateTableSQL()

eZMysqlSchema::generateTableSQL | ( |  | $tableName,
|  |  | $tableDef,
|  |  | $params,
|  |  | $asArray,
|  |  | $separateTypes = `false`
| ) |  |
| private

Parameters

  $asArray | If `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 449 of file ezmysqlschema.php.

References generateAddIndexSql(), generateFieldDef(), generateTableOption(), tableCharsetName(), and tableStorageTypeName().

Referenced by generateTableSchema(), and generateTableSQLList().

## ◆ generateTableSQLList()

eZMysqlSchema::generateTableSQLList | ( |  | $tableName,
|  |  | $table,
|  |  | $params,
|  |  | $separateTypes
| ) |  |
| virtual

Note
  Calls generateTableSQL() with $asArray set to `true`

Implements eZDBSchemaInterface.

Definition at line 437 of file ezmysqlschema.php.

References generateTableSQL().

## ◆ isMultiInsertSupported()

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

## ◆ parseType()

eZMysqlSchema::parseType | ( |  | $type_info,
|  | & | $length_info
| ) |  |

Definition at line 214 of file ezmysqlschema.php.

Referenced by fetchTableFields().

## ◆ schema()

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

  $params | supported options are 'meta_data' and 'format'

Returns
  DB schema array

Implements eZDBSchemaInterface.

Definition at line 20 of file ezmysqlschema.php.

References eZDBSchemaInterface\$Schema, fetchTableFields(), fetchTableIndexes(), and eZDBSchemaInterface\transformSchema().

## ◆ schemaName()

eZMysqlSchema::schemaName | ( |  | ) |
| virtual

Returns
  Displayable name for schema type as string. Examples: 'MySQL', 'PostgreSQL', 'Oracle'

See also
  schemaType()

Implements eZDBSchemaInterface.

Definition at line 666 of file ezmysqlschema.php.

## ◆ schemaType()

eZMysqlSchema::schemaType | ( |  | ) |
| virtual

Returns
  Identifier for schema type as string. Examples: 'mysql', 'postgresql', 'oracle'

See also
  schemaName()

Implements eZDBSchemaInterface.

Definition at line 661 of file ezmysqlschema.php.

## ◆ tableCharsetName()

eZMysqlSchema::tableCharsetName | ( |  | $charset | ) |

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

Definition at line 572 of file ezmysqlschema.php.

References eZCharsetInfo\realCharsetCode().

Referenced by generateTableSQL().

## ◆ tableStorageTypeName()

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

Referenced by generateTableSQL().

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

- ezmysqlschema.php

Copyright © 1998 – 2026 7x. All rights reserved. Licensed under the GNU GPLv2+.