Skip to content
This repository was archived by the owner on May 12, 2021. It is now read-only.
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions tajo-client/src/main/java/org/apache/tajo/cli/tsql/TajoCli.java
Original file line number Diff line number Diff line change
Expand Up @@ -390,7 +390,7 @@ private String updatePrompt(ParsingState state) throws ServiceException {
public int runShell() throws Exception {
String line;
String currentPrompt = context.getCurrentDatabase();
int exitCode = 0;
int exitCode;

sout.write("Try \\? for help.\n");

Expand All @@ -416,7 +416,7 @@ public int runShell() throws Exception {
exitCode = executeParsedResults(parsedResults);
currentPrompt = updatePrompt(parser.getState());

if (exitCode != 0 && context.getBool(SessionVars.ON_ERROR_STOP)) {
if (exitCode != 0) {
return exitCode;
}
}
Expand All @@ -430,24 +430,24 @@ public int runShell() throws Exception {

throw e;
}
return exitCode;
return 0;
}

private int executeParsedResults(Collection<ParsedResult> parsedResults) throws Exception {
int exitCode = 0;
int exitCode;
for (ParsedResult parsedResult : parsedResults) {
if (parsedResult.getType() == META) {
exitCode = executeMetaCommand(parsedResult.getStatement());
} else {
exitCode = executeQuery(parsedResult.getStatement());
}

if (exitCode != 0) {
if (exitCode != 0 && context.getBool(SessionVars.ON_ERROR_STOP)) {
return exitCode;
}
}

return exitCode;
return 0;
}

public int executeMetaCommand(String line) throws Exception {
Expand Down