1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-06-29 06:24:04 +02:00

[ticket/11188] Reduce waste.

PHPBB3-11188
This commit is contained in:
Oleg Pudeyev
2012-12-29 19:34:21 -05:00
parent 763f2929ba
commit 3d27ed13f5

View File

@ -477,10 +477,13 @@ class phpbb_search_fulltext_postgres extends phpbb_search_base
} }
$this->db->sql_transaction('begin'); $this->db->sql_transaction('begin');
$sql_from = "FROM $sql_from$sql_sort_table" . POSTS_TABLE . " p";
$sql_where = "WHERE (" . implode(' OR ', $tmp_sql_match) . ")
$sql_where_options";
$sql = "SELECT $sql_select $sql = "SELECT $sql_select
FROM $sql_from$sql_sort_table" . POSTS_TABLE . " p $sql_from
WHERE (" . implode(' OR ', $tmp_sql_match) . ") $sql_where
$sql_where_options
ORDER BY $sql_sort"; ORDER BY $sql_sort";
$result = $this->db->sql_query_limit($sql, $this->config['search_block_size'], $start); $result = $this->db->sql_query_limit($sql, $this->config['search_block_size'], $start);
@ -501,9 +504,8 @@ class phpbb_search_fulltext_postgres extends phpbb_search_base
if (!$result_count) if (!$result_count)
{ {
$sql_count = "SELECT COUNT(*) as result_count $sql_count = "SELECT COUNT(*) as result_count
FROM $sql_from$sql_sort_table" . POSTS_TABLE . " p $sql_from
WHERE (" . implode(' OR ', $tmp_sql_match) . ") $sql_where";
$sql_where_options";
$result = $this->db->sql_query($sql_count); $result = $this->db->sql_query($sql_count);
$result_count = (int) $this->db->sql_fetchfield('result_count'); $result_count = (int) $this->db->sql_fetchfield('result_count');
$this->db->sql_freeresult($result); $this->db->sql_freeresult($result);