From 2e171023bae38735ec08bbd9cb160cee75edbc62 Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Tue, 25 Feb 2014 15:21:41 +0200 Subject: Make db_pconnect an alias for db_connect(TRUE) and reduce code repetition --- system/database/drivers/oci8/oci8_driver.php | 22 +++++----------------- 1 file changed, 5 insertions(+), 17 deletions(-) (limited to 'system/database/drivers/oci8') 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); } // -------------------------------------------------------------------- -- cgit v1.2.3-24-g4f1b