summaryrefslogtreecommitdiff
path: root/framework/DataAccess/SQLMap/Statements/TCachingStatement.php
diff options
context:
space:
mode:
authorwei <>2006-12-16 03:56:03 +0000
committerwei <>2006-12-16 03:56:03 +0000
commitddc0de38f64e5834ce04f0407a8416172b596655 (patch)
treea94c75b6e7a4f443f748124b84e30d02826bb23a /framework/DataAccess/SQLMap/Statements/TCachingStatement.php
parentc8689010d28a0fe2a734131a2964d7df394cdf6c (diff)
removed adodb and framework/DataAccess
Diffstat (limited to 'framework/DataAccess/SQLMap/Statements/TCachingStatement.php')
-rw-r--r--framework/DataAccess/SQLMap/Statements/TCachingStatement.php102
1 files changed, 0 insertions, 102 deletions
diff --git a/framework/DataAccess/SQLMap/Statements/TCachingStatement.php b/framework/DataAccess/SQLMap/Statements/TCachingStatement.php
deleted file mode 100644
index 085fa9e6..00000000
--- a/framework/DataAccess/SQLMap/Statements/TCachingStatement.php
+++ /dev/null
@@ -1,102 +0,0 @@
-<?php
-
-/**
- *
- *
- * @author Wei Zhuo <weizhuo[at]gmail[dot]com>
- * @version $Id$
- * @package System.Web.UI.WebControls
- * @since 3.0
- */
-class TCachingStatement implements IMappedStatement
-{
- private $_mappedStatement;
-
- public function __construct(TMappedStatement $statement)
- {
- $this->_mappedStatement = $statement;
- }
-
- public function getID()
- {
- return $this->_mappedStatement->getID();
- }
-
- public function getStatement()
- {
- return $this->_mappedStatement->getStatement();
- }
-
- public function getSqlMap()
- {
- return $this->_mappedStatement->getSqlMap();
- }
-
- public function executeQueryForMap($connection, $parameter,
- $keyProperty, $valueProperty=null, $delegate=null)
- {
- $sql = $this->createCommand($connection, $parameter);
- $key = $this->getCacheKey(array($sql, $keyProperty, $valueProperty));
- $map = $this->getStatement()->getCache()->get($key);
- if(is_null($map))
- {
- $map = $this->_mappedStatement->runQueryForMap(
- $connection, $parameter, $sql, $keyProperty, $valueProperty, $delegate);
- $this->getStatement()->getCache()->set($key, $map);
- }
- return $map;
- }
-
- public function executeUpdate($connection, $parameter)
- {
- return $this->_mappedStatement->executeUpdate($connection, $parameter);
- }
-
- public function executeInsert($connection, $parameter)
- {
- return $this->executeInsert($connection, $parameter);
- }
-
- public function executeQueryForList($connection, $parameter,
- $result, $skip=-1, $max=-1, $delegate=null)
- {
- $sql = $this->createCommand($connection, $parameter);
- $key = $this->getCacheKey(array($sql, $skip, $max));
- $list = $this->getStatement()->getCache()->get($key);
- if(is_null($list))
- {
- $list = $this->_mappedStatement->runQueryForList(
- $connection, $parameter, $sql, $result, $skip, $max, $delegate);
- $this->getStatement()->getCache()->set($key, $list);
- }
- return $list;
- }
-
- public function executeQueryForObject($connection, $parameter, $result)
- {
- $sql = $this->createCommand($connection, $parameter);
- $key = $this->getCacheKey($sql);
- $object = $this->getStatement()->getCache()->get($key);
- if(is_null($object))
- {
- $object = $this->_mappedStatement->runQueryForObject(
- $connection, $sql, $result);
- $this->getStatement()->getCache()->set($key, $object);
- }
- return $object;
- }
-
- protected function getCacheKey($object)
- {
- $cacheKey = new TSqlMapCacheKey($object);
- return $cacheKey->getHash();
- }
-
- protected function createCommand($connection, $parameter)
- {
- return $this->_mappedStatement->getCommand()->create(
- $connection, $this->getStatement(), $parameter);
- }
-}
-
-?> \ No newline at end of file