summaryrefslogtreecommitdiffstats
path: root/system/database/drivers
diff options
context:
space:
mode:
authorPhil Sturgeon <email@philsturgeon.co.uk>2012-08-01 16:41:50 +0200
committerPhil Sturgeon <email@philsturgeon.co.uk>2012-08-01 16:41:50 +0200
commit6c94c2dcfb6557947c9ac67e419b2856fd80e01d (patch)
treea844b9aff5ecb42ce2c49ea4e187ef44cc4d39a8 /system/database/drivers
parent3a2d573a96241c01124d15c1ce517078e07c6235 (diff)
parent824085200b3362bfe1db1ecce52bf555dd064b57 (diff)
Merge pull request #1601 from rwillert/patch-1
Reconnect to PostgreSQL database if connection dropped.
Diffstat (limited to 'system/database/drivers')
-rw-r--r--system/database/drivers/postgre/postgre_driver.php10
1 files changed, 9 insertions, 1 deletions
diff --git a/system/database/drivers/postgre/postgre_driver.php b/system/database/drivers/postgre/postgre_driver.php
index 031740851..8c11c477b 100644
--- a/system/database/drivers/postgre/postgre_driver.php
+++ b/system/database/drivers/postgre/postgre_driver.php
@@ -132,7 +132,15 @@ class CI_DB_postgre_driver extends CI_DB {
*/
public function db_pconnect()
{
- return @pg_pconnect($this->dsn);
+ $conn = @pg_pconnect($this->dsn);
+ if ($conn && pg_connection_status($conn) === PGSQL_CONNECTION_BAD)
+ {
+ if (pg_ping($conn) === FALSE)
+ {
+ return FALSE;
+ }
+ }
+ return $conn;
}
// --------------------------------------------------------------------