Skip to content

Commit

Permalink
Merge pull request #50 from jozefhornik/cont
Browse files Browse the repository at this point in the history
Fix for SELECT with OFFSET
  • Loading branch information
muglug committed Jul 11, 2024
2 parents 3ae9c6c + 9bbc63a commit c2cf5e5
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/Processor/Processor.php
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ protected static function applyLimit(?LimitClause $limit, Scope $scope, QueryRes
}

return new QueryResult(
\array_slice($result->rows, $offset, $rowcount, true),
\array_slice($result->rows, $offset, $rowcount),
$result->columns
);
}
Expand Down
12 changes: 12 additions & 0 deletions tests/EndToEndTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -805,6 +805,18 @@ public function testSelectHavingOnAliasField()
);
}

public function testSelectWithOffset()
{
$pdo = self::getConnectionToFullDB(false);
$query = $pdo->prepare("SELECT `id` FROM `video_game_characters` ORDER BY `id` LIMIT 10000 OFFSET 1");
$query->execute();

$this->assertSame(
['id' => 2],
$query->fetch(\PDO::FETCH_ASSOC)
);
}

public function testLastInsertIdAfterSkippingAutoincrement()
{
$pdo = self::getConnectionToFullDB(false);
Expand Down

0 comments on commit c2cf5e5

Please sign in to comment.