本文整理汇总了PHP中oxDb::getDB方法的典型用法代码示例。如果您正苦于以下问题:PHP oxDb::getDB方法的具体用法?PHP oxDb::getDB怎么用?PHP oxDb::getDB使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类oxDb
的用法示例。
在下文中一共展示了oxDb::getDB方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: render
/**
* Collects available article axtended parameters, passes them to
* Smarty engine and returns tamplate file name "article_extend.tpl".
*
* @return string
*/
public function render()
{
parent::render();
$this->_aViewData['edit'] = $oArticle = oxNew('oxarticle');
$soxId = $this->getEditObjectId();
$sCatView = getViewName('oxcategories');
$sChosenArtCat = $this->_getCategoryTree("artcattree", oxConfig::getParameter("artcat"));
// all categories
if ($soxId != "-1" && isset($soxId)) {
// load object
$oArticle->loadInLang($this->_iEditLang, $soxId);
// load object in other languages
$oOtherLang = $oArticle->getAvailableInLangs();
if (!isset($oOtherLang[$this->_iEditLang])) {
// echo "language entry doesn't exist! using: ".key($oOtherLang);
$oArticle->loadInLang(key($oOtherLang), $soxId);
}
foreach ($oOtherLang as $id => $language) {
$oLang = new oxStdClass();
$oLang->sLangDesc = $language;
$oLang->selected = $id == $this->_iEditLang;
$this->_aViewData["otherlang"][$id] = clone $oLang;
}
// variant handling
if ($oArticle->oxarticles__oxparentid->value) {
$oParentArticle = oxNew('oxarticle');
$oParentArticle->load($oArticle->oxarticles__oxparentid->value);
$oArticle->oxarticles__oxnonmaterial = new oxField($oParentArticle->oxarticles__oxnonmaterial->value);
$oArticle->oxarticles__oxfreeshipping = new oxField($oParentArticle->oxarticles__oxfreeshipping->value);
$this->_aViewData["parentarticle"] = $oParentArticle;
$this->_aViewData["oxparentid"] = $oArticle->oxarticles__oxparentid->value;
}
$sO2CView = getViewName('oxobject2category');
}
$oDB = oxDb::getDB();
$myConfig = $this->getConfig();
$sArticleTable = getViewName('oxarticles', $this->_iEditLang);
$sSelect = "select {$sArticleTable}.oxtitle, {$sArticleTable}.oxartnum, {$sArticleTable}.oxvarselect from {$sArticleTable} where 1 ";
// #546
$sSelect .= $myConfig->getConfigParam('blVariantsSelection') ? '' : " and {$sArticleTable}.oxparentid = '' ";
$sSelect .= " and {$sArticleTable}.oxid = " . $oDB->quote($oArticle->oxarticles__oxbundleid->value);
$rs = $oDB->Execute($sSelect);
if ($rs != false && $rs->RecordCount() > 0) {
while (!$rs->EOF) {
$sArtNum = new oxField($rs->fields[1]);
$sArtTitle = new oxField($rs->fields[0] . " " . $rs->fields[2]);
$rs->MoveNext();
}
}
$this->_aViewData['bundle_artnum'] = $sArtNum;
$this->_aViewData['bundle_title'] = $sArtTitle;
$aColumns = array();
$iAoc = oxConfig::getParameter("aoc");
if ($iAoc == 1) {
include_once 'inc/' . strtolower(__CLASS__) . '.inc.php';
$this->_aViewData['oxajax'] = $aColumns;
return "popups/article_extend.tpl";
} elseif ($iAoc == 2) {
include_once 'inc/article_bundle.inc.php';
$this->_aViewData['oxajax'] = $aColumns;
return "popups/article_bundle.tpl";
}
//load media files
$this->_aViewData['aMediaUrls'] = $oArticle->getMediaUrls();
return "article_extend.tpl";
}
示例2: tearDown
/**
* Tear down the fixture.
*
* @return null
*/
protected function tearDown()
{
$this->getSession()->setVariable("gbSessionFormId", null);
$this->getSession()->setVariable("Errors", null);
oxDb::getDB()->execute('delete from oxgbentries');
parent::tearDown();
}
示例3: tearDown
/**
* Tear down the fixture.
*
* @return null
*/
protected function tearDown()
{
$myDB = oxDb::getDB();
// removing vouchers
$sQ = 'delete from oxvouchers where oxvouchers.oxvoucherserieid = "' . $this->_sOxid . '"';
$myDB->Execute($sQ);
parent::tearDown();
}
示例4: tearDown
/**
* Tear down the fixture.
*
* @return null
*/
protected function tearDown()
{
$myDB = oxDb::getDB();
$sQ = 'delete from oxuser where oxid="test"';
$myDB->Execute($sQ);
$this->cleanUpTable('oxreviews');
oxRemClassModule('modOxUtilsDate');
parent::tearDown();
}
示例5: setUp
/**
* Initialize the fixture.
*
* @return null
*/
protected function setUp()
{
oxUBaseHelper::resetComponentNames();
// adding article to recommendList
$sQ = 'replace into oxrecommlists ( oxid, oxuserid, oxtitle, oxdesc, oxshopid ) values ( "testlist", "oxdefaultadmin", "oxtest", "oxtest", "' . $this->getConfig()->getShopId() . '" ) ';
oxDb::getDB()->Execute($sQ);
parent::setUp();
// backup
$this->_sRequestMethod = $_SERVER["REQUEST_METHOD"];
$this->_sRequestUri = $_SERVER['REQUEST_URI'];
}
示例6: tearDown
/**
* Tear down the fixture.
*
* @return null
*/
protected function tearDown()
{
$this->cleanUpTable('oxuser');
$myDB = oxDb::getDB();
$myDB->execute("delete from oxseo where oxobjectid = '_testArt'");
$myDB->execute("delete from oxnewssubscribed where oxuserid = '_testUser'");
oxArticleHelper::cleanup();
//resetting cached testing values
$_GET["testReset"] = null;
parent::tearDown();
}
示例7: tearDown
/**
* Tear down the fixture.
*
* @return null
*/
protected function tearDown()
{
$oArt = oxNew('oxArticle');
$oArt->delete('_testArtId');
$oArt = oxNew('oxArticle');
$oArt->delete('_testArtId2');
$myDB = oxDb::getDB();
$myDB->execute('delete from oxobject2selectlist');
$this->addTableForCleanup('oxobject2category');
parent::tearDown();
}
示例8: testDelete
/**
* Checking deletion and assign
*/
public function testDelete()
{
$myDB = oxDb::getDB();
$oSelList = oxNew('oxselectlist');
$oSelList->load('oxsellisttest');
$oSelList->delete();
$sQ = 'select count(*) from oxselectlist where oxid = "oxsellisttest" ';
if ($myDB->getOne($sQ)) {
$this->fail('records from oxselectlist are not deleted');
}
$sQ = 'select count(*) from oxobject2selectlist where oxselnid = "oxsellisttest" ';
if ($myDB->getOne($sQ)) {
$this->fail('records from oxobject2selectlist are not deleted');
}
}
示例9: setUp
/**
* Tear down the fixture.
*/
protected function setUp()
{
// Dropping order payments table
oxDb::getDB()->execute("DROP TABLE IF EXISTS `oepaypal_orderpayments`");
oxDb::getDB()->execute("DROP TABLE IF EXISTS `oepaypal_order`");
oxDb::getDB()->execute("DROP TABLE IF EXISTS `oepaypal_orderpaymentcomments`");
// Deleting PayPal payment method
$oPayment = oxNew('oxPayment');
$oPayment->load('oxidpaypal');
$oPayment->delete();
// Deleting enabled PayPal RDFA
$sSql = "DELETE FROM `oxobject2payment` WHERE `OXID` = 'oepaypalrdfa'";
oxDb::getDb()->execute($sSql);
parent::setUp();
}
示例10: testSave
/**
* order_remark::save() test case
*
* @return null
*/
public function testSave()
{
$this->setRequestParameter('oxid', '_testOrder');
$this->setRequestParameter('remarktext', 'test text');
$oOrder = oxNew('oxbase');
$oOrder->init('oxorder');
$oOrder->setId('_testOrder');
$oOrder->oxorder__oxuserid = new oxField('oxdefaultadmin');
$oOrder->save();
$oView = oxNew('order_remark');
$oView->save();
$oRemark = oxNew("oxRemark");
$oRemark->load("_testRemark");
$this->assertEquals('r', oxDb::getDB()->getOne('select oxtype from oxremark where oxtext = "test text"'));
$this->assertEquals('oxdefaultadmin', oxDb::getDB()->getOne('select oxparentid from oxremark where oxtext = "test text"'));
}
示例11: setupUsers
/**
* Setting up users
*/
protected function setupUsers()
{
$myDB = oxDb::getDB();
$sTable = getViewName('oxuser');
$iLastCustNr = (int) $myDB->getOne('select max( oxcustnr ) from ' . $sTable) + 1;
$this->_oUser = oxNew('oxuser');
$this->_oUser->oxuser__oxshopid = new oxField($this->getConfig()->getShopId(), oxField::T_RAW);
$this->_oUser->oxuser__oxactive = new oxField(1, oxField::T_RAW);
$this->_oUser->oxuser__oxrights = new oxField('user', oxField::T_RAW);
$this->_oUser->oxuser__oxusername = new oxField('test@oxid-esales.com', oxField::T_RAW);
$this->_oUser->oxuser__oxpassword = new oxField(crc32('Test@oxid-esales.com'), oxField::T_RAW);
$this->_oUser->oxuser__oxcustnr = new oxField($iLastCustNr + 1, oxField::T_RAW);
$this->_oUser->oxuser__oxcountryid = new oxField("testCountry", oxField::T_RAW);
$this->_oUser->save();
$sQ = 'insert into oxaddress ( oxid, oxuserid, oxaddressuserid, oxcountryid ) values ( "test_user", "' . $this->_oUser->getId() . '", "' . $this->_oUser->getId() . '", "testCountry" ) ';
$myDB->Execute($sQ);
}
示例12: testGetRecommList
public function testGetRecommList()
{
$myDB = oxDb::getDB();
$sShopId = $this->getConfig()->getShopId();
// adding article to recommendlist
$sQ = 'insert into oxrecommlists ( oxid, oxuserid, oxtitle, oxdesc, oxshopid ) values ( "testlist", "oxdefaultadmin", "oxtest", "oxtest", "' . $sShopId . '" ) ';
$myDB->Execute($sQ);
$sQ = 'insert into oxobject2list ( oxid, oxobjectid, oxlistid, oxdesc ) values ( "testlist", "2000", "testlist", "test" ) ';
$myDB->Execute($sQ);
$oSuggest = $this->getProxyClass("suggest");
$oArticle = oxNew("oxArticle");
$oArticle->load('2000');
$oSuggest->setNonPublicVar("_oProduct", $oArticle);
$aLists = $oSuggest->getRecommList();
$this->assertTrue($aLists instanceof oxList);
$this->assertTrue($aLists instanceof oxList);
$this->assertEquals(1, $aLists->count());
$this->assertEquals('testlist', $aLists['testlist']->getId());
$this->assertTrue(in_array($aLists['testlist']->getFirstArticle()->getId(), array('2000')));
}
示例13: tearDown
/**
* Tear down the fixture.
*
* @return null
*/
protected function tearDown()
{
oxDb::getDB()->execute("delete from oxaddress where OXID = '_testUserAddressId' ");
parent::tearDown();
}
示例14: testBlockedUser
public function testBlockedUser()
{
$myDB = oxDb::getDB();
$sTable = getViewName('oxuser');
$iLastCustNr = (int) $myDB->getOne('select max( oxcustnr ) from ' . $sTable) + 1;
$oUser = oxNew('oxuser');
$oUser->oxuser__oxshopid = new oxField($this->getConfig()->getShopId(), oxField::T_RAW);
$oUser->oxuser__oxactive = new oxField(1, oxField::T_RAW);
$oUser->oxuser__oxrights = new oxField('user', oxField::T_RAW);
$oUser->oxuser__oxusername = new oxField('test@oxid-esales.com', oxField::T_RAW);
$oUser->oxuser__oxpassword = new oxField(crc32('Test@oxid-esales.com'), oxField::T_RAW);
$oUser->oxuser__oxcustnr = new oxField($iLastCustNr + 1, oxField::T_RAW);
$oUser->oxuser__oxcountryid = new oxField("testCountry", oxField::T_RAW);
$oUser->save();
$sQ = 'insert into oxaddress ( oxid, oxuserid, oxaddressuserid, oxcountryid ) values ( "test_user", "' . $oUser->getId() . '", "' . $oUser->getId() . '", "testCountry" ) ';
$myDB->Execute($sQ);
oxTestModules::addFunction("oxUtils", "redirect", "{ throw new exception( 'testBlockedUser', 123 );}");
$oUser2 = oxNew('oxuser');
$oUser2->load($oUser->getId());
$oUser2->login('test@oxid-esales.com', crc32('Test@oxid-esales.com'));
$myDB = oxDb::getDB();
$sQ = 'insert into oxobject2group (oxid,oxshopid,oxobjectid,oxgroupsid) values ( "' . $oUser2->getId() . '", "' . $this->getConfig()->getShopId() . '", "' . $oUser2->getId() . '", "oxidblocked" )';
$myDB->Execute($sQ);
try {
$oUserView = oxNew('oxcmp_user');
$oUserView->init();
} catch (Exception $oE) {
if ($oE->getCode() === 123) {
$oUser2->logout();
return;
}
}
$oUser->logout();
$this->fail('first assert should throw an exception');
}
示例15: getDbChecksum
/**
* Converts a string to UTF format.
*
* @todo move to separate class instead of static
*
* @return array
*/
protected static function getDbChecksum()
{
$myDB = oxDb::getDB();
$myConfig = modConfig::getInstance();
$sSelect = 'select GROUP_CONCAT(DISTINCT t.TABLE_NAME) from INFORMATION_SCHEMA.tables as t where t.TABLE_SCHEMA = "' . $myConfig->getConfigParam('dbName') . '" and t.TABLE_NAME not like "oxv_%"';
$rs = $myDB->execute($sSelect);
$sSelect = 'CHECKSUM TABLE ' . $rs->fields[0];
$rs = $myDB->execute($sSelect);
if ($rs != false && $rs->RecordCount() > 0) {
while (!$rs->EOF) {
if (stripos($rs->fields[0], "oxv_") !== 0) {
$aChecksum[$rs->fields[0]] = $rs->fields[1];
}
$rs->MoveNext();
}
}
return $aChecksum;
}