Package com.alibaba.druid.sql.parser

Examples of com.alibaba.druid.sql.parser.ParserException


    private void parseSet(OracleUpdateStatement update) throws ParserException {
        accept(Token.SET);

        if (identifierEquals("VALUE")) {
            throw new ParserException("TODO");
        }

        OracleUpdateSetListClause setListClause = new OracleUpdateSetListClause();
        while (true) {
            if (lexer.token() == (Token.LPAREN)) {
                throw new ParserException("TODO");
            }

            OracleUpdateSetListSingleColumnItem item = new OracleUpdateSetListSingleColumnItem();
            item.setColumn(this.exprParser.primary());
            accept(Token.EQ);
View Full Code Here


            constaints.add(nullable);
            return true;
        }

        if (lexer.token() == (Token.UNIQUE)) {
            throw new ParserException("TODO");
        }

        if (lexer.token() == (Token.REFERENCE)) {
            throw new ParserException("TODO");
        }

        if (lexer.token() == (Token.FOREIGN)) {
            lexer.nextToken();
            accept(Token.KEY);

            OracleForeignKey foreignKey = new OracleForeignKey();

            foreignKey.setName(constaintName);

            accept(Token.LPAREN);
            this.exprParser.names(foreignKey.getColumns());
            accept(Token.RPAREN);

            accept(Token.REFERENCE);
            foreignKey.setRefObject(this.exprParser.name());

            if (lexer.token() == (Token.LPAREN)) {
                lexer.nextToken();
                this.exprParser.names(foreignKey.getRefColumns());
                accept(Token.RPAREN);
            }

            if (lexer.token() == (Token.ON)) {
                lexer.nextToken();
                accept(Token.DELETE);

                if (identifierEquals("CASCADE")) {
                    throw new RuntimeException("TODO");
                } else {
                    throw new RuntimeException("TODO");
                }
            }

            foreignKey.setState(parseConstraintState());

            constaints.add(foreignKey);
            return true;
        }

        if (lexer.token() == (Token.SCHEMA)) {
            throw new ParserException("TODO");
        }

        if (lexer.token() == (Token.PRIMARY)) {
            lexer.nextToken();
            accept(Token.KEY);

            OraclePrimaryKey primaryKey = new OraclePrimaryKey();
            primaryKey.setName(constaintName);

            if (lexer.token() == (Token.LPAREN)) {
                lexer.nextToken();
                this.exprParser.names(primaryKey.getColumns());
                accept(Token.RPAREN);
            }

            primaryKey.setState(parseConstraintState());

            constaints.add(primaryKey);

            return true;
        }

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

            if (lexer.token() == (Token.IS)) {
                throw new RuntimeException("TODO");
            }
            if (identifierEquals("FOR")) {
                throw new ParserException("TODO");
            }
            throw new ParserException("TODO");
        }

        if (identifierEquals("REF")) {
            throw new ParserException("TODO");
        }

        if (identifierEquals("References")) {
            lexer.nextToken();
            OracleReferencesConstaint ref = new OracleReferencesConstaint();
View Full Code Here

    protected OracleConstraintState parseConstraintState() throws ParserException {
        OracleConstraintState state = null;
        while (true) {
            if (identifierEquals("DEFERRABLE")) {
                throw new ParserException("TODO");
            }

            if (identifierEquals("INITIALY")) throw new ParserException("TODO");
            if (identifierEquals("RELY")) throw new ParserException("TODO");
            if (identifierEquals("NORELY")) throw new ParserException("TODO");
            if (identifierEquals("USING")) throw new ParserException("TODO");
            if (identifierEquals("ENABLE")) throw new ParserException("TODO");
            if (identifierEquals("DISABLE")) break;
            if (state == null) {
                state = new OracleConstraintState();
            }

            lexer.nextToken();
            if (identifierEquals("CASCADE")) {
                lexer.nextToken();
                state.getStates().add(new SQLIdentifierExpr("DISABLE CASCADE"));
            }
            state.getStates().add(new SQLIdentifierExpr("DISABLE"));
        }

        if (identifierEquals("VALIDATE")) throw new ParserException("TODO");
        if (identifierEquals("NOVALIDATE")) throw new ParserException("TODO");
        if (identifierEquals("EXCEPTIONS")) {
            throw new ParserException("TODO");
        }

        return state;
    }
View Full Code Here

        return state;
    }

    protected void parsePhysicalAttributesClause() throws ParserException {
        if (identifierEquals("PCTREE")) throw new ParserException("TODO");
        if (identifierEquals("PCTUSED")) throw new ParserException("TODO");
        if (identifierEquals("INITRANS")) throw new ParserException("TODO");
        if (identifierEquals("STORAGE")) throw new ParserException("TODO");
    }
View Full Code Here

    protected OracleTableColumn parseColumn() throws ParserException {
        OracleTableColumn column = new OracleTableColumn();

        if (lexer.token() != Token.IDENTIFIER) {
            throw new ParserException("syntax error");
        }

        column.setName(lexer.stringVal());
        lexer.nextToken();
        column.setDataType(this.exprParser.parseDataType());

        if (identifierEquals("SORT")) {
            lexer.nextToken();
            column.setSort(true);
        }

        if (identifierEquals("DEFAULT")) {
            lexer.nextToken();
            column.setDefaultValue(this.exprParser.expr());
        }

        if (identifierEquals("ENCTRYPT")) {
            throw new ParserException("TODO");
        }
        return column;
    }
View Full Code Here

            queryBlock.setLimit(limit);
        }

        if (identifierEquals("PROCEDURE")) {
            lexer.nextToken();
            throw new ParserException("TODO");
        }

        if (lexer.token() == Token.INTO) {
            lexer.nextToken();
            throw new ParserException("TODO");
        }

        if (lexer.token() == Token.FOR) {
            lexer.nextToken();
            accept(Token.UPDATE);
View Full Code Here

            if (identifierEquals("OF")) {
                lexer.nextToken();
                this.createExprParser().exprList(forUpdate.getOf());

                if (identifierEquals("WAIT")) throw new ParserException("TODO");
                if (identifierEquals("NOWAIT")) throw new ParserException("TODO");
                if (identifierEquals("SKIP")) {
                    throw new ParserException("TODO");
                }
            }

            select.setForUpdate(forUpdate);
        }

        if (select.getOrderBy() == null) {
            select.setOrderBy(this.createExprParser().parseOrderBy());
        }

        if (lexer.token() == Token.WITH) {
            lexer.nextToken();

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

                if (identifierEquals("ONLY")) lexer.nextToken();
                else {
                    throw new ParserException("syntax error");
                }

                select.setRestriction(new OracleSelectRestriction.ReadOnly());
            } else if (lexer.token() == (Token.CHECK)) {
                lexer.nextToken();

                if (identifierEquals("OPTION")) lexer.nextToken();
                else {
                    throw new ParserException("syntax error");
                }

                OracleSelectRestriction.CheckOption checkOption = new OracleSelectRestriction.CheckOption();

                if (lexer.token() == Token.CONSTRAINT) {
                    lexer.nextToken();
                    throw new ParserException("TODO");
                }

                select.setRestriction(checkOption);
            } else {
                throw new ParserException("syntax error");
            }
        }

        return select;
    }
View Full Code Here

            if (lexer.token() == Token.SELECT) {
                tableSource = new OracleSelectSubqueryTableSource(select());
            } else if (lexer.token() == (Token.LPAREN)) {
                tableSource = new OracleSelectSubqueryTableSource(select());
            } else {
                throw new ParserException("TODO :" + lexer.token());
            }
            accept(Token.RPAREN);

            parsePivot((OracleSelectTableSource) tableSource);

            return parseTableSourceRest(tableSource);
        }

        if (lexer.token() == (Token.SELECT)) {
            throw new ParserException("TODO");
        }

        OracleSelectTableReference tableReference = new OracleSelectTableReference();

        if (identifierEquals("ONLY")) {
View Full Code Here

            }

            accept(Token.LPAREN);

            if (lexer.token() != Token.LITERAL_INT) {
                throw new ParserException("syntax error : " + lexer.token());
            }
            sample.setPercent(lexer.integerValue().intValue());
            lexer.nextToken();

            accept(Token.RPAREN);
View Full Code Here

            }

            accept(Token.IN);
            accept(Token.LPAREN);
            if (lexer.token() == (Token.LPAREN)) {
                throw new ParserException("TODO");
            }

            if (lexer.token() == (Token.SELECT)) {
                throw new ParserException("TODO");
            }

            for (;;) {
                item = new OracleSelectPivot.Item();
                item.setExpr(this.createExprParser().expr());
                item.setAlias(as());
                pivot.getPivotIn().add(item);

                if (lexer.token() != Token.COMMA) {
                    break;
                }

                lexer.nextToken();
            }

            accept(Token.RPAREN);

            accept(Token.RPAREN);

            tableSource.setPivot(pivot);
        } else if (identifierEquals("UNPIVOT")) {
            lexer.nextToken();

            OracleSelectUnPivot unPivot = new OracleSelectUnPivot();
            if (identifierEquals("INCLUDE")) {
                lexer.nextToken();
                acceptIdentifier("NULLS");
                unPivot.setNullsIncludeType(OracleSelectUnPivot.NullsIncludeType.INCLUDE_NULLS);
            } else if (identifierEquals("EXCLUDE")) {
                lexer.nextToken();
                acceptIdentifier("NULLS");
                unPivot.setNullsIncludeType(OracleSelectUnPivot.NullsIncludeType.EXCLUDE_NULLS);
            }

            accept(Token.LPAREN);

            if (lexer.token() == (Token.LPAREN)) {
                lexer.nextToken();
                this.createExprParser().exprList(unPivot.getItems());
                accept(Token.RPAREN);
            } else {
                unPivot.getItems().add(this.createExprParser().expr());
            }

            accept(Token.FOR);

            if (lexer.token() == (Token.LPAREN)) {
                lexer.nextToken();
                while (true) {
                    unPivot.getPivotFor().add(new SQLIdentifierExpr(lexer.stringVal()));
                    lexer.nextToken();

                    if (!(lexer.token() == (Token.COMMA))) break;
                    lexer.nextToken();
                }

                accept(Token.RPAREN);
            } else {
                unPivot.getPivotFor().add(new SQLIdentifierExpr(lexer.stringVal()));
                lexer.nextToken();
            }

            accept(Token.IN);
            accept(Token.LPAREN);
            if (lexer.token() == (Token.LPAREN)) {
                throw new ParserException("TODO");
            }

            if (lexer.token() == (Token.SELECT)) {
                throw new ParserException("TODO");
            }

            for (;;) {
                item = new OracleSelectPivot.Item();
                item.setExpr(this.createExprParser().expr());
View Full Code Here

TOP

Related Classes of com.alibaba.druid.sql.parser.ParserException

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.