improved sql parser.

This commit is contained in:
wenshao
2017-07-19 17:55:24 +08:00
parent 8a0bf34a6c
commit 168518e0e5
37 changed files with 1017 additions and 387 deletions
@@ -306,7 +306,7 @@ public class PGSQLStatementParser extends SQLStatementParser {
} else if (lexer.token() == Token.VALUES) {
query = this.parseSelect();
} else {
throw new ParserException("syntax error, support token '" + lexer.token() + "'");
throw new ParserException("syntax error, support token '" + lexer.token() + "', " + lexer.info());
}
withQuery.setQuery(query);
@@ -347,7 +347,7 @@ public class PGSQLStatementParser extends SQLStatementParser {
stmt.setWith(with);
return stmt;
}
throw new ParserException("TODO");
throw new ParserException("TODO. " + lexer.info());
}
protected SQLAlterTableAlterColumn parseAlterColumn() {
@@ -197,7 +197,7 @@ public class PGSelectParser extends SQLSelectParser {
} else if (lexer.token() == Token.NEXT) {
fetch.setOption(PGSelectQueryBlock.FetchClause.Option.NEXT);
} else {
throw new ParserException("expect 'FIRST' or 'NEXT'");
throw new ParserException("expect 'FIRST' or 'NEXT'. " + lexer.info());
}
SQLExpr count = expr();
@@ -206,13 +206,13 @@ public class PGSelectParser extends SQLSelectParser {
if (lexer.token() == Token.ROW || lexer.token() == Token.ROWS) {
lexer.nextToken();
} else {
throw new ParserException("expect 'ROW' or 'ROWS'");
throw new ParserException("expect 'ROW' or 'ROWS'. " + lexer.info());
}
if (lexer.token() == Token.ONLY) {
lexer.nextToken();
} else {
throw new ParserException("expect 'ONLY'");
throw new ParserException("expect 'ONLY'. " + lexer.info());
}
queryBlock.setFetch(fetch);
@@ -230,7 +230,7 @@ public class PGSelectParser extends SQLSelectParser {
forClause.setOption(PGSelectQueryBlock.ForClause.Option.SHARE);
lexer.nextToken();
} else {
throw new ParserException("expect 'FIRST' or 'NEXT'");
throw new ParserException("expect 'FIRST' or 'NEXT'. " + lexer.info());
}
if (lexer.token() == Token.OF) {