diff options
author | Marc Alexander <admin@m-a-styles.de> | 2012-12-09 21:02:31 +0100 |
---|---|---|
committer | Marc Alexander <admin@m-a-styles.de> | 2012-12-09 21:02:31 +0100 |
commit | 1aae72961a3205a8487218b6d69361c43a1297d6 (patch) | |
tree | 3096a599c14c88084f782022f002ed84224ccf8b /phpBB/includes/db/mysql.php | |
parent | 26bde05a30c7111b57621a37d86425aa69d74263 (diff) | |
parent | 3fe381eed561e724700b21789e28ea3efb1f7ef9 (diff) | |
download | forums-1aae72961a3205a8487218b6d69361c43a1297d6.tar forums-1aae72961a3205a8487218b6d69361c43a1297d6.tar.gz forums-1aae72961a3205a8487218b6d69361c43a1297d6.tar.bz2 forums-1aae72961a3205a8487218b6d69361c43a1297d6.tar.xz forums-1aae72961a3205a8487218b6d69361c43a1297d6.zip |
Merge branch 'develop' into feature/avatars
Conflicts:
phpBB/install/database_update.php
Diffstat (limited to 'phpBB/includes/db/mysql.php')
-rw-r--r-- | phpBB/includes/db/mysql.php | 45 |
1 files changed, 37 insertions, 8 deletions
diff --git a/phpBB/includes/db/mysql.php b/phpBB/includes/db/mysql.php index f685ab055c..dcdeec0401 100644 --- a/phpBB/includes/db/mysql.php +++ b/phpBB/includes/db/mysql.php @@ -29,6 +29,7 @@ include_once($phpbb_root_path . 'includes/db/dbal.' . $phpEx); class dbal_mysql extends dbal { var $multi_insert = true; + var $connect_error = ''; /** * Connect to server @@ -43,7 +44,24 @@ class dbal_mysql extends dbal $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 != '') { @@ -426,18 +444,29 @@ class dbal_mysql extends dbal */ 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; } /** |