summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--system/database/DB_driver.php19
-rw-r--r--user_guide_src/source/changelog.rst2
-rw-r--r--user_guide_src/source/database/db_driver_reference.rst1
3 files changed, 5 insertions, 17 deletions
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);
}
diff --git a/user_guide_src/source/changelog.rst b/user_guide_src/source/changelog.rst
index 5a41fa18b..1ea34eee6 100644
--- a/user_guide_src/source/changelog.rst
+++ b/user_guide_src/source/changelog.rst
@@ -13,7 +13,7 @@ Release Date: Not Released
- Database
- - CI_DB_driver::initialize() throws a "Database connection failure." RuntimeException if couldn't connect to the database.
+ - Failure to initialize a database connection will now throw a ``RuntimeException``.
Version 3.0.4
diff --git a/user_guide_src/source/database/db_driver_reference.rst b/user_guide_src/source/database/db_driver_reference.rst
index 1e436ede1..f0a438883 100644
--- a/user_guide_src/source/database/db_driver_reference.rst
+++ b/user_guide_src/source/database/db_driver_reference.rst
@@ -19,6 +19,7 @@ This article is intended to be a reference for them.
:returns: TRUE on success, FALSE on failure
:rtype: bool
+ :throws: RuntimeException In case of failure
Initialize database settings, establish a connection to
the database.