[ Index ]

PHP Cross Reference of Moodle 1.9.3 [Build 15-Oct-2008]

title

Body

[close]

/lib/xmldb/classes/generators/ -> XMLDBGenerator.class.php (summary)

(no description)

File Size: 1224 lines (51 kb)
Included or required: 1 time
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class

XMLDBgenerator:: (45 methods):
  XMLDBgenerator()
  setPrefix()
  getTableName()
  getCreateTableSQL()
  getCreateIndexSQL()
  getFieldSQL()
  getKeySQL()
  getDefaultValue()
  getDefaultClause()
  getRenameTableSQL()
  getDropTableSQL()
  getAddFieldSQL()
  getDropFieldSQL()
  getAlterFieldSQL()
  getModifyEnumSQL()
  getModifyDefaultSQL()
  getRenameFieldSQL()
  getAddKeySQL()
  getDropKeySQL()
  getRenameKeySQL()
  getAddIndexSQL()
  getDropIndexSQL()
  getRenameIndexSQL()
  getNameForObject()
  getEncQuoted()
  getExecuteInsertSQL()
  getConcatSQL()
  getEndedStatements()
  getSequenceFromDB()
  isNameInUse()
  getTypeSQL()
  getEnumSQL()
  getEnumExtraSQL()
  getRenameFieldExtraSQL()
  getCreateSequenceSQL()
  getCommentSQL()
  getRenameTableExtraSQL()
  getDropTableExtraSQL()
  getDropEnumSQL()
  getCreateEnumSQL()
  getDropDefaultSQL()
  getCheckConstraintsFromDB()
  getCreateDefaultSQL()
  getReservedWords()
  getTablesWithoutPrefix()


Class: XMLDBgenerator  - X-Ref

XMLDBgenerator()   X-Ref
Creates one new XMLDBGenerator


setPrefix($prefix)   X-Ref
Set the prefix


getTableName($xmldb_table, $quoted = true)   X-Ref
Given one XMLDBTable, returns it's correct name, depending of all the parametrization

param: XMLDBTable table whose name we want
param: boolean to specify if the name must be quoted (if reserved word, only!)
return: string the correct name of the table

getCreateTableSQL($xmldb_table)   X-Ref
Given one correct XMLDBTable, returns the SQL statements
to create it (inside one array)


getCreateIndexSQL($xmldb_table, $xmldb_index)   X-Ref
Given one correct XMLDBIndex, returns the SQL statements
needed to create it (in array)


getFieldSQL($xmldb_field, $skip_type_clause = false, $skip_default_clause = false, $skip_notnull_clause = false)   X-Ref
Given one correct XMLDBField, returns the complete SQL line to create it


getKeySQL($xmldb_table, $xmldb_key)   X-Ref
Given one correct XMLDBKey, returns its specs


getDefaultValue($xmldb_field)   X-Ref
Give one XMLDBField, returns the correct "default value" for the current configuration


getDefaultClause($xmldb_field)   X-Ref
Given one XMLDBField, returns the correct "default clause" for the current configuration


getRenameTableSQL($xmldb_table, $newname)   X-Ref
Given one correct XMLDBTable and the new name, returns the SQL statements
to rename it (inside one array)


getDropTableSQL($xmldb_table)   X-Ref
Given one correct XMLDBTable and the new name, returns the SQL statements
to drop it (inside one array)


getAddFieldSQL($xmldb_table, $xmldb_field)   X-Ref
Given one XMLDBTable and one XMLDBField, return the SQL statements needded to add the field to the table


getDropFieldSQL($xmldb_table, $xmldb_field)   X-Ref
Given one XMLDBTable and one XMLDBField, return the SQL statements needded to drop the field from the table


getAlterFieldSQL($xmldb_table, $xmldb_field)   X-Ref
Given one XMLDBTable and one XMLDBField, return the SQL statements needded to alter the field in the table


getModifyEnumSQL($xmldb_table, $xmldb_field)   X-Ref
Given one XMLDBTable and one XMLDBField, return the SQL statements needded to modify the enum of the field in the table


getModifyDefaultSQL($xmldb_table, $xmldb_field)   X-Ref
Given one XMLDBTable and one XMLDBField, return the SQL statements needded to modify the default of the field in the table


getRenameFieldSQL($xmldb_table, $xmldb_field, $newname)   X-Ref
Given one correct XMLDBField and the new name, returns the SQL statements
to rename it (inside one array)


getAddKeySQL($xmldb_table, $xmldb_key)   X-Ref
Given one XMLDBTable and one XMLDBKey, return the SQL statements needded to add the key to the table
note that undelying indexes will be added as parametrised by $xxxx_keys and $xxxx_index parameters


getDropKeySQL($xmldb_table, $xmldb_key)   X-Ref
Given one XMLDBTable and one XMLDBIndex, return the SQL statements needded to drop the index from the table


getRenameKeySQL($xmldb_table, $xmldb_key, $newname)   X-Ref
Given one XMLDBTable and one XMLDBKey, return the SQL statements needded to rename the key in the table
Experimental! Shouldn't be used at all!


getAddIndexSQL($xmldb_table, $xmldb_index)   X-Ref
Given one XMLDBTable and one XMLDBIndex, return the SQL statements needded to add the index to the table


getDropIndexSQL($xmldb_table, $xmldb_index)   X-Ref
Given one XMLDBTable and one XMLDBIndex, return the SQL statements needded to drop the index from the table


getRenameIndexSQL($xmldb_table, $xmldb_index, $newname)   X-Ref
Given one XMLDBTable and one XMLDBIndex, return the SQL statements needded to rename the index in the table
Experimental! Shouldn't be used at all!


getNameForObject($tablename, $fields, $suffix='')   X-Ref
Given three strings (table name, list of fields (comma separated) and suffix),
create the proper object name quoting it if necessary.

IMPORTANT: This function must be used to CALCULATE NAMES of objects TO BE CREATED,
NEVER TO GUESS NAMES of EXISTING objects!!!

getEncQuoted($input)   X-Ref
Given any string (or one array), enclose it by the proper quotes
if it's a reserved word


getExecuteInsertSQL($statement)   X-Ref
Given one XMLDB Statement, build the needed SQL insert sentences to execute it


getConcatSQL($elements)   X-Ref
Given one array of elements, build de proper CONCAT expresion, based
in the $concat_character setting. If such setting is empty, then
MySQL's CONCAT function will be used instead


getEndedStatements($input)   X-Ref
Given one string (or one array), ends it with statement_end


getSequenceFromDB($xmldb_table)   X-Ref
Returns the name (string) of the sequence used in the table for the autonumeric pk
Only some DB have this implemented


isNameInUse($object_name, $type, $table_name)   X-Ref
Given one object name and it's type (pk, uk, fk, ck, ix, uix, seq, trg)
return if such name is currently in use (true) or no (false)
(MySQL requires the whole XMLDBTable object to be specified, so we add it always)
(invoked from getNameForObject()
Only some DB have this implemented


getTypeSQL($xmldb_type, $xmldb_length=null, $xmldb_decimals=null)   X-Ref
Given one XMLDB Type, lenght and decimals, returns the DB proper SQL type


getEnumSQL($xmldb_field)   X-Ref
Given one XMLDB Field, return its enum SQL to be added inline with the column definition


getEnumExtraSQL($xmldb_table, $xmldb_field)   X-Ref
Returns the code needed to create one enum for the xmldb_table and xmldb_field passes


getRenameFieldExtraSQL($xmldb_table, $xmldb_field)   X-Ref
Returns the code (array of statements) needed to execute extra statements on field rename


getCreateSequenceSQL($xmldb_table, $xmldb_field)   X-Ref
Returns the code (array of statements) needed
to create one sequence for the xmldb_table and xmldb_field passes


getCommentSQL($xmldb_table)   X-Ref
Returns the code (array of statements) needed to add one comment to the table


getRenameTableExtraSQL($xmldb_table)   X-Ref
Returns the code (array of statements) needed to execute extra statements on table rename


getDropTableExtraSQL($xmldb_table)   X-Ref
Returns the code (array of statements) needed to execute extra statements on table drop


getDropEnumSQL($xmldb_table, $xmldb_field)   X-Ref
Given one XMLDBTable and one XMLDBField, return the SQL statements needded to drop its enum
(usually invoked from getModifyEnumSQL()


getCreateEnumSQL($xmldb_table, $xmldb_field)   X-Ref
Given one XMLDBTable and one XMLDBField, return the SQL statements needded to add its enum
(usually invoked from getModifyEnumSQL()


getDropDefaultSQL($xmldb_table, $xmldb_field)   X-Ref
Given one XMLDBTable and one XMLDBField, return the SQL statements needded to drop its default
(usually invoked from getModifyDefaultSQL()


getCheckConstraintsFromDB($xmldb_table, $xmldb_field=null)   X-Ref
Given one XMLDBTable and one optional XMLDBField, return one array with all the check
constrainst found for that table (or field). Must exist for each DB supported.
(usually invoked from find_check_constraint_name)


getCreateDefaultSQL($xmldb_table, $xmldb_field)   X-Ref
Given one XMLDBTable and one XMLDBField, return the SQL statements needded to add its default
(usually invoked from getModifyDefaultSQL()


getReservedWords()   X-Ref
Returns an array of reserved words (lowercase) for this DB
You MUST provide the real list for each DB inside every XMLDB class


getTablesWithoutPrefix()   X-Ref
Returns an array of tables to be built without prefix (lowercase)
It's enough to keep updated here this function.




Generated: Wed Jan 14 11:33:29 2009 Cross-referenced by PHPXref 0.7