summaryrefslogtreecommitdiff
path: root/framework/Caching
diff options
context:
space:
mode:
authorxue <>2007-06-23 11:12:30 +0000
committerxue <>2007-06-23 11:12:30 +0000
commitdb685ed372f5aba3130f8b51df440d802dd2233b (patch)
treed7d3de17a928d2f5504b567b9531d80947c79e1a /framework/Caching
parent932a86e8d849378a7bf7b7e849c6dda3764754bb (diff)
Fixed several typos in TDbCache.
Diffstat (limited to 'framework/Caching')
-rw-r--r--framework/Caching/TDbCache.php13
1 files changed, 8 insertions, 5 deletions
diff --git a/framework/Caching/TDbCache.php b/framework/Caching/TDbCache.php
index 78fc6849..302348ce 100644
--- a/framework/Caching/TDbCache.php
+++ b/framework/Caching/TDbCache.php
@@ -135,7 +135,7 @@ class TDbCache extends TCache
// DB table not exists
if($this->_autoCreate)
{
- $sql='CREATE TABLE '.$this->_cacheTable.' (key CHAR(128) PRIMARY KEY, value BLOB, expire INT)';
+ $sql='CREATE TABLE '.$this->_cacheTable.' (itemkey CHAR(128) PRIMARY KEY, value BLOB, expire INT)';
$db->createCommand($sql)->execute();
}
else
@@ -169,7 +169,7 @@ class TDbCache extends TCache
*/
public function setConnectionString($value)
{
- $this->getDbConnection()->getConnectionString($value);
+ $this->getDbConnection()->setConnectionString($value);
}
/**
@@ -253,7 +253,7 @@ class TDbCache extends TCache
*/
protected function getValue($key)
{
- $sql='SELECT value FROM '.$this->_cacheTable.' WHERE key=\''.$key.'\' AND (expire=0 OR expire>'.time().')';
+ $sql='SELECT value FROM '.$this->_cacheTable.' WHERE itemkey=\''.$key.'\' AND (expire=0 OR expire>'.time().')';
return $this->_db->createCommand($sql)->queryScalar();
}
@@ -283,10 +283,11 @@ class TDbCache extends TCache
*/
protected function addValue($key,$value,$expire)
{
- $sql="INSERT INTO {$this->_cacheTable} (key,value,expire) VALUES('$key',:value,$expire)";
+ $sql="INSERT INTO {$this->_cacheTable} (itemkey,value,expire) VALUES(:key,:value,$expire)";
try
{
$command=$this->_db->createCommand($sql);
+ $command->bindValue(':key',$key,PDO::PARAM_STR);
$command->bindValue(':value',$value,PDO::PARAM_LOB);
$command->execute();
return true;
@@ -305,7 +306,9 @@ class TDbCache extends TCache
*/
protected function deleteValue($key)
{
- $this->_db->createCommand("DELETE FROM {$this->_cacheTable} WHERE key='$key'")->execute();
+ $command=$this->_db->createCommand("DELETE FROM {$this->_cacheTable} WHERE itemkey=:key");
+ $command->bindValue(':key',$key,PDO::PARAM_STR);
+ $command->execute();
return true;
}