From 5cf6e00cf9e9aedfb293f1e9da228aefc37d70f8 Mon Sep 17 00:00:00 2001 From: David M Date: Tue, 9 Jan 2007 01:33:20 +0000 Subject: [PATCH] - installer now checks if the page size is correct for Firebird - Firebird now has a proper explain page git-svn-id: file:///svn/phpbb/trunk@6863 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/includes/db/firebird.php | 15 +++++++++++ phpBB/install/install_install.php | 41 +++++++++++++++++++++++++++++++ phpBB/language/en/install.php | 1 + 3 files changed, 57 insertions(+) diff --git a/phpBB/includes/db/firebird.php b/phpBB/includes/db/firebird.php index 7fd034c7dc..60fa366b7f 100644 --- a/phpBB/includes/db/firebird.php +++ b/phpBB/includes/db/firebird.php @@ -97,6 +97,12 @@ class dbal_firebird extends dbal { global $cache; + // EXPLAIN only in extra debug mode + if (defined('DEBUG_EXTRA')) + { + $this->sql_report('start', $query); + } + $this->last_query_text = $query; $this->query_result = ($cache_ttl && method_exists($cache, 'sql_load')) ? $cache->sql_load($query) : false; $this->sql_add_num_queries($this->query_result); @@ -108,6 +114,11 @@ class dbal_firebird extends dbal $this->sql_error($query); } + if (defined('DEBUG_EXTRA')) + { + $this->sql_report('stop', $query); + } + if (!$this->transaction) { if (function_exists('ibase_commit_ret')) @@ -131,6 +142,10 @@ class dbal_firebird extends dbal $this->open_queries[(int) $this->query_result] = $this->query_result; } } + else if (defined('DEBUG_EXTRA')) + { + $this->sql_report('fromcache', $query); + } } else { diff --git a/phpBB/install/install_install.php b/phpBB/install/install_install.php index c9231075df..38dc491665 100755 --- a/phpBB/install/install_install.php +++ b/phpBB/install/install_install.php @@ -1967,6 +1967,14 @@ class install_install extends module { $error[] = $lang['INST_ERR_DB_NO_FIREBIRD']; } + $db_info = @ibase_db_info($db->service_handle, $dbname, IBASE_STS_HDR_PAGES); + + preg_match('/^\\s*Page size\\s*(\\d+)/m', $db_info, $regs); + $page_size = intval($regs[1]); + if ($page_size < 8192) + { + $error[] = $lang['INST_ERR_DB_NO_FIREBIRD_PS']; + } } else { @@ -1994,6 +2002,39 @@ class install_install extends module } $db->sql_freeresult($result); } + + // Setup the stuff for our random table + $char_array = array_merge(range('A', 'Z'), range('0', '9')); + $char_len = mt_rand(7, 9); + $char_array_len = sizeof($char_array) - 1; + + $final = ''; + + for ($i = 0; $i < $char_len; $i++) + { + $final .= $char_array[mt_rand(0, $char_array_len)]; + } + + // Create some random table + $sql = 'CREATE TABLE ' . $final . " ( + FIELD1 VARCHAR(255) CHARACTER SET UTF8 DEFAULT '' NOT NULL COLLATE UNICODE, + FIELD2 INTEGER DEFAULT 0 NOT NULL);"; + $db->sql_query($sql); + + // Create an index that should fail if the page size is less than 8192 + $sql = 'CREATE INDEX ' . $final . ' ON ' . $final . '(FIELD1, FIELD2);'; + $db->sql_query($sql); + + if (ibase_errmsg() !== false) + { + $error[] = $lang['INST_ERR_DB_NO_FIREBIRD_PS']; + } + else + { + // Kill the old table + $db->sql_query('DROP TABLE ' . $final . ';'); + } + unset($final); } break; diff --git a/phpBB/language/en/install.php b/phpBB/language/en/install.php index 632b305e4b..c8546325a8 100755 --- a/phpBB/language/en/install.php +++ b/phpBB/language/en/install.php @@ -194,6 +194,7 @@ $lang = array_merge($lang, array( 'INST_ERR_DB_NO_SQLITE' => 'The version of the SQLite extension you have installed is too old, it must be upgraded to at least 2.8.2.', 'INST_ERR_DB_NO_ORACLE' => 'The version of Oracle installed on this machine requires you to set the NLS_CHARACTERSET parameter to UTF8. Either upgrade your installation to 9.2+ or change the parameter.', 'INST_ERR_DB_NO_FIREBIRD' => 'The version of Firebird installed on this machine is older than 2.0, please upgrade to a newer version.', + 'INST_ERR_DB_NO_FIREBIRD_PS'=> 'The database you selected for Firebird has a page size less than 8192, it must be at least 8192.', 'INST_ERR_DB_NO_POSTGRES' => 'The database you have selected was not created in UNICODE or UTF8 encoding. Try installing with a database in UNICODE or UTF8 encoding', 'INST_ERR_DB_NO_NAME' => 'No database name specified', 'INST_ERR_EMAIL_INVALID' => 'The email address you entered is invalid',