Packageindex Classtrees Modulegroups Elementlist Report XML Files

File: ../phpdbedittk/dbmodel.php
PHPDBEditTk -

table_relations

table_relations

Capsules the relations between tables in the data model. This is used

 

private class table_relations

Capsules the relations between tables in the data model. This is used
by gadm_command to handle the editing of foreign keys accordingly

 

Public Method Summary

void

table_relations(string &$table_relations_bu)

constructor function
void

process_table_rel()

Process table relations
string

get_f_table(string $table, string $fieldname, array $row)

Returns the table a foreign key in a table points to
array

get_first_f_table(string $table, array $currrow)

returns the an assotiative array with the first table which is
string

get_fkey_by_subtable(string $toptable, string $subtable)

returns the name of an fkey for a referenced table. This is used to look up
array

get_sub_tables(string $table)

returns a partition of the top down view: an array with all tables that
int

get_src_complexity(string $table, string $fieldname)

Get src complexity of the relation.
string

get_zero_src_complexity_text(string $table, string $fieldname)

Get src complexity text
array

get_filter(string $table, string $fieldname, $datarow)

Returns the filter definitions for the relationship.

Private Field Summary

array

$tr_bu

Array that holds all information for foreign keys in a
array

$tr_td

Array that holds all information for foreign keys in a

Public Method Details

table_relations

public void table_relations( string &$table_relations_bu )

  constructor function
references the global table relations array and produces atop down view in $this->tr_td

Parameter
string &$table_relations_bu
The name of the table relations array. This is a reference, so that they can be changed, after first instantiating the object
Returns void


process_table_rel

public void process_table_rel( )

  Process table relations
Build a top-down array from the table relations, which are in bottom up format.This has been separated from the constructor, so that it can be called from a function,if the table defintions have been changed.

Returns void


get_f_table

public string get_f_table( string $table, string $fieldname, array $row )

  Returns the table a foreign key in a table points to
get_f_table uses the bottom-up relationship array to determine the targettable. If the foreign key points to multiple tables, it looks up, which tableis set in the row.

Parameter
string $table
the table where the foreign key is in
string $fieldname
the name of the foreign key
array $row
the complete row of the table where the foreign key is in.
Returns string

The table where the fkex points to.


get_first_f_table

public array get_first_f_table( string $table, array $currrow )

  returns the an assotiative array with the first table which is
referenced by a foreign key and the name of that key.get_first_f_table is used, when we want to traverse the table relationfrom bottom to top. If currrow is empty, always the first table is used.If there are multiple tables for a fkey, the first one is used.If currrow is set, then the table of multiple tables is determined fromthe content of currrow.

Parameter
string $table
the table we want to use the foreign key from
array $currrow
the current data row in that table
Returns array

: with the following entries - tablename the first fkey points to - the field name of the fkey


get_fkey_by_subtable

public string get_fkey_by_subtable( string $toptable, string $subtable )

  returns the name of an fkey for a referenced table. This is used to look up
rows in a table which contains a foreign key

Parameter
string $toptable
the name of the table which contains the primary key
string $subtable
the name of the table which contains the foreign key
Returns string

: the fkey name


get_sub_tables

public array get_sub_tables( string $table )

  returns a partition of the top down view: an array with all tables that
point a foreign key to this table (subtables).

Parameter
string $table
: the table the foreign keys point to
Returns array

: array with table names as key and the foreign key field name as value.


get_src_complexity

public int get_src_complexity( string $table, string $fieldname )

  Get src complexity of the relation.
This is just read from the definitions table

Parameter
string $table
the table the foreign key is in
string $fieldname
the name of the foreign key
Returns int

: The complexity (UML term) on the src of the relationship. "1", if not defined.


get_zero_src_complexity_text

public string get_zero_src_complexity_text( string $table, string $fieldname )

  Get src complexity text
Just read from the table.Returns the text for the 0-complexity of the relation on the fkey side and "-- none --" if notdefined

Parameter
string $table
the table the foreign key is in
string $fieldname
the name of the foreign key
Returns string

: The text which is displayed in the select-tag for "0" complexity


get_filter

public array get_filter( string $table, string $fieldname, $datarow )

  Returns the filter definitions for the relationship.

Parameter
string $table
: the table the foreign key is in
string $fieldname
: the name of the foreign key
$datarow
Warning: documentation is missing.
Returns array $datarow

: Returns the filter for a foreign key table


Private Field Details

$tr_bu

private array $tr_bu

>><<

Array that holds all information for foreign keys in a
"bottom-up" view. The data is stored in a structured associative arrayThe main array contains the table where the foreign key resides as anarray key and an array of all foreign keys in this table.The array of foreign keys has the name of the foreign key as an arraykey and all necessary data as the valueThe value of each foreign key data is an array again. The key/value pairs are:- 'table' : The table the foreign key points to. If there aremultiple tables, use 'multiple'- 'src_complexity' : The complexity of the relation on the foreign key side.Values are "0" : the foreign key can be set"1" : the foreign key must be set: This value can be omitted and is then set to "1"- zero_src_complexity_text : For the src complexity of 0, this defines the textshown in the selector. If it is not set, the text is setto "-- none --".- 'tgt_complexity' : The complexity on the primary key side. Not supported yet.- 'allowed_tables' : simple array of table names, if foreign key points todifferent tables- 'table_field' : the field which is used to determine the table to point to.the content of table_field is a short table name. The array$history_type_to_table is used to translate into the table name.- filter : This allows to run a filter on the rows of the foreign table.Filters are defined as an ass. array, which key is the name ofthe field to be filtered and whichs value is the operator andThe value.


$tr_td

private array $tr_td

>><<

Array that holds all information for foreign keys in a
"bottom-up" view. The data is stored in a structured assiciative array.This array is constructed from the bottom-up array in the constructor function.The description is omitted, because it is private



Packageindex Classtrees Modulegroups Elementlist Report XML Files
PHPDoc 1.0beta