summaryrefslogtreecommitdiff
path: root/framework/Data/Common/Pgsql
diff options
context:
space:
mode:
authorctrlaltca <ctrlaltca@gmail.com>2014-08-26 16:59:21 +0200
committerctrlaltca <ctrlaltca@gmail.com>2014-08-26 16:59:21 +0200
commit74b31be9515eddfa63005d6760614badfaba9fea (patch)
tree47c952901dcb5eccd6dd8b7c6ee7e0b6bf176510 /framework/Data/Common/Pgsql
parent2b11341614ac4a15be697fa8acad07055154ac54 (diff)
parent0c5026b55cde5c104f10686afd8b441568175d38 (diff)
Merge pull request #530 from pradosoft/prado-3.2.43.2.4prado-3.2
Backports for Prado 3.2.4
Diffstat (limited to 'framework/Data/Common/Pgsql')
-rw-r--r--framework/Data/Common/Pgsql/TPgsqlCommandBuilder.php4
-rw-r--r--framework/Data/Common/Pgsql/TPgsqlMetaData.php32
-rw-r--r--framework/Data/Common/Pgsql/TPgsqlTableColumn.php4
-rw-r--r--framework/Data/Common/Pgsql/TPgsqlTableInfo.php4
4 files changed, 32 insertions, 12 deletions
diff --git a/framework/Data/Common/Pgsql/TPgsqlCommandBuilder.php b/framework/Data/Common/Pgsql/TPgsqlCommandBuilder.php
index eb975a1a..851dabb5 100644
--- a/framework/Data/Common/Pgsql/TPgsqlCommandBuilder.php
+++ b/framework/Data/Common/Pgsql/TPgsqlCommandBuilder.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 Pgsql database.
*
* @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/Pgsql/TPgsqlMetaData.php b/framework/Data/Common/Pgsql/TPgsqlMetaData.php
index dd91dfdc..595f46e8 100644
--- a/framework/Data/Common/Pgsql/TPgsqlMetaData.php
+++ b/framework/Data/Common/Pgsql/TPgsqlMetaData.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 3245 2013-01-07 20:23:32Z ctrlaltca $
* @package System.Data.Common.Pgsql
*/
@@ -20,7 +19,6 @@ Prado::using('System.Data.Common.Pgsql.TPgsqlTableInfo');
* TPgsqlMetaData loads PostgreSQL database table and column information.
*
* @author Wei Zhuo <weizho[at]gmail[dot]com>
- * @version $Id: TPgsqlMetaData.php 3245 2013-01-07 20:23:32Z ctrlaltca $
* @package System.Data.Common.Pgsql
* @since 3.1
*/
@@ -418,5 +416,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='public')
+ {
+ if($schema==='')
+ $schema=self::DEFAULT_SCHEMA;
+ $sql=<<<EOD
+SELECT table_name, table_schema FROM information_schema.tables
+WHERE table_schema=:schema AND table_type='BASE TABLE'
+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[]=$row['table_schema'].'.'.$row['table_name'];
+ }
+ return $names;
+ }
}
diff --git a/framework/Data/Common/Pgsql/TPgsqlTableColumn.php b/framework/Data/Common/Pgsql/TPgsqlTableColumn.php
index da17a7d3..fd0fd23c 100644
--- a/framework/Data/Common/Pgsql/TPgsqlTableColumn.php
+++ b/framework/Data/Common/Pgsql/TPgsqlTableColumn.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: TPgsqlTableColumn.php 3245 2013-01-07 20:23:32Z ctrlaltca $
* @package System.Data.Common.Pgsql
*/
@@ -19,7 +18,6 @@ Prado::using('System.Data.Common.TDbTableColumn');
* Describes the column metadata of the schema for a PostgreSQL database table.
*
* @author Wei Zhuo <weizho[at]gmail[dot]com>
- * @version $Id: TPgsqlTableColumn.php 3245 2013-01-07 20:23:32Z ctrlaltca $
* @package System.Data.Common.Pgsql
* @since 3.1
*/
diff --git a/framework/Data/Common/Pgsql/TPgsqlTableInfo.php b/framework/Data/Common/Pgsql/TPgsqlTableInfo.php
index ef2b4575..43298ffa 100644
--- a/framework/Data/Common/Pgsql/TPgsqlTableInfo.php
+++ b/framework/Data/Common/Pgsql/TPgsqlTableInfo.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: TPgsqlTableInfo.php 3245 2013-01-07 20:23:32Z ctrlaltca $
* @package System.Data.Common.Pgsql
*/
@@ -20,7 +19,6 @@ Prado::using('System.Data.Common.Pgsql.TPgsqlTableColumn');
* TPgsqlTableInfo class provides additional table information for PostgreSQL database.
*
* @author Wei Zhuo <weizho[at]gmail[dot]com>
- * @version $Id: TPgsqlTableInfo.php 3245 2013-01-07 20:23:32Z ctrlaltca $
* @package System.Data.Common.Pgsql
* @since 3.1
*/