Skip to content

Commit c2cf5e5

Browse files
authored
Merge pull request #50 from jozefhornik/cont
Fix for SELECT with OFFSET
2 parents 3ae9c6c + 9bbc63a commit c2cf5e5

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

src/Processor/Processor.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ protected static function applyLimit(?LimitClause $limit, Scope $scope, QueryRes
125125
}
126126

127127
return new QueryResult(
128-
\array_slice($result->rows, $offset, $rowcount, true),
128+
\array_slice($result->rows, $offset, $rowcount),
129129
$result->columns
130130
);
131131
}

tests/EndToEndTest.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -805,6 +805,18 @@ public function testSelectHavingOnAliasField()
805805
);
806806
}
807807

808+
public function testSelectWithOffset()
809+
{
810+
$pdo = self::getConnectionToFullDB(false);
811+
$query = $pdo->prepare("SELECT `id` FROM `video_game_characters` ORDER BY `id` LIMIT 10000 OFFSET 1");
812+
$query->execute();
813+
814+
$this->assertSame(
815+
['id' => 2],
816+
$query->fetch(\PDO::FETCH_ASSOC)
817+
);
818+
}
819+
808820
public function testLastInsertIdAfterSkippingAutoincrement()
809821
{
810822
$pdo = self::getConnectionToFullDB(false);

0 commit comments

Comments
 (0)