summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/Parser.php2
-rw-r--r--src/Utils/Query.php2
2 files changed, 2 insertions, 2 deletions
diff --git a/src/Parser.php b/src/Parser.php
index 31a6244..911e71b 100644
--- a/src/Parser.php
+++ b/src/Parser.php
@@ -436,7 +436,7 @@ namespace SqlParser {
// `LIMIT` keywords actually belong to the first statement.
$lastStatement->order = $statement->order;
$lastStatement->limit = $statement->limit;
- $statement->order = null;
+ $statement->order = array();
$statement->limit = null;
// The statement actually ends where the last statement in
diff --git a/src/Utils/Query.php b/src/Utils/Query.php
index 1f887ab..c11e858 100644
--- a/src/Utils/Query.php
+++ b/src/Utils/Query.php
@@ -536,7 +536,7 @@ class Query
// This is a cheap fix for `SELECT` statements that contain `UNION`.
// Replacing the `ORDER BY` or `LIMIT` clauses should replace the last
// clause.
- if (!empty($statement->union)) {
+ if (($statement instanceof SelectStatement) && (!empty($statement->union))) {
$clauses['ORDER BY'] = count($clauses) + 1;
$clauses['LIMIT'] = count($clauses) + 2;
}