diff options
author | wei <> | 2007-04-16 02:02:27 +0000 |
---|---|---|
committer | wei <> | 2007-04-16 02:02:27 +0000 |
commit | 4a2ebb333d239b58c19d09ee88646fa0e32e71ed (patch) | |
tree | 9256d53581139ede3df5c2c4aa1c729283f3e74e /framework/Data/Common | |
parent | d4df553e7163f8bc8f09f79e058d5815f35ce709 (diff) |
Updates to db stuff, removed js build from build.xml (no longer necessary)
Diffstat (limited to 'framework/Data/Common')
-rw-r--r-- | framework/Data/Common/Mssql/TMssqlMetaData.php | 24 | ||||
-rw-r--r-- | framework/Data/Common/Mssql/TMssqlTableColumn.php | 9 | ||||
-rw-r--r-- | framework/Data/Common/Mssql/TMssqlTableInfo.php | 4 | ||||
-rw-r--r-- | framework/Data/Common/Mysql/TMysqlMetaData.php | 2 | ||||
-rw-r--r-- | framework/Data/Common/Pgsql/TPgsqlMetaData.php | 2 | ||||
-rw-r--r-- | framework/Data/Common/Sqlite/TSqliteMetaData.php | 2 | ||||
-rw-r--r-- | framework/Data/Common/Sqlite/TSqliteTableColumn.php | 3 | ||||
-rw-r--r-- | framework/Data/Common/TDbMetaData.php | 2 | ||||
-rw-r--r-- | framework/Data/Common/TDbTableColumn.php | 2 |
9 files changed, 48 insertions, 2 deletions
diff --git a/framework/Data/Common/Mssql/TMssqlMetaData.php b/framework/Data/Common/Mssql/TMssqlMetaData.php index c70bc349..5d14aac1 100644 --- a/framework/Data/Common/Mssql/TMssqlMetaData.php +++ b/framework/Data/Common/Mssql/TMssqlMetaData.php @@ -1,4 +1,14 @@ <?php
+/**
+ * TMssqlMetaData class file.
+ *
+ * @author Wei Zhuo <weizhuo[at]gmail[dot]com>
+ * @link http://www.pradosoft.com/
+ * @copyright Copyright © 2005-2007 PradoSoft
+ * @license http://www.pradosoft.com/license/
+ * @version $Id: TPgsqlMetaData.php 1866 2007-04-14 05:02:29Z wei $
+ * @package System.Data.Common.Pgsql
+ */
/**
* Load the base TDbMetaData class.
@@ -6,6 +16,14 @@ Prado::using('System.Data.Common.TDbMetaData');
Prado::using('System.Data.Common.Mssql.TMssqlTableInfo');
+/**
+ * TMssqlMetaData loads MSSQL database table and column information.
+ *
+ * @author Wei Zhuo <weizho[at]gmail[dot]com>
+ * @version $Id: TPgsqlMetaData.php 1866 2007-04-14 05:02:29Z wei $
+ * @package System.Data.Commom.Pgsql
+ * @since 3.1
+ */
class TMssqlMetaData extends TDbMetaData
{
/**
@@ -45,9 +63,15 @@ EOD; $tableInfo = $this->createNewTableInfo($col);
$this->processColumn($tableInfo,$col);
}
+ if($tableInfo===null)
+ throw new TDbException('dbmetadata_invalid_table_view', $table);
return $tableInfo;
}
+ /**
+ * @param string table name
+ * @return array tuple($catalogName,$schemaName,$tableName)
+ */
protected function getCatalogSchemaTableName($table)
{
//remove possible delimiters
diff --git a/framework/Data/Common/Mssql/TMssqlTableColumn.php b/framework/Data/Common/Mssql/TMssqlTableColumn.php index 77c115e5..f108248d 100644 --- a/framework/Data/Common/Mssql/TMssqlTableColumn.php +++ b/framework/Data/Common/Mssql/TMssqlTableColumn.php @@ -37,16 +37,25 @@ class TMssqlTableColumn extends TDbTableColumn return 'string';
}
+ /**
+ * @return boolean true if the column has identity (auto-increment)
+ */
public function getAutoIncrement()
{
return $this->getInfo('AutoIncrement',false);
}
+ /**
+ * @return boolean true if auto increments.
+ */
public function hasSequence()
{
return $this->getAutoIncrement();
}
+ /**
+ * @return boolean true if db type is 'timestamp'.
+ */
public function getIsExcluded()
{
return strtolower($this->getDbType())==='timestamp';
diff --git a/framework/Data/Common/Mssql/TMssqlTableInfo.php b/framework/Data/Common/Mssql/TMssqlTableInfo.php index b407ad44..e408440b 100644 --- a/framework/Data/Common/Mssql/TMssqlTableInfo.php +++ b/framework/Data/Common/Mssql/TMssqlTableInfo.php @@ -34,6 +34,9 @@ class TMssqlTableInfo extends TDbTableInfo return $this->getInfo('SchemaName');
}
+ /**
+ * @return string catalog name (database name)
+ */
public function getCatalogName()
{
return $this->getInfo('CatalogName');
@@ -44,6 +47,7 @@ class TMssqlTableInfo extends TDbTableInfo */
public function getTableFullName()
{
+ //MSSQL alway returns the catalog, schem and table names.
return '['.$this->getCatalogName().'].['.$this->getSchemaName().'].['.$this->getTableName().']';
}
diff --git a/framework/Data/Common/Mysql/TMysqlMetaData.php b/framework/Data/Common/Mysql/TMysqlMetaData.php index 9e947298..32d5114f 100644 --- a/framework/Data/Common/Mysql/TMysqlMetaData.php +++ b/framework/Data/Common/Mysql/TMysqlMetaData.php @@ -26,6 +26,8 @@ class TMysqlMetaData extends TDbMetaData $col['index'] = $index++;
$this->processColumn($tableInfo,$col);
}
+ if($index===0)
+ throw new TDbException('dbmetadata_invalid_table_view', $table);
return $tableInfo;
}
diff --git a/framework/Data/Common/Pgsql/TPgsqlMetaData.php b/framework/Data/Common/Pgsql/TPgsqlMetaData.php index ac7e6b7a..bb03b6cd 100644 --- a/framework/Data/Common/Pgsql/TPgsqlMetaData.php +++ b/framework/Data/Common/Pgsql/TPgsqlMetaData.php @@ -109,6 +109,8 @@ EOD; $col['index'] = $index++;
$this->processColumn($tableInfo, $col);
}
+ if($index===0)
+ throw new TDbException('dbmetadata_invalid_table_view', $table);
return $tableInfo;
}
diff --git a/framework/Data/Common/Sqlite/TSqliteMetaData.php b/framework/Data/Common/Sqlite/TSqliteMetaData.php index 2ce46fb7..6fcf7b7f 100644 --- a/framework/Data/Common/Sqlite/TSqliteMetaData.php +++ b/framework/Data/Common/Sqlite/TSqliteMetaData.php @@ -52,6 +52,8 @@ class TSqliteMetaData extends TDbMetaData $info['TableName'] = $table;
if($this->getIsView($tableName))
$info['IsView'] = true;
+ if(count($columns)===0)
+ throw new TDbException('dbmetadata_invalid_table_view', $tableName);
$tableInfo = new TSqliteTableInfo($info,$primary,$foreign);
$tableInfo->getColumns()->copyFrom($columns);
return $tableInfo;
diff --git a/framework/Data/Common/Sqlite/TSqliteTableColumn.php b/framework/Data/Common/Sqlite/TSqliteTableColumn.php index b8287218..80dcd9d9 100644 --- a/framework/Data/Common/Sqlite/TSqliteTableColumn.php +++ b/framework/Data/Common/Sqlite/TSqliteTableColumn.php @@ -25,6 +25,9 @@ Prado::using('System.Data.Common.TDbTableColumn'); */
class TSqliteTableColumn extends TDbTableColumn
{
+ /**
+ * @TODO add sqlite types.
+ */
private static $types = array();
/**
diff --git a/framework/Data/Common/TDbMetaData.php b/framework/Data/Common/TDbMetaData.php index 6838d7dc..d0963f44 100644 --- a/framework/Data/Common/TDbMetaData.php +++ b/framework/Data/Common/TDbMetaData.php @@ -47,7 +47,7 @@ abstract class TDbMetaData extends TComponent * @param TDbConnection database connection.
* @return TDbMetaData database specific TDbMetaData.
*/
- public static function getMetaData($conn)
+ public static function getInstance($conn)
{
$conn->setActive(true); //must be connected before retrieving driver name
$driver = $conn->getDriverName();
diff --git a/framework/Data/Common/TDbTableColumn.php b/framework/Data/Common/TDbTableColumn.php index 6ff2ff46..84fb238c 100644 --- a/framework/Data/Common/TDbTableColumn.php +++ b/framework/Data/Common/TDbTableColumn.php @@ -100,7 +100,7 @@ class TDbTableColumn extends TComponent }
/**
- * @return integer one-based ordinal position of the column in the table.
+ * @return integer zero-based ordinal position of the column in the table.
*/
public function getColumnIndex()
{
|