Prefix=$prefix[0]; $this->Special=$special; } /** * Returns joined prefix * and special if any * * @return string * @access protected */ function getPrefixSpecial() { return rtrim($this->Prefix.'.'.$this->Special,'.'); } /** * Set's application * * @return kBase * @access public */ function kBase() { $this->Application =& kApplication::Instance(); } } class kDBBase extends kBase { /** * Description * * @var DBConnection * @access public */ var $Conn; /** * Description * * @var string Name of primary key field for the item * @access public */ var $IDField; /** * Holds SELECT, FROM, JOIN parts of SELECT query * * @var string * @access public */ var $SelectClause; /** * Display queries executed by the class * * @var bool * @access public */ var $DisplayQueries = false; /** * Object that holds all * formatters created * * @var kItemFormatter * @access private */ var $ItemFormatter; /** * Description * * @var string Item' database table name, without prefix * @access public */ var $TableName; function kDBBase() { parent::kBase(); $this->Conn =& $this->Application->GetADODBConnection(); } /** * Set current item' database table name * * @access public * @param string $table_name * @return void */ function setTableName($table_name) { $this->TableName = $table_name; } /** * Sets SELECT part of list' query * * @access public * @param string $sql SELECT and FROM [JOIN] part of the query up to WHERE * @return void */ function SetSelectSQL($sql) { $this->SelectClause = $sql; } function GetSelectSQL() { return sprintf($this->SelectClause,$this->TableName); } /** * Sets ID Field name used as primary key for loading items * * @access public * @param string $field_name * @return void * @see kDBBase::IDField */ function setIDField($field_name) { $this->IDField = $field_name; } /** * Returns formatted field value * * @param string $field * @return string * @access public */ function GetField($field) { } /** * Returns unformatted field value * * @param string $field * @return string * @access public */ function GetDBField($field) { } /** * Returns ID of currently processed record * * @return int * @access public */ function GetID() { return $this->GetDBField($this->IDField); } } ?>