本文整理汇总了PHP中oxDb::getDb方法的典型用法代码示例。如果您正苦于以下问题:PHP oxDb::getDb方法的具体用法?PHP oxDb::getDb怎么用?PHP oxDb::getDb使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类oxDb
的用法示例。
在下文中一共展示了oxDb::getDb方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: addSel
/**
* Adds selection lists to article.
*/
public function addSel()
{
$aAddSel = $this->_getActionIds('oxselectlist.oxid');
$soxId = oxRegistry::getConfig()->getRequestParameter('synchoxid');
// adding
if (oxRegistry::getConfig()->getRequestParameter('all')) {
$sSLViewName = $this->_getViewName('oxselectlist');
$aAddSel = $this->_getAll($this->_addFilter("select {$sSLViewName}.oxid " . $this->_getQuery()));
}
if ($soxId && $soxId != "-1" && is_array($aAddSel)) {
$oDb = oxDb::getDb();
foreach ($aAddSel as $sAdd) {
$oNew = oxNew("oxbase");
$oNew->init("oxobject2selectlist");
$sObjectIdField = 'oxobject2selectlist__oxobjectid';
$sSelectetionIdField = 'oxobject2selectlist__oxselnid';
$sOxSortField = 'oxobject2selectlist__oxsort';
$oNew->{$sObjectIdField} = new oxField($soxId);
$oNew->{$sSelectetionIdField} = new oxField($sAdd);
$sSql = "select max(oxsort) + 1 from oxobject2selectlist where oxobjectid = {$oDb->quote($soxId)} ";
$oNew->{$sOxSortField} = new oxField((int) $oDb->getOne($sSql, false, false));
$oNew->save();
}
}
}
示例2: cleanup
public static function cleanup()
{
$oDb = oxDb::getDb();
$sShopId = oxRegistry::getConfig()->getShopId();
$sQuery = "DELETE FROM `oxseo` WHERE `OXSTDURL` LIKE '%StylaSEO_Output%' and oxshopid = " . $oDb->quote($sShopId) . " ;";
$oDb->Execute($sQuery);
}
示例3: getTitleById
/**
* Get state title by id
*
* @param integer|string $iStateId
*
* @return string
*/
public function getTitleById($iStateId)
{
$oDb = oxDb::getDb();
$sQ = "SELECT oxtitle FROM " . getViewName("oxstates") . " WHERE oxid = " . $oDb->quote($iStateId);
$sStateTitle = $oDb->getOne($sQ);
return (string) $sStateTitle;
}
示例4: setUp
/**
* Setup: Prepare data - create need tables
*/
public function setUp()
{
oePayPalEvents::addOrderPaymentsTable();
oePayPalEvents::addOrderTable();
oxDb::getDb()->execute('TRUNCATE TABLE `oepaypal_order`');
oxDb::getDb()->execute('TRUNCATE TABLE `oepaypal_orderpayments`');
}
示例5: tearDown
/**
* Tear down the fixture.
*
* @return null
*/
protected function tearDown()
{
$this->cleanUpTable('oxuser');
oxDb::getDb()->execute("delete from oxremark where oxparentid = '_testArt'");
oxDb::getDb()->execute("delete from oxnewssubscribed where oxuserid = '_testArt'");
parent::tearDown();
}
示例6: addCatToAttr
/**
* Adds category to Attributes list
*/
public function addCatToAttr()
{
$aAddCategory = $this->_getActionIds('oxcategories.oxid');
$soxId = oxRegistry::getConfig()->getRequestParameter('synchoxid');
$oAttribute = oxNew("oxattribute");
// adding
if (oxRegistry::getConfig()->getRequestParameter('all')) {
$sCatTable = $this->_getViewName('oxcategories');
$aAddCategory = $this->_getAll($this->_addFilter("select {$sCatTable}.oxid " . $this->_getQuery()));
}
if ($oAttribute->load($soxId) && is_array($aAddCategory)) {
$oDb = oxDb::getDb();
foreach ($aAddCategory as $sAdd) {
$oNewGroup = oxNew("oxbase");
$oNewGroup->init("oxcategory2attribute");
$sOxSortField = 'oxcategory2attribute__oxsort';
$sObjectIdField = 'oxcategory2attribute__oxobjectid';
$sAttributeIdField = 'oxcategory2attribute__oxattrid';
$sOxIdField = 'oxattribute__oxid';
$oNewGroup->{$sObjectIdField} = new oxField($sAdd);
$oNewGroup->{$sAttributeIdField} = new oxField($oAttribute->{$sOxIdField}->value);
$sSql = "select max(oxsort) + 1 from oxcategory2attribute where oxobjectid = '{$sAdd}' ";
$oNewGroup->{$sOxSortField} = new oxField((int) $oDb->getOne($sSql, false, false));
$oNewGroup->save();
}
}
$this->resetContentCache();
}
示例7: onDeactivate
/**
* Is called on module deactivation. Deletes the theme settings. Note that after deactivation the settings
* will be lost.
*/
public static function onDeactivate()
{
$iShopId = oxRegistry::getConfig()->getShopId();
$sThemeName = self::_getThemeName();
$sDeleteSQL = "\n DELETE\n oxconfig.*,\n oxconfigdisplay.*\n FROM `oxconfig`\n LEFT JOIN `oxconfigdisplay`\n ON ( `oxconfig`.`OXID` = `oxconfigdisplay`.`OXID` )\n WHERE `oxconfig`.`OXMODULE` = ? AND `oxconfig`.`oxshopid` = ?\n ";
oxDb::getDb()->Execute($sDeleteSQL, array('theme:' . $sThemeName, $iShopId));
}
示例8: setUp
/**
* Set up
*/
protected function setUp()
{
parent::setUp();
// fix for state ID compatability between editions
$sSqlState = "REPLACE INTO `oxstates` (`OXID`, `OXCOUNTRYID`, `OXTITLE`, `OXISOALPHA2`, `OXTITLE_1`, `OXTITLE_2`, `OXTITLE_3`, `OXTIMESTAMP`) " . "VALUES ('333', '8f241f11096877ac0.98748826', 'USA last state', 'SS', 'USA last state', '', '', CURRENT_TIMESTAMP);";
oxDb::getDb()->execute($sSqlState);
}
示例9: render
/**
* Executes parent method parent::render(), creates oxpricealarm object
* and passes it's data to Smarty engine. Returns name of template file
* "pricealarm_main.tpl".
*
* @return string
*/
public function render()
{
$config = $this->getConfig();
parent::render();
$shopId = $config->getShopId();
//articles price in subshop and baseshop can be different
$this->_aViewData['iAllCnt'] = 0;
$query = "\n SELECT oxprice, oxartid\n FROM oxpricealarm\n WHERE oxsended = '000-00-00 00:00:00' AND oxshopid = '{$shopId}' ";
$result = oxDb::getDb()->execute($query);
if ($result != false && $result->recordCount() > 0) {
$simpleCache = array();
while (!$result->EOF) {
$price = $result->fields[0];
$articleId = $result->fields[1];
if (isset($simpleCache[$articleId])) {
if ($simpleCache[$articleId] <= $price) {
$this->_aViewData['iAllCnt'] += 1;
}
} else {
$article = oxNew("oxArticle");
if ($article->load($articleId)) {
$articlePrice = $simpleCache[$articleId] = $article->getPrice()->getBruttoPrice();
if ($articlePrice <= $price) {
$this->_aViewData['iAllCnt'] += 1;
}
}
}
$result->moveNext();
}
}
return "pricealarm_mail.tpl";
}
示例10: getIdByName
/**
* returns delivery set id
*
* @param string $sTitle delivery name
*
* @return string
*/
public function getIdByName($sTitle)
{
$oDb = oxDb::getDb();
$sQ = "SELECT `oxid` FROM `" . getViewName('oxdeliveryset') . "` WHERE `oxtitle` = " . $oDb->quote($sTitle);
$sId = $oDb->getOne($sQ);
return $sId;
}
示例11: getONGRVersionId
/**
* Returns ongr version id.
*
* @return int
*/
public function getONGRVersionId()
{
$oDb = oxDb::getDb();
$sql = 'SELECT ID FROM ongr_sync_jobs WHERE OXID=';
$sql .= $oDb->quote($this->getId()) . ' ORDER BY ID DESC LIMIT 1';
return (int) $oDb->getOne($sql);
}
示例12: execute
/**
* Executes the current command.
*
* @param InputInterface $input An InputInterface instance
* @param OutputInterface $output An OutputInterface instance
*/
protected function execute(InputInterface $input, OutputInterface $output)
{
// allow empty password
$dbPwd = \oxRegistry::getConfig()->getConfigParam('dbPwd');
if (!empty($dbPwd)) {
$dbPwd = '-p' . $dbPwd;
}
$file = $input->getOption('file');
if (!empty($file)) {
$file = "> " . $file;
} else {
$file = "";
}
if ($input->getOption('ignoreViews')) {
$dbName = \oxRegistry::getConfig()->getConfigParam('dbName');
$viewsResultArray = \oxDb::getDb()->getArray("SHOW FULL TABLES IN {$dbName} WHERE TABLE_TYPE LIKE 'VIEW'");
$ignoreViewTables = array();
foreach ($viewsResultArray as $viewArray) {
$ignoreViewTables[] = '--ignore-table=' . $dbName . '.' . $viewArray[0];
}
$ignoreViewTables = implode(' ', $ignoreViewTables);
}
$exec = sprintf("mysqldump -h%s %s -u%s %s %s %s 2>&1", \oxRegistry::getConfig()->getConfigParam('dbHost'), $dbPwd, \oxRegistry::getConfig()->getConfigParam('dbUser'), \oxRegistry::getConfig()->getConfigParam('dbName'), $ignoreViewTables, $file);
exec($exec, $commandOutput, $returnValue);
if ($returnValue > 0) {
$output->writeln('<error>' . implode(PHP_EOL, $commandOutput) . '</error>');
return;
}
if (!empty($file)) {
$output->writeln("<info>Dump {$input->getOption('file')} created.</info>");
} else {
$output->writeln($commandOutput);
}
}
示例13: onActivate
/**
* Setup routine
*/
public static function onActivate()
{
if (class_exists('oxRegistry')) {
$myConfig = oxRegistry::getConfig();
} else {
$myConfig = oxConfig::getInstance()->getConfig();
}
$bIsEE = $myConfig->getEdition() === "EE";
try {
$db = oxDb::getDb();
// create oxjson groups
if ($bIsEE) {
$maxRRId = intval($db->getOne("select MAX(OXRRID) from oxgroups"));
$nextRRId = $maxRRId + 1;
$sQ = "INSERT IGNORE INTO oxgroups (OXID, OXACTIVE, OXTITLE, OXTITLE_1, OXRRID) VALUES ('oxjsonro', '1', 'OXJSON Read-only', 'OXJSON Read-only', '{$nextRRId}');";
$db->Execute($sQ);
$nextRRId++;
$sQ = "INSERT IGNORE INTO oxgroups (OXID, OXACTIVE, OXTITLE, OXTITLE_1, OXRRID) VALUES ('oxjsonfull', '1', 'OXJSON Full', 'OXJSON Full', '{$nextRRId}');";
$db->Execute($sQ);
} else {
$sQ = "INSERT IGNORE INTO oxgroups (OXID, OXACTIVE, OXTITLE, OXTITLE_1) VALUES ('oxjsonro', '1', 'OXJSON Read-only', 'OXJSON Read-only');";
$db->Execute($sQ);
$nextRRId++;
$sQ = "INSERT IGNORE INTO oxgroups (OXID, OXACTIVE, OXTITLE, OXTITLE_1) VALUES ('oxjsonfull', '1', 'OXJSON Full', 'OXJSON Full');";
$db->Execute($sQ);
}
} catch (Exception $ex) {
error_log("Error activating module: " . $ex->getMessage());
}
}
示例14: getUserCount
/**
* Returns count of users assigned to active newsletter receiver group
*
* @return int
*/
public function getUserCount()
{
if ($this->_iUserCount === null) {
$this->_iUserCount = 0;
// load object
$oNewsletter = oxNew("oxnewsletter");
if ($oNewsletter->load($this->getEditObjectId())) {
// get nr. of users in these groups
// we do not use lists here as we dont need this overhead right now
$oDB = oxDb::getDb();
$blSep = false;
$sSelectGroups = " ( oxobject2group.oxgroupsid in ( ";
// remove already added groups
foreach ($oNewsletter->getGroups() as $oInGroup) {
if ($blSep) {
$sSelectGroups .= ",";
}
$sSelectGroups .= $oDB->quote($oInGroup->oxgroups__oxid->value);
$blSep = true;
}
$sSelectGroups .= " ) ) ";
// no group selected
if (!$blSep) {
$sSelectGroups = " oxobject2group.oxobjectid is null ";
}
$sShopId = $this->getConfig()->getShopID();
$sQ = "select count(*) from ( select oxnewssubscribed.oxemail as _icnt from oxnewssubscribed left join\n oxobject2group on oxobject2group.oxobjectid = oxnewssubscribed.oxuserid\n where ( oxobject2group.oxshopid = '{$sShopId}'\n or oxobject2group.oxshopid is null ) and {$sSelectGroups} and\n oxnewssubscribed.oxdboptin = 1 and ( not ( oxnewssubscribed.oxemailfailed = '1') )\n and (not(oxnewssubscribed.oxemailfailed = '1')) and oxnewssubscribed.oxshopid = '{$sShopId}'\n group by oxnewssubscribed.oxemail ) as _tmp";
$this->_iUserCount = $oDB->getOne($sQ, false, false);
}
}
return $this->_iUserCount;
}
示例15: jxGetCategoryList
public function jxGetCategoryList($sParent, $sNoPath, $sCatPath)
{
$myConfig = $this->getConfig();
if (!empty($sNoPath)) {
$sNoPath .= '.';
$sCatPath .= ' / ';
}
$sWhere = "";
if ($myConfig->getConfigParam('sJxGTaxoDisplayInactive') == FALSE) {
$sWhere .= "AND c.oxactive = 1 ";
}
if ($myConfig->getConfigParam('sJxGTaxoDisplayHidden') == FALSE) {
$sWhere .= "AND c.oxhidden = 0 ";
}
$sSql = "SELECT c.oxid, c.oxtitle, c.oxactive, c.oxhidden, " . "(SELECT COUNT(*) FROM oxobject2category o2c WHERE o2c.oxcatnid = c.oxid) AS artcount, " . "(SELECT COUNT(*) FROM oxcategories c1 WHERE c1.oxparentid=c.oxid) AS count, c.jxamazoncategory AS taxonomy " . "FROM oxcategories c " . "WHERE c.oxparentid = '{$sParent}' " . $sWhere . "ORDER BY c.oxtitle";
$oDb = oxDb::getDb(oxDB::FETCH_MODE_ASSOC);
$rs = $oDb->Execute($sSql);
$i = 1;
while (!$rs->EOF) {
$aCols = $rs->fields;
$aCols['path'] = $sNoPath . $i;
$aCols['oxtitle'] = $sCatPath . $aCols['oxtitle'];
array_push($this->aCategories, $aCols);
if ($aCols['count'] != 0) {
$this->jxGetCategoryList($aCols['oxid'], $aCols['path'], $aCols['oxtitle']);
}
$rs->MoveNext();
$i++;
}
return;
}