diff options
author | wei <> | 2007-04-14 05:02:29 +0000 |
---|---|---|
committer | wei <> | 2007-04-14 05:02:29 +0000 |
commit | 0f0d3c62e608287cdf77f1a3239371b521ecb40b (patch) | |
tree | bd91a9499a946e1667a0e17a9c5a97a9d695c7ce /framework/Data/Common/Mysql | |
parent | b05442bbe751b87998d8500ad8e6b28d652a35db (diff) |
Refactor ActiveRecordGateway to use TDataGatewayCommand
Diffstat (limited to 'framework/Data/Common/Mysql')
-rw-r--r-- | framework/Data/Common/Mysql/TMysqlMetaData.php | 14 | ||||
-rw-r--r-- | framework/Data/Common/Mysql/TMysqlTableColumn.php | 2 | ||||
-rw-r--r-- | framework/Data/Common/Mysql/TMysqlTableInfo.php | 5 |
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().'`';
}
}
|