|
eZ Publish
[trunk]
|
Provides lint checking of database schemas. More...
Inheritance diagram for eZLintSchema:
Collaboration diagram for eZLintSchema:Public Member Functions | |
| data ($schema=false, $tableNameList=false, $params=array()) | |
| eZLintSchema ($db, $otherSchema) | |
| generateAddFieldSql ($table, $field_name, $added_field, $params) | |
| generateAddIndexSql ($table, $index_name, $added_index, $params) | |
| generateAlterFieldSql ($table, $field_name, $changed_field, $params) | |
| generateDataFile ($schema, $data, $params) | |
| generateDataValueTextSQL ($fieldDef, $value) | |
| generateDropFieldSql ($table, $field_name, $params) | |
| generateDropIndexSql ($table, $index_name, $removed_index, $params) | |
| generateDropTable ($table, $params) | |
| generateSchemaFile ($schema, $params=array()) | |
| generateTableInsert ($tableName, $tableDef, $dataEntries, $params) | |
| generateTableSchema ($table, $tableDef, $params) | |
| generateUpgradeFile ($differences, $params=array()) | |
| isLintChecked () | |
| isMultiInsertSupported () | |
| otherSchema () | |
| schema ($params=array()) | |
| schemaName () | |
| schemaType () | |
| shortenIdentifier ($identifier, $limit, $shortenList) | |
| validate () | |
Public Attributes | |
| $CorrectSchema | |
| The corrected schema. | |
| $IsLintChecked | |
| Whether the schema has been checked or not. | |
| $OtherSchema | |
| eZDBSchemaInterface object which should be lint checked | |
Private Member Functions | |
| lintCheckSchema (&$schema) | |
Provides lint checking of database schemas.
Checks a given schema by going trough all tables, fields and indexes and corrects any mistakes. The result is a new schema which is returned in schema(). The new schema can then be used to diff against the original and output the changes.
The current rules apply:
The lint checker works by taking in another DB Schema object as parameter to the constructor. All calls will be forwarded to this object so it will work as though it were a real schema. The exception are the schema(), data() and validate() methods which makes sure the schema is correct.
To check if the schema has been checked yet call isLintChecked(). To fetch the DB schema which is checked use otherSchema().
Definition at line 40 of file ezlintschema.php.
| eZLintSchema::data | ( | $ | schema = false, |
| $ | tableNameList = false, |
||
| $ | params = array() |
||
| ) |
Forwards request to data() on the otherSchema() object.
Reimplemented from eZDBSchemaInterface.
Definition at line 397 of file ezlintschema.php.
| eZLintSchema::eZLintSchema | ( | $ | db, |
| $ | otherSchema | ||
| ) |
Initializes the lint checker with a foreign db schema.
| $db | A dummy parameter, pass false. |
| $otherSchema | The db schema that should be checked |
Definition at line 48 of file ezlintschema.php.
| eZLintSchema::generateAddFieldSql | ( | $ | table, |
| $ | field_name, | ||
| $ | added_field, | ||
| $ | params | ||
| ) | [virtual] |
Forwards request to generateAddFieldSql() on the otherSchema() object.
Implements eZDBSchemaInterface.
Definition at line 453 of file ezlintschema.php.
| eZLintSchema::generateAddIndexSql | ( | $ | table, |
| $ | index_name, | ||
| $ | added_index, | ||
| $ | params | ||
| ) |
Forwards request to generateAddIndexSql() on the otherSchema() object.
Definition at line 477 of file ezlintschema.php.
| eZLintSchema::generateAlterFieldSql | ( | $ | table, |
| $ | field_name, | ||
| $ | changed_field, | ||
| $ | params | ||
| ) | [virtual] |
Forwards request to generateAlterFieldSql() on the otherSchema() object.
Implements eZDBSchemaInterface.
Definition at line 461 of file ezlintschema.php.
| eZLintSchema::generateDataFile | ( | $ | schema, |
| $ | data, | ||
| $ | params | ||
| ) |
Forwards request to generateDataFile() on the otherSchema() object.
Reimplemented from eZDBSchemaInterface.
Definition at line 421 of file ezlintschema.php.
| eZLintSchema::generateDataValueTextSQL | ( | $ | fieldDef, |
| $ | value | ||
| ) |
Forwards request to generateDataValueTextSQL() on the otherSchema() object.
Reimplemented from eZDBSchemaInterface.
Definition at line 501 of file ezlintschema.php.
| eZLintSchema::generateDropFieldSql | ( | $ | table, |
| $ | field_name, | ||
| $ | params | ||
| ) |
Forwards request to generateDropFieldSql() on the otherSchema() object.
Reimplemented from eZDBSchemaInterface.
Definition at line 469 of file ezlintschema.php.
| eZLintSchema::generateDropIndexSql | ( | $ | table, |
| $ | index_name, | ||
| $ | removed_index, | ||
| $ | params | ||
| ) |
Forwards request to generateDropIndexSql() on the otherSchema() object.
Definition at line 485 of file ezlintschema.php.
| eZLintSchema::generateDropTable | ( | $ | table, |
| $ | params | ||
| ) |
Forwards request to generateDropTable() on the otherSchema() object.
Definition at line 445 of file ezlintschema.php.
| eZLintSchema::generateSchemaFile | ( | $ | schema, |
| $ | params = array() |
||
| ) |
Forwards request to generateSchemaFile() on the otherSchema() object.
Reimplemented from eZDBSchemaInterface.
Definition at line 405 of file ezlintschema.php.
| eZLintSchema::generateTableInsert | ( | $ | tableName, |
| $ | tableDef, | ||
| $ | dataEntries, | ||
| $ | params | ||
| ) |
Forwards request to generateTableInsert() on the otherSchema() object.
Reimplemented from eZDBSchemaInterface.
Definition at line 437 of file ezlintschema.php.
| eZLintSchema::generateTableSchema | ( | $ | table, |
| $ | tableDef, | ||
| $ | params | ||
| ) | [virtual] |
Forwards request to generateTableSchema() on the otherSchema() object.
Implements eZDBSchemaInterface.
Definition at line 429 of file ezlintschema.php.
| eZLintSchema::generateUpgradeFile | ( | $ | differences, |
| $ | params = array() |
||
| ) |
Forwards request to generateUpgradeFile() on the otherSchema() object.
Reimplemented from eZDBSchemaInterface.
Definition at line 413 of file ezlintschema.php.
true if the lint checker has been run on the schema. Definition at line 96 of file ezlintschema.php.
Forwards request to isMultiInsertSupported() on the otherSchema() object.
Reimplemented from eZDBSchemaInterface.
Definition at line 493 of file ezlintschema.php.
| eZLintSchema::lintCheckSchema | ( | &$ | schema | ) | [private] |
Goes trough all tables, fields and indexes and makes sure they have valid names.
false if something was fixed, true otherwise. Definition at line 131 of file ezlintschema.php.
Referenced by schema(), and validate().
Definition at line 88 of file ezlintschema.php.
| eZLintSchema::schema | ( | $ | params = array() | ) | [virtual] |
Runs the lint checker on the database schema in otherSchema() and returns the new schema that is correct.
Implements eZDBSchemaInterface.
Definition at line 60 of file ezlintschema.php.
| eZLintSchema::schemaName | ( | ) | [virtual] |
Forwards request to schemaName() on the otherSchema() object.
Implements eZDBSchemaInterface.
Definition at line 517 of file ezlintschema.php.
| eZLintSchema::schemaType | ( | ) | [virtual] |
Forwards request to schemaType() on the otherSchema() object.
Implements eZDBSchemaInterface.
Definition at line 509 of file ezlintschema.php.
| eZLintSchema::shortenIdentifier | ( | $ | identifier, |
| $ | limit, | ||
| $ | shortenList | ||
| ) |
Definition at line 104 of file ezlintschema.php.
Referenced by lintCheckSchema().
Runs lint checker on all tables, indexes and fields.
Reimplemented from eZDBSchemaInterface.
Definition at line 80 of file ezlintschema.php.
| eZLintSchema::$CorrectSchema |
The corrected schema.
Definition at line 526 of file ezlintschema.php.
| eZLintSchema::$IsLintChecked |
Whether the schema has been checked or not.
Definition at line 528 of file ezlintschema.php.
| eZLintSchema::$OtherSchema |
eZDBSchemaInterface object which should be lint checked
Definition at line 524 of file ezlintschema.php.