Class dbtable

Description

Class describing a database table.

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

SchemaObject
   |
   --dbtable
Direct descendents
Class Description
 class DB_dbtable Class describing a Postgres database table. Inherits the standard dbtable class properties and methods, but adds in the getschema specifics for acquiring Postgres table info from the metadata, and provides a specific create() method.
Variable Summary
 mixed $constraints
 mixed $fields
 mixed $indexes
 mixed $pkey
Method Summary
 dbtable dbtable (mixed &$schema, string $name, array $pkey, integer $dbversion)
 void addcolumn (mixed $column)
 void addfield (mixed $field)
 void create ()
 void drop ()
 void dropcolumn (mixed $column)
 void dump ()
 void getfield (mixed $name)
 void getfieldbynum (mixed $num)
 void getfieldnum (mixed $fieldname)
 void getlabelfield ([$pattern $pattern = ""])
 void getschema ()
 void newfield (mixed $name, mixed $num, mixed $type, [mixed $default = ""], [mixed $notnull = false])
 void setdefault (mixed $column)
 void setnullconstraint (mixed $column)
Variables
mixed $constraints = array() (line 718)

Array of constraints on this table

mixed $fields = array() (line 716)

Array of field objects

mixed $indexes = array() (line 720)

Array of indexes on this table

mixed $pkey = array() (line 714)

Array of field attnum's which are primary keys in table

Inherited Variables

Inherited from SchemaObject

SchemaObject::$name
SchemaObject::$schema
Methods
Constructor dbtable (line 728)

Construct a table of given name and array of primary key fields.

dbtable dbtable (mixed &$schema, string $name, array $pkey, integer $dbversion)
  • string $name: The name of the table
  • array $pkey: The array of pkeys is actually a list of integers, each being the enumerated order of the field which is part of the key.
  • integer $dbversion: Optional database version information
addcolumn (line 865)

Return SQL which will create a column in this table. The $column passed in is actually a field object.

void addcolumn (mixed $column)

Redefined in descendants as:
  • DB_dbtable::addcolumn() : Return SQL which will create a column in this table. The $column passed in is actually a field object.
addfield (line 739)

Add a field to the table.

void addfield (mixed $field)
create (line 842)

Return the SQL which will create this table.

void create ()

Redefined in descendants as:
drop (line 897)

Return the SQL to drop this table.

void drop ()
dropcolumn (line 890)

Return SQL to drop a column from the table. The $column passed is actually a field object.

void dropcolumn (mixed $column)
dump (line 825)

Dump the table description to stdout.

void dump ()
getfield (line 798)

Returns field object of given name

void getfield (mixed $name)
getfieldbynum (line 750)

Returns field object of given attnum (order number)

void getfieldbynum (mixed $num)
getfieldnum (line 758)

Returns field number of given field name

void getfieldnum (mixed $fieldname)
getkeyfieldnames (line 803)

Returns list of names of keyfields as array

void getkeyfieldnames ()
getlabelfield (line 773)

Returns a candidate label field name according to some fairly simple heuristics. This would be a field suitable for displaying in a listbox which is somewhat more informative than a keyfield. If nothing is found then the key is used as fallback.

void getlabelfield ([$pattern $pattern = ""])
  • $pattern $pattern: Extra pattern to use in matching likely fieldnames
getnonkeyfieldnames (line 814)

Returns list of names of non-keyfields as array

void getnonkeyfieldnames ()
getschema (line 736)

Acquires the schema from database metadata.

NB: Override this function to get schema info per DB type.

void getschema ()

Redefined in descendants as:
newfield (line 744)

Create a new field in the table with given parameters.

void newfield (mixed $name, mixed $num, mixed $type, [mixed $default = ""], [mixed $notnull = false])

Redefined in descendants as:
setdefault (line 872)

Return SQL to set the default for given field on this table.

void setdefault (mixed $column)
setnullconstraint (line 880)

Return SQL to set the NULL/NOT NULL constraint..

void setnullconstraint (mixed $column)

Redefined in descendants as:

Inherited Methods

Inherited From SchemaObject

 SchemaObject::SchemaObject()

Documentation generated by phpDocumentor 1.3.0RC3