diff options
| author | Igor Wiedler <igor@wiedler.ch> | 2012-12-13 08:52:53 -0800 |
|---|---|---|
| committer | Igor Wiedler <igor@wiedler.ch> | 2012-12-13 08:52:53 -0800 |
| commit | 155937807a99e4a5789ad9c0991bfa6e1fe010ff (patch) | |
| tree | 6ba6cff4ae53355f6234494f6c2599ec5ec2f9f2 /phpBB/includes/db/driver/oracle.php | |
| parent | b0b5a13131b90b8320de6f49db6c505d38b42c96 (diff) | |
| parent | 83345d986d172ee8b655ec4600c1f1575ba306d0 (diff) | |
| download | forums-155937807a99e4a5789ad9c0991bfa6e1fe010ff.tar forums-155937807a99e4a5789ad9c0991bfa6e1fe010ff.tar.gz forums-155937807a99e4a5789ad9c0991bfa6e1fe010ff.tar.bz2 forums-155937807a99e4a5789ad9c0991bfa6e1fe010ff.tar.xz forums-155937807a99e4a5789ad9c0991bfa6e1fe010ff.zip | |
Merge pull request #19 from p/ticket/11015
Ticket/11015
Diffstat (limited to 'phpBB/includes/db/driver/oracle.php')
| -rw-r--r-- | phpBB/includes/db/driver/oracle.php | 53 |
1 files changed, 45 insertions, 8 deletions
diff --git a/phpBB/includes/db/driver/oracle.php b/phpBB/includes/db/driver/oracle.php index d8474694e3..6263ea8414 100644 --- a/phpBB/includes/db/driver/oracle.php +++ b/phpBB/includes/db/driver/oracle.php @@ -22,6 +22,7 @@ if (!defined('IN_PHPBB')) class phpbb_db_driver_oracle extends phpbb_db_driver { var $last_query_text = ''; + var $connect_error = ''; /** * Connect to server @@ -45,7 +46,33 @@ class phpbb_db_driver_oracle extends phpbb_db_driver $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(''); } @@ -644,17 +671,27 @@ class phpbb_db_driver_oracle extends phpbb_db_driver */ 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; |
