mirror of
https://github.com/alibaba/druid.git
synced 2023-03-04 19:17:16 +00:00
add hive sql parser
This commit is contained in:
-83
@@ -15,17 +15,8 @@
|
||||
*/
|
||||
package com.alibaba.druid.sql.dialect.sqlserver.parser;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.alibaba.druid.sql.ast.SQLStatement;
|
||||
import com.alibaba.druid.sql.ast.statement.SQLSelectStatement;
|
||||
import com.alibaba.druid.sql.dialect.oracle.ast.stmt.OraclePLSQLCommitStatement;
|
||||
import com.alibaba.druid.sql.dialect.oracle.parser.OracleDeleteParser;
|
||||
import com.alibaba.druid.sql.dialect.oracle.parser.OracleSelectParser;
|
||||
import com.alibaba.druid.sql.parser.Lexer;
|
||||
import com.alibaba.druid.sql.parser.ParserException;
|
||||
import com.alibaba.druid.sql.parser.SQLStatementParser;
|
||||
import com.alibaba.druid.sql.parser.Token;
|
||||
|
||||
public class SQLServerStatementParser extends SQLStatementParser {
|
||||
|
||||
@@ -38,78 +29,4 @@ public class SQLServerStatementParser extends SQLStatementParser {
|
||||
super(lexer);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void parseStatementList(List<SQLStatement> statementList) throws ParserException {
|
||||
for (;;) {
|
||||
if (lexer.token() == Token.EOF) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (lexer.token() == (Token.SEMI)) {
|
||||
lexer.nextToken();
|
||||
continue;
|
||||
}
|
||||
|
||||
if (lexer.token() == (Token.SELECT)) {
|
||||
statementList.add(new SQLSelectStatement(new SQLServerSelectParser(this.lexer).select()));
|
||||
continue;
|
||||
}
|
||||
|
||||
if (lexer.token() == (Token.UPDATE)) {
|
||||
statementList.add(parseUpdateStatement());
|
||||
continue;
|
||||
}
|
||||
|
||||
if (lexer.token() == (Token.CREATE)) {
|
||||
lexer.nextToken();
|
||||
|
||||
// if ((this.tokenList.lookup(1).equals(Token.ViewToken)) ||
|
||||
// (this.tokenList.lookup(3).equals(Token.ViewToken))
|
||||
// || (this.tokenList.lookup(4).equals(Token.ViewToken)) ||
|
||||
// (this.tokenList.lookup(5).equals(Token.ViewToken))) {
|
||||
// statementList.add(parseCreateView());
|
||||
// }
|
||||
//
|
||||
// if ((this.tokenList.lookup(1).equals(Token.TableToken)) ||
|
||||
// (this.tokenList.lookup(3).equals(Token.TableToken))) {
|
||||
// statementList.add(parseOracleCreateTable());
|
||||
// }
|
||||
|
||||
throw new ParserException("TODO");
|
||||
}
|
||||
|
||||
if (lexer.token() == Token.INSERT) {
|
||||
statementList.add(parseInsert());
|
||||
continue;
|
||||
}
|
||||
|
||||
if (lexer.token() == (Token.DELETE)) {
|
||||
statementList.add(new OracleDeleteParser(this.lexer).parseDelete());
|
||||
continue;
|
||||
}
|
||||
|
||||
if (lexer.token() == (Token.SLASH)) {
|
||||
lexer.nextToken();
|
||||
statementList.add(new OraclePLSQLCommitStatement());
|
||||
continue;
|
||||
}
|
||||
|
||||
if (lexer.token() == Token.ALTER) {
|
||||
throw new ParserException("TODO");
|
||||
}
|
||||
|
||||
if (lexer.token() == Token.WITH) {
|
||||
statementList.add(new SQLSelectStatement(new OracleSelectParser(this.lexer).select()));
|
||||
continue;
|
||||
}
|
||||
|
||||
if (identifierEquals("CALL")) {
|
||||
statementList.add(this.parseCall());
|
||||
continue;
|
||||
}
|
||||
|
||||
throw new ParserException("TODO : " + lexer.token() + " " + lexer.stringVal());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user