diff options
author | Andreas Fischer <bantu@phpbb.com> | 2012-12-08 03:08:21 +0100 |
---|---|---|
committer | Andreas Fischer <bantu@phpbb.com> | 2012-12-08 03:08:21 +0100 |
commit | b7b8fefdd084b51c93b15dfdfb34d2ef294f4d76 (patch) | |
tree | ea97afaa481306dbb0a111490b9443f80de56a29 /phpBB/includes/db/oracle.php | |
parent | ebc15a8b6cb62e29371cb02d6421ea46e47a4020 (diff) | |
parent | b5f94a14f1a5c77366f824780f1120a1b5e9184a (diff) | |
download | forums-b7b8fefdd084b51c93b15dfdfb34d2ef294f4d76.tar forums-b7b8fefdd084b51c93b15dfdfb34d2ef294f4d76.tar.gz forums-b7b8fefdd084b51c93b15dfdfb34d2ef294f4d76.tar.bz2 forums-b7b8fefdd084b51c93b15dfdfb34d2ef294f4d76.tar.xz forums-b7b8fefdd084b51c93b15dfdfb34d2ef294f4d76.zip |
Merge branch 'develop-olympus' into develop
* develop-olympus:
[ticket/10205] Reduce nesting in mysql drivers.
[ticket/10205] Rewrite _sql_error implementations to have a single return.
[ticket/10205] Cosmetic changes.
[ticket/10205] Add some columns to the empty fixture file for mssqlnative.
[ticket/10205] Delete stray return.
[ticket/10205] Test failed connection attempts.
[ticket/10205] Check for function existence in mssql connect method.
[ticket/10205] Convert mssqlnative driver to the same logic.
[ticket/10205] Fix a parse error in oracle driver.
[ticket/10205] Fix remaining db drivers.
[ticket/10205] Avoid calling mysqli functions when mysqli is missing.
[ticket/10205] Account for potentially missing extensions in dbal.
Conflicts:
tests/fixtures/empty.xml
Diffstat (limited to 'phpBB/includes/db/oracle.php')
-rw-r--r-- | phpBB/includes/db/oracle.php | 53 |
1 files changed, 45 insertions, 8 deletions
diff --git a/phpBB/includes/db/oracle.php b/phpBB/includes/db/oracle.php index 6d9339b2d8..4a2b107865 100644 --- a/phpBB/includes/db/oracle.php +++ b/phpBB/includes/db/oracle.php @@ -24,6 +24,7 @@ include_once($phpbb_root_path . 'includes/db/dbal.' . $phpEx); class dbal_oracle extends dbal { var $last_query_text = ''; + var $connect_error = ''; /** * Connect to server @@ -47,7 +48,33 @@ class dbal_oracle extends dbal $connect = $sqlserver . (($port) ? ':' . $port : '') . '/' . $database; } - $this->db_connect_id = ($new_link) ? @ocinlogon($this->user, $sqlpassword, $connect, 'UTF8') : (($this->persistency) ? @ociplogon($this->user, $sqlpassword, $connect, 'UTF8') : @ocilogon($this->user, $sqlpassword, $connect, 'UTF8')); + if ($new_link) + { + if (!function_exists('ocinlogon')) + { + $this->connect_error = 'ocinlogon function does not exist, is oci extension installed?'; + return $this->sql_error(''); + } + $this->db_connect_id = @ocinlogon($this->user, $sqlpassword, $connect, 'UTF8'); + } + else if ($this->persistency) + { + if (!function_exists('ociplogon')) + { + $this->connect_error = 'ociplogon function does not exist, is oci extension installed?'; + return $this->sql_error(''); + } + $this->db_connect_id = @ociplogon($this->user, $sqlpassword, $connect, 'UTF8'); + } + else + { + if (!function_exists('ocilogon')) + { + $this->connect_error = 'ocilogon function does not exist, is oci extension installed?'; + return $this->sql_error(''); + } + $this->db_connect_id = @ocilogon($this->user, $sqlpassword, $connect, 'UTF8'); + } return ($this->db_connect_id) ? $this->db_connect_id : $this->sql_error(''); } @@ -646,17 +673,27 @@ class dbal_oracle extends dbal */ function _sql_error() { - $error = @ocierror(); - $error = (!$error) ? @ocierror($this->query_result) : $error; - $error = (!$error) ? @ocierror($this->db_connect_id) : $error; - - if ($error) + if (function_exists('ocierror')) { - $this->last_error_result = $error; + $error = @ocierror(); + $error = (!$error) ? @ocierror($this->query_result) : $error; + $error = (!$error) ? @ocierror($this->db_connect_id) : $error; + + if ($error) + { + $this->last_error_result = $error; + } + else + { + $error = (isset($this->last_error_result) && $this->last_error_result) ? $this->last_error_result : array(); + } } else { - $error = (isset($this->last_error_result) && $this->last_error_result) ? $this->last_error_result : array(); + $error = array( + 'message' => $this->connect_error, + 'code' => '', + ); } return $error; |