Fixed query and schema caching renamings.

This commit is contained in:
Qiang Xue
2013-01-05 17:19:08 -05:00
parent 9d75714b46
commit 9cd67bb6b4
4 changed files with 15 additions and 26 deletions

View File

@ -106,12 +106,11 @@ class DbCache extends Cache
->from($this->cacheTableName)
->where('id = :id AND (expire = 0 OR expire > :time)', array(':id' => $key, ':time' => time()));
$db = $this->getDbConnection();
if ($db->queryCachingDuration >= 0) {
if ($db->enableQueryCache) {
// temporarily disable and re-enable query caching
$duration = $db->queryCachingDuration;
$db->queryCachingDuration = -1;
$db->enableQueryCache = false;
$result = $query->createCommand($db)->queryScalar();
$db->queryCachingDuration = $duration;
$db->enableQueryCache = true;
return $result;
} else {
return $query->createCommand($db)->queryScalar();
@ -135,11 +134,10 @@ class DbCache extends Cache
->andWhere("expire = 0 OR expire > " . time() . ")");
$db = $this->getDbConnection();
if ($db->queryCachingDuration >= 0) {
$duration = $db->queryCachingDuration;
$db->queryCachingDuration = -1;
if ($db->enableQueryCache) {
$db->enableQueryCache = false;
$rows = $query->createCommand($db)->queryAll();
$db->queryCachingDuration = $duration;
$db->enableQueryCache = true;
} else {
$rows = $query->createCommand($db)->queryAll();
}