Fix SQL error when list count is 0

This commit is contained in:
Kijin Sung 2021-02-26 16:25:11 +09:00
parent 53d54fbeaf
commit 6b6c0eacfc

View file

@ -244,7 +244,11 @@ class Query extends VariableBase
// Compose the LIMIT/OFFSET clause.
if ($this->navigation && $this->navigation->list_count && !$count_only)
{
$result .= ' LIMIT ' . $this->_arrangeLimitOffset($this->navigation);
$limit_offset = $this->_arrangeLimitOffset($this->navigation);
if ($limit_offset !== '')
{
$result .= ' LIMIT ' . $limit_offset;
}
}
// Wrap in a subquery if necesary.
@ -399,7 +403,11 @@ class Query extends VariableBase
// Compose the LIMIT/OFFSET clause.
if ($this->navigation && $this->navigation->list_count)
{
$result .= ' LIMIT ' . $this->_arrangeLimitOffset($this->navigation);
$limit_offset = $this->_arrangeLimitOffset($this->navigation);
if ($limit_offset !== '')
{
$result .= ' LIMIT ' . $limit_offset;
}
}
// Return the final query string.