/** * Replaces the existing "context" column in "audit" table with apropriate table names * * @return boolean */ function updateAuditContext() { $tblAudit = $this->oUpgrade->oDbh->quoteIdentifier(OA_Dal::getTablePrefix() . 'audit', true); foreach ($this->aContexts as $contextOld => $contextNew) { $query = 'UPDATE ' . $tblAudit . ' SET context = ' . $this->oUpgrade->oDbh->quote($contextNew) . ' WHERE context = ' . $this->oUpgrade->oDbh->quote($contextOld); $result = $this->oUpgrade->oDbh->exec($query); if (PEAR::isError($result) || $result === false) { $this->logError('Error while updating audit context: ' . $result->getUserInfo()); return false; } } $this->logOnly('audit context values updated'); return true; }
/** * Add a prefix to table name and save oroginal table name in _tableName * * @access private */ function _addPrefixToTableName() { if (empty($this->_tableName)) { $this->_prefix = OA_Dal::getTablePrefix(); $this->_tableName = $this->__table; $this->__table = $this->_prefix . $this->__table; } }
/** * Returns the bucket's destination statistics table, that is, the * table that is defined in the component's plugin to store the * aggregate bucket data for the components. * * @return string The statistics table name with added prefix. */ public function getStatisticsTableName() { return OA_Dal::getTablePrefix() . $this->getStatisticsName(); }
function testAutoincrementsVsSerial() { $prefix = OA_Dal::getTablePrefix(); $oDbh = OA_DB::singleton(); $table = $oDbh->quoteIdentifier($prefix . 'ad_category_assoc'); $sqlInsert = "INSERT INTO {$table} (category_id, ad_id) VALUES (1, 1)"; DBC::execute($sqlInsert); // Take generated primary key $doAd_category_assoc = OA_Dal::factoryDO('ad_category_assoc'); $doAd_category_assoc->find($aufetch = true); $id1 = $doAd_category_assoc->ad_category_assoc_id; // Now lets generate new record using DataGenerator $id2 = DataGenerator::generateOne('ad_category_assoc'); // Not only above code should work but also id2 should be equal id1+1 $this->assertEqual($id2, $id1 + 1); }
function outdateSession() { $sessionId = SESSIONID; $prefix = OA_Dal::getTablePrefix(); $table = $this->dbh->quoteIdentifier($prefix . 'session'); $this->dbh->exec("UPDATE {$table} set lastused = '2005-01-01 01:00:00' WHERE sessionid = '{$sessionId}'"); }
function getTablePrefix() { return OA_Dal::getTablePrefix(); }