View Issue Details

IDProjectCategoryView StatusLast Update
0004763OXID eShop (all versions)4.05. Performancepublic2012-12-10 13:29
ReporterFibreFoX 
PrioritynormalSeveritytweakReproducibilityalways
Status resolvedResolutionfixed 
Product Version4.7.1 / 5.0.1 revision 52468 
Target VersionFixed in Version4.7.2 / 5.0.2 revision 53018 
Summary0004763: oxDb::getInstance without fetchMode makes it hard to use it
DescriptionoxDb::getInstance uses an cached version of oxDb, but it creates a new one with default-settings, in this case with $iFetchMode = oxDb::FETCH_MODE_NUM, so you have to use oxDb::getDb(oxDb::FETCH_MODE_ASSOC) or have to set fetchMode later, which blows up some code.
TagsPerformance
ThemeBoth
BrowserAll
PHP Versionany
MySQL Versionany

Activities

FibreFoX

2012-11-30 14:41

reporter   ~0008034

Maybe it is a good thing to reduce "getDb" and "getInstance" to only ONE thing

Linas Kukulskis

2012-12-03 10:25

reporter   ~0008038

oxDb::getInstance() - should be used only when we want to use oxDB methods: quoteArray() , escapeString() etc. for data manipulation must be oxdb::getDb():

oxDb::getDB()->select(...);
oxDb::getDB( oxdb::FETCH_MODE_ASSOC )->getAll(...);

$oDb =oxDb::getDB();
$oDb->getOne(...);
$oDb->setFetchMode(oxdb::FETCH_MODE_ASSOC);
....

Linas Kukulskis

2012-12-03 10:25

reporter   ~0008039

also remove oxDb::getInstance()->getDB() usage in code