summaryrefslogtreecommitdiffstats
path: root/system/database/drivers/oci8
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/oci8
parente7d017bcc38909f55e8f817b27263e59d1ca5598 (diff)
Make db_pconnect an alias for db_connect(TRUE) and reduce code repetition
Diffstat (limited to 'system/database/drivers/oci8')
-rw-r--r--system/database/drivers/oci8/oci8_driver.php22
1 files changed, 5 insertions, 17 deletions
diff --git a/system/database/drivers/oci8/oci8_driver.php b/system/database/drivers/oci8/oci8_driver.php
index f309a8272..7453db7a8 100644
--- a/system/database/drivers/oci8/oci8_driver.php
+++ b/system/database/drivers/oci8/oci8_driver.php
@@ -208,27 +208,15 @@ class CI_DB_oci8_driver extends CI_DB {
/**
* Non-persistent database connection
*
+ * @param bool $persistent
* @return resource
*/
- public function db_connect()
- {
- return ( ! empty($this->char_set))
- ? @oci_connect($this->username, $this->password, $this->dsn, $this->char_set)
- : @oci_connect($this->username, $this->password, $this->dsn);
- }
-
- // --------------------------------------------------------------------
-
- /**
- * Persistent database connection
- *
- * @return resource
- */
- public function db_pconnect()
+ public function db_connect($persistent = FALSE)
{
+ $func = ($persistent === TRUE) ? 'oci_pconnect' : 'oci_connect';
return empty($this->char_set)
- ? @oci_pconnect($this->username, $this->password, $this->dsn)
- : @oci_pconnect($this->username, $this->password, $this->dsn, $this->char_set);
+ ? $func($this->username, $this->password, $this->dsn)
+ : $func($this->username, $this->password, $this->dsn, $this->char_set);
}
// --------------------------------------------------------------------