aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/includes/db/mysql.php
diff options
context:
space:
mode:
authorDavid M <davidmj@users.sourceforge.net>2006-10-01 16:20:05 +0000
committerDavid M <davidmj@users.sourceforge.net>2006-10-01 16:20:05 +0000
commitaa71cfaa8b2d938ef971328f0de1a2c5a1979ed8 (patch)
tree9fa5530747bca132570925ab55a1cb58564ac415 /phpBB/includes/db/mysql.php
parentfd0b2e7df328ad7a7f210b79b2861c8b551ae761 (diff)
downloadforums-aa71cfaa8b2d938ef971328f0de1a2c5a1979ed8.tar
forums-aa71cfaa8b2d938ef971328f0de1a2c5a1979ed8.tar.gz
forums-aa71cfaa8b2d938ef971328f0de1a2c5a1979ed8.tar.bz2
forums-aa71cfaa8b2d938ef971328f0de1a2c5a1979ed8.tar.xz
forums-aa71cfaa8b2d938ef971328f0de1a2c5a1979ed8.zip
- Goodbye MySQL4, hello unified MySQL driver. MySQL 3.23 to MySQL 5.0 are now in one driver.
git-svn-id: file:///svn/phpbb/trunk@6425 89ea8834-ac86-4346-8a33-228a782c2dd0
Diffstat (limited to 'phpBB/includes/db/mysql.php')
-rw-r--r--phpBB/includes/db/mysql.php34
1 files changed, 27 insertions, 7 deletions
diff --git a/phpBB/includes/db/mysql.php b/phpBB/includes/db/mysql.php
index 6aadd812a4..15158bbb59 100644
--- a/phpBB/includes/db/mysql.php
+++ b/phpBB/includes/db/mysql.php
@@ -20,13 +20,15 @@ if (!defined('IN_PHPBB'))
*/
if (!defined('SQL_LAYER'))
{
-
- define('SQL_LAYER', 'mysql');
include_once($phpbb_root_path . 'includes/db/dbal.' . $phpEx);
/**
-* MySQL Database Abstraction Layer
-* Minimum Requirement is 3.23+/4.0+ (NOT 4.1+/5.0+)
+* MySQL4 Database Abstraction Layer
+* Compatible with:
+* MySQL 3.23+
+* MySQL 4.0+
+* MySQL 4.1+
+* MySQL 5.0+
* @package dbal
*/
class dbal_mysql extends dbal
@@ -48,6 +50,23 @@ class dbal_mysql extends dbal
{
if (@mysql_select_db($this->dbname))
{
+ // Determine what version we are using and if it natively supports UNICODE
+ $mysql_version = mysql_get_server_info($this->db_connect_id);
+
+ if (version_compare($mysql_version, '4.1.3', '>='))
+ {
+ define('SQL_LAYER', 'mysql4');
+ @mysql_query("SET NAMES 'utf8'", $this->db_connect_id);
+ }
+ else if (version_compare($mysql_version, '4.0.0', '>='))
+ {
+ define('SQL_LAYER', 'mysql4');
+ }
+ else
+ {
+ define('SQL_LAYER', 'mysql');
+ }
+
return $this->db_connect_id;
}
}
@@ -158,7 +177,8 @@ class dbal_mysql extends dbal
// if $total is set to 0 we do not want to limit the number of rows
if ($total == 0)
{
- $total = -1;
+ // Having a value of -1 was always a bug
+ $total = '18446744073709551615';
}
$query .= "\n LIMIT " . ((!empty($offset)) ? $offset . ', ' . $total : $total);
@@ -324,7 +344,7 @@ class dbal_mysql extends dbal
{
return @mysql_real_escape_string($msg);
}
-
+
return @mysql_real_escape_string($msg, $this->db_connect_id);
}
@@ -343,7 +363,7 @@ class dbal_mysql extends dbal
return $data;
}
-
+
/**
* return sql error array
* @access private