Skip to content

Commit e69da4e

Browse files
authored
Merge pull request #101 from devenbansod/fix_incorrect_error_in_union
Fix incorrect error in union queries
2 parents fcfed04 + 57cc4cf commit e69da4e

File tree

4 files changed

+5
-0
lines changed

4 files changed

+5
-0
lines changed

src/Utils/Query.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -831,6 +831,8 @@ public static function getClauseStartOffset($statement, $list, $clause)
831831
&& ($clause === $token->value)
832832
) {
833833
return $i;
834+
} elseif ($token->value === 'UNION') {
835+
return -1;
834836
}
835837
}
836838
}

tests/Parser/SelectStatementTest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ public function testSelectProvider()
6161
array('parser/parseSelectEndOptions2'),
6262
array('parser/parseSelectEndOptionsErr'),
6363
array('parser/parseSelectUnion'),
64+
array('parser/parseSelectUnion2'),
6465
);
6566
}
6667
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
(SELECT DISTINCT `User`, `Host` FROM `mysql`.`user` ) UNION (SELECT DISTINCT `User`, `Host` FROM `mysql`.`db` ) UNION (SELECT DISTINCT `User`, `Host` FROM `mysql`.`tables_priv` ) UNION (SELECT DISTINCT `User`, `Host` FROM `mysql`.`columns_priv` ) UNION (SELECT DISTINCT `User`, `Host` FROM `mysql`.`procs_priv` ) ORDER BY `User` ASC, `Host` ASC

0 commit comments

Comments
 (0)