提交 4e5e5826 authored 作者: Evgenij Ryazanov's avatar Evgenij Ryazanov

Inline extracted method back

上级 23d020cc
...@@ -673,7 +673,21 @@ public class Parser { ...@@ -673,7 +673,21 @@ public class Parser {
*/ */
public Command prepareCommand(String sql) { public Command prepareCommand(String sql) {
try { try {
CommandContainer c = prepareSingleCommand(sql); Prepared p = parse(sql);
if (currentTokenType != SEMICOLON && currentTokenType != END) {
addExpected(SEMICOLON);
throw getSyntaxError();
}
try {
p.prepare();
} catch (Throwable t) {
CommandContainer.clearCTE(session, p);
throw t;
}
if (parseIndex < sql.length()) {
sql = sql.substring(0, parseIndex);
}
CommandContainer c = new CommandContainer(session, sql, p);
if (currentTokenType == SEMICOLON) { if (currentTokenType == SEMICOLON) {
String remaining = originalSQL.substring(parseIndex); String remaining = originalSQL.substring(parseIndex);
if (!StringUtils.isWhitespaceOrEmpty(remaining)) { if (!StringUtils.isWhitespaceOrEmpty(remaining)) {
...@@ -726,24 +740,6 @@ public class Parser { ...@@ -726,24 +740,6 @@ public class Parser {
} }
} }
private CommandContainer prepareSingleCommand(String sql) {
Prepared p = parse(sql);
if (currentTokenType != SEMICOLON && currentTokenType != END) {
addExpected(SEMICOLON);
throw getSyntaxError();
}
try {
p.prepare();
} catch (Throwable t) {
CommandContainer.clearCTE(session, p);
throw t;
}
if (parseIndex < sql.length()) {
sql = sql.substring(0, parseIndex);
}
return new CommandContainer(session, sql, p);
}
/** /**
* Parse the statement, but don't prepare it for execution. * Parse the statement, but don't prepare it for execution.
* *
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论