Skip to content
Permalink
Browse files
[NO ISSUE][*DB][MISC] Avoid appending trailing ; on statements ending…
… with a ;

Change-Id: Iae6db76195ad834f01c8e35fc8a30d3b7148764c
Reviewed-on: https://asterix-gerrit.ics.uci.edu/c/asterixdb/+/10883
Integration-Tests: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
Tested-by: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
Reviewed-by: Michael Blow <mblow@apache.org>
Reviewed-by: Till Westmann <tillw@apache.org>
Contrib: Michael Blow <mblow@apache.org>
  • Loading branch information
mblow committed Apr 5, 2021
1 parent 104d46a commit d4f3aba32bb71a8a370bcaea332a1e5c576af4b3
Showing 1 changed file with 8 additions and 6 deletions.
@@ -280,10 +280,12 @@ private void handleRequest(IServletRequest request, IServletResponse response, b
final ResultProperties resultProperties = new ResultProperties(delivery, param.getMaxResultReads());
buildResponseHeaders(requestRef, sessionOutput, param, responsePrinter, delivery);
responsePrinter.printHeaders();
validateStatement(param.getStatement());
String statementsText = param.getStatement() + ";";
String statement = param.getStatement();
statement = statement == null || (!statement.isEmpty() && statement.charAt(statement.length() - 1) == ';')
? statement : (statement + ";");
validateStatement(statement);
if (param.isParseOnly()) {
ResultUtil.ParseOnlyResult parseOnlyResult = parseStatement(statementsText);
ResultUtil.ParseOnlyResult parseOnlyResult = parseStatement(statement);
setAccessControlHeaders(request, response);
executionState.setStatus(ResultStatus.SUCCESS, HttpResponseStatus.OK);
response.setStatus(executionState.getHttpStatus());
@@ -296,9 +298,9 @@ private void handleRequest(IServletRequest request, IServletResponse response, b
IStatementExecutor.StatementProperties statementProperties =
new IStatementExecutor.StatementProperties();
response.setStatus(HttpResponseStatus.OK);
executeStatement(request, requestRef, statementsText, sessionOutput, resultProperties,
statementProperties, stats, param, executionState, param.getOptionalParams(), statementParams,
responsePrinter, warnings);
executeStatement(request, requestRef, statement, sessionOutput, resultProperties, statementProperties,
stats, param, executionState, param.getOptionalParams(), statementParams, responsePrinter,
warnings);
executionState.setStatus(ResultStatus.SUCCESS, HttpResponseStatus.OK);
}
errorCount = 0;

0 comments on commit d4f3aba

Please sign in to comment.