Class schema

Description

Class describing a database schema. This object hold ALL the information

for the named database including tables, constraints, functions, triggers and sequences. Methods are provided, however to allow you to obtain the information for an individual table (@see getschema_table()), rather than having to read in the whole schema. For all other info, you must use the getschema() method to read all information in, then access it via the arrays and methods provided.

Located in /schema-defs.php (line 915)

SchemaObject
   |
   --schema
Direct descendents
Class Description
 class DB_schema Class describing a Postgres database schema.
Variable Summary
 mixed $constraints
 mixed $functions
 mixed $indexes
 mixed $sequences
 mixed $tables
 mixed $triggers
Method Summary
 schema schema (mixed $name)
 void addconstraint (mixed $schemaobj)
 void addfunction (mixed $schemaobj)
 void addsequence (mixed $schemaobj)
 void addtable (mixed $schemaobj)
 void addtrigger (mixed $schemaobj)
 void capable_of ([mixed $capability = ""])
 void constraint_exists (mixed $name)
 string diff (object $schema)
 void dump ()
 void getconstraint (mixed $name)
 void getfunction (mixed $name)
 void getindex (mixed $name)
 void getschema ()
 void getschema_table (string $tablename)
 void getsequence (mixed $name)
 void getsequences ()
 void gettable (mixed $name)
 void gettables ()
 void gettrigger (mixed $name)
 void gettriggers ()
 void getversion ()
 void index_exists (mixed $name)
 void set_dbversion (mixed $ver)
Variables
mixed $constraints = array() (line 919)
mixed $database_version = 0 (line 916)
mixed $functions = array() (line 921)
mixed $indexes = array() (line 920)
mixed $sequences = array() (line 918)
mixed $tables = array() (line 917)
mixed $triggers = array() (line 922)

Inherited Variables

Inherited from SchemaObject

SchemaObject::$name
SchemaObject::$schema
Methods
Constructor schema (line 929)

Create a schema (database) of given name. The name should be a valid existing database name that is currently connected. It will be selected to ensure the correct data is obtained.

schema schema (mixed $name)
addconstraint (line 1053)

Add a constraint to the schema information.

void addconstraint (mixed $schemaobj)
addfunction (line 1059)

Add a function to the schema information.

void addfunction (mixed $schemaobj)
addsequence (line 1041)

Add a sequence to the schema information.

void addsequence (mixed $schemaobj)
addtable (line 1047)

Add a table to the schema information.

void addtable (mixed $schemaobj)
addtrigger (line 1065)

Add a trigger to the schema information.

void addtrigger (mixed $schemaobj)
capable_of (line 996)

Return database capabilities. There are specific capabilities which the diff code needs to query, and this method should be overridden in the specific database module to answer those questions.

void capable_of ([mixed $capability = ""])

Redefined in descendants as:
  • DB_schema::capable_of() : Return database capabilities. There are specific capabilities which the diff code needs to query, and this method should be overridden in the specific database module to answer those questions.
constraint_exists (line 1127)

Returns true if named constraint exists.

void constraint_exists (mixed $name)
diff (line 1167)

Produce the SQL required to morph the schema described in the passed dbschema object $db, into the schema we have in this current object.

The resulting SQL is commented. This virtual function is database specific.

  • return: The SQL required to make passed-in schema same as current
string diff (object $schema)
  • object $schema: The schema to morph into the current schema
dump (line 1137)

Dump this entire schema description to stdout.

void dump ()
getconstraint (line 1076)

Returns constraint object of given name

void getconstraint (mixed $name)
getfunction (line 1112)

Returns function object of given name

void getfunction (mixed $name)
getindex (line 1094)

Returns index object of given name

void getindex (mixed $name)
getschema (line 938)

Acquire all of the schema details.

Override this method for your specific database type.

void getschema ()
getschema_table (line 970)

Acquire the schema details of a specific database table. This method is provided to cater for the common requirement of acquiring details for a specific table, without having to endure the overhead of reading all of the database schema metadata to get it.

Override this method for your specific database type.

void getschema_table (string $tablename)
  • string $tablename: Name of the table to acquire schema of

Redefined in descendants as:
  • DB_schema::getschema_table() : Acquire the schema details of a specific Postgres table. This method is provided to cater for the common requirement of acquiring details for a specific table, without having to endure the overhead of reading all of the database schema metadata to get it.
getsequence (line 1122)

Returns seqeuence object of given name

void getsequence (mixed $name)
getsequences (line 959)

Populates schema sequences.

Override this method for your specific database type.

void getsequences ()

Redefined in descendants as:
gettable (line 1071)

Returns table object of given name

void gettable (mixed $name)
gettables (line 951)

Populates schema tables.

Override this method for your specific database type.

void gettables ()

Redefined in descendants as:
gettrigger (line 1117)

Returns trigger object of given name

void gettrigger (mixed $name)
gettriggers (line 955)

Populates schema triggers.

Override this method for your specific database type.

void gettriggers ()

Redefined in descendants as:
getversion (line 982)

Acquire the database version.

Override this method for your specific database type.

void getversion ()

Redefined in descendants as:
  • DB_schema::getversion() : Acquire the Postgres database version. We make some gross assumptions here with regard to standard local Postgres setup. Change as necessary.
index_exists (line 1132)

Returns true if named index exists.

void index_exists (mixed $name)
set_dbversion (line 987)

Set the database version

void set_dbversion (mixed $ver)

Inherited Methods

Inherited From SchemaObject

 SchemaObject::SchemaObject()

Documentation generated by phpDocumentor 1.3.0RC3