diff options
author | David M <davidmj@users.sourceforge.net> | 2008-01-06 02:21:44 +0000 |
---|---|---|
committer | David M <davidmj@users.sourceforge.net> | 2008-01-06 02:21:44 +0000 |
commit | 57645ad5bc2469e166cb3e5d54628d87ffa74c42 (patch) | |
tree | 2b7e47b0a2d4d07b8b1c3acbab5115d7b60ce606 /phpBB/includes/db/mysql.php | |
parent | f0dea060972a48460ce64d3cdf885d82383763c6 (diff) | |
download | forums-57645ad5bc2469e166cb3e5d54628d87ffa74c42.tar forums-57645ad5bc2469e166cb3e5d54628d87ffa74c42.tar.gz forums-57645ad5bc2469e166cb3e5d54628d87ffa74c42.tar.bz2 forums-57645ad5bc2469e166cb3e5d54628d87ffa74c42.tar.xz forums-57645ad5bc2469e166cb3e5d54628d87ffa74c42.zip |
the end of an era...
- MySQL < 4.1.3 support is removed
- renamed mysql4 to mysql, no need to cause confusion
- changed the cfg cacher, reduces file system lookups and include count by two on every page load
git-svn-id: file:///svn/phpbb/trunk@8307 89ea8834-ac86-4346-8a33-228a782c2dd0
Diffstat (limited to 'phpBB/includes/db/mysql.php')
-rw-r--r-- | phpBB/includes/db/mysql.php | 59 |
1 files changed, 22 insertions, 37 deletions
diff --git a/phpBB/includes/db/mysql.php b/phpBB/includes/db/mysql.php index 108a75c0cc..0c949309a1 100644 --- a/phpBB/includes/db/mysql.php +++ b/phpBB/includes/db/mysql.php @@ -19,21 +19,18 @@ if (!defined('IN_PHPBB')) include_once($phpbb_root_path . 'includes/db/dbal.' . $phpEx); /** -* MySQL4 Database Abstraction Layer +* MySQL Database Abstraction Layer * Compatible with: -* MySQL 3.23+ -* MySQL 4.0+ * MySQL 4.1+ * MySQL 5.0+ * @package dbal */ class dbal_mysql extends dbal { - var $mysql_version; var $multi_insert = true; // Supports multiple table deletion - var $multi_table_deletion = false; + var $multi_table_deletion = true; /** * Connect to server @@ -46,49 +43,37 @@ class dbal_mysql extends dbal $this->server = $sqlserver . (($port) ? ':' . $port : ''); $this->dbname = $database; - $this->sql_layer = 'mysql4'; - $this->db_connect_id = ($this->persistency) ? @mysql_pconnect($this->server, $this->user, $sqlpassword, $new_link) : @mysql_connect($this->server, $this->user, $sqlpassword, $new_link); if ($this->db_connect_id && $this->dbname != '') { if (@mysql_select_db($this->dbname, $this->db_connect_id)) { - // Determine what version we are using and if it natively supports UNICODE - $this->mysql_version = mysql_get_server_info($this->db_connect_id); - - if (version_compare($this->mysql_version, '4.1.3', '>=')) + @mysql_query("SET NAMES 'utf8'", $this->db_connect_id); + // enforce strict mode on databases that support it + if (version_compare(mysql_get_server_info($this->db_connect_id), '5.0.2', '>=')) { - @mysql_query("SET NAMES 'utf8'", $this->db_connect_id); - // enforce strict mode on databases that support it - if (version_compare($this->mysql_version, '5.0.2', '>=')) - { - $result = @mysql_query('SELECT @@session.sql_mode AS sql_mode', $this->db_connect_id); - $row = @mysql_fetch_assoc($result); - @mysql_free_result($result); - $modes = array_map('trim', explode(',', $row['sql_mode'])); + $result = @mysql_query('SELECT @@session.sql_mode AS sql_mode', $this->db_connect_id); + $row = @mysql_fetch_assoc($result); + @mysql_free_result($result); + $modes = array_map('trim', explode(',', $row['sql_mode'])); - // TRADITIONAL includes STRICT_ALL_TABLES and STRICT_TRANS_TABLES - if (!in_array('TRADITIONAL', $modes)) + // TRADITIONAL includes STRICT_ALL_TABLES and STRICT_TRANS_TABLES + if (!in_array('TRADITIONAL', $modes)) + { + if (!in_array('STRICT_ALL_TABLES', $modes)) { - if (!in_array('STRICT_ALL_TABLES', $modes)) - { - $modes[] = 'STRICT_ALL_TABLES'; - } - - if (!in_array('STRICT_TRANS_TABLES', $modes)) - { - $modes[] = 'STRICT_TRANS_TABLES'; - } + $modes[] = 'STRICT_ALL_TABLES'; } - $mode = implode(',', $modes); - @mysql_query("SET SESSION sql_mode='{$mode}'", $this->db_connect_id); + if (!in_array('STRICT_TRANS_TABLES', $modes)) + { + $modes[] = 'STRICT_TRANS_TABLES'; + } } - } - else if (version_compare($this->mysql_version, '4.0.0', '<')) - { - $this->sql_layer = 'mysql'; + + $mode = implode(',', $modes); + @mysql_query("SET SESSION sql_mode='{$mode}'", $this->db_connect_id); } return $this->db_connect_id; @@ -103,7 +88,7 @@ class dbal_mysql extends dbal */ function sql_server_info() { - return 'MySQL ' . $this->mysql_version; + return 'MySQL ' . mysql_get_server_info($this->db_connect_id); } /** |