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

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 958)
mixed $database_server = "Generic" (line 954)
mixed $database_version = 0 (line 955)
mixed $functions = array() (line 960)
mixed $indexes = array() (line 959)
mixed $sequences = array() (line 957)
mixed $tables = array() (line 956)
mixed $triggers = array() (line 961)

Inherited Variables

Inherited from SchemaObject

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

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

Add a constraint to the schema information.

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

Add a function to the schema information.

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

Add a sequence to the schema information.

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

Add a table to the schema information.

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

Add a trigger to the schema information.

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

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

Returns true if named constraint exists.

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

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

Dump this entire schema description to stdout.

void dump ()
getconstraint (line 1117)

Returns constraint object of given name

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

Returns function object of given name

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

Returns index object of given name

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

Acquire all of the schema details.

Override this method for your specific database type.

void getschema ()
getschema_table (line 1011)

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

Returns seqeuence object of given name

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

Populates schema sequences.

Override this method for your specific database type.

void getsequences ()

Redefined in descendants as:
gettable (line 1112)

Returns table object of given name

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

Populates schema tables.

Override this method for your specific database type.

void gettables ()

Redefined in descendants as:
gettrigger (line 1158)

Returns trigger object of given name

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

Populates schema triggers.

Override this method for your specific database type.

void gettriggers ()

Redefined in descendants as:
getversion (line 1023)

Acquire the database version.

Override this method for your specific database type.

void getversion ()

Redefined in descendants as:
index_exists (line 1173)

Returns true if named index exists.

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

Set the database version

void set_dbversion (mixed $ver)

Inherited Methods

Inherited From SchemaObject

 SchemaObject::SchemaObject()

Documentation generated by phpDocumentor 1.3.0RC3