diff options
author | wei <> | 2007-05-08 07:49:50 +0000 |
---|---|---|
committer | wei <> | 2007-05-08 07:49:50 +0000 |
commit | 3392e51b4edf84682b66ce9e32d00c1adb3205bb (patch) | |
tree | c8263f0d8e6d7b4d28cf69ce48d6beea37b96ed9 /framework/Data/Common | |
parent | 84863ce89a1a712aa00df5c33227cecafded881a (diff) |
Fixed sqlmap query with limit and offsets.
Diffstat (limited to 'framework/Data/Common')
-rw-r--r-- | framework/Data/Common/Mssql/TMssqlMetaData.php | 11 | ||||
-rw-r--r-- | framework/Data/Common/Mysql/TMysqlMetaData.php | 11 | ||||
-rw-r--r-- | framework/Data/Common/Pgsql/TPgsqlMetaData.php | 11 | ||||
-rw-r--r-- | framework/Data/Common/Sqlite/TSqliteMetaData.php | 11 | ||||
-rw-r--r-- | framework/Data/Common/TDbMetaData.php | 23 | ||||
-rw-r--r-- | framework/Data/Common/TDbTableInfo.php | 2 |
6 files changed, 59 insertions, 10 deletions
diff --git a/framework/Data/Common/Mssql/TMssqlMetaData.php b/framework/Data/Common/Mssql/TMssqlMetaData.php index 72d297f7..37ce124f 100644 --- a/framework/Data/Common/Mssql/TMssqlMetaData.php +++ b/framework/Data/Common/Mssql/TMssqlMetaData.php @@ -27,6 +27,14 @@ Prado::using('System.Data.Common.Mssql.TMssqlTableInfo'); class TMssqlMetaData extends TDbMetaData
{
/**
+ * @return string TDbTableInfo class name.
+ */
+ protected function getTableInfoClass()
+ {
+ return 'TMssqlTableInfo';
+ }
+
+ /**
* Get the column definitions for given table.
* @param string table name.
* @return TMssqlTableInfo table information.
@@ -130,7 +138,8 @@ EOD; if($col['TABLE_TYPE']==='VIEW')
$info['IsView'] = true;
list($primary, $foreign) = $this->getConstraintKeys($col);
- return new TMssqlTableInfo($info,$primary,$foreign);
+ $class = $this->getTableInfoClass();
+ return new $class($info,$primary,$foreign);
}
/**
diff --git a/framework/Data/Common/Mysql/TMysqlMetaData.php b/framework/Data/Common/Mysql/TMysqlMetaData.php index 89e9e3ca..3b9a12f7 100644 --- a/framework/Data/Common/Mysql/TMysqlMetaData.php +++ b/framework/Data/Common/Mysql/TMysqlMetaData.php @@ -32,6 +32,14 @@ class TMysqlMetaData extends TDbMetaData private $_serverVersion=0;
/**
+ * @return string TDbTableInfo class name.
+ */
+ protected function getTableInfoClass()
+ {
+ return 'TMysqlTableInfo';
+ }
+
+ /**
* Get the column definitions for given table.
* @param string table name.
* @return TMysqlTableInfo table information.
@@ -185,7 +193,8 @@ class TMysqlMetaData extends TDbMetaData if($this->getIsView($schemaName,$tableName))
$info['IsView'] = true;
list($primary, $foreign) = $this->getConstraintKeys($schemaName, $tableName);
- return new TMysqlTableInfo($info,$primary,$foreign);
+ $class = $this->getTableInfoClass();
+ return new $class($info,$primary,$foreign);
}
/**
diff --git a/framework/Data/Common/Pgsql/TPgsqlMetaData.php b/framework/Data/Common/Pgsql/TPgsqlMetaData.php index c68bbaa0..0b647445 100644 --- a/framework/Data/Common/Pgsql/TPgsqlMetaData.php +++ b/framework/Data/Common/Pgsql/TPgsqlMetaData.php @@ -29,6 +29,14 @@ class TPgsqlMetaData extends TDbMetaData private $_defaultSchema = 'public';
/**
+ * @return string TDbTableInfo class name.
+ */
+ protected function getTableInfoClass()
+ {
+ return 'TPgsqlTableInfo';
+ }
+
+ /**
* @param string default schema.
*/
public function setDefaultSchema($schema)
@@ -126,7 +134,8 @@ EOD; if($this->getIsView($schemaName,$tableName))
$info['IsView'] = true;
list($primary, $foreign) = $this->getConstraintKeys($schemaName, $tableName);
- return new TPgsqlTableInfo($info,$primary,$foreign);
+ $class = $this->getTableInfoClass();
+ return new $class($info,$primary,$foreign);
}
/**
diff --git a/framework/Data/Common/Sqlite/TSqliteMetaData.php b/framework/Data/Common/Sqlite/TSqliteMetaData.php index 5e1c5f77..aa2ed724 100644 --- a/framework/Data/Common/Sqlite/TSqliteMetaData.php +++ b/framework/Data/Common/Sqlite/TSqliteMetaData.php @@ -27,6 +27,14 @@ Prado::using('System.Data.Common.Sqlite.TSqliteTableInfo'); class TSqliteMetaData extends TDbMetaData
{
/**
+ * @return string TDbTableInfo class name.
+ */
+ protected function getTableInfoClass()
+ {
+ return 'TSqliteTableInfo';
+ }
+
+ /**
* Get the column definitions for given table.
* @param string table name.
* @return TPgsqlTableInfo table information.
@@ -55,7 +63,8 @@ class TSqliteMetaData extends TDbMetaData $info['IsView'] = true;
if(count($columns)===0)
throw new TDbException('dbmetadata_invalid_table_view', $tableName);
- $tableInfo = new TSqliteTableInfo($info,$primary,$foreign);
+ $class = $this->getTableInfoClass();
+ $tableInfo = new $class($info,$primary,$foreign);
$tableInfo->getColumns()->copyFrom($columns);
return $tableInfo;
}
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 diff --git a/framework/Data/Common/TDbTableInfo.php b/framework/Data/Common/TDbTableInfo.php index 9689630f..ee5d2d00 100644 --- a/framework/Data/Common/TDbTableInfo.php +++ b/framework/Data/Common/TDbTableInfo.php @@ -33,7 +33,7 @@ class TDbTableInfo extends TComponent * Sets the database table meta data information.
* @param array table column information.
*/
- public function __construct($tableInfo,$primary=array(),$foreign=array())
+ public function __construct($tableInfo=array(),$primary=array(),$foreign=array())
{
$this->_info=$tableInfo;
$this->_primaryKeys=$primary;
|