db2 sql parser support select_for_update. fixed issue #1322

This commit is contained in:
高铁
2016-07-08 21:22:50 +08:00
parent f744f260ee
commit b880695381
5 changed files with 116 additions and 32 deletions
@@ -116,9 +116,15 @@ public class DB2SelectParser extends SQLSelectParser {
if (lexer.token() == Token.FOR) {
lexer.nextToken();
acceptIdentifier("READ");
accept(Token.ONLY);
queryBlock.setForReadOnly(true);
if (lexer.token() == Token.UPDATE) {
queryBlock.setForUpdate(true);
lexer.nextToken();
} else {
acceptIdentifier("READ");
accept(Token.ONLY);
queryBlock.setForReadOnly(true);
}
}
if (lexer.token() == Token.OPTIMIZE) {
@@ -58,6 +58,9 @@ public class DB2OutputVisitor extends SQLASTOutputVisitor implements DB2ASTVisit
if (x.isForReadOnly()) {
println();
print0(ucase ? "FOR READ ONLY" : "for read only");
} else if (x.isForUpdate()) {
println();
print0(ucase ? "FOR UPDATE" : "for update");
}
if (x.getIsolation() != null) {