From 3392e51b4edf84682b66ce9e32d00c1adb3205bb Mon Sep 17 00:00:00 2001 From: wei <> Date: Tue, 8 May 2007 07:49:50 +0000 Subject: Fixed sqlmap query with limit and offsets. --- framework/Data/Common/TDbMetaData.php | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) (limited to 'framework/Data/Common/TDbMetaData.php') diff --git a/framework/Data/Common/TDbMetaData.php b/framework/Data/Common/TDbMetaData.php index d0963f44..e7c53618 100644 --- a/framework/Data/Common/TDbMetaData.php +++ b/framework/Data/Common/TDbMetaData.php @@ -80,11 +80,16 @@ abstract class TDbMetaData extends TComponent * @param string table or view name * @return TDbTableInfo table information. */ - public function getTableInfo($tableName) + public function getTableInfo($tableName=null) { - if(!isset($this->_tableInfoCache[$tableName])) - $this->_tableInfoCache[$tableName] = $this->createTableInfo($tableName); - return $this->_tableInfoCache[$tableName]; + $key = $tableName===null?$this->getDbConnection()->getConnectionString():$tableName; + if(!isset($this->_tableInfoCache[$key])) + { + $class = $this->getTableInfoClass(); + $tableInfo = $tableName===null ? new $class : $this->createTableInfo($tableName); + $this->_tableInfoCache[$key] = $tableInfo; + } + return $this->_tableInfoCache[$key]; } /** @@ -92,7 +97,7 @@ abstract class TDbMetaData extends TComponent * @param string table name. * @return TDbCommandBuilder command builder instance for the given table. */ - public function createCommandBuilder($tableName) + public function createCommandBuilder($tableName=null) { return $this->getTableInfo($tableName)->createCommandBuilder($this->getDbConnection()); } @@ -102,6 +107,14 @@ abstract class TDbMetaData extends TComponent * @return TDbTableInfo driver dependent create builder. */ abstract protected function createTableInfo($tableName); + + /** + * @return string TDbTableInfo class name. + */ + protected function getTableInfoClass() + { + return 'TDbTableInfo'; + } } ?> \ No newline at end of file -- cgit v1.2.3