Skip to content
Snippets Groups Projects
Commit 069e0cab authored by jaapjansma's avatar jaapjansma
Browse files

Fixed issue with limit

parent 017dcd7e
No related branches found
No related tags found
No related merge requests found
...@@ -78,7 +78,7 @@ abstract class SqlDataFlow extends AbstractDataFlow { ...@@ -78,7 +78,7 @@ abstract class SqlDataFlow extends AbstractDataFlow {
$orderBy = $this->getOrderByStatement(); $orderBy = $this->getOrderByStatement();
$countName = 'count_'.$this->getName(); $countName = 'count_'.$this->getName();
$sql = "{$selectAndFrom} {$where} {$groupBy} {$orderBy}"; $sql = "{$selectAndFrom} {$where} {$groupBy} {$orderBy}";
$countSql = "SELECT COUNT(*) FROM ({$sql}) `{$countName}`"; $countSql = "SELECT COUNT(*) AS count FROM ({$sql}) `{$countName}`";
//$countSql = "SELECT COUNT(*) AS `count` {$from} {$where} {$groupBy}"; //$countSql = "SELECT COUNT(*) AS `count` {$from} {$where} {$groupBy}";
$this->sqlCountStatements[] = $countSql; $this->sqlCountStatements[] = $countSql;
...@@ -94,13 +94,13 @@ abstract class SqlDataFlow extends AbstractDataFlow { ...@@ -94,13 +94,13 @@ abstract class SqlDataFlow extends AbstractDataFlow {
// Build Limit and Offset. // Build Limit and Offset.
$limitStatement = ""; $limitStatement = "";
if ($this->offset !== FALSE && $this->limit > 0) { if ($this->offset !== FALSE && $this->limit !== FALSE) {
$limitStatement = "LIMIT {$this->offset}, {$this->limit}"; $limitStatement = "LIMIT {$this->offset}, {$this->limit}";
} }
elseif ($this->offset === FALSE && $this->limit >0) { elseif ($this->offset === FALSE && $this->limit !== FALSE) {
$limitStatement = "LIMIT 0, {$this->limit}"; $limitStatement = "LIMIT 0, {$this->limit}";
} }
elseif ($this->offset !== FALSE && $this->limit == FALSE) { elseif ($this->offset !== FALSE && $this->limit === FALSE) {
$calculatedLimit = $this->count - $this->offset; $calculatedLimit = $this->count - $this->offset;
$limitStatement = "LIMIT {$this->offset}, {$calculatedLimit}"; $limitStatement = "LIMIT {$this->offset}, {$calculatedLimit}";
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment