mirror of
https://github.com/alibaba/druid.git
synced 2023-03-04 19:17:16 +00:00
db2 sql parser support select_for_update. fixed issue #1322
This commit is contained in:
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user