Class DBMS_TABLEOBJ

Description

Implements interfaces:

Base class DBMS_TABLEOBJ to handel table data in an object

  • author: Peter Krebs (pk) <pitlinz@users.sourceforge.net>
  • version: pk-05-11-17
  • version: pk-04-01-02
  • version: pk-08-01-31
  • version: $Id: DBMS_TABLEOBJ.phpclass,v 1.60 2008/12/17 16:28:52 peterkrebs Exp $
  • project: Open CSP-Management
  • license: GNU Public License

Located in /db/DBMS_TABLEOBJ.phpclass (line 46)

OCSP_OBJ
   |
   --DBMS_TABLEOBJ
Direct descendents
Class Description
 class AUDIENCE Class file AUDIENCE.phpclass
 class ADDRESS Base class DBMS_TABLEOBJ to handel table data in an object
 class CLIENT Class CLIENT
 class CLI_PROFILE_ENTRY Class file CLI_PROFILE_ENTRY.phpclass
 class CLI_STAFF Class file CLI_STAFF.phpclass
 class CLI_STAFF_TYPE Class file CLI_STAFF_TYPE.phpclass
 class CLI_STATE Class file CLI_STATE.phpclass
 class CLI_TYPE Class file CLI_TYPE.phpclass
 class TMPL_CHAPTER openCSP class TMPL_CHAPTER
Abstract class CMS_TABLEOBJ Abstract Class CMS_TABLEOBJ
 class DBMS_TREE_NODE Base class DBMS_TABLEOBJ to handel table data in an object
 class DBMS_JOINOBJ openCSP class DBMS_JOINOBJ
Abstract class DBMS_SIMPLETREE openCSP class DBMS_SIMPLETREE
 class DBMS_TREE ABSTRACT class DBMS_TREE to handel table tree data in an object
 class MED_MIMETYPE Class MED_MIMETYPE
 class MED_TABLEOBJ Abstract Class MED_TABLEOBJ
 class OCSP_MODULE openCSP class OCSP_MODULE uses the singleton pattern
 class OCSP_MOD_CONF openCSP class OCSP_MOD_CONF
 class PRO_PART openCSP class PRO_PART
 class PRO_PARTTYPE Class PRO_PARTTYPE
 class PRO_PRODTYPE Class PRO_PRODTYPE
 class PRO_PRODUCT openCSP class PRO_PRODUCT
 class PRO_GROUP openCSP class PRO_GROUP
 class PRO_GROUP_TYPE openCSP class PRO_GROUP_TYPE
 class PRO_PROD_TYPE openCSP class PRO_PROD_TYPE
 class PRO_PART_TYPE openCSP class PRO_PART_TYPE
 class SHOP_ORDER openCSP class SHOP_ORDER
 class SHOP_ORDERITEM openCSP class SHOP_ORDERITEM
 class OCSP_USER Base class DBMS_TABLEOBJ to handel table data in an object
 class OCSP_GROUP Class class OCSP_GROUP handles T_SYS_GROUP
Class Constant Summary
 CLASS_SRC_FILE = __FILE__
Variable Summary
 static mixed $dbTableDefinitions
 static mixed $staticClassVars
 string $autoIncFld
 double $initTS
 double $myCacheTS
 mixed $myFields
 array $myKeys
 int $myMode
 array $myObjVals
 mixed $myTable
 boolean $objError
 string $objErrorMsg
 double $populateTS
 double $valChangeTS
Method Summary
 DBMS_TABLEOBJ DBMS_TABLEOBJ ([$tblName $tblName = ""], [$debug $debug = False])
 void cacheRestore ([ $debug = False])
 bool cacheWriteTo ([boolean $debug = False])
 void clearErrors ()
 void dbDelete ([ $backupData = False], [ $debug = False])
 array dbGetDataArray (array $tables, [array $filter = NULL], [boolean $withObjVars = True], [boolean $debug = False])
 DBMS_FORM &dbGetForm (int $mode, [string $frmName = ""], [boolean $debug = False], [ $autoNew = False], boolean $autonew)
 int dbInsert ([boolean $debug = False])
 boolean dbPopulate ([boolean $debug = False], string $gDBIDX)
 boolean dbReplace ([boolean $debug = False], [boolean $ignorPopulated = False])
 mixed dbSave ([boolean $debug = False], string $gDBIDX)
 void db_SetKey (string $kName, mixed $kValue, [boolean $debug = False])
 void db_SetKeyArray (array $keyArray, [boolean $debug = False])
 string getClassInclude ([boolean $debug = False])
 array getDbDesc ([ $debug = False])
 mixed getDBField (string $aColumn, [boolean $debug = False], [boolean $autoPopulate = True])
 array getDBRow ([boolean $withoutNull = True], [boolean $debug = False], [boolean $withoutOV = False], [boolean $fldAutoPopulate = True])
 array getDBVal ([boolean $setFIELDS = False], [boolean $debug = False], [boolean $withObjVars = True])
 array getDefaults ([boolean $debug = False])
 string getErrorMsg ()
 mixed getFieldDBDefault (string $aField)
 OCSP_FORM &getForm ([int $mode = FRM_MODE_READONLY], [mixed $form = ''], [ $frmClass = 'OCSP_FORM'], [boolean $debug = False])
 string getFormClassName ()
 string getFormName ()
 string getJSON ([boolean $debug = False])
 array getKeyArr ([bolean $debug = False])
 string getMyTable ()
 array getObjValArray ([boolean $debug = False])
 void getObjValValue (string $name, [boolean $autoPopulate = True], [boolean $debug = False])
 int getPopulateTs ()
 string getWhere ([boolean $debug = False])
 boolean hasChanged ()
 boolean hasColumn (string $colName)
 boolean hasErrors ()
 boolean hasObjVals ()
 void init ([boolean $debug = False], [boolean $noCache = False])
 boolean isInit ()
 boolean isPopulated ()
 boolean keysAreSet ([boolean $debug = False])
 boolean populateFromKeys (array $keys, [boolean $debug = False])
 boolean populateFromValues (array $arrValues, [boolean $debug = False])
 int populateObjVals ([boolean $debug = False])
 bool p_cacheIsExpired ([boolean $debug = False])
 boolean saveLinkedRow (string $table, array $row, string $cmd, [boolean $debug = False])
 boolean saveLinkedTableRows (boolean $debug)
 int saveObjVals ([boolean $clearFirst = False], [boolean $debug = False], string $gDBIDX)
 void setChanged ([boolean $debug = False])
 void setDBField (string $aField, mixed $aValue, [boolean $debug = False], [boolean $strict = False])
 void setDBFieldIfDiff (string $aField, mixed $aValue, [boolean $debug = False])
 void setDBFieldIfEmpty (string $aField, mixed $aValue, [boolean $debug = False])
 boolean setDBRow (array $row, [boolean $asPopulated = True], [boolean $debug = False])
 void setDBVal (array $valArr, [boolean $debug = False])
 void setDefaults ([boolean $debug = False])
 void setError (string $errMsg)
 void setLinkedTableRow (string $tblName, string $dbCmd, array $aRow, [boolean $debug = False])
 boolean setMyTable (string $aTblName, [boolean $debug = False])
 void setObjValArray (array $valArr, [boolean $debug = False])
 void setObjValValue (string $key, string $val, [boolean $debug = False])
 boolean setObjVarIfEmpty (string $varName, mixed $value)
 void setUnChanged ([boolean $debug = False])
 void userIsAllowed ( $mode)
 void writeDebugInfo ([boolean $fullMode = False])
 bool &xmladdDOMElement (mixed &$domObj,  &$domRoot, [boolean $base64 = True], [boolean $debug = False], string $domRoot)
 bool xmlExport ([string $xmlfile = ""], [boolean $base64 = True], [boolean $debug = False])
 string _getCacheFileName ()
 boolean _getDBFields ([boolean $debug = False])
Variables
static mixed $dbTableDefinitions = array() (line 69)

array of already seen tables definitions

  • staticvar: array $dbTableDefinitions:
  • since: pk-08-03-11
static mixed $staticClassVars = array('myClassSrcFile') (line 61)
  • staticvar: array $staticClassVars: vars which must not be copied
  • access: protected

Redefinition of:
OCSP_OBJ::$staticClassVars
string $autoIncFld = "" (line 82)
  • var: name of the auto incremental column
  • access: protected
array $frmPostSubOjects = NULL (line 166)
  • var: stru
  • since: pk-08-03-07
bool $hasObjVals = False (line 128)
  • since: pk-05-07-13
  • access: protected
double $initTS = 0 (line 122)
  • var: linux timestamp when DB_TBLOBJ::init() was called
  • access: protected
double $myCacheTS (line 92)
  • var: linux timestamp of the cache file
  • access: protected
mixed $myFields = NULL (line 78)
  • staticvar: array $myFields: array of db column description
  • access: protected
array $myKeys = array() (line 74)
  • var: array of db primary key columns
  • access: protected
array $myLinkedTableRows = array() (line 157)

array of linked (joined) table rows

this is used if a form has subtables or joins which are not directly implemented in the table object class to change this values on insert,update or delete

structure of the array:

  • [tableName][]
  • - [ROW] => array COL => VALUE
  • - [OBJ] => DBMS_TABLEOBJ
  • - [CMD] => one of _OCSP_DBCMD_* cmd

  • access: protected
int $myMode = FRM_MODE_READONLY (line 97)
  • var: editing mode FRM_MODE_*
  • access: protected
array $myObjVals = array() (line 134)
  • since: pk-05-07-13
  • access: protected
double $myObjValsPopulateTS (line 140)
  • since: pk-05-07-13
  • access: protected
boolean $objError = False (line 108)
  • var: obj has errors
  • access: protected
string $objErrorMsg = "" (line 112)
  • var: obj error message
  • access: protected
double $populateTS = 0 (line 117)
  • var: linux timestamp when DB_TBLOBJ::dbPopulateDB() was called
  • access: protected
double $valChangeTS = 1 (line 103)
  • var: timestamp values changed
  • since: pk-03-10-25
  • access: protected

Inherited Variables

Inherited from OCSP_OBJ

OCSP_OBJ::$global_currentUser
OCSP_OBJ::$global_defaultDBObj_read
OCSP_OBJ::$global_defaultDBObj_write
OCSP_OBJ::$myDBObj
Methods
Constructor DBMS_TABLEOBJ (line 178)

constructor

  • since: pk-04-12-21
DBMS_TABLEOBJ DBMS_TABLEOBJ ([$tblName $tblName = ""], [$debug $debug = False])
  • $tblName $tblName
  • $debug $debug
cacheRestore (line 2282)
  • access: protected
void cacheRestore ([ $debug = False])
  • $debug
cacheWriteTo (line 2228)

PROTECTED cache object to filesystem

writes CLASS Variables to class Cache-File

  • return: False if an error occured or cacheing is disabled
  • version: pk-05-07-13
bool cacheWriteTo ([boolean $debug = False])
  • boolean $debug
clearErrors (line 2051)

clears all errors

void clearErrors ()

Redefined in descendants as:
dbDelete (line 1002)
void dbDelete ([ $backupData = False], [ $debug = False])
  • $backupData
  • $debug

Implementation of:
INFA_DBMS_TABLEOBJ::dbDelete()
deletes the row from the database

Redefined in descendants as:
dbGetDataArray (line 1883)

returns the the data array of a joins to the current row

requirements:

  • $this->myTable must have an autoIncFld
  • the foreign table must have a column called like $this->autoIncFld
  • getDBField($this->autoIncFld) must return a value
NOTE treats the join like 1:1 key means only the first matching row is returned

  • todo: DBMS_TABLEOBJ::dbGetDataArray() check the filter if the columns exists in foreign table
  • since: pk-07-08-27
array dbGetDataArray (array $tables, [array $filter = NULL], [boolean $withObjVars = True], [boolean $debug = False])
  • array $tables
  • array $filter: (array(COLUMN => VALUE))
  • boolean $withObjVars
  • boolean $debug

Redefined in descendants as:
dbGetForm (line 1535)

returns a database form

  • version: pk-05-11-29 if $frmName like 'ID:000' it is asumed to be the form id
  • version: pk-05-01-31
  • version: pk-05-11-22
  • deprecated: since pk-07-08-16
  • requires: __OCSP_PHPINCPATH__."db/forms/forms.phpinc";
DBMS_FORM &dbGetForm (int $mode, [string $frmName = ""], [boolean $debug = False], [ $autoNew = False], boolean $autonew)
  • int $mode: dbms form show mode
  • string $frmName: dbms form name
  • boolean $debug: since pk-05-01-11
  • boolean $autonew: generate a default form if no form is found
  • $autoNew

Redefined in descendants as:
dbInsert (line 813)

inserts a new row to the table

  • return: returns the autoIncFld ID if exists or 1 on success
  • version: pk-03-10-25
  • version: pk-03-10-22
  • version: pk-04-12-21
  • version: pk-06-01-24
  • version: pk-07-08-17
  • version: pk-08-03-07 linkedTables
int dbInsert ([boolean $debug = False])
  • boolean $debug: show debug info

Implementation of:
INFA_DBMS_TABLEOBJ::dbInsert()
inserts a new row to the table

Redefined in descendants as:
dbPopulate (line 606)

populates the object values form the database

  • return: found row ?
  • version: pk-07-06-01
  • since: pk-03-12-18 calls $this->setDBRow() to set the object values
boolean dbPopulate ([boolean $debug = False], string $gDBIDX)
  • string $gDBIDX: GLOBAL ARRAY INDEX OF DB OBJECT
  • boolean $debug: SHOW DEBUG INFO

Redefined in descendants as:
dbReplace (line 890)

replaces a row in the table

if the object has not been populated (!$this->populateTS) False is returned

  • version: pk-03-10-22
  • version: pk-07-08-17
  • version: pk-07-12-06 $ignorPopulated added
boolean dbReplace ([boolean $debug = False], [boolean $ignorPopulated = False])
  • boolean $debug: show debug info
  • boolean $ignorPopulated: (if False the table MUST have been populated)

Implementation of:
INFA_DBMS_TABLEOBJ::dbReplace()
replaces a row in the table

Redefined in descendants as:
dbSave (line 729)

save the Object if $this->autoIncFld is not empty

if (!empty($this->{$this->autoIncFld})) dbReplace is called else dbInsert

overwrite in child classes to addopt to your needs

  • version: pk-03-10-18
  • version: pk-05-11-19 bugfix if no autoIncFld call replace
  • version:

    pk-05-12-29 debug bugfix

    history

    • pk-03-10-18: parame changed $mode -> $gDBIDX="USRDB",$debug=False

mixed dbSave ([boolean $debug = False], string $gDBIDX)
  • string $gDBIDX: GLOBAL ARRAY INDEX OF DB OBJECT
  • boolean $debug: SHOW DEBUG INFO

Implementation of:
INFA_DBMS_TABLEOBJ::dbSave()
save the Object

Redefined in descendants as:
db_SetKey (line 353)
void db_SetKey (string $kName, mixed $kValue, [boolean $debug = False])
  • string $kName
  • mixed $kValue
  • boolean $debug: since pk-06-05-28
db_SetKeyArray (line 337)

sets an array with keys

  • version: pk-06-05-28
void db_SetKeyArray (array $keyArray, [boolean $debug = False])
  • array $keyArray
  • boolean $debug: since pk-06-05-28
getClassInclude (line 310)

returns the class source file if $this->classSrcFile is set

add the following code to your class:

  1.   / **
  2.    * source file of the class
  3.    *
  4.    * @staticvar string $classSrcFile
  5.    * @since pk-07-09-17
  6.    * /
  7.   protected $classSrcFile=__FILE__;

  • version: pk-08-03-02
  • since: pk-07-09-17
  • access: public
string getClassInclude ([boolean $debug = False])
  • boolean $debug
getDbDesc (line 447)

returns the dbDesc array ($this->myFields);

  • since: pk-04-08-31
array getDbDesc ([ $debug = False])
  • $debug
getDBField (line 1264)

returns the value of a db column

NOTE no check of the value is accurate

  • version: pk-05-07-14
  • version: pk-08-10-14
  • version: pk-07-08-22 check if the object is populated
  • version: pk-07-10-21 $autoPopulate to avoid enless loops
  • access: public
mixed getDBField (string $aColumn, [boolean $debug = False], [boolean $autoPopulate = True])
  • string $aColumn: (name of the db column and the obj var holding the value of the column)
  • boolean $debug
  • boolean $autoPopulate: (populate the row if keysAreSet)
getDBRow (line 1830)

returns a field => value array

used also in insert and update statements

make sure to not include some special values and object columns are serialised

  • return: done empty is not equal null !! pk-03-10-22
  • version: pk-03-10-22
  • version: pk-06-07-31 check if $this->myFields is an array
  • version: pk-07-08-13
  • version: pk-08-06-06
array getDBRow ([boolean $withoutNull = True], [boolean $debug = False], [boolean $withoutOV = False], [boolean $fldAutoPopulate = True])
  • boolean $withoutNull: if True null values are not added to the array
  • boolean $debug
  • boolean $withoutOV: if False and $this->hasObjVals() the object value array is added with index __OCSP_OBJ_VALS__
  • boolean $fldAutoPopulate

Implementation of:
INFA_DBMS_TABLEOBJ::getDBRow()
returns a field => value array

Redefined in descendants as:
getDBVal (line 1759)

returns a field => value array for dbms

use this in cms and dbms elements to get $DBVAL array

overwrite this and add some special values for objects if needed

  • version: pk-04-08-10 debug info changed
  • version: pk-05-07-14
  • version: pk-06-05-21 debugging
  • version: pk-07-06-19
  • see: dbms
array getDBVal ([boolean $setFIELDS = False], [boolean $debug = False], [boolean $withObjVars = True])
  • boolean $setFIELDS: if True $ret['_DBMS_FIELDS'] is filled
  • boolean $debug: show debug info?
  • boolean $withObjVars: add object var values to the returned array

Redefined in descendants as:
  • : returns a field => value array for dbms
getDefaults (line 1698)

returns an array of db default values

  • access: public
array getDefaults ([boolean $debug = False])
  • boolean $debug

Implementation of:
INFA_DBMS_TABLEOBJ::getDefaults()
returns an array of db default values

Redefined in descendants as:
getErrorMsg (line 2072)
  • since: pk-05-07-29
string getErrorMsg ()

Redefined in descendants as:
getFieldDBDefault (line 1682)

returns the db default value for aField

  • since: pk-03-12-19
mixed getFieldDBDefault (string $aField)
  • string $aField
getForm (line 1629)

replaces dbGetForm and returns a OCSP_FORM

  • return: __OCSP_PHPINCPATH__
  • version: pk-08-06-26
  • version: pk-08-11-01 getFormName() & getFormClassName added
  • since: pk-07-08-16
  • requires: db/forms/OCSP_FORM.phpclass
OCSP_FORM &getForm ([int $mode = FRM_MODE_READONLY], [mixed $form = ''], [ $frmClass = 'OCSP_FORM'], [boolean $debug = False])
  • int $mode
  • mixed $form: (string) form name (int) form id
  • boolean $debug
  • $frmClass

Redefined in descendants as:
getFormClassName (line 1608)

returns the form class name to use

if you overwrite this method make sure the returned form class source has been included

  • since: pk-08-11-01
  • access: public
string getFormClassName ()

Redefined in descendants as:
getFormName (line 1593)

returns the required form name

normaly this function return Null to let $this->getForm decide which form ($this->getMyTable()) to use. In some subclasses it can be useful to overwrite this methode to get a special form

This is also a way to tell ajax reloads to change form. in jOCSP/formRPC.php is checked wether the currently loaded form (from the environment) fits to the forms tableobject if this function returns a value.

  • since: pk-08-11-01
  • access: public
string getFormName ()

Redefined in descendants as:
getJSON (line 2411)

returns a json string for the object data

  • return: (JSON)
  • since: pk-07-12-12
string getJSON ([boolean $debug = False])
  • boolean $debug
getKeyArr (line 375)

returns the key array an array of all key fields

  • since: pk-05-06-23
  • access: public
array getKeyArr ([bolean $debug = False])
  • bolean $debug

Redefined in descendants as:
getMyTable (line 194)

returns the table name

  • since: pk-06-01-06
string getMyTable ()
getObjValArray (line 1480)

returns the object value array

  • version: pk-08-06-19
  • since: pk-07-08-13
array getObjValArray ([boolean $debug = False])
  • boolean $debug
getObjValValue (line 1425)

returns an object value value

  • version: pk-05-08-26
  • since: pk-05-07-14
void getObjValValue (string $name, [boolean $autoPopulate = True], [boolean $debug = False])
  • string $name
  • boolean $autoPopulate
  • boolean $debug
getPopulateTs (line 461)

returns the populate timestamp if it returns 0 the object has not been populated which means not that it is empty

  • since: pk-03-12-18
int getPopulateTs ()
getWhere (line 420)

generates a where clause to select the object identfied by DBMS_TBLOBJ::myKeys

  • version: pk-06-09-14 E_ALL
string getWhere ([boolean $debug = False])
  • boolean $debug

Redefined in descendants as:
hasChanged (line 485)

returns if valChangeTS > populateTS

  • since: pk-06-05-28
boolean hasChanged ()
hasColumn (line 1243)

returns if the table as a column named $colName

  • version: pk-06-06-26
  • since: pk-05-07-28
boolean hasColumn (string $colName)
  • string $colName
hasErrors (line 2062)
  • since: pk-05-07-29
boolean hasErrors ()
hasObjVals (line 1410)
  • since: pk-07-08-18
boolean hasObjVals ()
init (line 250)

initalize the object

  • tries to get the object from cache
  • if fails load it from db and write it to chache
  • set initTS to now

  • version: pk-03-10-24
  • version: pk-05-07-13
  • version: pk-06-05-27
void init ([boolean $debug = False], [boolean $noCache = False])
  • boolean $debug: version pk-03-10-24
  • boolean $noCache: version pk-06-05-27

Redefined in descendants as:
isInit (line 282)

returns if the object is initialized

  • access: public
boolean isInit ()
isPopulated (line 473)

returns if populateTS > 0

  • since: pk-04-01-05
boolean isPopulated ()
keysAreSet (line 391)

returns if the primary key columns are set

  • since: pk-07-10-02
boolean keysAreSet ([boolean $debug = False])
  • boolean $debug
populateFromKeys (line 527)

populates the object from a key array NOTE if more columns fit $keys only the first is set

  • since: pk-07-08-14
boolean populateFromKeys (array $keys, [boolean $debug = False])
  • array $keys
  • boolean $debug
populateFromValues (line 562)

populates the object by extracting keys from a value array

  • since: pk-08-12-18
boolean populateFromValues (array $arrValues, [boolean $debug = False])
  • array $arrValues
  • boolean $debug
populateObjVals (line 680)

populates the Object values

  • return: sizeof myObjVals
  • version: pk-07-04-16
  • since: pk-05-07-13
int populateObjVals ([boolean $debug = False])
  • boolean $debug

Redefined in descendants as:
p_cacheIsExpired (line 2179)

PROTECTED check if cache is expired

returns if chache has reached OCSP_OBJ::getConf('OBJCACHEPATH')

  • version: pk-04-01-02
  • access: protected
bool p_cacheIsExpired ([boolean $debug = False])
  • boolean $debug
saveLinkedRow (line 1187)

saves a linked row due to $cmd

  • since: pk-08-03-07
  • access: public
boolean saveLinkedRow (string $table, array $row, string $cmd, [boolean $debug = False])
  • string $table
  • array $row
  • string $cmd: (_OCSP_DBCMD_*)
  • boolean $debug

Redefined in descendants as:
saveLinkedTableRows (line 1159)

handels linked tables after insert

  • since: pk-08-07-03
  • access: protected
boolean saveLinkedTableRows (boolean $debug)
  • boolean $debug
saveObjVals (line 759)

saves the object values

  • version: pk-07-08-18
  • since: pk-05-07-14
int saveObjVals ([boolean $clearFirst = False], [boolean $debug = False], string $gDBIDX)
  • string $gDBIDX
  • boolean $clearFirst
  • boolean $debug
setChanged (line 497)

sets the changed flag ($this->valChangeTS > $this-populateTS)

  • since: pk-06-05-28
void setChanged ([boolean $debug = False])
  • boolean $debug
setDBField (line 1321)

sets the value of a object var (DB COLUMN)

NOTE: does not save youe have to call DBMS_TBLOBJ::dbsave() to save the value permanently in the database

  • version: pk-05-07-14
  • version: pk-07-10-01
  • version: pk-05-07-28
  • version: pk-06-10-11
  • access: public
void setDBField (string $aField, mixed $aValue, [boolean $debug = False], [boolean $strict = False])
  • string $aField: DB Column Name or Obj Field
  • mixed $aValue: the value to set
  • boolean $debug: since pk-05-07-28
  • boolean $strict: do not use objVals

Redefined in descendants as:
setDBFieldIfDiff (line 1354)

sets the value of an object var (DB COLUMN) if it differs with $aValue

if you use this method you can check with $this::hasChanged() method if the object values differs from the database value.

  • since: pk-06-08-11
  • access: public
void setDBFieldIfDiff (string $aField, mixed $aValue, [boolean $debug = False])
  • string $aField: DB Column Name or Obj Field
  • mixed $aValue: the value to set
  • boolean $debug: since pk-05-07-28
setDBFieldIfEmpty (line 1376)

sets the value of an column if it is empty or not set

if you use this method you can check with $this::hasChanged() method if the object values differs from the database value.

  • since: pk-06-12-20
  • access: public
void setDBFieldIfEmpty (string $aField, mixed $aValue, [boolean $debug = False])
  • string $aField: DB Column Name or Obj Field
  • mixed $aValue: the value to set
  • boolean $debug: since pk-05-07-28
setDBRow (line 1965)

sets a database row to the object fields

sets each key (=columname) value

if $row['__OCSP_OBJ_VALS__'] isset and an array this values are set as object values else if $asPopulated object values are loaded

  • version: pk-07-08-10
  • since: pk-03-12-13 more debug infos
boolean setDBRow (array $row, [boolean $asPopulated = True], [boolean $debug = False])
  • array $row: the row form a select * from DBMS_TABLEOBJ::myTable
  • boolean $asPopulated: set populateTS as if the object has been populated
  • boolean $debug

Implementation of:
INFA_DBMS_TABLEOBJ::setDBRow()
sets a database row to the object fields

Redefined in descendants as:
setDBVal (line 1924)

sets all fields of an array to the objcet

  • version: pk-05-10-04
  • since: pk-05-08-30
void setDBVal (array $valArr, [boolean $debug = False])
  • array $valArr
  • boolean $debug

Redefined in descendants as:
  • CMS_TABLEOBJ::setDBVal() : sets all fields of an array to the objcet if $valArr['PEARCACHE_TS'] isset this will become the populateTS
  • : sets all fields of an array to the objcet
  • CMS_MENU_NODE::setDBVal() : sets all fields of an array to the objcet if $valArr['PEARCACHE_TS'] isset this will become the populateTS
setDefaults (line 1722)

sets the database default values to the fields

COUTION overrides populated values

void setDefaults ([boolean $debug = False])
  • boolean $debug: show debug info
setError (line 2084)

sets an error cmd

  • since: pk-05-07-29
void setError (string $errMsg)
  • string $errMsg
setLinkedTableRow (line 1128)

sets the row of an other table

this method is used to cache form values of other tables which are joined in to $this->myTable

this rows must be considert in insert,update,delete

possible commands are

  • _OCSP_DBCMD_INSERT_ (insert a new row)
  • _OCSP_DBCMD_REPLACE_ (update an existing row or insert if not exists)
  • _OCSP_DBCMD_UPDATE_ (update an existing row)
  • _OCSP_DBCMD_DELETE_ (delete an existing row)

void setLinkedTableRow (string $tblName, string $dbCmd, array $aRow, [boolean $debug = False])
  • string $tblName
  • string $dbCmd
  • array $aRow
  • boolean $debug

Implementation of:
INFA_DBMS_TABLEOBJ::setLinkedTableRow()
sets the row of an other table
setMyTable (line 212)

sets the table name an recals init if $this->myTable != $aTablName

  • version: pk-06-05-27
  • version: pk-07-07-11 removed $gDBIDX param
  • since: pk-06-02-09
boolean setMyTable (string $aTblName, [boolean $debug = False])
  • string $aTblName
  • boolean $debug
setObjValArray (line 1507)

sets an array of values as object values

  • since: pk-05-12-05
void setObjValArray (array $valArr, [boolean $debug = False])
  • array $valArr
  • boolean $debug
setObjValValue (line 1453)

sets an object value value

  • version: pk-05-08-26
  • todo: type check
  • since: pk-05-07-14
void setObjValValue (string $key, string $val, [boolean $debug = False])
  • string $key
  • string $val
  • boolean $debug
setObjVarIfEmpty (line 1394)

sets an object var if it's empty or null NOTE the object var has to be set already NOTE does not set the changed flag

  • return: (the value has been set)
  • access: public
boolean setObjVarIfEmpty (string $varName, mixed $value)
  • string $varName
  • mixed $value
setUnChanged (line 510)

clears the changed flag

  • since: pk-06-10-24
void setUnChanged ([boolean $debug = False])
  • boolean $debug
userIsAllowed (line 2099)

overwrite in class implementation

void userIsAllowed ( $mode)
  • $mode
writeDebugInfo (line 2026)

echos the object

  • since: pk-04-07-30
void writeDebugInfo ([boolean $fullMode = False])
  • boolean $fullMode
xmladdDOMElement (line 2348)

adds TableObject Contents to domRoot

  • since: sw-05-03-09
bool &xmladdDOMElement (mixed &$domObj,  &$domRoot, [boolean $base64 = True], [boolean $debug = False], string $domRoot)
  • mixed &$domObj: //reference to Parent DomObject
  • string $domRoot: //reference to Parent DomRoot
  • boolean $base64
  • boolean $debug
  • &$domRoot

Redefined in descendants as:
xmlExport (line 2322)

xmlExport of a Table Object

  • since:

    sw-05-03-08

    NEED TO BE OVERWRITTEN!!!

bool xmlExport ([string $xmlfile = ""], [boolean $base64 = True], [boolean $debug = False])
  • string $xmlfile
  • boolean $base64
  • boolean $debug
_getCacheFileName (line 2205)

PROTECTED get the name of the cache file

returns the full path to the cache file name or False if cacheing is disabled by not setting $GLOBALS['PROJECT']['OBJCACHEPATH']

  • version: pk-08-06-15
  • version: pk-06-05-27 mytable added to filename
  • access: protected
string _getCacheFileName ()
_getDBFields (line 2117)

class method sets $this->myFields

  • version: pk-04-12-21
  • version: pk-05-07-13
  • version: pk-07-04-14
  • version: pk-08-03-11
  • version: pk-07-06-15
  • access: protected
boolean _getDBFields ([boolean $debug = False])
  • boolean $debug

Redefined in descendants as:

Inherited Methods

Inherited From OCSP_OBJ

 OCSP_OBJ::castObj()
 OCSP_OBJ::cloneMe()
 OCSP_OBJ::currentUser()
 OCSP_OBJ::dbConnect()
 OCSP_OBJ::defaultDBObj()
 OCSP_OBJ::defaultReadDBObj()
 OCSP_OBJ::defaultWriteDBObj()
 OCSP_OBJ::getConf()
 OCSP_OBJ::getDBObj()
 OCSP_OBJ::get_myClassConstant()
 OCSP_OBJ::get_myObject_vars()
 OCSP_OBJ::get_mySourceFile()
 OCSP_OBJ::isConnected()
 OCSP_OBJ::isMultiByteStr()
 OCSP_OBJ::isUTF8()
 OCSP_OBJ::setConf()
 OCSP_OBJ::setDBObj()
 OCSP_OBJ::set_myObject_vars()
 OCSP_OBJ::set_myVarsFrom()
Class Constants
CLASS_SRC_FILE = __FILE__ (line 54)

Inherited Constants

Inherited from OCSP_OBJ

OCSP_OBJ::CLASS_SRC_FILE

Documentation generated on Thu, 08 Jan 2009 17:43:52 +0100 by phpDocumentor 1.4.0a2