mirror of
https://github.com/alibaba/druid.git
synced 2023-03-04 19:17:16 +00:00
bug fixed for oracle sql parser.
This commit is contained in:
+17
-8
@@ -987,19 +987,28 @@ public class OracleStatementParser extends SQLStatementParser {
|
||||
|
||||
public SQLStatement parseSet() {
|
||||
accept(Token.SET);
|
||||
acceptIdentifier("TRANSACTION");
|
||||
|
||||
OracleSetTransactionStatement stmt = new OracleSetTransactionStatement();
|
||||
|
||||
if (identifierEquals("READ")) {
|
||||
if (identifierEquals("TRANSACTION")) {
|
||||
lexer.nextToken();
|
||||
acceptIdentifier("ONLY");
|
||||
stmt.setReadOnly(true);
|
||||
|
||||
OracleSetTransactionStatement stmt = new OracleSetTransactionStatement();
|
||||
|
||||
if (identifierEquals("READ")) {
|
||||
lexer.nextToken();
|
||||
acceptIdentifier("ONLY");
|
||||
stmt.setReadOnly(true);
|
||||
}
|
||||
|
||||
acceptIdentifier("NAME");
|
||||
|
||||
stmt.setName(this.exprParser.expr());
|
||||
return stmt;
|
||||
}
|
||||
|
||||
acceptIdentifier("NAME");
|
||||
SQLSetStatement stmt = new SQLSetStatement(getDbType());
|
||||
parseAssignItems(stmt.getItems(), stmt);
|
||||
|
||||
stmt.setName(this.exprParser.expr());
|
||||
stmt.putAttribute("parser.set", Boolean.TRUE);
|
||||
return stmt;
|
||||
}
|
||||
|
||||
|
||||
@@ -2170,7 +2170,8 @@ public class SQLASTOutputVisitor extends SQLASTVisitorAdapter implements Paramet
|
||||
|
||||
@Override
|
||||
public boolean visit(SQLSetStatement x) {
|
||||
if (!JdbcConstants.ORACLE.equals(dbType)) {
|
||||
boolean printSet = x.getAttribute("parser.set") == Boolean.TRUE || !JdbcConstants.ORACLE.equals(dbType);
|
||||
if (printSet) {
|
||||
print0(ucase ? "SET " : "set ");
|
||||
}
|
||||
printAndAccept(x.getItems(), ", ");
|
||||
|
||||
Reference in New Issue
Block a user