Public Method Details |
define_table |
public void define_table( string $table, array $fields )
|
|
Define columns of a table.
The field types are described by array over array that hold variousinformation about each column:array (array ('field_info' => 'data', # Field A'field_info' => 'data'),array ('field_info' => 'data', # Field B'field_info' => 'data'),#...);Each column description must contain the following field infos:'n' - Name't' - SQL typeOptional:'i' - Index is created for faster lookups if true.'e' - Extended type from dbi/types.phpTODO: Generic primary key handling.
|
Parameter |
|
string |
$table |
|
|
Table name. |
|
|
array |
$fields |
|
|
Array of field descriptions. |
|
Returns |
void |
|
types |
public array types( [ string $table ] )
|
|
Return array of extended field description of a $table.
|
Parameter |
|
string |
$table |
= >>''<< |
|
Table name. |
|
Returns |
array Array of types for each field keyed by name. If the
table name is empty, an array of all type arrays is
returned which is keyed by table names. |
|
set_ref |
public void set_ref( string $table, string $ref_table, string $ref_id )
|
|
Define a cross-table reference.
When using multi-delete, all records that point to a record which isdeleted, they are also removed.This way you can create a tree structure by letting a table point toitself.
|
Parameter |
|
string |
$table |
|
|
Name of table that holds the reference. |
|
|
string |
$ref_table |
|
|
Name of the column that holds the primary key's value of the
referenced row. |
|
|
string |
$ref_id |
|
|
Name of the table that is referenced. The table's primary key
must be defined using set_primary(). |
|
Returns |
void |
|
ref_table |
public string ref_table( string $table )
|
|
Get name of a parent table.
|
Parameter |
|
string |
$table |
|
|
Table name. |
|
Returns |
string Name of the parent table. |
|
ref_id |
public string ref_id( string $table )
|
|
Get name of field with reference to a parent record.
|
Parameter |
|
string |
$table |
|
|
Table name. |
|
Returns |
string Name of the field in $table. |
|
set_listref |
public void set_listref( string $table, string $id_last, string $id_next )
|
|
Define the reference fields to siblings of rows in a table.
|
Parameter |
|
string |
$table |
|
|
The table name. |
|
|
string |
$id_last |
|
|
Column name that holds the primary key of the
previous row. |
|
|
string |
$id_next |
|
|
Column name that holds the primary key of the
next row. |
|
Returns |
void |
|
is_list |
public void is_list( string $table )
|
|
Determine if a table holds lists (defined using set_listref ())
|
Parameter |
|
string |
$table |
|
|
The table name. |
|
Returns |
void |
|
set_xref |
public void set_xref( string $table, string $xref_table )
|
|
Define n:n reference table.
|
Parameter |
|
string |
$table |
|
|
The table name. |
|
|
string |
$xref_table |
|
|
The reference table name. |
|
Returns |
void |
|
xref_table |
public string xref_table( string $table )
|
|
Get name of n:n reference table.
|
Parameter |
|
string |
$table |
|
|
The table name. |
|
Returns |
string Reference Table name. |
|
prev_of |
public string prev_of( string $table )
|
|
Get name of field that points to the previous row in a list.
|
Parameter |
|
string |
$table |
|
|
The table name. |
|
Returns |
string Field name. |
|
next_of |
public string next_of( string $table )
|
|
Get name of field that points to the next row in a list.
|
Parameter |
|
string |
$table |
|
|
The table name. |
|
Returns |
string Field name. |
|
set_primary |
public void set_primary( string $table, string $primary )
|
|
Define field name for a table's primary key.
|
Parameter |
|
string |
$table |
|
|
The table name. |
|
|
string |
$primary |
|
|
Primary field name. |
|
Returns |
void |
|
primary |
public string primary( string $table )
|
|
Get field name of primary key.
|
Parameter |
|
string |
$table |
|
|
The table name. |
|
Returns |
string Primary field name. |
|