SQLite error on UNION
Opened this issue · 1 comments
robob4him commented
SQLite does not appreciate parentheses in UNION:
(SELECT "4" AS "column1") UNION (SELECT "5" AS "column1")
$select = (new Combine())
->union(
[
(new Select())->columns(['column1' => 4]),
(new Select())->columns(['column1' => 5])
]
);
$sql = (new Sql(new Adapter(new PdoDriver(new Connection(new PDO('sqlite::memory:'))))));
$stmt = $sql->prepareStatementForSqlObject($select);
$result = $stmt->execute();
var_dump(iterator_to_array($result));
Zend\Db\Adapter\Exception\RuntimeException: near "(": syntax error
or explicitly on the PHP PDO instance:
PDOException: SQLSTATE[HY000]: General error: 1 near "(": syntax error
StackOverflow question reference: http://stackoverflow.com/questions/4653124
michalbundyra commented
This repository has been closed and moved to laminas/laminas-db; a new issue has been opened at laminas/laminas-db#134.