[ Index ]

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

title

Body

[close]

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

(no description)

File Size: 574 lines (27 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class

XMLDBpostgres7:: (16 methods):
  XMLDBpostgres7()
  getTypeSQL()
  getEnumExtraSQL()
  getCommentSQL()
  getRenameTableExtraSQL()
  getAddFieldSQL()
  getAlterFieldSQL()
  getRenameFieldExtraSQL()
  getCreateEnumSQL()
  getDropEnumSQL()
  getCreateDefaultSQL()
  getDropDefaultSQL()
  getCheckConstraintsFromDB()
  getSequenceFromDB()
  isNameInUse()
  getReservedWords()


Class: XMLDBpostgres7  - X-Ref

XMLDBpostgres7()   X-Ref
Creates one new XMLDBpostgres7


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


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


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


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


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
PostgreSQL is pretty standard but with one severe restriction under 7.4 that forces us to overload
this function: Default clause is not allowed when adding fields.

This function can be safely removed once min req. for PG will be 8.0

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
PostgreSQL has some severe limits:
- Any change of type or precision requires a new temporary column to be created, values to
be transfered potentially casting them, to apply defaults if the column is not null and
finally, to rename it
- Changes in null/not null require the SET/DROP NOT NULL clause
- Changes in default require the SET/DROP DEFAULT clause


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


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


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()


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


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 returns one array with all the check constrainsts
in the table (fetched from DB)
Optionally the function allows one xmldb_field to be specified in
order to return only the check constraints belonging to one field.
Each element contains the name of the constraint and its description
If no check constraints are found, returns an empty array


getSequenceFromDB($xmldb_table)   X-Ref
Given one XMLDBTable returns one string with the sequence of the table
in the table (fetched from DB)
The sequence name for Postgres has one standard name convention:
tablename_fieldname_seq
so we just calculate it and confirm it's present in pg_class
If no sequence is found, returns false


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)
(invoked from getNameForObject()


getReservedWords()   X-Ref
Returns an array of reserved words (lowercase) for this DB




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