From 87cbafce2d6803af78714baf8bba64309c01fc33 Mon Sep 17 00:00:00 2001 From: Derek Jones Date: Fri, 27 Feb 2009 16:29:59 +0000 Subject: added reconnect() method to db drivers --- system/database/drivers/mysql/mysql_driver.php | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'system/database/drivers/mysql/mysql_driver.php') diff --git a/system/database/drivers/mysql/mysql_driver.php b/system/database/drivers/mysql/mysql_driver.php index 2b05c3f15..334daf3a6 100644 --- a/system/database/drivers/mysql/mysql_driver.php +++ b/system/database/drivers/mysql/mysql_driver.php @@ -90,6 +90,25 @@ class CI_DB_mysql_driver extends CI_DB { // -------------------------------------------------------------------- + /** + * Reconnect + * + * Keep / reestablish the db connection if no queries have been + * sent for a length of time exceeding the server's idle timeout + * + * @access public + * @return void + */ + function reconnect() + { + if (mysql_ping($this->conn_id) === FALSE) + { + $this->conn_id = FALSE; + } + } + + // -------------------------------------------------------------------- + /** * Select the database * -- cgit v1.2.3-24-g4f1b