ILIAS  Release_5_0_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
ilADTMultiDBBridge Class Reference
+ Inheritance diagram for ilADTMultiDBBridge:
+ Collaboration diagram for ilADTMultiDBBridge:

Public Member Functions

 readRecord (array $a_row)
 Import DB values to ADT.
 prepareInsert (array &$a_fields)
 Prepare ADT values for insert.
 afterInsert ()
 After insert hook to enable sub-tables.
 afterUpdate ()
 After update hook to enable sub-tables.
 afterDelete ()
 After delete hook to enable sub-tables.
- Public Member Functions inherited from ilADTDBBridge
 __construct (ilADT $a_adt)
 Constructor.
 getADT ()
 Get ADT.
 setTable ($a_table)
 Set table name.
 getTable ()
 Get table name.
 setElementId ($a_value)
 Set element id (aka DB column[s] [prefix])
 getElementId ()
 Get element id.
 setPrimary (array $a_value)
 Set primary fields (in MDB2 format)
 getPrimary ()
 Get primary fields.
 buildPrimaryWhere ()
 Convert primary keys array to sql string.
 prepareUpdate (array &$a_fields)
 Prepare ADT values for update.

Protected Member Functions

 getSubTableName ()
 Build sub-table name.
 readMultiRecord ($a_set)
 Import record-rows from sub-table.
 prepareMultiInsert ()
 Build insert-fields for each "value".
- Protected Member Functions inherited from ilADTDBBridge
 isValidADT (ilADT $a_adt)
 Check if given ADT is valid.
 setADT (ilADT $a_adt)
 Set ADT.

Additional Inherited Members

- Protected Attributes inherited from ilADTDBBridge
 $adt
 $table
 $id
 $primary

Detailed Description

Definition at line 5 of file class.ilADTMultiDBBridge.php.

Member Function Documentation

ilADTMultiDBBridge::afterDelete ( )

After delete hook to enable sub-tables.

Reimplemented from ilADTDBBridge.

Definition at line 72 of file class.ilADTMultiDBBridge.php.

References $ilDB, ilADTDBBridge\buildPrimaryWhere(), and getSubTableName().

{
global $ilDB;
$ilDB->manipulate("DELETE FROM ".$this->getSubTableName().
" WHERE ".$this->buildPrimaryWhere());
}

+ Here is the call graph for this function:

ilADTMultiDBBridge::afterInsert ( )

After insert hook to enable sub-tables.

Reimplemented from ilADTDBBridge.

Definition at line 43 of file class.ilADTMultiDBBridge.php.

References afterUpdate().

{
$this->afterUpdate();
}

+ Here is the call graph for this function:

ilADTMultiDBBridge::afterUpdate ( )

After update hook to enable sub-tables.

Reimplemented from ilADTDBBridge.

Definition at line 48 of file class.ilADTMultiDBBridge.php.

References $ilDB, ilADTDBBridge\buildPrimaryWhere(), ilADTDBBridge\getPrimary(), getSubTableName(), and prepareMultiInsert().

Referenced by afterInsert().

{
global $ilDB;
// :TODO: build diff, save difference
$ilDB->manipulate("DELETE FROM ".$this->getSubTableName().
" WHERE ".$this->buildPrimaryWhere());
foreach($this->prepareMultiInsert() as $sub_items)
{
$fields = array_merge($this->getPrimary(), $sub_items);
$ilDB->insert($this->getSubTableName(), $fields);
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilADTMultiDBBridge::getSubTableName ( )
protected

Build sub-table name.

Returns
string

Definition at line 14 of file class.ilADTMultiDBBridge.php.

References ilADTDBBridge\getElementId(), and ilADTDBBridge\getTable().

Referenced by afterDelete(), and afterUpdate().

{
return $this->getTable()."_".$this->getElementId();
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilADTMultiDBBridge::prepareInsert ( array &  $a_fields)

Prepare ADT values for insert.

Parameters
array&$a_fields

Reimplemented from ilADTDBBridge.

Reimplemented in ilADTMultiEnumDBBridge.

Definition at line 38 of file class.ilADTMultiDBBridge.php.

{
// see afterUpdate()
}
ilADTMultiDBBridge::prepareMultiInsert ( )
abstractprotected

Build insert-fields for each "value".

Returns
array

Reimplemented in ilADTMultiEnumDBBridge, and ilADTMultiTextDBBridge.

Referenced by afterUpdate().

+ Here is the caller graph for this function:

ilADTMultiDBBridge::readMultiRecord (   $a_set)
abstractprotected

Import record-rows from sub-table.

Parameters
object$a_set

Reimplemented in ilADTMultiEnumDBBridge, and ilADTMultiTextDBBridge.

Referenced by readRecord().

+ Here is the caller graph for this function:

ilADTMultiDBBridge::readRecord ( array  $a_row)

Import DB values to ADT.

Parameters
array$a_row

Reimplemented from ilADTDBBridge.

Reimplemented in ilADTMultiEnumDBBridge.

Definition at line 19 of file class.ilADTMultiDBBridge.php.

References $ilDB, and readMultiRecord().

{
global $ilDB;
$sql = "SELECT ".$this->getElementId().
" FROM ".$this->getSubTableName().
" WHERE ".$this->buildPrimaryWhere();
$set = $ilDB->query($sql);
$this->readMultiRecord($set);
}

+ Here is the call graph for this function:


The documentation for this class was generated from the following file: