diff options
author | rwillert <robert.willert@conceptpeople.de> | 2012-07-10 13:02:01 +0200 |
---|---|---|
committer | rwillert <robert.willert@conceptpeople.de> | 2012-07-10 13:02:01 +0200 |
commit | 824085200b3362bfe1db1ecce52bf555dd064b57 (patch) | |
tree | ca8833d7fd3b0007c0f1c646d9d82dd09db3c2cb /system/database | |
parent | cbb654d9b332b65c5e2ae6f7bf8936b425b709ac (diff) |
Reconnect to PostgreSQL database if connection droped.
Diffstat (limited to 'system/database')
-rw-r--r-- | system/database/drivers/postgre/postgre_driver.php | 10 |
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 20b78673e..c24c523de 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; } // -------------------------------------------------------------------- |