summaryrefslogtreecommitdiffstats
path: root/system/database/drivers/sqlite/sqlite_driver.php
diff options
context:
space:
mode:
authorAndrey Andreev <narf@devilix.net>2014-02-25 14:21:41 +0100
committerAndrey Andreev <narf@devilix.net>2014-02-25 14:21:41 +0100
commit2e171023bae38735ec08bbd9cb160cee75edbc62 (patch)
tree15327555ec2101f723f6ae35c6c388abf1b18317 /system/database/drivers/sqlite/sqlite_driver.php
parente7d017bcc38909f55e8f817b27263e59d1ca5598 (diff)
Make db_pconnect an alias for db_connect(TRUE) and reduce code repetition
Diffstat (limited to 'system/database/drivers/sqlite/sqlite_driver.php')
-rw-r--r--system/database/drivers/sqlite/sqlite_driver.php42
1 files changed, 7 insertions, 35 deletions
diff --git a/system/database/drivers/sqlite/sqlite_driver.php b/system/database/drivers/sqlite/sqlite_driver.php
index 9928aedb7..dd9e1e849 100644
--- a/system/database/drivers/sqlite/sqlite_driver.php
+++ b/system/database/drivers/sqlite/sqlite_driver.php
@@ -62,45 +62,17 @@ class CI_DB_sqlite_driver extends CI_DB {
/**
* 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);
-
- if ($this->db_debug)
- {
- $this->display_error($error, '', TRUE);
- }
-
- return FALSE;
- }
-
- return $conn_id;
- }
-
- // --------------------------------------------------------------------
+ $error = NULL;
+ $conn_id = ($persistent === TRUE)
+ ? sqlite_popen($this->database, 0666, $error)
+ : sqlite_open($this->database, 0666, $error);
- /**
- * 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;
}