|
eZ Publish
[trunk]
|
This class provide interface for DB schema library. More...
Inheritance diagram for eZDBSchemaInterface:Public Member Functions | |
| appendSQLComments ($def, &$sql) | |
| data ($schema=false, $tableNameList=false, $params=array()) | |
| escapeSQLString ($value) | |
| eZDBSchemaInterface ($params) | |
| insertSchema ($params=array()) | |
| schema ($params=array()) | |
| schemaName () | |
| schemaType () | |
| validate () | |
| writeArraySchemaFile ($filename, $params=array()) | |
| writeSerializedSchemaFile ($filename, $params=array()) | |
| writeSQLSchemaFile ($filename, $params=array()) | |
| writeUpgradeFile ($differences, $filename, $params=array()) | |
Public Attributes | |
| $Data | |
| $DBInstance | |
| eZDB instance | |
| $Schema | |
Protected Member Functions | |
| fetchTableData ($tableInfo, $offset=false, $limit=false) | |
| generateAddFieldSql ($table_name, $field_name, $def, $params) | |
| generateAlterFieldSql ($table_name, $field_name, $def, $params) | |
| generateDataValueTextSQL ($fieldDef, $value) | |
| generateTableInsert ($tableName, $tableDef, $dataEntries, $params) | |
| generateTableInsertSQLList ($tableName, $tableDef, $dataEntries, $params, $withClosure=true) | |
| generateTableSchema ($tableName, $table, $params) | |
| generateTableSQLList ($tableName, $table, $params, $separateTypes) | |
| isMultiInsertSupported () | |
| transformData (&$data, $toLocal) | |
| transformSchema (&$schema, $toLocal) | |
Private Member Functions | |
| generateDataFile ($schema, $data, $params) | |
| generateDropFieldSql ($table_name, $field_name, $params) | |
| generateSchemaFile ($schema, $params=array()) | |
| generateUpgradeFile ($differences, $params=array()) | |
Static Private Member Functions | |
| loadSchemaTransformationRules ($schemaType) | |
This class provide interface for DB schema library.
Schema structure an array with Table structures, each key is the name of the table.
Table structure:
The removed entry will only be used when some comments have been added to the table. That way the comments can be added to the DROP TABLE statements.
Field structure:
false false means no default value.Index structure:
Index Types:
Field Types:
length to define number of digits.length to define number of digits.length for max length.length.When stored as a PHP array the schema structure will be placed in a variable called $schema. The data structure will be placed in $data.
Definition at line 61 of file ezdbschemainterface.php.
| eZDBSchemaInterface::appendSQLComments | ( | $ | def, |
| &$ | sql | ||
| ) |
Appends any comments found in $def to SQL text $sql as SQL comments.
true if any comments were added. Definition at line 858 of file ezdbschemainterface.php.
Referenced by generateUpgradeFile().
| eZDBSchemaInterface::data | ( | $ | schema = false, |
| $ | tableNameList = false, |
||
| $ | params = array() |
||
| ) |
Fetches the data for all tables and returns an array containing the data. Empty tables are skipped. NB: once the data is generated, it might be cached. Use the 'force_read' parameter to force regeneration of the data
| $schema | A schema definition array which defines tables to fetch from. If false it will call schema() to fetch it. |
| $tableNameList | An array with tables to include, will further narrow tables in $schema. Use false to fetch all tables. |
Reimplemented in eZLintSchema.
Definition at line 107 of file ezdbschemainterface.php.
Referenced by insertSchema(), writeArraySchemaFile(), writeSerializedSchemaFile(), and writeSQLSchemaFile().
| eZDBSchemaInterface::escapeSQLString | ( | $ | value | ) | [pure virtual] |
This escapes the string according to the current database type and returns it.
Implemented in eZPgsqlSchema, and eZMysqlSchema.
Definition at line 823 of file ezdbschemainterface.php.
Referenced by generateDataValueTextSQL().
| eZDBSchemaInterface::eZDBSchemaInterface | ( | $ | params | ) |
Constructor
Definition at line 68 of file ezdbschemainterface.php.
Referenced by eZLintSchema\eZLintSchema(), eZMysqlSchema\eZMysqlSchema(), and eZPgsqlSchema\eZPgsqlSchema().
| eZDBSchemaInterface::fetchTableData | ( | $ | tableInfo, |
| $ | offset = false, |
||
| $ | limit = false |
||
| ) | [protected] |
Fetches all rows for table defined in $tableInfo and returns this structure:
| $tableInfo | Table structure from schema definition. |
| $offset | Which offset to start from or false to start at top |
| $limit | How many rows to fetch or false for no limit. |
Definition at line 179 of file ezdbschemainterface.php.
Referenced by data().
| eZDBSchemaInterface::generateAddFieldSql | ( | $ | table_name, |
| $ | field_name, | ||
| $ | def, | ||
| $ | params | ||
| ) | [protected, pure virtual] |
Implemented in eZPgsqlSchema, eZLintSchema, and eZMysqlSchema.
Definition at line 840 of file ezdbschemainterface.php.
Referenced by generateUpgradeFile().
| eZDBSchemaInterface::generateAlterFieldSql | ( | $ | table_name, |
| $ | field_name, | ||
| $ | def, | ||
| $ | params | ||
| ) | [protected, pure virtual] |
Implemented in eZPgsqlSchema, eZLintSchema, and eZMysqlSchema.
Definition at line 832 of file ezdbschemainterface.php.
Referenced by generateUpgradeFile().
| eZDBSchemaInterface::generateDataFile | ( | $ | schema, |
| $ | data, | ||
| $ | params | ||
| ) | [private] |
| schema | database schema |
Reimplemented in eZLintSchema.
Definition at line 466 of file ezdbschemainterface.php.
Referenced by writeSQLSchemaFile().
| eZDBSchemaInterface::generateDataValueTextSQL | ( | $ | fieldDef, |
| $ | value | ||
| ) | [protected] |
Reimplemented in eZLintSchema.
Definition at line 792 of file ezdbschemainterface.php.
Referenced by generateTableInsertSQLList().
| eZDBSchemaInterface::generateDropFieldSql | ( | $ | table_name, |
| $ | field_name, | ||
| $ | params | ||
| ) | [private] |
Reimplemented in eZPgsqlSchema, and eZLintSchema.
Definition at line 847 of file ezdbschemainterface.php.
Referenced by generateUpgradeFile().
| eZDBSchemaInterface::generateSchemaFile | ( | $ | schema, |
| $ | params = array() |
||
| ) | [private] |
| schema | database schema |
Reimplemented in eZPgsqlSchema, and eZLintSchema.
Definition at line 497 of file ezdbschemainterface.php.
Referenced by writeSQLSchemaFile().
| eZDBSchemaInterface::generateTableInsert | ( | $ | tableName, |
| $ | tableDef, | ||
| $ | dataEntries, | ||
| $ | params | ||
| ) | [protected] |
Reimplemented in eZLintSchema.
Definition at line 661 of file ezdbschemainterface.php.
Referenced by generateDataFile().
| eZDBSchemaInterface::generateTableInsertSQLList | ( | $ | tableName, |
| $ | tableDef, | ||
| $ | dataEntries, | ||
| $ | params, | ||
| $ | withClosure = true |
||
| ) | [protected] |
Reimplemented in eZPgsqlSchema.
Definition at line 669 of file ezdbschemainterface.php.
Referenced by generateTableInsert(), and insertSchema().
| eZDBSchemaInterface::generateTableSchema | ( | $ | tableName, |
| $ | table, | ||
| $ | params | ||
| ) | [protected, pure virtual] |
Generates the necessary SQLs to create the table and returns them all in a string.
| $tableName | The table name |
| $table | The table structure, see class definition for more details |
Implemented in eZPgsqlSchema, eZMysqlSchema, and eZLintSchema.
Definition at line 651 of file ezdbschemainterface.php.
Referenced by generateSchemaFile(), and generateUpgradeFile().
| eZDBSchemaInterface::generateTableSQLList | ( | $ | tableName, |
| $ | table, | ||
| $ | params, | ||
| $ | separateTypes | ||
| ) | [protected, pure virtual] |
Generates the necessary SQLs to create the table and returns them all in an array.
| $tableName | The table name |
| $table | The table structure, see class definition for more details |
| $params | An associative array with optional parameters which controls the output of SQLs |
| $separateTypes | If true then the returned array must be an associative array containing the SQL arrays split into multiple groups. The groups are:
|
Implemented in eZPgsqlSchema, and eZMysqlSchema.
Definition at line 635 of file ezdbschemainterface.php.
Referenced by insertSchema().
| eZDBSchemaInterface::generateUpgradeFile | ( | $ | differences, |
| $ | params = array() |
||
| ) | [private] |
Reimplemented in eZLintSchema.
Definition at line 520 of file ezdbschemainterface.php.
Referenced by writeUpgradeFile().
| eZDBSchemaInterface::insertSchema | ( | $ | params = array() | ) |
Insert PHP schema to the current database instance by running one SQL at a time.
| $params | Optional parameter which controls what to insert:
|
false if the schema could not be inserted, true if successful Definition at line 380 of file ezdbschemainterface.php.
| eZDBSchemaInterface::isMultiInsertSupported | ( | ) | [protected] |
true if the schema system supports multi inserts. The default is to return false. Reimplemented in eZMysqlSchema, and eZLintSchema.
Definition at line 882 of file ezdbschemainterface.php.
Referenced by generateTableInsertSQLList().
| eZDBSchemaInterface::loadSchemaTransformationRules | ( | $ | schemaType | ) | [static, private] |
Definition at line 914 of file ezdbschemainterface.php.
Referenced by transformData(), and transformSchema().
| eZDBSchemaInterface::schema | ( | $ | params = array() | ) | [pure 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.
| $params | supported options are 'meta_data' and 'format' |
Implemented in eZPgsqlSchema, eZLintSchema, and eZMysqlSchema.
Definition at line 88 of file ezdbschemainterface.php.
Referenced by data(), insertSchema(), writeArraySchemaFile(), writeSerializedSchemaFile(), and writeSQLSchemaFile().
| eZDBSchemaInterface::schemaName | ( | ) | [pure virtual] |
Implemented in eZPgsqlSchema, eZMysqlSchema, and eZLintSchema.
Definition at line 905 of file ezdbschemainterface.php.
| eZDBSchemaInterface::schemaType | ( | ) | [pure virtual] |
Implemented in eZPgsqlSchema, eZMysqlSchema, and eZLintSchema.
Definition at line 894 of file ezdbschemainterface.php.
Referenced by transformData(), and transformSchema().
| eZDBSchemaInterface::transformData | ( | &$ | data, |
| $ | toLocal | ||
| ) | [protected] |
Transforms database data to the given direction, applying the transformation rules.
Definition at line 1317 of file ezdbschemainterface.php.
Referenced by data(), and writeSQLSchemaFile().
| eZDBSchemaInterface::transformSchema | ( | &$ | schema, |
| $ | toLocal | ||
| ) | [protected] |
Transforms database schema to the given direction, applying the transformation rules.
Definition at line 1046 of file ezdbschemainterface.php.
Referenced by data(), eZMysqlSchema\schema(), eZPgsqlSchema\schema(), and writeSQLSchemaFile().
Validates the current schema and returns true if it is correct or false if something must be fixed.
Reimplemented in eZLintSchema.
Definition at line 159 of file ezdbschemainterface.php.
| eZDBSchemaInterface::writeArraySchemaFile | ( | $ | filename, |
| $ | params = array() |
||
| ) |
Write PHP schema definition to file using PHP array structures.
| filename |
Definition at line 323 of file ezdbschemainterface.php.
| eZDBSchemaInterface::writeSerializedSchemaFile | ( | $ | filename, |
| $ | params = array() |
||
| ) |
Write PHP schema definition to file using PHP serialized format.
| filename |
Definition at line 283 of file ezdbschemainterface.php.
| eZDBSchemaInterface::writeSQLSchemaFile | ( | $ | filename, |
| $ | params = array() |
||
| ) |
Write SQL schema definition to file. The generated schema is always in 'local' format, as 'generic' SQL does not exist.
| filename |
Definition at line 243 of file ezdbschemainterface.php.
| eZDBSchemaInterface::writeUpgradeFile | ( | $ | differences, |
| $ | filename, | ||
| $ | params = array() |
||
| ) | [pure virtual] |
Write upgrade sql to file
| differences | array |
| filename |
Definition at line 217 of file ezdbschemainterface.php.
| eZDBSchemaInterface::$Data |
Definition at line 1374 of file ezdbschemainterface.php.
| eZDBSchemaInterface::$DBInstance |
eZDB instance
Definition at line 1372 of file ezdbschemainterface.php.
| eZDBSchemaInterface::$Schema |
Definition at line 1373 of file ezdbschemainterface.php.