1
0
mirror of https://github.com/dg/dibi.git synced 2025-08-07 06:36:44 +02:00

Fluent: fixed combination of modifier and inner fluent [Closes #192]

This commit is contained in:
David Grudl
2015-11-02 15:16:56 +01:00
parent 65d6f62a5b
commit 2627e23701
2 changed files with 10 additions and 2 deletions

View File

@@ -189,8 +189,7 @@ class Fluent implements IDataSource
foreach ($args as $arg) {
if ($arg instanceof self) {
$this->cursor[] = '%SQL';
$arg = "($arg)";
$arg = new Literal("($arg)");
}
$this->cursor[] = $arg;
}

View File

@@ -151,3 +151,12 @@ Assert::same(
reformat(' SELECT * LIMIT 1 OFFSET 1'),
(string) $fluent
);
$fluent = $conn->select('*')->from('abc')
->where('x IN (%SQL)', $conn->select('id')->from('xyz'));
Assert::same(
reformat('SELECT * FROM [abc] WHERE x IN ((SELECT [id] FROM [xyz]))'),
(string) $fluent
);