db = new DB_ConLite(); if ($sTable == '') { $sMsg = "$sClassName: No table specified. Inherited classes *need* to set a table"; throw new Contenido_ItemException($sMsg); } elseif ($sPrimaryKey == '') { $sMsg = "No primary key specified. Inherited classes *need* to set a primary key"; throw new Contenido_ItemException($sMsg); } $this->_settings = $cfg['sql']; // instanciate caching $aCacheOpt = (isset($this->_settings['cache'])) ? $this->_settings['cache'] : array(); self::$_oCache = cItemCache::getInstance($sTable, $aCacheOpt); $this->table = $sTable; $this->primaryKey = $sPrimaryKey; $this->virgin = true; $this->lifetime = $iLifetime; $this->_className = $sClassName; } /** * Escape string for using in SQL-Statement. * * @param string $sString The string to escape * @return string Escaped string */ public function escape($sString) { return $this->db->escape($sString); } /** * Returns the second database instance, usable to run additional statements * without losing current query results. * * @return DB_ConLite */ protected function _getSecondDBInstance() { if (!isset($this->secondDb) || !($this->secondDb instanceof DB_ConLite)) { $this->secondDb = new DB_ConLite(); } return $this->secondDb; } /** * Returns properties instance, instantiates it if not done before. * * @return PropertyCollection */ protected function _getPropertiesCollectionInstance() { // Runtime on-demand allocation of the properties object if (!isset($this->properties) || !($this->properties instanceof PropertyCollection)) { $this->properties = new PropertyCollection(); } return $this->properties; } } ?>