提交 e2e8736a authored 作者: Evgenij Ryazanov's avatar Evgenij Ryazanov

Use currentTokenType in Parser.parsePrepared()

上级 87e449d9
......@@ -672,13 +672,13 @@ public class Parser {
private Prepared parsePrepared() {
int start = lastParseIndex;
Prepared c = null;
String token = currentToken;
if (token.length() == 0) {
switch (currentTokenType) {
case END:
case SEMICOLON:
c = new NoOperation(session);
} else {
char first = token.charAt(0);
switch (first) {
case '?':
setSQL(c, null, start);
return c;
case PARAMETER:
// read the ? as a parameter
readTerm();
// this is an 'out' parameter - set a dummy value
......@@ -687,9 +687,17 @@ public class Parser {
read("CALL");
c = parseCall();
break;
case '(':
case OPEN_PAREN:
case FROM:
case SELECT:
c = parseSelect();
break;
case WITH:
read();
c = parseWithStatementOrQuery();
break;
case IDENTIFIER:
switch (currentToken.charAt(0)) {
case 'a':
case 'A':
if (readIf("ALTER")) {
......@@ -741,12 +749,6 @@ public class Parser {
c = parseExecute();
}
break;
case 'f':
case 'F':
if (isToken(FROM)) {
c = parseSelect();
}
break;
case 'g':
case 'G':
if (readIf("GRANT")) {
......@@ -793,9 +795,7 @@ public class Parser {
break;
case 's':
case 'S':
if (isToken(SELECT)) {
c = parseSelect();
} else if (readIf("SET")) {
if (readIf("SET")) {
c = parseSet();
} else if (readIf("SAVEPOINT")) {
c = parseSavepoint();
......@@ -826,17 +826,9 @@ public class Parser {
if (readIf("VALUES")) {
c = parseValues();
}
break;
case 'w':
case 'W':
if (readIf(WITH)) {
c = parseWithStatementOrQuery();
}
break;
case ';':
c = new NoOperation(session);
break;
default:
}
if (c == null) {
throw getSyntaxError();
}
if (indexedParameterList != null) {
......@@ -869,10 +861,6 @@ public class Parser {
}
parameters.clear();
}
}
if (c == null) {
throw getSyntaxError();
}
setSQL(c, null, start);
return c;
}
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论