diff options
author | Andrey Andreev <narf@bofh.bg> | 2012-10-27 02:22:43 +0200 |
---|---|---|
committer | Andrey Andreev <narf@bofh.bg> | 2012-10-27 02:22:43 +0200 |
commit | 485a348a7a633d38f69a963e9f77e23077f75d11 (patch) | |
tree | d45c37f73b848e054ad424bfe29fbf839867b944 /system/database/drivers/pdo | |
parent | ca20d8445312e49e1e974c5ed8cf04400929e615 (diff) |
Add database schema configuration support (used by PostgreSQL, fix #158)
Diffstat (limited to 'system/database/drivers/pdo')
-rw-r--r-- | system/database/drivers/pdo/subdrivers/pdo_odbc_driver.php | 9 | ||||
-rw-r--r-- | system/database/drivers/pdo/subdrivers/pdo_pgsql_driver.php | 9 |
2 files changed, 14 insertions, 4 deletions
diff --git a/system/database/drivers/pdo/subdrivers/pdo_odbc_driver.php b/system/database/drivers/pdo/subdrivers/pdo_odbc_driver.php index 5944d55f4..3be7e3c70 100644 --- a/system/database/drivers/pdo/subdrivers/pdo_odbc_driver.php +++ b/system/database/drivers/pdo/subdrivers/pdo_odbc_driver.php @@ -51,6 +51,11 @@ class CI_DB_pdo_odbc_driver extends CI_DB_pdo_driver { protected $_random_keyword = ' RAND()'; /** + * @var string Database schema + */ + public $schema = 'public'; + + /** * Constructor * * Builds the DSN if not already set. @@ -122,12 +127,12 @@ class CI_DB_pdo_odbc_driver extends CI_DB_pdo_driver { * * Generates a platform-specific query string so that the table names can be fetched * - * @param bool + * @param bool $prefix_limit = FALSE * @return string */ protected function _list_tables($prefix_limit = FALSE) { - $sql = "SELECT table_name FROM information_schema.tables WHERE table_schema = 'public'"; + $sql = "SELECT table_name FROM information_schema.tables WHERE table_schema = '".$this->schema."'"; if ($prefix_limit !== FALSE && $this->dbprefix !== '') { diff --git a/system/database/drivers/pdo/subdrivers/pdo_pgsql_driver.php b/system/database/drivers/pdo/subdrivers/pdo_pgsql_driver.php index 74d56e6b8..3efc45a2d 100644 --- a/system/database/drivers/pdo/subdrivers/pdo_pgsql_driver.php +++ b/system/database/drivers/pdo/subdrivers/pdo_pgsql_driver.php @@ -45,6 +45,11 @@ class CI_DB_pdo_pgsql_driver extends CI_DB_pdo_driver { protected $_random_keyword = ' RANDOM()'; /** + * @var string Database schema + */ + public $schema = 'public'; + + /** * Constructor * * Builds the DSN if not already set. @@ -92,12 +97,12 @@ class CI_DB_pdo_pgsql_driver extends CI_DB_pdo_driver { * * Generates a platform-specific query string so that the table names can be fetched * - * @param bool + * @param bool $prefix_limit = FALSE * @return string */ protected function _list_tables($prefix_limit = FALSE) { - $sql = 'SELECT "table_name" FROM "information_schema"."tables" WHERE "table_schema" = \'public\''; + $sql = 'SELECT "table_name" FROM "information_schema"."tables" WHERE "table_schema" = \''.$this->schema."'"; if ($prefix_limit === TRUE && $this->dbprefix !== '') { |