mirror of
https://github.com/dg/dibi.git
synced 2025-08-26 23:44:24 +02:00
DibiFluent::fetch() uses limit only when there is no LIMIT & OFFSET (fixes 20f2093
on MSSQL)
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @dataProvider ../databases.ini
|
||||
* @dataProvider ../databases.ini !=mssql
|
||||
*/
|
||||
|
||||
use Tester\Assert;
|
||||
@@ -59,14 +59,20 @@ Assert::same(
|
||||
|
||||
|
||||
$fluent->removeClause('limit');
|
||||
$fluent->fetch();
|
||||
try {
|
||||
$fluent->fetch();
|
||||
} catch (DibiException $e) {
|
||||
}
|
||||
Assert::same(
|
||||
reformat('SELECT * FROM [customers] ORDER BY [customer_id] LIMIT 1 OFFSET 3'),
|
||||
reformat('SELECT * FROM [customers] ORDER BY [customer_id] OFFSET 3'),
|
||||
dibi::$sql
|
||||
);
|
||||
$fluent->fetchSingle();
|
||||
try {
|
||||
$fluent->fetchSingle();
|
||||
} catch (DibiException $e) {
|
||||
}
|
||||
Assert::same(
|
||||
reformat('SELECT * FROM [customers] ORDER BY [customer_id] LIMIT 1 OFFSET 3'),
|
||||
reformat('SELECT * FROM [customers] ORDER BY [customer_id] OFFSET 3'),
|
||||
dibi::$sql
|
||||
);
|
||||
Assert::same(
|
||||
@@ -78,12 +84,12 @@ Assert::same(
|
||||
$fluent->removeClause('offset');
|
||||
$fluent->fetch();
|
||||
Assert::same(
|
||||
reformat('SELECT * FROM [customers] ORDER BY [customer_id] LIMIT 1'),
|
||||
reformat(' SELECT * FROM [customers] ORDER BY [customer_id] LIMIT 1'),
|
||||
dibi::$sql
|
||||
);
|
||||
$fluent->fetchSingle();
|
||||
Assert::same(
|
||||
reformat('SELECT * FROM [customers] ORDER BY [customer_id] LIMIT 1'),
|
||||
reformat(' SELECT * FROM [customers] ORDER BY [customer_id] LIMIT 1'),
|
||||
dibi::$sql
|
||||
);
|
||||
Assert::same(
|
||||
|
@@ -85,7 +85,7 @@ try {
|
||||
} catch (Exception $e) {
|
||||
}
|
||||
Assert::same(
|
||||
reformat('SELECT * FROM [table] LIMIT 1'),
|
||||
reformat(' SELECT * FROM [table] LIMIT 1'),
|
||||
dibi::$sql
|
||||
);
|
||||
|
||||
|
Reference in New Issue
Block a user