mirror of
https://github.com/dg/dibi.git
synced 2025-08-20 12:51:40 +02:00
Fluent: exports limit & offset as %lmt and %ofs [Closes #82]
Also fixes 20f2093
on MSSQL
This commit is contained in:
@@ -85,7 +85,7 @@ try {
|
||||
} catch (Exception $e) {
|
||||
}
|
||||
Assert::same(
|
||||
reformat('SELECT * FROM [table] LIMIT 1'),
|
||||
reformat(' SELECT * FROM [table] LIMIT 1'),
|
||||
dibi::$sql
|
||||
);
|
||||
|
||||
@@ -102,7 +102,7 @@ $fluent = $conn->select('*')
|
||||
->offset(0);
|
||||
|
||||
Assert::same(
|
||||
reformat('SELECT * , (SELECT count(*) FROM [precteni] AS [P] WHERE P.id_clanku = C.id_clanku) FROM [clanky] AS [C] WHERE id_clanku=123 LIMIT 1 OFFSET 0'),
|
||||
reformat(' SELECT * , (SELECT count(*) FROM [precteni] AS [P] WHERE P.id_clanku = C.id_clanku) FROM [clanky] AS [C] WHERE id_clanku=123 LIMIT 1'),
|
||||
(string) $fluent
|
||||
);
|
||||
|
||||
@@ -141,3 +141,13 @@ Assert::same(
|
||||
reformat('SELECT * FROM [me] AS [t] WHERE col > 10 AND ([x] = \'a\') AND (b) AND (c)'),
|
||||
(string) $fluent
|
||||
);
|
||||
|
||||
|
||||
$fluent = $conn->select('*')
|
||||
->limit(' 1; DROP TABLE users')
|
||||
->offset(' 1; DROP TABLE users');
|
||||
|
||||
Assert::same(
|
||||
reformat(' SELECT * LIMIT 1 OFFSET 1'),
|
||||
(string) $fluent
|
||||
);
|
||||
|
Reference in New Issue
Block a user