Package com.alibaba.druid.sql.dialect.sqlserver.ast.stmt

Examples of com.alibaba.druid.sql.dialect.sqlserver.ast.stmt.SQLServerSetTransactionIsolationLevelStatement


        if (identifierEquals("TRANSACTION")) {
            lexer.nextToken();
            acceptIdentifier("ISOLATION");
            acceptIdentifier("LEVEL");

            SQLServerSetTransactionIsolationLevelStatement stmt = new SQLServerSetTransactionIsolationLevelStatement();

            if (identifierEquals("READ")) {
                lexer.nextToken();

                if (identifierEquals("UNCOMMITTED")) {
                    stmt.setLevel("READ UNCOMMITTED");
                    lexer.nextToken();
                } else if (identifierEquals("COMMITTED")) {
                    stmt.setLevel("READ COMMITTED");
                    lexer.nextToken();
                } else {
                    throw new ParserException("UNKOWN TRANSACTION LEVEL : " + lexer.stringVal());
                }
            } else if (identifierEquals("SERIALIZABLE")) {
                stmt.setLevel("SERIALIZABLE");
                lexer.nextToken();
            } else if (identifierEquals("SNAPSHOT")) {
                stmt.setLevel("SNAPSHOT");
                lexer.nextToken();
            } else if (identifierEquals("REPEATABLE")) {
                lexer.nextToken();
                if (identifierEquals("READ")) {
                    stmt.setLevel("REPEATABLE READ");
                    lexer.nextToken();
                } else {
                    throw new ParserException("UNKOWN TRANSACTION LEVEL : " + lexer.stringVal());
                }
            } else {
                throw new ParserException("UNKOWN TRANSACTION LEVEL : " + lexer.stringVal());
            }

            return stmt;
        }

        if (identifierEquals("STATISTICS")) {
            lexer.nextToken();

            SQLServerSetStatement stmt = new SQLServerSetStatement();

            if (identifierEquals("IO") || identifierEquals("XML") || identifierEquals("PROFILE")
                || identifierEquals("TIME")) {
                stmt.getItem().setTarget(new SQLIdentifierExpr("STATISTICS " + lexer.stringVal().toUpperCase()));

                lexer.nextToken();
                if (lexer.token() == Token.ON) {
                    stmt.getItem().setValue(new SQLIdentifierExpr("ON"));
                    lexer.nextToken();
                } else if (identifierEquals("OFF")) {
                    stmt.getItem().setValue(new SQLIdentifierExpr("OFF"));
                    lexer.nextToken();
                }
            }
            return stmt;
        }

        if (lexer.token() == Token.VARIANT) {
            SQLSetStatement stmt = new SQLSetStatement(getDbType());
            parseAssignItems(stmt.getItems(), stmt);
            return stmt;
        } else {
            SQLServerSetStatement stmt = new SQLServerSetStatement();
            stmt.getItem().setTarget(this.exprParser.expr());

            if (lexer.token() == Token.ON) {
                stmt.getItem().setValue(new SQLIdentifierExpr("ON"));
                lexer.nextToken();
            } else if (identifierEquals("OFF")) {
                stmt.getItem().setValue(new SQLIdentifierExpr("OFF"));
                lexer.nextToken();
            } else {
                stmt.getItem().setValue(this.exprParser.expr());
            }
            return stmt;
        }
    }
View Full Code Here

TOP

Related Classes of com.alibaba.druid.sql.dialect.sqlserver.ast.stmt.SQLServerSetTransactionIsolationLevelStatement

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.