aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/includes/db/driver/mysql.php
diff options
context:
space:
mode:
authorIgor Wiedler <igor@wiedler.ch>2012-12-13 08:52:53 -0800
committerIgor Wiedler <igor@wiedler.ch>2012-12-13 08:52:53 -0800
commit155937807a99e4a5789ad9c0991bfa6e1fe010ff (patch)
tree6ba6cff4ae53355f6234494f6c2599ec5ec2f9f2 /phpBB/includes/db/driver/mysql.php
parentb0b5a13131b90b8320de6f49db6c505d38b42c96 (diff)
parent83345d986d172ee8b655ec4600c1f1575ba306d0 (diff)
downloadforums-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/mysql.php')
-rw-r--r--phpBB/includes/db/driver/mysql.php45
1 files changed, 37 insertions, 8 deletions
diff --git a/phpBB/includes/db/driver/mysql.php b/phpBB/includes/db/driver/mysql.php
index f8c2be2366..6fc6fab483 100644
--- a/phpBB/includes/db/driver/mysql.php
+++ b/phpBB/includes/db/driver/mysql.php
@@ -27,6 +27,7 @@ if (!defined('IN_PHPBB'))
class phpbb_db_driver_mysql extends phpbb_db_driver
{
var $multi_insert = true;
+ var $connect_error = '';
/**
* Connect to server
@@ -41,7 +42,24 @@ class phpbb_db_driver_mysql extends phpbb_db_driver
$this->sql_layer = 'mysql4';
- $this->db_connect_id = ($this->persistency) ? @mysql_pconnect($this->server, $this->user, $sqlpassword) : @mysql_connect($this->server, $this->user, $sqlpassword, $new_link);
+ if ($this->persistency)
+ {
+ if (!function_exists('mysql_pconnect'))
+ {
+ $this->connect_error = 'mysql_pconnect function does not exist, is mysql extension installed?';
+ return $this->sql_error('');
+ }
+ $this->db_connect_id = @mysql_pconnect($this->server, $this->user, $sqlpassword);
+ }
+ else
+ {
+ if (!function_exists('mysql_connect'))
+ {
+ $this->connect_error = 'mysql_connect function does not exist, is mysql extension installed?';
+ return $this->sql_error('');
+ }
+ $this->db_connect_id = @mysql_connect($this->server, $this->user, $sqlpassword, $new_link);
+ }
if ($this->db_connect_id && $this->dbname != '')
{
@@ -424,18 +442,29 @@ class phpbb_db_driver_mysql extends phpbb_db_driver
*/
function _sql_error()
{
- if (!$this->db_connect_id)
+ if ($this->db_connect_id)
+ {
+ $error = array(
+ 'message' => @mysql_error($this->db_connect_id),
+ 'code' => @mysql_errno($this->db_connect_id),
+ );
+ }
+ else if (function_exists('mysql_error'))
{
- return array(
+ $error = array(
'message' => @mysql_error(),
- 'code' => @mysql_errno()
+ 'code' => @mysql_errno(),
+ );
+ }
+ else
+ {
+ $error = array(
+ 'message' => $this->connect_error,
+ 'code' => '',
);
}
- return array(
- 'message' => @mysql_error($this->db_connect_id),
- 'code' => @mysql_errno($this->db_connect_id)
- );
+ return $error;
}
/**