mirror of
https://github.com/Sarjuuk/aowow.git
synced 2025-11-29 15:58:16 +08:00
BaseType/Fixup
* fix totals query. Rather treat original query as subquery than trying to modify it * fixes queries utilizing HAVING and GROUP BY
This commit is contained in:
@@ -277,8 +277,13 @@ abstract class BaseType
|
|||||||
{
|
{
|
||||||
if ($calcTotal)
|
if ($calcTotal)
|
||||||
{
|
{
|
||||||
$totalQuery = substr_replace($totalQuery, 'SELECT COUNT(*) ', 0, strpos($totalQuery, 'FROM'));
|
// hackfix the inner items query to not contain duplicate column names
|
||||||
$this->matches += DB::{$n}($dbIdx)->selectCell($totalQuery);
|
// yes i know the real solution would be to not have items and item_stats share column names
|
||||||
|
// soon™....
|
||||||
|
if (get_class($this) == 'ItemList')
|
||||||
|
$totalQuery = str_replace([', `is`.*', ', i.id AS id'], '', $totalQuery);
|
||||||
|
|
||||||
|
$this->matches += DB::{$n}($dbIdx)->selectCell('SELECT COUNT(*) FROM ('.$totalQuery.') x');
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach ($rows as $id => $row)
|
foreach ($rows as $id => $row)
|
||||||
|
|||||||
Reference in New Issue
Block a user