}
private Query parseSelectUnionExtension(Query command, int start, boolean unionOnly) {
while (true) {
if (readIf("UNION")) {
SelectUnion union = new SelectUnion(session, command);
if (readIf("ALL")) {
union.setUnionType(SelectUnion.UNION_ALL);
} else {
readIf("DISTINCT");
union.setUnionType(SelectUnion.UNION);
}
union.setRight(parseSelectSub());
command = union;
} else if (readIf("MINUS") || readIf("EXCEPT")) {
SelectUnion union = new SelectUnion(session, command);
union.setUnionType(SelectUnion.EXCEPT);
union.setRight(parseSelectSub());
command = union;
} else if (readIf("INTERSECT")) {
SelectUnion union = new SelectUnion(session, command);
union.setUnionType(SelectUnion.INTERSECT);
union.setRight(parseSelectSub());
command = union;
} else {
break;
}
}