aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/includes/search
diff options
context:
space:
mode:
authorAndreas Fischer <bantu@phpbb.com>2011-10-29 15:31:29 +0200
committerAndreas Fischer <bantu@phpbb.com>2012-03-03 21:03:50 +0100
commitefe25a0b49c7445bef665ab28fc979e485e49289 (patch)
treed01ce0e8c376102fd7f21d383f96ba3a7ea45467 /phpBB/includes/search
parentd67fae0f09b339dc0f399062dd228fba94e5aaa0 (diff)
downloadforums-efe25a0b49c7445bef665ab28fc979e485e49289.tar
forums-efe25a0b49c7445bef665ab28fc979e485e49289.tar.gz
forums-efe25a0b49c7445bef665ab28fc979e485e49289.tar.bz2
forums-efe25a0b49c7445bef665ab28fc979e485e49289.tar.xz
forums-efe25a0b49c7445bef665ab28fc979e485e49289.zip
[ticket/9813] Use SHOW TABLE STATUS to get search stats for native on MySQL.
PHPBB3-9813
Diffstat (limited to 'phpBB/includes/search')
-rw-r--r--phpBB/includes/search/fulltext_native.php38
1 files changed, 28 insertions, 10 deletions
diff --git a/phpBB/includes/search/fulltext_native.php b/phpBB/includes/search/fulltext_native.php
index b63205fd76..e5eee50fdb 100644
--- a/phpBB/includes/search/fulltext_native.php
+++ b/phpBB/includes/search/fulltext_native.php
@@ -1461,17 +1461,35 @@ class fulltext_native extends search_backend
{
global $db;
- $sql = 'SELECT COUNT(*) as total_words
- FROM ' . SEARCH_WORDLIST_TABLE;
- $result = $db->sql_query($sql);
- $this->stats['total_words'] = (int) $db->sql_fetchfield('total_words');
- $db->sql_freeresult($result);
+ switch ($db->sql_layer)
+ {
+ case 'mysql4':
+ case 'mysqli':
+ $sql = "SHOW TABLE STATUS LIKE '" . SEARCH_WORDLIST_TABLE . "'";
+ $result = $db->sql_query($sql);
+ $this->stats['total_words'] = (int) $db->sql_fetchfield('Rows');
+ $db->sql_freeresult($result);
+
+ $sql = "SHOW TABLE STATUS LIKE '" . SEARCH_WORDMATCH_TABLE . "'";
+ $result = $db->sql_query($sql);
+ $this->stats['total_matches'] = (int) $db->sql_fetchfield('Rows');
+ $db->sql_freeresult($result);
+ break;
- $sql = 'SELECT COUNT(*) as total_matches
- FROM ' . SEARCH_WORDMATCH_TABLE;
- $result = $db->sql_query($sql);
- $this->stats['total_matches'] = (int) $db->sql_fetchfield('total_matches');
- $db->sql_freeresult($result);
+ default:
+ $sql = 'SELECT COUNT(*) as total_words
+ FROM ' . SEARCH_WORDLIST_TABLE;
+ $result = $db->sql_query($sql);
+ $this->stats['total_words'] = (int) $db->sql_fetchfield('total_words');
+ $db->sql_freeresult($result);
+
+ $sql = 'SELECT COUNT(*) as total_matches
+ FROM ' . SEARCH_WORDMATCH_TABLE;
+ $result = $db->sql_query($sql);
+ $this->stats['total_matches'] = (int) $db->sql_fetchfield('total_matches');
+ $db->sql_freeresult($result);
+ break;
+ }
}
/**