|
eZ Publish
[4.2]
|
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 83 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 870 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.
| $schema | A schema 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 $scema. Use false to fetch all tables. |
Reimplemented in eZLintSchema.
Definition at line 123 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 835 of file ezdbschemainterface.php.
Referenced by generateDataValueTextSQL().
| eZDBSchemaInterface::eZDBSchemaInterface | ( | $ | params | ) |
Constructor
Definition at line 90 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. |
| $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 192 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 852 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 844 of file ezdbschemainterface.php.
Referenced by generateUpgradeFile().
| eZDBSchemaInterface::generateDataFile | ( | $ | schema, |
| $ | data, | ||
| $ | params | ||
| ) | [private] |
| schema | database schema |
Reimplemented in eZLintSchema.
Definition at line 478 of file ezdbschemainterface.php.
Referenced by writeSQLSchemaFile().
| eZDBSchemaInterface::generateDataValueTextSQL | ( | $ | fieldDef, |
| $ | value | ||
| ) | [protected] |
Reimplemented in eZLintSchema.
Definition at line 804 of file ezdbschemainterface.php.
Referenced by generateTableInsertSQLList().
| eZDBSchemaInterface::generateDropFieldSql | ( | $ | table_name, |
| $ | field_name, | ||
| $ | params | ||
| ) | [private] |
Reimplemented in eZLintSchema.
Definition at line 859 of file ezdbschemainterface.php.
Referenced by generateUpgradeFile().
| eZDBSchemaInterface::generateSchemaFile | ( | $ | schema, |
| $ | params = array() |
||
| ) | [private] |
| schema | database schema |
Reimplemented in eZPgsqlSchema, and eZLintSchema.
Definition at line 509 of file ezdbschemainterface.php.
Referenced by writeSQLSchemaFile().
| eZDBSchemaInterface::generateTableInsert | ( | $ | tableName, |
| $ | tableDef, | ||
| $ | dataEntries, | ||
| $ | params | ||
| ) | [protected] |
Reimplemented in eZLintSchema.
Definition at line 673 of file ezdbschemainterface.php.
Referenced by generateDataFile().
| eZDBSchemaInterface::generateTableInsertSQLList | ( | $ | tableName, |
| $ | tableDef, | ||
| $ | dataEntries, | ||
| $ | params, | ||
| $ | withClosure = true |
||
| ) | [protected] |
Reimplemented in eZPgsqlSchema.
Definition at line 681 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 663 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 647 of file ezdbschemainterface.php.
Referenced by insertSchema().
| eZDBSchemaInterface::generateUpgradeFile | ( | $ | differences, |
| $ | params = array() |
||
| ) | [private] |
Reimplemented in eZLintSchema.
Definition at line 532 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 392 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 894 of file ezdbschemainterface.php.
Referenced by generateTableInsertSQLList().
| eZDBSchemaInterface::loadSchemaTransformationRules | ( | $ | schemaType | ) | [static, private] |
Definition at line 926 of file ezdbschemainterface.php.
Referenced by transformData(), and transformSchema().
| eZDBSchemaInterface::schema | ( | $ | params = array() | ) | [pure virtual] |
Get SQL db schema
Implemented in eZPgsqlSchema, eZLintSchema, and eZMysqlSchema.
Definition at line 107 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 917 of file ezdbschemainterface.php.
| eZDBSchemaInterface::schemaType | ( | ) | [pure virtual] |
Implemented in eZPgsqlSchema, eZMysqlSchema, and eZLintSchema.
Definition at line 906 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 1329 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 1058 of file ezdbschemainterface.php.
Referenced by data(), eZMysqlSchema\schema(), eZPgsqlSchema\schema(), and writeSQLSchemaFile().
| eZDBSchemaInterface::validate | ( | ) |
Validates the current schema and returns true if it is correct or false if something must be fixed.
Reimplemented in eZLintSchema.
Definition at line 172 of file ezdbschemainterface.php.
| eZDBSchemaInterface::writeArraySchemaFile | ( | $ | filename, |
| $ | params = array() |
||
| ) |
Write PHP schema definition to file using PHP array structures.
| filename |
Definition at line 339 of file ezdbschemainterface.php.
| eZDBSchemaInterface::writeSerializedSchemaFile | ( | $ | filename, |
| $ | params = array() |
||
| ) |
Write PHP schema definition to file using PHP serialized format.
| filename |
Definition at line 301 of file ezdbschemainterface.php.
| eZDBSchemaInterface::writeSQLSchemaFile | ( | $ | filename, |
| $ | params = array() |
||
| ) |
Write SQL schema definition to file
| filename |
Definition at line 263 of file ezdbschemainterface.php.
| eZDBSchemaInterface::writeUpgradeFile | ( | $ | differences, |
| $ | filename, | ||
| $ | params = array() |
||
| ) | [pure virtual] |
Write upgrade sql to file
| differences | array |
| filename |
Definition at line 238 of file ezdbschemainterface.php.
| eZDBSchemaInterface::$Data |
Definition at line 1386 of file ezdbschemainterface.php.
| eZDBSchemaInterface::$DBInstance |
eZDB instance
Definition at line 1384 of file ezdbschemainterface.php.
| eZDBSchemaInterface::$Schema |
Definition at line 1385 of file ezdbschemainterface.php.