summaryrefslogtreecommitdiff
path: root/framework/Data/Common/Mysql
diff options
context:
space:
mode:
Diffstat (limited to 'framework/Data/Common/Mysql')
-rw-r--r--framework/Data/Common/Mysql/TMysqlMetaData.php14
-rw-r--r--framework/Data/Common/Mysql/TMysqlTableColumn.php2
-rw-r--r--framework/Data/Common/Mysql/TMysqlTableInfo.php5
3 files changed, 14 insertions, 7 deletions
diff --git a/framework/Data/Common/Mysql/TMysqlMetaData.php b/framework/Data/Common/Mysql/TMysqlMetaData.php
index 2a6d80bd..9e947298 100644
--- a/framework/Data/Common/Mysql/TMysqlMetaData.php
+++ b/framework/Data/Common/Mysql/TMysqlMetaData.php
@@ -1,5 +1,4 @@
-<?php
-
+<?php
/**
* Load the base TDbMetaData class.
*/
@@ -15,8 +14,10 @@ class TMysqlMetaData extends TDbMetaData
*/
protected function createTableInfo($table)
{
+ list($schemaName,$tableName) = $this->getSchemaTableName($table);
+ $find = $schemaName===null ? "`{$tableName}`" : "`{$schemaName}`.`{$tableName}`";
$this->getDbConnection()->setActive(true);
- $sql = "SHOW FULL FIELDS FROM {$table}";
+ $sql = "SHOW FULL FIELDS FROM {$find}";
$command = $this->getDbConnection()->createCommand($sql);
$tableInfo = $this->createNewTableInfo($table);
$index=0;
@@ -37,6 +38,7 @@ class TMysqlMetaData extends TDbMetaData
$columnId = $col['Field'];
$info['ColumnName'] = "`$columnId`"; //quote the column names!
+ $info['ColumnId'] = $columnId;
$info['ColumnIndex'] = $col['index'];
if($col['Null']!=='NO')
$info['AllowNull'] = true;
@@ -122,7 +124,8 @@ class TMysqlMetaData extends TDbMetaData
/**
* http://dev.mysql.com/doc/refman/5.0/en/identifiers.html
- * @param unknown_type $name
+ * @param string identifier name
+ * @param boolean true if valid identifier.
*/
protected function isValidIdentifier($name)
{
@@ -139,7 +142,8 @@ class TMysqlMetaData extends TDbMetaData
list($schemaName,$tableName) = $this->getSchemaTableName($table);
$info['SchemaName'] = $schemaName;
$info['TableName'] = $tableName;
- $info['IsView'] = $this->getIsView($schemaName,$tableName);
+ if($this->getIsView($schemaName,$tableName))
+ $info['IsView'] = true;
list($primary, $foreign) = $this->getConstraintKeys($schemaName, $tableName);
return new TMysqlTableInfo($info,$primary,$foreign);
}
diff --git a/framework/Data/Common/Mysql/TMysqlTableColumn.php b/framework/Data/Common/Mysql/TMysqlTableColumn.php
index 4f0f7da2..0e991d6b 100644
--- a/framework/Data/Common/Mysql/TMysqlTableColumn.php
+++ b/framework/Data/Common/Mysql/TMysqlTableColumn.php
@@ -59,7 +59,7 @@ class TMysqlTableColumn extends TDbTableColumn
/**
* @return boolean true if auto increment is true.
*/
- public function getHasSequence()
+ public function hasSequence()
{
return $this->getAutoIncrement();
}
diff --git a/framework/Data/Common/Mysql/TMysqlTableInfo.php b/framework/Data/Common/Mysql/TMysqlTableInfo.php
index e8585730..9bc01717 100644
--- a/framework/Data/Common/Mysql/TMysqlTableInfo.php
+++ b/framework/Data/Common/Mysql/TMysqlTableInfo.php
@@ -39,7 +39,10 @@ class TMysqlTableInfo extends TDbTableInfo
*/
public function getTableFullName()
{
- return '`'.$this->getSchemaName().'`.`'.$this->getTableName().'`';
+ if(($schema=$this->getSchemaName())!==null)
+ return '`'.$schema.'`.`'.$this->getTableName();
+ else
+ return '`'.$this->getTableName().'`';
}
}