Class dbtable

Description

Class describing a database table.

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

SchemaObject
   |
   --dbtable
Direct descendents
Class Description
 class Class describing a database table. Inherits the standard dbtable class properties and methods, but adds in the getschema specifics for acquiring table info from the metadata for this DB, 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 getorderfield ([$pattern $pattern = ""])
 void getschema ()
 void newfield (mixed $name, mixed $num, mixed $type, [mixed $defaultval = ""], [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 894)

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

void addcolumn (mixed $column)
addfield (line 739)

Add a field to the table.

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

Return the SQL which will create this table.

void create ()
drop (line 935)

Return the SQL to drop this table.

void drop ()
dropcolumn (line 928)

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

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

Dump the table description to stdout.

void dump ()
getfield (line 827)

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

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

Returns list of names of non-keyfields as array

void getnonkeyfieldnames ()
getorderfield (line 802)

Returns a candidate ordering field name according to some fairly simple heuristics. If nothing is found then a labelfield is used as fallback.

void getorderfield ([$pattern $pattern = ""])
  • $pattern $pattern: Extra pattern to use in matching likely fieldnames
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 $defaultval = ""], [mixed $notnull = false])
setdefault (line 901)

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

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

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

void setnullconstraint (mixed $column)

Inherited Methods

Inherited From SchemaObject

 SchemaObject::SchemaObject()

Documentation generated by phpDocumentor 1.3.0RC3