Example #1
0
 /**
  * Updates article.
  *
  * @param string     $sCurrUpdateTime
  * @param oxLegacyDb $oDb
  *
  * @return mixed
  */
 protected function updateOxArticles($sCurrUpdateTime, $oDb)
 {
     $sQ = $this->getQueryToUpdateOxArticle($sCurrUpdateTime);
     $blUpdated = $oDb->execute(sprintf($sQ, "`oxarticles`"));
     return $blUpdated;
 }
Example #2
0
 /**
  * Returns database object
  *
  * @param int $iFetchMode - fetch mode default numeric - 0
  *
  * @throws oxConnectionException error while initiating connection to DB
  *
  * @return oxLegacyDb
  */
 public static function getDb($iFetchMode = oxDb::FETCH_MODE_NUM)
 {
     if (defined('OXID_PHP_UNIT')) {
         if (isset(modDB::$unitMOD) && is_object(modDB::$unitMOD)) {
             return modDB::$unitMOD;
         }
     }
     if (self::$_oDB === null) {
         $oInst = self::getInstance();
         //setting configuration on the first call
         $oInst->setConfig(oxRegistry::get("oxConfigFile"));
         global $ADODB_SESSION_TBL, $ADODB_SESSION_CONNECT, $ADODB_SESSION_DRIVER, $ADODB_SESSION_USER, $ADODB_SESSION_PWD, $ADODB_SESSION_DB, $ADODB_SESS_LIFE, $ADODB_SESS_DEBUG;
         // session related parameters. don't change.
         //Tomas
         //the default setting is 3000 * 60, but actually changing this will give no effect as now redefinition of this constant
         //appears after OXID custom settings are loaded and $ADODB_SESS_LIFE depends on user settings.
         //You can find the redefinition of ADODB_SESS_LIFE @ oxconfig.php:: line ~ 390.
         $ADODB_SESS_LIFE = 3000 * 60;
         $ADODB_SESSION_TBL = "oxsessions";
         $ADODB_SESSION_DRIVER = self::_getConfigParam('_dbType');
         $ADODB_SESSION_USER = self::_getConfigParam('_dbUser');
         $ADODB_SESSION_PWD = self::_getConfigParam('_dbPwd');
         $ADODB_SESSION_DB = self::_getConfigParam('_dbName');
         $ADODB_SESSION_CONNECT = self::_getConfigParam('_dbHost');
         $ADODB_SESS_DEBUG = false;
         $oDb = new oxLegacyDb();
         $oDbInst = $oInst->_getDbInstance();
         $oDb->setConnection($oDbInst);
         self::$_oDB = $oDb;
     }
     self::$_oDB->setFetchMode($iFetchMode);
     return self::$_oDB;
 }