mirror of
https://github.com/alibaba/druid.git
synced 2023-03-04 19:17:16 +00:00
imporved sql parser.
This commit is contained in:
@@ -18,6 +18,9 @@ package com.alibaba.druid.sql.ast.statement;
|
||||
import com.alibaba.druid.sql.visitor.SQLASTVisitor;
|
||||
|
||||
public class SQLColumnPrimaryKey extends SQLConstraintImpl implements SQLColumnConstraint {
|
||||
public SQLColumnPrimaryKey() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void accept0(SQLASTVisitor visitor) {
|
||||
|
||||
+20
-4
@@ -873,8 +873,8 @@ public class OracleStatementParser extends SQLStatementParser {
|
||||
|
||||
accept(Token.FUNCTION);
|
||||
|
||||
SQLName procedureName = this.exprParser.name();
|
||||
stmt.setName(procedureName);
|
||||
SQLName functionName = this.exprParser.name();
|
||||
stmt.setName(functionName);
|
||||
|
||||
if (lexer.token() == Token.LPAREN) {
|
||||
lexer.nextToken();
|
||||
@@ -963,13 +963,13 @@ public class OracleStatementParser extends SQLStatementParser {
|
||||
|
||||
stmt.setBlock(block);
|
||||
|
||||
if (lexer.identifierEquals(procedureName.getSimpleName())) {
|
||||
if (lexer.identifierEquals(functionName.getSimpleName())) {
|
||||
lexer.nextToken();
|
||||
}
|
||||
|
||||
// return stmt;
|
||||
|
||||
if (lexer.identifierEquals(procedureName.getSimpleName())) {
|
||||
if (lexer.identifierEquals(functionName.getSimpleName())) {
|
||||
lexer.nextToken();
|
||||
}
|
||||
|
||||
@@ -2705,6 +2705,22 @@ public class OracleStatementParser extends SQLStatementParser {
|
||||
stmt.getStatements().add(proc);
|
||||
} else if (lexer.token() == Token.END) {
|
||||
break;
|
||||
|
||||
} else if (lexer.token() == Token.BEGIN) {
|
||||
lexer.nextToken();
|
||||
SQLBlockStatement block = new SQLBlockStatement();
|
||||
parseStatementList(block.getStatementList(), -1, block);
|
||||
accept(Token.END);
|
||||
block.setParent(stmt);
|
||||
stmt.getStatements().add(block);
|
||||
|
||||
if (lexer.identifierEquals(pkgName.getSimpleName())) {
|
||||
lexer.nextToken();
|
||||
accept(Token.SEMI);
|
||||
return stmt;
|
||||
}
|
||||
|
||||
break;
|
||||
} else {
|
||||
throw new ParserException("TODO : " + lexer.info());
|
||||
}
|
||||
|
||||
@@ -666,7 +666,13 @@ public class SQLASTOutputVisitor extends SQLASTVisitorAdapter implements Paramet
|
||||
print0(ucase ? " OR " : " or ");
|
||||
}
|
||||
printExpr(left);
|
||||
printOperator(operator);
|
||||
print(' ');
|
||||
if (operator == SQLBinaryOperator.Is) {
|
||||
print('=');
|
||||
} else {
|
||||
printOperator(operator);
|
||||
}
|
||||
print(' ');
|
||||
printParameter(value);
|
||||
}
|
||||
print(')');
|
||||
|
||||
Reference in New Issue
Block a user