summaryrefslogtreecommitdiff
path: root/framework/Data/Common/Mssql
diff options
context:
space:
mode:
Diffstat (limited to 'framework/Data/Common/Mssql')
-rw-r--r--framework/Data/Common/Mssql/TMssqlCommandBuilder.php4
-rw-r--r--framework/Data/Common/Mssql/TMssqlMetaData.php34
-rw-r--r--framework/Data/Common/Mssql/TMssqlTableColumn.php4
-rw-r--r--framework/Data/Common/Mssql/TMssqlTableInfo.php4
4 files changed, 33 insertions, 13 deletions
diff --git a/framework/Data/Common/Mssql/TMssqlCommandBuilder.php b/framework/Data/Common/Mssql/TMssqlCommandBuilder.php
index efee34f9..ac718bcb 100644
--- a/framework/Data/Common/Mssql/TMssqlCommandBuilder.php
+++ b/framework/Data/Common/Mssql/TMssqlCommandBuilder.php
@@ -4,9 +4,8 @@
*
* @author Wei Zhuo <weizhuo[at]gmail[dot]com>
* @link http://www.pradosoft.com/
- * @copyright Copyright &copy; 2005-2013 PradoSoft
+ * @copyright Copyright &copy; 2005-2014 PradoSoft
* @license http://www.pradosoft.com/license/
- * @version $Id: TDbCommandBuilder.php 1863 2007-04-12 12:43:49Z wei $
* @package System.Data.Common
*/
@@ -17,7 +16,6 @@ Prado::using('System.Data.Common.TDbCommandBuilder');
* for MSSQL servers.
*
* @author Wei Zhuo <weizho[at]gmail[dot]com>
- * @version $Id: TDbCommandBuilder.php 1863 2007-04-12 12:43:49Z wei $
* @package System.Data.Common
* @since 3.1
*/
diff --git a/framework/Data/Common/Mssql/TMssqlMetaData.php b/framework/Data/Common/Mssql/TMssqlMetaData.php
index 3ff7ac7f..21571428 100644
--- a/framework/Data/Common/Mssql/TMssqlMetaData.php
+++ b/framework/Data/Common/Mssql/TMssqlMetaData.php
@@ -4,9 +4,8 @@
*
* @author Wei Zhuo <weizhuo[at]gmail[dot]com>
* @link http://www.pradosoft.com/
- * @copyright Copyright &copy; 2005-2013 PradoSoft
+ * @copyright Copyright &copy; 2005-2014 PradoSoft
* @license http://www.pradosoft.com/license/
- * @version $Id: TPgsqlMetaData.php 1866 2007-04-14 05:02:29Z wei $
* @package System.Data.Common.Mssql
*/
@@ -20,12 +19,11 @@ 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.Common.Mssql
* @since 3.1
*/
class TMssqlMetaData extends TDbMetaData
-{
+{
/**
* @return string TDbTableInfo class name.
*/
@@ -260,5 +258,33 @@ EOD;
}
return false;
}
+
+ /**
+ * Returns all table names in the database.
+ * @param string $schema the schema of the tables. Defaults to empty string, meaning the current or default schema.
+ * If not empty, the returned table names will be prefixed with the schema name.
+ * @return array all table names in the database.
+ */
+ public function findTableNames($schema='dbo')
+ {
+ $condition="TABLE_TYPE='BASE TABLE'";
+ $sql=<<<EOD
+SELECT TABLE_NAME, TABLE_SCHEMA FROM [INFORMATION_SCHEMA].[TABLES]
+WHERE TABLE_SCHEMA=:schema AND $condition
+EOD;
+ $command=$this->getDbConnection()->createCommand($sql);
+ $command->bindParam(":schema", $schema);
+ $rows=$command->queryAll();
+ $names=array();
+ foreach ($rows as $row)
+ {
+ if ($schema == self::DEFAULT_SCHEMA)
+ $names[]=$row['TABLE_NAME'];
+ else
+ $names[]=$schema.'.'.$row['TABLE_SCHEMA'].'.'.$row['TABLE_NAME'];
+ }
+
+ return $names;
+ }
}
diff --git a/framework/Data/Common/Mssql/TMssqlTableColumn.php b/framework/Data/Common/Mssql/TMssqlTableColumn.php
index 7976c28a..e3bd431e 100644
--- a/framework/Data/Common/Mssql/TMssqlTableColumn.php
+++ b/framework/Data/Common/Mssql/TMssqlTableColumn.php
@@ -4,9 +4,8 @@
*
* @author Wei Zhuo <weizhuo[at]gmail[dot]com>
* @link http://www.pradosoft.com/
- * @copyright Copyright &copy; 2005-2013 PradoSoft
+ * @copyright Copyright &copy; 2005-2014 PradoSoft
* @license http://www.pradosoft.com/license/
- * @version $Id: TMssqlTableColumn.php 1863 2007-04-12 12:43:49Z wei $
* @package System.Data.Common.Mssql
*/
@@ -19,7 +18,6 @@ Prado::using('System.Data.Common.TDbTableColumn');
* Describes the column metadata of the schema for a Mssql database table.
*
* @author Wei Zhuo <weizho[at]gmail[dot]com>
- * @version $Id: TMssqlTableColumn.php 1863 2007-04-12 12:43:49Z wei $
* @package System.Data.Common.Mssql
* @since 3.1
*/
diff --git a/framework/Data/Common/Mssql/TMssqlTableInfo.php b/framework/Data/Common/Mssql/TMssqlTableInfo.php
index 0db446b1..d003b336 100644
--- a/framework/Data/Common/Mssql/TMssqlTableInfo.php
+++ b/framework/Data/Common/Mssql/TMssqlTableInfo.php
@@ -4,9 +4,8 @@
*
* @author Wei Zhuo <weizhuo[at]gmail[dot]com>
* @link http://www.pradosoft.com/
- * @copyright Copyright &copy; 2005-2013 PradoSoft
+ * @copyright Copyright &copy; 2005-2014 PradoSoft
* @license http://www.pradosoft.com/license/
- * @version $Id: TMssqlTableInfo.php 1861 2007-04-12 08:05:03Z wei $
* @package System.Data.Common.Mssql
*/
@@ -20,7 +19,6 @@ Prado::using('System.Data.Common.Mssql.TMssqlTableColumn');
* TMssqlTableInfo class provides additional table information for Mssql database.
*
* @author Wei Zhuo <weizho[at]gmail[dot]com>
- * @version $Id: TMssqlTableInfo.php 1861 2007-04-12 08:05:03Z wei $
* @package System.Data.Common.Mssql
* @since 3.1
*/