summaryrefslogtreecommitdiffstats
path: root/system/database/drivers/postgre
diff options
context:
space:
mode:
authorAndrey Andreev <narf@devilix.net>2014-11-13 14:16:09 +0100
committerAndrey Andreev <narf@devilix.net>2014-11-13 14:16:09 +0100
commit71f0099cf443eaa98e2510b3fc274da4715b3b36 (patch)
tree9cccb06f6dfd2a5ee6d246f40bbd9eca6a4e083d /system/database/drivers/postgre
parent90671c02d6bb871da6b03c870fb27349885b0b50 (diff)
Fix an issue with 'postgre' persistent connections
Basically, they were never persistent.
Diffstat (limited to 'system/database/drivers/postgre')
-rw-r--r--system/database/drivers/postgre/postgre_driver.php27
1 files changed, 13 insertions, 14 deletions
diff --git a/system/database/drivers/postgre/postgre_driver.php b/system/database/drivers/postgre/postgre_driver.php
index bdb8a7127..18a218104 100644
--- a/system/database/drivers/postgre/postgre_driver.php
+++ b/system/database/drivers/postgre/postgre_driver.php
@@ -149,22 +149,21 @@ class CI_DB_postgre_driver extends CI_DB {
*/
public function db_connect($persistent = FALSE)
{
- if ($persistent === TRUE
- && ($this->conn_id = pg_pconnect($this->dsn))
- && pg_connection_status($this->conn_id) === PGSQL_CONNECTION_BAD
- && pg_ping($this->conn_id) === FALSE
- )
- {
- return FALSE;
- }
- else
- {
- $this->conn_id = pg_connect($this->dsn);
- }
+ $this->conn_id = ($persistent === TRUE)
+ ? pg_pconnect($this->dsn)
+ : pg_connect($this->dsn);
- if ($this->conn_id && ! empty($this->schema))
+ if ($this->conn_id !== FALSE)
{
- $this->simple_query('SET search_path TO '.$this->schema.',public');
+ if ($persistent === TRUE
+ && pg_connection_status($this->conn_id) === PGSQL_CONNECTION_BAD
+ && pg_ping($this->conn_id) === FALSE
+ )
+ {
+ return FALSE;
+ }
+
+ empty($this->schema) OR $this->simple_query('SET search_path TO '.$this->schema.',public');
}
return $this->conn_id;