summaryrefslogtreecommitdiff
path: root/framework/Data/Common/TDbMetaData.php
diff options
context:
space:
mode:
authorwei <>2007-05-08 07:49:50 +0000
committerwei <>2007-05-08 07:49:50 +0000
commit3392e51b4edf84682b66ce9e32d00c1adb3205bb (patch)
treec8263f0d8e6d7b4d28cf69ce48d6beea37b96ed9 /framework/Data/Common/TDbMetaData.php
parent84863ce89a1a712aa00df5c33227cecafded881a (diff)
Fixed sqlmap query with limit and offsets.
Diffstat (limited to 'framework/Data/Common/TDbMetaData.php')
-rw-r--r--framework/Data/Common/TDbMetaData.php23
1 files changed, 18 insertions, 5 deletions
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