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 Class describing a database schema.
Variable Summary
Method Summary
 schema schema (string $name, [string $dbserver = "Generic"])
 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 920)
mixed $database_server = "Generic" (line 916)
mixed $database_version = 0 (line 917)
mixed $functions = array() (line 922)
mixed $indexes = array() (line 921)
mixed $sequences = array() (line 919)
mixed $tables = array() (line 918)
mixed $triggers = array() (line 923)

Inherited Variables

Inherited from SchemaObject

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

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 (string $name, [string $dbserver = "Generic"])
  • string $name: Name of this particular database
  • string $dbserver: Database server, eg. 'Postgresql', or 'Oracle'
addconstraint (line 1056)

Add a constraint to the schema information.

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

Add a function to the schema information.

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

Add a sequence to the schema information.

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

Add a table to the schema information.

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

Add a trigger to the schema information.

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

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 = ""])
constraint_exists (line 1130)

Returns true if named constraint exists.

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

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

Dump this entire schema description to stdout.

void dump ()
getconstraint (line 1079)

Returns constraint object of given name

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

Returns function object of given name

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

Returns index object of given name

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

Acquire all of the schema details.

Override this method for your specific database type.

void getschema ()
getschema_table (line 973)

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
getsequence (line 1125)

Returns seqeuence object of given name

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

Populates schema sequences.

Override this method for your specific database type.

void getsequences ()

Redefined in descendants as:
gettable (line 1074)

Returns table object of given name

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

Populates schema tables.

Override this method for your specific database type.

void gettables ()

Redefined in descendants as:
gettrigger (line 1120)

Returns trigger object of given name

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

Populates schema triggers.

Override this method for your specific database type.

void gettriggers ()

Redefined in descendants as:
getversion (line 985)

Acquire the database version.

Override this method for your specific database type.

void getversion ()

Redefined in descendants as:
index_exists (line 1135)

Returns true if named index exists.

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

Set the database version

void set_dbversion (mixed $ver)

Inherited Methods

Inherited From SchemaObject

 SchemaObject::SchemaObject()

Documentation generated by phpDocumentor 1.3.0RC3