Make db_pconnect an alias for db_connect(TRUE) and reduce code repetition
diff --git a/system/database/drivers/sqlite/sqlite_driver.php b/system/database/drivers/sqlite/sqlite_driver.php
index 9928aed..dd9e1e8 100644
--- a/system/database/drivers/sqlite/sqlite_driver.php
+++ b/system/database/drivers/sqlite/sqlite_driver.php
@@ -62,45 +62,17 @@
/**
* Non-persistent database connection
*
+ * @param bool $persistent
* @return resource
*/
- public function db_connect()
+ public function db_connect($persistent = FALSE)
{
- if ( ! $conn_id = @sqlite_open($this->database, FILE_WRITE_MODE, $error))
- {
- log_message('error', $error);
+ $error = NULL;
+ $conn_id = ($persistent === TRUE)
+ ? sqlite_popen($this->database, 0666, $error)
+ : sqlite_open($this->database, 0666, $error);
- if ($this->db_debug)
- {
- $this->display_error($error, '', TRUE);
- }
-
- return FALSE;
- }
-
- return $conn_id;
- }
-
- // --------------------------------------------------------------------
-
- /**
- * Persistent database connection
- *
- * @return resource
- */
- public function db_pconnect()
- {
- if ( ! $conn_id = @sqlite_popen($this->database, FILE_WRITE_MODE, $error))
- {
- log_message('error', $error);
-
- if ($this->db_debug)
- {
- $this->display_error($error, '', TRUE);
- }
-
- return FALSE;
- }
+ isset($error) && log_message('error', $error);
return $conn_id;
}