diff options
author | GODZilla0480@gmail.com <> | 2011-08-28 06:24:03 +0000 |
---|---|---|
committer | GODZilla0480@gmail.com <> | 2011-08-28 06:24:03 +0000 |
commit | fb494d1e299e256721cba77105a01b7480c48c08 (patch) | |
tree | 60a126bd254916501f45f8034108a77c580bd0bc /framework/Data/Common/Mysql/TMysqlMetaData.php | |
parent | 5ad92b6fe39f04aad8d94f32d23c7e665725fe8c (diff) |
Add methods quoteTableName, quoteColumnName, quoteColumnAlias to TDbMetaData & TDbConnection and add TDbConnection:getDbMetaData [TODO: customize TOracleMetaData]
Diffstat (limited to 'framework/Data/Common/Mysql/TMysqlMetaData.php')
-rw-r--r-- | framework/Data/Common/Mysql/TMysqlMetaData.php | 38 |
1 files changed, 34 insertions, 4 deletions
diff --git a/framework/Data/Common/Mysql/TMysqlMetaData.php b/framework/Data/Common/Mysql/TMysqlMetaData.php index d3de3ff6..5eba540d 100644 --- a/framework/Data/Common/Mysql/TMysqlMetaData.php +++ b/framework/Data/Common/Mysql/TMysqlMetaData.php @@ -24,7 +24,7 @@ Prado::using('System.Data.Common.Mysql.TMysqlTableInfo'); *
* @author Wei Zhuo <weizho[at]gmail[dot]com>
* @version $Id$
- * @package System.Data.Commom.Sqlite
+ * @package System.Data.Common.Mysql
* @since 3.1
*/
class TMysqlMetaData extends TDbMetaData
@@ -40,6 +40,36 @@ class TMysqlMetaData extends TDbMetaData }
/**
+ * Quotes a table name for use in a query.
+ * @param string $name table name
+ * @return string the properly quoted table name
+ */
+ public function quoteTableName($name)
+ {
+ return parent::quoteTableName($name, '`', '`');
+ }
+
+ /**
+ * Quotes a column name for use in a query.
+ * @param string $name column name
+ * @return string the properly quoted column name
+ */
+ public function quoteColumnName($name)
+ {
+ return parent::quoteColumnName($name, '`', '`');
+ }
+
+ /**
+ * Quotes a column alias for use in a query.
+ * @param string $name column alias
+ * @return string the properly quoted column alias
+ */
+ public function quoteColumnAlias($name)
+ {
+ return parent::quoteColumnAlias($name, '`', '`');
+ }
+
+ /**
* Get the column definitions for given table.
* @param string table name.
* @return TMysqlTableInfo table information.
@@ -246,8 +276,8 @@ class TMysqlMetaData extends TDbMetaData if($row['Key_name']==='PRIMARY')
$primary[] = $row['Column_name'];
}
- // MySQL version was increased to >=5.1.21 instead of 5.x
- // due to a MySQL bug (http://bugs.mysql.com/bug.php?id=19588)
+ // MySQL version was increased to >=5.1.21 instead of 5.x
+ // due to a MySQL bug (http://bugs.mysql.com/bug.php?id=19588)
if($this->getServerVersion() >= 5.121)
$foreign = $this->getForeignConstraints($schemaName,$tableName);
else
@@ -272,7 +302,7 @@ class TMysqlMetaData extends TDbMetaData REFERENCED_TABLE_NAME as fktable,
REFERENCED_COLUMN_NAME as fkcol
FROM
- `INFORMATION_SCHEMA`.`KEY_COLUMN_USAGE`
+ `INFORMATION_SCHEMA`.`KEY_COLUMN_USAGE`
WHERE
REFERENCED_TABLE_NAME IS NOT NULL
AND TABLE_NAME LIKE :table
|