From 97ecf2fcce8e3133e286e16de1b49612235a8dcf Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Sat, 12 Dec 2015 17:26:28 +0200 Subject: Complete the proposed changes from PR #4300 --- system/database/DB_driver.php | 19 +++---------------- 1 file changed, 3 insertions(+), 16 deletions(-) (limited to 'system/database/DB_driver.php') diff --git a/system/database/DB_driver.php b/system/database/DB_driver.php index f3aeb7f81..418de27c8 100644 --- a/system/database/DB_driver.php +++ b/system/database/DB_driver.php @@ -381,6 +381,7 @@ abstract class CI_DB_driver { * Initialize Database Settings * * @return bool + * @throws RuntimeException In case of failure */ public function initialize() { @@ -429,14 +430,7 @@ abstract class CI_DB_driver { // We still don't have a connection? if ( ! $this->conn_id) { - log_message('error', 'Unable to connect to the database'); - - if ($this->db_debug) - { - $this->display_error('db_unable_to_connect'); - } - - throw new RuntimeException('Database connection failure.'); + throw new RuntimeException('Unable to connect to the database.'); } } @@ -751,14 +745,7 @@ abstract class CI_DB_driver { */ public function simple_query($sql) { - if ( ! $this->conn_id) - { - if ( ! $this->initialize()) - { - return FALSE; - } - } - + empty($this->conn_id) && $this->initialize(); return $this->_execute($sql); } -- cgit v1.2.3-24-g4f1b