ILIAS  Release_5_0_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
ilADTDBBridge Class Reference

ADT DB bridge base class. More...

+ Inheritance diagram for ilADTDBBridge:
+ Collaboration diagram for ilADTDBBridge:

Public Member Functions

 __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.
 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.
 prepareUpdate (array &$a_fields)
 Prepare ADT values for update.
 afterUpdate ()
 After update hook to enable sub-tables.
 afterDelete ()
 After delete hook to enable sub-tables.

Protected Member Functions

 isValidADT (ilADT $a_adt)
 Check if given ADT is valid.
 setADT (ilADT $a_adt)
 Set ADT.

Protected Attributes

 $adt
 $table
 $id
 $primary

Detailed Description

ADT DB bridge base class.

Author
Jörg Lützenkirchen luetz.nosp@m.enki.nosp@m.rchen.nosp@m.@lei.nosp@m.fos.c.nosp@m.om
Version
$Id$

Definition at line 11 of file class.ilADTDBBridge.php.

Constructor & Destructor Documentation

ilADTDBBridge::__construct ( ilADT  $a_adt)

Constructor.

Parameters
ilADT$a_adt
Returns
self

Definition at line 24 of file class.ilADTDBBridge.php.

References setADT().

{
$this->setADT($a_adt);
}

+ Here is the call graph for this function:

Member Function Documentation

ilADTDBBridge::afterDelete ( )

After delete hook to enable sub-tables.

Reimplemented in ilADTGroupDBBridge, and ilADTMultiDBBridge.

Definition at line 198 of file class.ilADTDBBridge.php.

{
}
ilADTDBBridge::afterInsert ( )

After insert hook to enable sub-tables.

Reimplemented in ilADTGroupDBBridge, and ilADTMultiDBBridge.

Definition at line 171 of file class.ilADTDBBridge.php.

{
}
ilADTDBBridge::afterUpdate ( )

After update hook to enable sub-tables.

Reimplemented in ilADTGroupDBBridge, and ilADTMultiDBBridge.

Definition at line 190 of file class.ilADTDBBridge.php.

{
}
ilADTDBBridge::buildPrimaryWhere ( )

Convert primary keys array to sql string.

See Also
ilADTActiveRecord (:TODO: needed for multi)
Returns
string

Definition at line 135 of file class.ilADTDBBridge.php.

References $ilDB.

Referenced by ilADTMultiDBBridge\afterDelete(), and ilADTMultiDBBridge\afterUpdate().

{
global $ilDB;
$sql = array();
foreach($this->primary as $field => $def)
{
$sql[] = $field."=".$ilDB->quote($def[1], $def[0]);
}
return implode(" AND ", $sql);
}

+ Here is the caller graph for this function:

ilADTDBBridge::getPrimary ( )

Get primary fields.

Returns
array

Definition at line 124 of file class.ilADTDBBridge.php.

References $primary.

Referenced by ilADTMultiDBBridge\afterUpdate(), ilADTGroupDBBridge\prepareElements(), and ilADTGroupDBBridge\setPrimary().

{
}

+ Here is the caller graph for this function:

ilADTDBBridge::getTable ( )

Get table name.

Returns
string

Definition at line 84 of file class.ilADTDBBridge.php.

References $table.

Referenced by ilADTMultiDBBridge\getSubTableName(), ilADTGroupDBBridge\prepareElements(), and ilADTGroupDBBridge\setTable().

{
return $this->table;
}

+ Here is the caller graph for this function:

ilADTDBBridge::isValidADT ( ilADT  $a_adt)
abstractprotected

Check if given ADT is valid.

:TODO: This could be avoided with type-specifc constructors :TODO: bridge base class?

Parameters
ilADT$a_adt

Reimplemented in ilADTMultiEnumDBBridge, ilADTGroupDBBridge, ilADTBooleanDBBridge, ilADTDateDBBridge, ilADTDateTimeDBBridge, ilADTEnumDBBridge, ilADTFloatDBBridge, ilADTIntegerDBBridge, ilADTLocationDBBridge, ilADTMultiTextDBBridge, and ilADTTextDBBridge.

Referenced by setADT().

+ Here is the caller graph for this function:

ilADTDBBridge::prepareInsert ( array &  $a_fields)
abstract

Prepare ADT values for insert.

Parameters
array&$a_fields

Reimplemented in ilADTGroupDBBridge, ilADTMultiEnumDBBridge, ilADTMultiDBBridge, ilADTDateDBBridge, ilADTDateTimeDBBridge, ilADTLocationDBBridge, ilADTBooleanDBBridge, ilADTFloatDBBridge, ilADTIntegerDBBridge, ilADTEnumDBBridge, and ilADTTextDBBridge.

Referenced by prepareUpdate().

+ Here is the caller graph for this function:

ilADTDBBridge::prepareUpdate ( array &  $a_fields)

Prepare ADT values for update.

See Also
prepareInsert()
Parameters
array&$a_fields

Definition at line 182 of file class.ilADTDBBridge.php.

References prepareInsert().

{
$this->prepareInsert($a_fields);
}

+ Here is the call graph for this function:

ilADTDBBridge::readRecord ( array  $a_row)
abstract
ilADTDBBridge::setADT ( ilADT  $a_adt)
protected

Set ADT.

Exceptions
Exception
Parameters
ilADT$a_adt

Definition at line 49 of file class.ilADTDBBridge.php.

References isValidADT().

Referenced by __construct().

{
if(!$this->isValidADT($a_adt))
{
throw new Exception('ADTDBBridge Type mismatch.');
}
$this->adt = $a_adt;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilADTDBBridge::setElementId (   $a_value)

Set element id (aka DB column[s] [prefix])

Parameters
string$a_value

Definition at line 94 of file class.ilADTDBBridge.php.

{
$this->id = (string)$a_value;
}
ilADTDBBridge::setPrimary ( array  $a_value)

Set primary fields (in MDB2 format)

Parameters
array$a_value

Reimplemented in ilADTGroupDBBridge.

Definition at line 114 of file class.ilADTDBBridge.php.

{
$this->primary = $a_value;
}
ilADTDBBridge::setTable (   $a_table)

Set table name.

Parameters
string$a_table

Reimplemented in ilADTGroupDBBridge.

Definition at line 74 of file class.ilADTDBBridge.php.

{
$this->table = (string)$a_table;
}

Field Documentation

ilADTDBBridge::$adt
protected

Definition at line 13 of file class.ilADTDBBridge.php.

Referenced by getADT().

ilADTDBBridge::$id
protected

Definition at line 15 of file class.ilADTDBBridge.php.

Referenced by getElementId().

ilADTDBBridge::$primary
protected

Definition at line 16 of file class.ilADTDBBridge.php.

Referenced by getPrimary().

ilADTDBBridge::$table
protected

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

Referenced by getTable().


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