Package com.alibaba.druid.sql.dialect.mysql.ast.statement

Examples of com.alibaba.druid.sql.dialect.mysql.ast.statement.MySqlAlterTableAddColumn


          }
          field.setName(newColumnName);
        }
      } else if (item instanceof MySqlAlterTableAddColumn) {
        // Alter Table Add Column
        MySqlAlterTableAddColumn addColumn = (MySqlAlterTableAddColumn) item;
        List<SQLColumnDefinition> columns = addColumn.getColumns();
        boolean first = addColumn.isFirst();
        SQLName afterColumn = addColumn.getAfterColumn();
        LinkedHashMap<String, Field> ftableColumns = newTable.getColumns();

        List<Field> addFields = convertColumnDefForAlterTable(columns);
        // check Duplicate column name
        metaEventOperation.areLegalTableColumns(ftableColumns.values(),
View Full Code Here


                } else if (identifierEquals("ADD")) {
                    lexer.nextToken();

                    if (lexer.token() == Token.COLUMN) {
                        lexer.nextToken();
                        MySqlAlterTableAddColumn item = new MySqlAlterTableAddColumn();
                        SQLColumnDefinition columnDef = this.exprParser.parseColumn();
                        item.getColumns().add(columnDef);
                        if (identifierEquals("AFTER")) {
                            lexer.nextToken();
                            item.setAfterColumn(this.exprParser.name());
                        } else if (identifierEquals("FIRST")) {
                            lexer.nextToken();
                            if (lexer.token() == Token.IDENTIFIER) {
                                item.setFirstColumn(this.exprParser.name());
                            } else {
                                item.setFirst(true);
                            }
                        }
                        stmt.getItems().add(item);
                    } else if (lexer.token() == Token.INDEX) {
                        SQLAlterTableAddIndex item = parseAlterTableAddIndex();
                        item.setParent(stmt);
                        stmt.getItems().add(item);
                    } else if (lexer.token() == Token.UNIQUE) {
                        SQLAlterTableAddIndex item = parseAlterTableAddIndex();
                        item.setParent(stmt);
                        stmt.getItems().add(item);
                    } else if (lexer.token() == Token.PRIMARY) {
                        SQLPrimaryKey primaryKey = this.exprParser.parsePrimaryKey();
                        SQLAlterTableAddConstraint item = new SQLAlterTableAddConstraint(primaryKey);
                        stmt.getItems().add(item);
                    } else if (lexer.token() == Token.KEY) {
                        throw new ParserException("TODO " + lexer.token() + " " + lexer.stringVal());
                    } else if (lexer.token() == Token.CONSTRAINT) {
                        lexer.nextToken();
                        SQLName constraintName = this.exprParser.name();

                        if (lexer.token() == Token.PRIMARY) {
                            SQLPrimaryKey primaryKey = ((MySqlExprParser) this.exprParser).parsePrimaryKey();

                            primaryKey.setName(constraintName);

                            SQLAlterTableAddConstraint item = new SQLAlterTableAddConstraint(primaryKey);
                            item.setParent(stmt);

                            stmt.getItems().add(item);
                        } else if (lexer.token() == Token.FOREIGN) {
                            MysqlForeignKey fk = this.getExprParser().parseForeignKey();
                            fk.setName(constraintName);
                            fk.setHasConstraint(true);

                            SQLAlterTableAddConstraint item = new SQLAlterTableAddConstraint(fk);

                            item.setParent(stmt);

                            stmt.getItems().add(item);
                        } else {
                            throw new ParserException("TODO " + lexer.token() + " " + lexer.stringVal());
                        }
                    } else if (identifierEquals(FULLTEXT)) {
                        throw new ParserException("TODO " + lexer.token() + " " + lexer.stringVal());
                    } else if (identifierEquals(SPATIAL)) {
                        throw new ParserException("TODO " + lexer.token() + " " + lexer.stringVal());
                    } else {
                        MySqlAlterTableAddColumn item = new MySqlAlterTableAddColumn();
                        SQLColumnDefinition columnDef = this.exprParser.parseColumn();
                        item.getColumns().add(columnDef);
                        if (identifierEquals("AFTER")) {
                            lexer.nextToken();
                            item.setAfterColumn(this.exprParser.name());
                        }
                        stmt.getItems().add(item);
                    }
                } else if (lexer.token() == Token.ALTER) {
                    lexer.nextToken();
                    if (lexer.token() == Token.COLUMN) {
                        lexer.nextToken();
                    }

                    SQLAlterTableAlterColumn alterColumn = new SQLAlterTableAlterColumn();
                    SQLColumnDefinition columnDef = this.exprParser.parseColumn();
                    alterColumn.setColumn(columnDef);

                    stmt.getItems().add(alterColumn);
                } else if (identifierEquals("CHANGE")) {
                    lexer.nextToken();
                    if (lexer.token() == Token.COLUMN) {
                        lexer.nextToken();
                    }
                    MySqlAlterTableChangeColumn item = new MySqlAlterTableChangeColumn();
                    item.setColumnName(this.exprParser.name());
                    item.setNewColumnDefinition(this.exprParser.parseColumn());
                    if (identifierEquals("AFTER")) {
                        lexer.nextToken();
                        item.setAfterColumn(this.exprParser.name());
                    } else if (identifierEquals("FIRST")) {
                        lexer.nextToken();
                        if (lexer.token() == Token.IDENTIFIER) {
                            item.setFirstColumn(this.exprParser.name());
                        } else {
                            item.setFirst(true);
                        }
                    }
                    stmt.getItems().add(item);
                } else if (identifierEquals("MODIFY")) {
                    lexer.nextToken();
                    if (lexer.token() == Token.COLUMN) {
                        lexer.nextToken();
                    }
                    MySqlAlterTableModifyColumn item = new MySqlAlterTableModifyColumn();
                    item.setNewColumnDefinition(this.exprParser.parseColumn());
                    if (identifierEquals("AFTER")) {
                        lexer.nextToken();
                        item.setAfterColumn(this.exprParser.name());
                    } else if (identifierEquals("FIRST")) {
                        lexer.nextToken();
                        if (lexer.token() == Token.IDENTIFIER) {
                            item.setFirstColumn(this.exprParser.name());
                        } else {
                            item.setFirst(true);
                        }
                    }
                    stmt.getItems().add(item);
                } else if (lexer.token() == Token.DISABLE) {
                    lexer.nextToken();

                    if (lexer.token() == Token.CONSTRAINT) {
                        lexer.nextToken();
                        SQLAlterTableDisableConstraint item = new SQLAlterTableDisableConstraint();
                        item.setConstraintName(this.exprParser.name());
                        stmt.getItems().add(item);
                    } else {
                        acceptIdentifier("KEYS");
                        SQLAlterTableDisableKeys item = new SQLAlterTableDisableKeys();
                        stmt.getItems().add(item);
                    }
                } else if (lexer.token() == Token.ENABLE) {
                    lexer.nextToken();
                    if (lexer.token() == Token.CONSTRAINT) {
                        lexer.nextToken();
                        SQLAlterTableEnableConstraint item = new SQLAlterTableEnableConstraint();
                        item.setConstraintName(this.exprParser.name());
                        stmt.getItems().add(item);
                    } else {
                        acceptIdentifier("KEYS");
                        SQLAlterTableEnableKeys item = new SQLAlterTableEnableKeys();
                        stmt.getItems().add(item);
                    }
                } else if (identifierEquals("RENAME")) {
                    lexer.nextToken();
                    if (lexer.token() == Token.TO || lexer.token() == Token.AS) {
                        lexer.nextToken();
                    }
                    MySqlRenameTableStatement renameStmt = new MySqlRenameTableStatement();
                    MySqlRenameTableStatement.Item item = new MySqlRenameTableStatement.Item();
                    item.setName(stmt.getTableSource().getExpr());
                    item.setTo(this.exprParser.name());
                    renameStmt.getItems().add(item);

                    return renameStmt;
                } else if (lexer.token() == Token.ORDER) {
                    throw new ParserException("TODO " + lexer.token() + " " + lexer.stringVal());
                } else if (identifierEquals("CONVERT")) {
                    throw new ParserException("TODO " + lexer.token() + " " + lexer.stringVal());
                } else if (lexer.token() == Token.DEFAULT) {
                    throw new ParserException("TODO " + lexer.token() + " " + lexer.stringVal());
                } else if (identifierEquals("DISCARD")) {
                    lexer.nextToken();
                    accept(Token.TABLESPACE);
                    MySqlAlterTableDiscardTablespace item = new MySqlAlterTableDiscardTablespace();
                    stmt.getItems().add(item);
                } else if (identifierEquals("IMPORT")) {
                    lexer.nextToken();
                    accept(Token.TABLESPACE);
                    MySqlAlterTableImportTablespace item = new MySqlAlterTableImportTablespace();
                    stmt.getItems().add(item);
                } else if (identifierEquals("FORCE")) {
                    throw new ParserException("TODO " + lexer.token() + " " + lexer.stringVal());
                } else if (identifierEquals("TRUNCATE")) {
                    throw new ParserException("TODO " + lexer.token() + " " + lexer.stringVal());
                } else if (identifierEquals("COALESCE")) {
                    throw new ParserException("TODO " + lexer.token() + " " + lexer.stringVal());
                } else if (identifierEquals("REORGANIZE")) {
                    throw new ParserException("TODO " + lexer.token() + " " + lexer.stringVal());
                } else if (identifierEquals("EXCHANGE")) {
                    throw new ParserException("TODO " + lexer.token() + " " + lexer.stringVal());
                } else if (identifierEquals("ANALYZE")) {
                    throw new ParserException("TODO " + lexer.token() + " " + lexer.stringVal());
                } else if (identifierEquals("CHECK")) {
                    throw new ParserException("TODO " + lexer.token() + " " + lexer.stringVal());
                } else if (lexer.token() == Token.OPTIMIZE) {
                    throw new ParserException("TODO " + lexer.token() + " " + lexer.stringVal());
                } else if (identifierEquals("REBUILD")) {
                    throw new ParserException("TODO " + lexer.token() + " " + lexer.stringVal());
                } else if (identifierEquals("REPAIR")) {
                    throw new ParserException("TODO " + lexer.token() + " " + lexer.stringVal());
                } else if (identifierEquals("REMOVE")) {
                    throw new ParserException("TODO " + lexer.token() + " " + lexer.stringVal());
                } else if (identifierEquals(ENGINE)) {
                    lexer.nextToken();
                    accept(Token.EQ);
                    stmt.getItems().add(new MySqlAlterTableOption(ENGINE, lexer.stringVal()));
                    lexer.nextToken();
                } else if (identifierEquals(AUTO_INCREMENT)) {
                    lexer.nextToken();
                    accept(Token.EQ);
                    stmt.getItems().add(new MySqlAlterTableOption(AUTO_INCREMENT, lexer.integerValue()));
                    lexer.nextToken();
                } else if (identifierEquals(COLLATE2)) {
                    lexer.nextToken();
                    accept(Token.EQ);
                    stmt.getItems().add(new MySqlAlterTableOption(COLLATE2, lexer.stringVal()));
                    lexer.nextToken();
                } else if (identifierEquals("PACK_KEYS")) {
                    lexer.nextToken();
                    accept(Token.EQ);
                    if (identifierEquals("PACK")) {
                        lexer.nextToken();
                        accept(Token.ALL);
                        stmt.getItems().add(new MySqlAlterTableOption("PACK_KEYS", "PACK ALL"));
                    } else {
                        stmt.getItems().add(new MySqlAlterTableOption("PACK_KEYS", lexer.stringVal()));
                        lexer.nextToken();
                    }
                } else if (identifierEquals(CHARACTER)) {
                    lexer.nextToken();
                    accept(Token.SET);
                    accept(Token.EQ);
                    MySqlAlterTableCharacter item = new MySqlAlterTableCharacter();
                    item.setCharacterSet(this.exprParser.primary());
                    if (lexer.token() == Token.COMMA) {
                        lexer.nextToken();
                        acceptIdentifier(COLLATE2);
                        accept(Token.EQ);
                        item.setCollate(this.exprParser.primary());
                    }
                    stmt.getItems().add(item);
                } else if (lexer.token() == Token.COMMENT) {
                    lexer.nextToken();
                    if(lexer.token() == Token.EQ) {
View Full Code Here

                } else if (identifierEquals("ADD")) {
                    lexer.nextToken();

                    if (lexer.token() == Token.COLUMN) {
                        lexer.nextToken();
                        MySqlAlterTableAddColumn item = new MySqlAlterTableAddColumn();
                        SQLColumnDefinition columnDef = this.exprParser.parseColumn();
                        item.getColumns().add(columnDef);
                        if (identifierEquals("AFTER")) {
                            lexer.nextToken();
                            item.setAfterColumn(this.exprParser.name());
                        } else if (identifierEquals("FIRST")) {
                            lexer.nextToken();
                            if (lexer.token() == Token.IDENTIFIER) {
                                item.setFirstColumn(this.exprParser.name());
                            } else {
                                item.setFirst(true);
                            }
                        }
                        stmt.getItems().add(item);
                    } else if (lexer.token() == Token.INDEX) {
                        SQLAlterTableAddIndex item = parseAlterTableAddIndex();
                        item.setParent(stmt);
                        stmt.getItems().add(item);
                    } else if (lexer.token() == Token.UNIQUE) {
                        SQLAlterTableAddIndex item = parseAlterTableAddIndex();
                        item.setParent(stmt);
                        stmt.getItems().add(item);
                    } else if (lexer.token() == Token.PRIMARY) {
                        SQLPrimaryKey primaryKey = this.exprParser.parsePrimaryKey();
                        SQLAlterTableAddConstraint item = new SQLAlterTableAddConstraint(primaryKey);
                        stmt.getItems().add(item);
                    } else if (lexer.token() == Token.KEY) {
                        throw new ParserException("TODO " + lexer.token() + " " + lexer.stringVal());
                    } else if (lexer.token() == Token.CONSTRAINT) {
                        lexer.nextToken();
                        SQLName constraintName = this.exprParser.name();

                        if (lexer.token() == Token.PRIMARY) {
                            SQLPrimaryKey primaryKey = ((MySqlExprParser) this.exprParser).parsePrimaryKey();

                            primaryKey.setName(constraintName);

                            SQLAlterTableAddConstraint item = new SQLAlterTableAddConstraint(primaryKey);
                            item.setParent(stmt);

                            stmt.getItems().add(item);
                        } else if (lexer.token() == Token.FOREIGN) {
                            MysqlForeignKey fk = this.getExprParser().parseForeignKey();
                            fk.setName(constraintName);
                            fk.setHasConstaint(true);

                            SQLAlterTableAddConstraint item = new SQLAlterTableAddConstraint(fk);

                            item.setParent(stmt);

                            stmt.getItems().add(item);
                        } else {
                            throw new ParserException("TODO " + lexer.token() + " " + lexer.stringVal());
                        }
                    } else if (identifierEquals(FULLTEXT)) {
                        throw new ParserException("TODO " + lexer.token() + " " + lexer.stringVal());
                    } else if (identifierEquals(SPATIAL)) {
                        throw new ParserException("TODO " + lexer.token() + " " + lexer.stringVal());
                    } else {
                        MySqlAlterTableAddColumn item = new MySqlAlterTableAddColumn();
                        SQLColumnDefinition columnDef = this.exprParser.parseColumn();
                        item.getColumns().add(columnDef);
                        if (identifierEquals("AFTER")) {
                            lexer.nextToken();
                            item.setAfterColumn(this.exprParser.name());
                        }
                        stmt.getItems().add(item);
                    }
                } else if (lexer.token() == Token.ALTER) {
                    lexer.nextToken();
                    if (lexer.token() == Token.COLUMN) {
                        lexer.nextToken();
                    }

                    SQLAlterTableAlterColumn alterColumn = new SQLAlterTableAlterColumn();
                    SQLColumnDefinition columnDef = this.exprParser.parseColumn();
                    alterColumn.setColumn(columnDef);

                    stmt.getItems().add(alterColumn);
                } else if (identifierEquals("CHANGE")) {
                    lexer.nextToken();
                    if (lexer.token() == Token.COLUMN) {
                        lexer.nextToken();
                    }
                    MySqlAlterTableChangeColumn item = new MySqlAlterTableChangeColumn();
                    item.setColumnName(this.exprParser.name());
                    item.setNewColumnDefinition(this.exprParser.parseColumn());
                    if (identifierEquals("AFTER")) {
                        lexer.nextToken();
                        item.setAfterColumn(this.exprParser.name());
                    } else if (identifierEquals("FIRST")) {
                        lexer.nextToken();
                        if (lexer.token() == Token.IDENTIFIER) {
                            item.setFirstColumn(this.exprParser.name());
                        } else {
                            item.setFirst(true);
                        }
                    }
                    stmt.getItems().add(item);
                } else if (identifierEquals("MODIFY")) {
                    lexer.nextToken();
                    if (lexer.token() == Token.COLUMN) {
                        lexer.nextToken();
                    }
                    MySqlAlterTableModifyColumn item = new MySqlAlterTableModifyColumn();
                    item.setNewColumnDefinition(this.exprParser.parseColumn());
                    if (identifierEquals("AFTER")) {
                        lexer.nextToken();
                        item.setAfterColumn(this.exprParser.name());
                    } else if (identifierEquals("FIRST")) {
                        lexer.nextToken();
                        if (lexer.token() == Token.IDENTIFIER) {
                            item.setFirstColumn(this.exprParser.name());
                        } else {
                            item.setFirst(true);
                        }
                    }
                    stmt.getItems().add(item);
                } else if (lexer.token() == Token.DISABLE) {
                    lexer.nextToken();

                    if (lexer.token() == Token.CONSTRAINT) {
                        lexer.nextToken();
                        SQLAlterTableDisableConstraint item = new SQLAlterTableDisableConstraint();
                        item.setConstraintName(this.exprParser.name());
                        stmt.getItems().add(item);
                    } else {
                        acceptIdentifier("KEYS");
                        SQLAlterTableDisableKeys item = new SQLAlterTableDisableKeys();
                        stmt.getItems().add(item);
                    }
                } else if (lexer.token() == Token.ENABLE) {
                    lexer.nextToken();
                    if (lexer.token() == Token.CONSTRAINT) {
                        lexer.nextToken();
                        SQLAlterTableEnableConstraint item = new SQLAlterTableEnableConstraint();
                        item.setConstraintName(this.exprParser.name());
                        stmt.getItems().add(item);
                    } else {
                        acceptIdentifier("KEYS");
                        SQLAlterTableEnableKeys item = new SQLAlterTableEnableKeys();
                        stmt.getItems().add(item);
                    }
                } else if (identifierEquals("RENAME")) {
                    lexer.nextToken();
                    if (lexer.token() == Token.TO || lexer.token() == Token.AS) {
                        lexer.nextToken();
                    }
                    MySqlRenameTableStatement renameStmt = new MySqlRenameTableStatement();
                    MySqlRenameTableStatement.Item item = new MySqlRenameTableStatement.Item();
                    item.setName(stmt.getTableSource().getExpr());
                    item.setTo(this.exprParser.name());
                    renameStmt.getItems().add(item);

                    return renameStmt;
                } else if (lexer.token() == Token.ORDER) {
                    throw new ParserException("TODO " + lexer.token() + " " + lexer.stringVal());
                } else if (identifierEquals("CONVERT")) {
                    throw new ParserException("TODO " + lexer.token() + " " + lexer.stringVal());
                } else if (lexer.token() == Token.DEFAULT) {
                    throw new ParserException("TODO " + lexer.token() + " " + lexer.stringVal());
                } else if (identifierEquals("DISCARD")) {
                    lexer.nextToken();
                    accept(Token.TABLESPACE);
                    MySqlAlterTableDiscardTablespace item = new MySqlAlterTableDiscardTablespace();
                    stmt.getItems().add(item);
                } else if (identifierEquals("IMPORT")) {
                    lexer.nextToken();
                    accept(Token.TABLESPACE);
                    MySqlAlterTableImportTablespace item = new MySqlAlterTableImportTablespace();
                    stmt.getItems().add(item);
                } else if (identifierEquals("FORCE")) {
                    throw new ParserException("TODO " + lexer.token() + " " + lexer.stringVal());
                } else if (identifierEquals("TRUNCATE")) {
                    throw new ParserException("TODO " + lexer.token() + " " + lexer.stringVal());
                } else if (identifierEquals("COALESCE")) {
                    throw new ParserException("TODO " + lexer.token() + " " + lexer.stringVal());
                } else if (identifierEquals("REORGANIZE")) {
                    throw new ParserException("TODO " + lexer.token() + " " + lexer.stringVal());
                } else if (identifierEquals("EXCHANGE")) {
                    throw new ParserException("TODO " + lexer.token() + " " + lexer.stringVal());
                } else if (identifierEquals("ANALYZE")) {
                    throw new ParserException("TODO " + lexer.token() + " " + lexer.stringVal());
                } else if (identifierEquals("CHECK")) {
                    throw new ParserException("TODO " + lexer.token() + " " + lexer.stringVal());
                } else if (lexer.token() == Token.OPTIMIZE) {
                    throw new ParserException("TODO " + lexer.token() + " " + lexer.stringVal());
                } else if (identifierEquals("REBUILD")) {
                    throw new ParserException("TODO " + lexer.token() + " " + lexer.stringVal());
                } else if (identifierEquals("REPAIR")) {
                    throw new ParserException("TODO " + lexer.token() + " " + lexer.stringVal());
                } else if (identifierEquals("REMOVE")) {
                    throw new ParserException("TODO " + lexer.token() + " " + lexer.stringVal());
                } else if (identifierEquals(ENGINE)) {
                    lexer.nextToken();
                    accept(Token.EQ);
                    stmt.getItems().add(new MySqlAlterTableOption(ENGINE, lexer.stringVal()));
                    lexer.nextToken();
                } else if (identifierEquals(AUTO_INCREMENT)) {
                    lexer.nextToken();
                    accept(Token.EQ);
                    stmt.getItems().add(new MySqlAlterTableOption(AUTO_INCREMENT, lexer.integerValue()));
                    lexer.nextToken();
                } else if (identifierEquals(COLLATE2)) {
                    lexer.nextToken();
                    accept(Token.EQ);
                    stmt.getItems().add(new MySqlAlterTableOption(COLLATE2, lexer.stringVal()));
                    lexer.nextToken();
                } else if (identifierEquals("PACK_KEYS")) {
                    lexer.nextToken();
                    accept(Token.EQ);
                    if (identifierEquals("PACK")) {
                        lexer.nextToken();
                        accept(Token.ALL);
                        stmt.getItems().add(new MySqlAlterTableOption("PACK_KEYS", "PACK ALL"));
                    } else {
                        stmt.getItems().add(new MySqlAlterTableOption("PACK_KEYS", lexer.stringVal()));
                        lexer.nextToken();
                    }
                } else if (identifierEquals(CHARACTER)) {
                    lexer.nextToken();
                    accept(Token.SET);
                    accept(Token.EQ);
                    MySqlAlterTableCharacter item = new MySqlAlterTableCharacter();
                    item.setCharacterSet(this.exprParser.primary());
                    if (lexer.token() == Token.COMMA) {
                        lexer.nextToken();
                        acceptIdentifier(COLLATE2);
                        accept(Token.EQ);
                        item.setCollate(this.exprParser.primary());
                    }
                    stmt.getItems().add(item);
                } else if (lexer.token() == Token.COMMENT) {
                    lexer.nextToken();
                    if(lexer.token() == Token.EQ) {
View Full Code Here

                } else if (identifierEquals("ADD")) {
                    lexer.nextToken();

                    if (lexer.token() == Token.COLUMN) {
                        lexer.nextToken();
                        MySqlAlterTableAddColumn item = new MySqlAlterTableAddColumn();
                        SQLColumnDefinition columnDef = this.exprParser.parseColumn();
                        item.getColumns().add(columnDef);
                        if (identifierEquals("AFTER")) {
                            lexer.nextToken();
                            item.setAfterColumn(this.exprParser.name());
                        } else if (identifierEquals("FIRST")) {
                            lexer.nextToken();
                            if (lexer.token() == Token.IDENTIFIER) {
                                item.setFirstColumn(this.exprParser.name());
                            } else {
                                item.setFirst(true);
                            }
                        }
                        stmt.getItems().add(item);
                    } else if (lexer.token() == Token.INDEX) {
                        SQLAlterTableAddIndex item = parseAlterTableAddIndex();
                        item.setParent(stmt);
                        stmt.getItems().add(item);
                    } else if (lexer.token() == Token.UNIQUE) {
                        SQLAlterTableAddIndex item = parseAlterTableAddIndex();
                        item.setParent(stmt);
                        stmt.getItems().add(item);
                    } else if (lexer.token() == Token.PRIMARY) {
                        SQLPrimaryKey primaryKey = this.exprParser.parsePrimaryKey();
                        SQLAlterTableAddConstraint item = new SQLAlterTableAddConstraint(primaryKey);
                        stmt.getItems().add(item);
                    } else if (lexer.token() == Token.KEY) {
                        throw new ParserException("TODO " + lexer.token() + " " + lexer.stringVal());
                    } else if (lexer.token() == Token.CONSTRAINT) {
                        lexer.nextToken();
                        SQLName constraintName = this.exprParser.name();

                        if (lexer.token() == Token.PRIMARY) {
                            SQLPrimaryKey primaryKey = ((MySqlExprParser) this.exprParser).parsePrimaryKey();

                            primaryKey.setName(constraintName);

                            SQLAlterTableAddConstraint item = new SQLAlterTableAddConstraint(primaryKey);
                            item.setParent(stmt);

                            stmt.getItems().add(item);
                        } else if (lexer.token() == Token.FOREIGN) {
                            MysqlForeignKey fk = this.getExprParser().parseForeignKey();
                            fk.setName(constraintName);
                            fk.setHasConstaint(true);

                            SQLAlterTableAddConstraint item = new SQLAlterTableAddConstraint(fk);

                            item.setParent(stmt);

                            stmt.getItems().add(item);
                        } else {
                            throw new ParserException("TODO " + lexer.token() + " " + lexer.stringVal());
                        }
                    } else if (identifierEquals(FULLTEXT)) {
                        throw new ParserException("TODO " + lexer.token() + " " + lexer.stringVal());
                    } else if (identifierEquals(SPATIAL)) {
                        throw new ParserException("TODO " + lexer.token() + " " + lexer.stringVal());
                    } else {
                        MySqlAlterTableAddColumn item = new MySqlAlterTableAddColumn();
                        SQLColumnDefinition columnDef = this.exprParser.parseColumn();
                        item.getColumns().add(columnDef);
                        if (identifierEquals("AFTER")) {
                            lexer.nextToken();
                            item.setAfterColumn(this.exprParser.name());
                        }
                        stmt.getItems().add(item);
                    }
                } else if (lexer.token() == Token.ALTER) {
                    lexer.nextToken();
                    if (lexer.token() == Token.COLUMN) {
                        lexer.nextToken();
                    }

                    SQLAlterTableAlterColumn alterColumn = new SQLAlterTableAlterColumn();
                    SQLColumnDefinition columnDef = this.exprParser.parseColumn();
                    alterColumn.setColumn(columnDef);

                    stmt.getItems().add(alterColumn);
                } else if (identifierEquals("CHANGE")) {
                    lexer.nextToken();
                    if (lexer.token() == Token.COLUMN) {
                        lexer.nextToken();
                    }
                    MySqlAlterTableChangeColumn item = new MySqlAlterTableChangeColumn();
                    item.setColumnName(this.exprParser.name());
                    item.setNewColumnDefinition(this.exprParser.parseColumn());
                    if (identifierEquals("AFTER")) {
                        lexer.nextToken();
                        item.setAfterColumn(this.exprParser.name());
                    } else if (identifierEquals("FIRST")) {
                        lexer.nextToken();
                        if (lexer.token() == Token.IDENTIFIER) {
                            item.setFirstColumn(this.exprParser.name());
                        } else {
                            item.setFirst(true);
                        }
                    }
                    stmt.getItems().add(item);
                } else if (identifierEquals("MODIFY")) {
                    lexer.nextToken();
                    if (lexer.token() == Token.COLUMN) {
                        lexer.nextToken();
                    }
                    MySqlAlterTableModifyColumn item = new MySqlAlterTableModifyColumn();
                    item.setNewColumnDefinition(this.exprParser.parseColumn());
                    if (identifierEquals("AFTER")) {
                        lexer.nextToken();
                        item.setAfterColumn(this.exprParser.name());
                    } else if (identifierEquals("FIRST")) {
                        lexer.nextToken();
                        if (lexer.token() == Token.IDENTIFIER) {
                            item.setFirstColumn(this.exprParser.name());
                        } else {
                            item.setFirst(true);
                        }
                    }
                    stmt.getItems().add(item);
                } else if (lexer.token() == Token.DISABLE) {
                    lexer.nextToken();

                    if (lexer.token() == Token.CONSTRAINT) {
                        lexer.nextToken();
                        SQLAlterTableDisableConstraint item = new SQLAlterTableDisableConstraint();
                        item.setConstraintName(this.exprParser.name());
                        stmt.getItems().add(item);
                    } else {
                        acceptIdentifier("KEYS");
                        SQLAlterTableDisableKeys item = new SQLAlterTableDisableKeys();
                        stmt.getItems().add(item);
                    }
                } else if (lexer.token() == Token.ENABLE) {
                    lexer.nextToken();
                    if (lexer.token() == Token.CONSTRAINT) {
                        lexer.nextToken();
                        SQLAlterTableEnableConstraint item = new SQLAlterTableEnableConstraint();
                        item.setConstraintName(this.exprParser.name());
                        stmt.getItems().add(item);
                    } else {
                        acceptIdentifier("KEYS");
                        SQLAlterTableEnableKeys item = new SQLAlterTableEnableKeys();
                        stmt.getItems().add(item);
                    }
                } else if (identifierEquals("RENAME")) {
                    lexer.nextToken();
                    if (lexer.token() == Token.TO || lexer.token() == Token.AS) {
                        lexer.nextToken();
                    }
                    MySqlRenameTableStatement renameStmt = new MySqlRenameTableStatement();
                    MySqlRenameTableStatement.Item item = new MySqlRenameTableStatement.Item();
                    item.setName(stmt.getTableSource().getExpr());
                    item.setTo(this.exprParser.name());
                    renameStmt.getItems().add(item);

                    return renameStmt;
                } else if (lexer.token() == Token.ORDER) {
                    throw new ParserException("TODO " + lexer.token() + " " + lexer.stringVal());
                } else if (identifierEquals("CONVERT")) {
                    throw new ParserException("TODO " + lexer.token() + " " + lexer.stringVal());
                } else if (lexer.token() == Token.DEFAULT) {
                    throw new ParserException("TODO " + lexer.token() + " " + lexer.stringVal());
                } else if (identifierEquals("DISCARD")) {
                    lexer.nextToken();
                    accept(Token.TABLESPACE);
                    MySqlAlterTableDiscardTablespace item = new MySqlAlterTableDiscardTablespace();
                    stmt.getItems().add(item);
                } else if (identifierEquals("IMPORT")) {
                    lexer.nextToken();
                    accept(Token.TABLESPACE);
                    MySqlAlterTableImportTablespace item = new MySqlAlterTableImportTablespace();
                    stmt.getItems().add(item);
                } else if (identifierEquals("FORCE")) {
                    throw new ParserException("TODO " + lexer.token() + " " + lexer.stringVal());
                } else if (identifierEquals("TRUNCATE")) {
                    throw new ParserException("TODO " + lexer.token() + " " + lexer.stringVal());
                } else if (identifierEquals("COALESCE")) {
                    throw new ParserException("TODO " + lexer.token() + " " + lexer.stringVal());
                } else if (identifierEquals("REORGANIZE")) {
                    throw new ParserException("TODO " + lexer.token() + " " + lexer.stringVal());
                } else if (identifierEquals("EXCHANGE")) {
                    throw new ParserException("TODO " + lexer.token() + " " + lexer.stringVal());
                } else if (identifierEquals("ANALYZE")) {
                    throw new ParserException("TODO " + lexer.token() + " " + lexer.stringVal());
                } else if (identifierEquals("CHECK")) {
                    throw new ParserException("TODO " + lexer.token() + " " + lexer.stringVal());
                } else if (lexer.token() == Token.OPTIMIZE) {
                    throw new ParserException("TODO " + lexer.token() + " " + lexer.stringVal());
                } else if (identifierEquals("REBUILD")) {
                    throw new ParserException("TODO " + lexer.token() + " " + lexer.stringVal());
                } else if (identifierEquals("REPAIR")) {
                    throw new ParserException("TODO " + lexer.token() + " " + lexer.stringVal());
                } else if (identifierEquals("REMOVE")) {
                    throw new ParserException("TODO " + lexer.token() + " " + lexer.stringVal());
                } else if (identifierEquals(ENGINE)) {
                    lexer.nextToken();
                    accept(Token.EQ);
                    stmt.getItems().add(new MySqlAlterTableOption(ENGINE, lexer.stringVal()));
                    lexer.nextToken();
                } else if (identifierEquals(AUTO_INCREMENT)) {
                    lexer.nextToken();
                    accept(Token.EQ);
                    stmt.getItems().add(new MySqlAlterTableOption(AUTO_INCREMENT, lexer.integerValue()));
                    lexer.nextToken();
                } else if (identifierEquals(COLLATE2)) {
                    lexer.nextToken();
                    accept(Token.EQ);
                    stmt.getItems().add(new MySqlAlterTableOption(COLLATE2, lexer.stringVal()));
                    lexer.nextToken();
                } else if (identifierEquals("PACK_KEYS")) {
                    lexer.nextToken();
                    accept(Token.EQ);
                    if (identifierEquals("PACK")) {
                        lexer.nextToken();
                        accept(Token.ALL);
                        stmt.getItems().add(new MySqlAlterTableOption("PACK_KEYS", "PACK ALL"));
                    } else {
                        stmt.getItems().add(new MySqlAlterTableOption("PACK_KEYS", lexer.stringVal()));
                        lexer.nextToken();
                    }
                } else if (identifierEquals(CHARACTER)) {
                    lexer.nextToken();
                    accept(Token.SET);
                    accept(Token.EQ);
                    MySqlAlterTableCharacter item = new MySqlAlterTableCharacter();
                    item.setCharacterSet(this.exprParser.primary());
                    if (lexer.token() == Token.COMMA) {
                        lexer.nextToken();
                        acceptIdentifier(COLLATE2);
                        accept(Token.EQ);
                        item.setCollate(this.exprParser.primary());
                    }
                    stmt.getItems().add(item);
                } else if (lexer.token() == Token.COMMENT) {
                    lexer.nextToken();
                    if(lexer.token() == Token.EQ) {
View Full Code Here

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

                    if (identifierEquals("COLUMN")) {
                        lexer.nextToken();
                        MySqlAlterTableAddColumn item = new MySqlAlterTableAddColumn();
                        SQLColumnDefinition columnDef = this.exprParser.parseColumn();
                        item.getColumns().add(columnDef);
                        if (identifierEquals("AFTER")) {
                            lexer.nextToken();
                            item.setAfter(this.exprParser.name());
                        }
                        stmt.getItems().add(item);
                    } else if (lexer.token() == Token.INDEX) {
                        lexer.nextToken();
                        MySqlAlterTableAddIndex item = new MySqlAlterTableAddIndex();
                       
                        if (lexer.token() == Token.LPAREN) {
                            lexer.nextToken();
                        } else {
                            item.setName(this.exprParser.name());
                            accept(Token.LPAREN);
                        }
                       
                        for (;;) {
                            SQLSelectOrderByItem column = this.exprParser.parseSelectOrderByItem();
                            item.getItems().add(column);
                            if (lexer.token() == Token.COMMA) {
                                lexer.nextToken();
                                continue;
                            }
                            break;
                        }
                        accept(Token.RPAREN);

                        stmt.getItems().add(item);
                    } else if (lexer.token() == Token.UNIQUE) {
                        lexer.nextToken();
                        MySqlAlterTableAddUnique item = new MySqlAlterTableAddUnique();
                       
                        if (lexer.token() == Token.LPAREN) {
                            lexer.nextToken();
                        } else {
                            item.setName(this.exprParser.name());
                            accept(Token.LPAREN);
                        }
                       
                        for (;;) {
                            SQLSelectOrderByItem column = this.exprParser.parseSelectOrderByItem();
                            item.getItems().add(column);
                            if (lexer.token() == Token.COMMA) {
                                lexer.nextToken();
                                continue;
                            }
                            break;
                        }
                        accept(Token.RPAREN);

                        stmt.getItems().add(item);
                    } else if (lexer.token() == Token.KEY) {
                        throw new ParserException("TODO " + lexer.token() + " " + lexer.stringVal());
                    } else if (lexer.token() == Token.CONSTRAINT) {
                        throw new ParserException("TODO " + lexer.token() + " " + lexer.stringVal());
                    } else if (identifierEquals("FULLTEXT")) {
                        throw new ParserException("TODO " + lexer.token() + " " + lexer.stringVal());
                    } else if (identifierEquals("SPATIAL")) {
                        throw new ParserException("TODO " + lexer.token() + " " + lexer.stringVal());
                    } else {
                        MySqlAlterTableAddColumn item = new MySqlAlterTableAddColumn();
                        SQLColumnDefinition columnDef = this.exprParser.parseColumn();
                        item.getColumns().add(columnDef);
                        if (identifierEquals("AFTER")) {
                            lexer.nextToken();
                            item.setAfter(this.exprParser.name());
                        }
                        stmt.getItems().add(item);
                    }
                } else if (identifierEquals("ALTER")) {
                    throw new ParserException("TODO " + lexer.token() + " " + lexer.stringVal());
                } else if (identifierEquals("CHANGE")) {
                    lexer.nextToken();
                    if (identifierEquals("COLUMN")) {
                        lexer.nextToken();
                    }
                    MySqlAlterTableChangeColumn item = new MySqlAlterTableChangeColumn();
                    item.setColumnName(this.exprParser.name());
                    item.setNewColumnDefinition(this.exprParser.parseColumn());
                    if (identifierEquals("FIRST")) {
                        lexer.nextToken();
                        item.setFirst(true);
                    } else if (identifierEquals("AFTER")) {
                        lexer.nextToken();
                        item.setFirst(false);
                    }
                    stmt.getItems().add(item);
                } else if (identifierEquals("MODIFY")) {
                    throw new ParserException("TODO " + lexer.token() + " " + lexer.stringVal());
                } else if (lexer.token() == Token.DROP) {
                    lexer.nextToken();
                    if (identifierEquals("COLUMN")) {
                        lexer.nextToken();
                    }
                    SQLAlterTableDropColumnItem item = new SQLAlterTableDropColumnItem();
                    item.setColumnName(this.exprParser.name());
                    stmt.getItems().add(item);
                } else if (identifierEquals("DISABLE")) {
                    throw new ParserException("TODO " + lexer.token() + " " + lexer.stringVal());
                } else if (identifierEquals("ENABLE")) {
                    throw new ParserException("TODO " + lexer.token() + " " + lexer.stringVal());
                } else if (identifierEquals("RENAME")) {
                    lexer.nextToken();
                    MySqlRenameTableStatement renameStmt = new MySqlRenameTableStatement();
                    MySqlRenameTableStatement.Item item = new MySqlRenameTableStatement.Item();
                    item.setName(stmt.getTableSource().getExpr());
                    item.setTo(this.exprParser.name());
                    renameStmt.getItems().add(item);
                   
                    return renameStmt;
                } else if (lexer.token() == Token.ORDER) {
                    throw new ParserException("TODO " + lexer.token() + " " + lexer.stringVal());
                } else if (identifierEquals("CONVERT")) {
                    throw new ParserException("TODO " + lexer.token() + " " + lexer.stringVal());
                } else if (lexer.token() == Token.DEFAULT) {
                    throw new ParserException("TODO " + lexer.token() + " " + lexer.stringVal());
                } else if (identifierEquals("DISCARD")) {
                    throw new ParserException("TODO " + lexer.token() + " " + lexer.stringVal());
                } else if (identifierEquals("IMPORT")) {
                    throw new ParserException("TODO " + lexer.token() + " " + lexer.stringVal());
                } else if (identifierEquals("FORCE")) {
                    throw new ParserException("TODO " + lexer.token() + " " + lexer.stringVal());
                } else if (identifierEquals("TRUNCATE")) {
                    throw new ParserException("TODO " + lexer.token() + " " + lexer.stringVal());
                } else if (identifierEquals("COALESCE")) {
                    throw new ParserException("TODO " + lexer.token() + " " + lexer.stringVal());

                } else if (identifierEquals("REORGANIZE")) {
                    throw new ParserException("TODO " + lexer.token() + " " + lexer.stringVal());
                } else if (identifierEquals("EXCHANGE")) {
                    throw new ParserException("TODO " + lexer.token() + " " + lexer.stringVal());
                } else if (identifierEquals("ANALYZE")) {
                    throw new ParserException("TODO " + lexer.token() + " " + lexer.stringVal());
                } else if (identifierEquals("CHECK")) {
                    throw new ParserException("TODO " + lexer.token() + " " + lexer.stringVal());
                } else if (identifierEquals("OPTIMIZE")) {
                    throw new ParserException("TODO " + lexer.token() + " " + lexer.stringVal());
                } else if (identifierEquals("REBUILD")) {
                    throw new ParserException("TODO " + lexer.token() + " " + lexer.stringVal());
                } else if (identifierEquals("REPAIR")) {
                    throw new ParserException("TODO " + lexer.token() + " " + lexer.stringVal());
                } else if (identifierEquals("REMOVE")) {
                    throw new ParserException("TODO " + lexer.token() + " " + lexer.stringVal());
                } else if (identifierEquals("ENGINE")) {
                    lexer.nextToken();
                    accept(Token.EQ);
                    stmt.getItems().add(new MySqlAlterTableOption("ENGINE", lexer.stringVal()));
                    lexer.nextToken();
                } else if (identifierEquals("COLLATE")) {
                    lexer.nextToken();
                    accept(Token.EQ);
                    stmt.getItems().add(new MySqlAlterTableOption("COLLATE", lexer.stringVal()));
                    lexer.nextToken();
                } else if (identifierEquals("PACK_KEYS")) {
                    lexer.nextToken();
                    accept(Token.EQ);
                    if (identifierEquals("PACK")) {
                        lexer.nextToken();
                        accept(Token.ALL);
                        stmt.getItems().add(new MySqlAlterTableOption("PACK_KEYS", "PACK ALL"));
                    } else {
                        stmt.getItems().add(new MySqlAlterTableOption("PACK_KEYS", lexer.stringVal()));
                        lexer.nextToken();
                    }
                } else if (identifierEquals("CHARACTER")) {
                    lexer.nextToken();
                    accept(Token.SET);
                    accept(Token.EQ);
                    MySqlAlterTableCharacter item = new MySqlAlterTableCharacter();
                    item.setCharacterSet(this.exprParser.primary());
                    if (lexer.token() == Token.COMMA) {
                        lexer.nextToken();
                        acceptIdentifier("COLLATE");
                        accept(Token.EQ);
                        item.setCollate(this.exprParser.primary());
                    }
                    stmt.getItems().add(item);
                } else {
                    break;
                }
View Full Code Here

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

                    if (identifierEquals("COLUMN")) {
                        lexer.nextToken();
                        MySqlAlterTableAddColumn item = new MySqlAlterTableAddColumn();
                        SQLColumnDefinition columnDef = this.exprParser.parseColumn();
                        item.getColumns().add(columnDef);
                        if (identifierEquals("AFTER")) {
                            lexer.nextToken();
                            item.setAfterColumn(this.exprParser.name());
                        } else if (identifierEquals("FIRST")) {
                            lexer.nextToken();
                            if (lexer.token() == Token.IDENTIFIER) {
                                item.setFirstColumn(this.exprParser.name());
                            } else {
                                item.setFirst(true);
                            }
                        }
                        stmt.getItems().add(item);
                    } else if (lexer.token() == Token.INDEX) {
                        lexer.nextToken();
                        MySqlAlterTableAddIndex item = new MySqlAlterTableAddIndex();

                        if (lexer.token() == Token.LPAREN) {
                            lexer.nextToken();
                        } else {
                            item.setName(this.exprParser.name());
                            accept(Token.LPAREN);
                        }

                        for (;;) {
                            SQLSelectOrderByItem column = this.exprParser.parseSelectOrderByItem();
                            item.getItems().add(column);
                            if (lexer.token() == Token.COMMA) {
                                lexer.nextToken();
                                continue;
                            }
                            break;
                        }
                        accept(Token.RPAREN);

                        stmt.getItems().add(item);
                    } else if (lexer.token() == Token.UNIQUE) {
                        lexer.nextToken();
                       
                        if (lexer.token() == Token.INDEX) {
                            lexer.nextToken();
                        }
                       
                        MySqlAlterTableAddUnique item = new MySqlAlterTableAddUnique();

                        if (lexer.token() == Token.LPAREN) {
                            lexer.nextToken();
                        } else {
                            item.setName(this.exprParser.name());
                            accept(Token.LPAREN);
                        }

                        for (;;) {
                            SQLSelectOrderByItem column = this.exprParser.parseSelectOrderByItem();
                            item.getItems().add(column);
                            if (lexer.token() == Token.COMMA) {
                                lexer.nextToken();
                                continue;
                            }
                            break;
                        }
                        accept(Token.RPAREN);

                        stmt.getItems().add(item);
                    } else if (lexer.token() == Token.PRIMARY) {
                        SQLPrimaryKey primaryKey = ((MySqlExprParser) this.exprParser).parsePrimaryKey();
                        SQLAlterTableAddPrimaryKey item = new SQLAlterTableAddPrimaryKey();
                        item.setPrimaryKey(primaryKey);
                        stmt.getItems().add(item);
                    } else if (lexer.token() == Token.KEY) {
                        throw new ParserException("TODO " + lexer.token() + " " + lexer.stringVal());
                    } else if (lexer.token() == Token.CONSTRAINT) {
                        throw new ParserException("TODO " + lexer.token() + " " + lexer.stringVal());
                    } else if (identifierEquals(FULLTEXT)) {
                        throw new ParserException("TODO " + lexer.token() + " " + lexer.stringVal());
                    } else if (identifierEquals(SPATIAL)) {
                        throw new ParserException("TODO " + lexer.token() + " " + lexer.stringVal());
                    } else {
                        MySqlAlterTableAddColumn item = new MySqlAlterTableAddColumn();
                        SQLColumnDefinition columnDef = this.exprParser.parseColumn();
                        item.getColumns().add(columnDef);
                        if (identifierEquals("AFTER")) {
                            lexer.nextToken();
                            item.setAfterColumn(this.exprParser.name());
                        }
                        stmt.getItems().add(item);
                    }
                } else if (identifierEquals("ALTER")) {
                    throw new ParserException("TODO " + lexer.token() + " " + lexer.stringVal());
                } else if (identifierEquals("CHANGE")) {
                    lexer.nextToken();
                    if (identifierEquals("COLUMN")) {
                        lexer.nextToken();
                    }
                    MySqlAlterTableChangeColumn item = new MySqlAlterTableChangeColumn();
                    item.setColumnName(this.exprParser.name());
                    item.setNewColumnDefinition(this.exprParser.parseColumn());
                    if (identifierEquals("AFTER")) {
                        lexer.nextToken();
                        item.setAfterColumn(this.exprParser.name());
                    } else if (identifierEquals("FIRST")) {
                        lexer.nextToken();
                        if (lexer.token() == Token.IDENTIFIER) {
                            item.setFirstColumn(this.exprParser.name());
                        } else {
                            item.setFirst(true);
                        }
                    }
                    stmt.getItems().add(item);
                } else if (identifierEquals("MODIFY")) {
                    throw new ParserException("TODO " + lexer.token() + " " + lexer.stringVal());
                } else if (lexer.token() == Token.DROP) {
                    lexer.nextToken();
                    if (lexer.token() == Token.INDEX) {
                        lexer.nextToken();
                        SQLName indexName = this.exprParser.name();
                        SQLAlterTableDropIndex item = new SQLAlterTableDropIndex();
                        item.setIndexName(indexName);
                        stmt.getItems().add(item);
                    } else {
                        if (identifierEquals("COLUMN")) {
                            lexer.nextToken();
                        }
                        SQLAlterTableDropColumnItem item = new SQLAlterTableDropColumnItem();
                        item.setColumnName(this.exprParser.name());
                        stmt.getItems().add(item);
                    }
                } else if (identifierEquals("DISABLE")) {
                    throw new ParserException("TODO " + lexer.token() + " " + lexer.stringVal());
                } else if (identifierEquals("ENABLE")) {
                    throw new ParserException("TODO " + lexer.token() + " " + lexer.stringVal());
                } else if (identifierEquals("RENAME")) {
                    lexer.nextToken();
                    MySqlRenameTableStatement renameStmt = new MySqlRenameTableStatement();
                    MySqlRenameTableStatement.Item item = new MySqlRenameTableStatement.Item();
                    item.setName(stmt.getTableSource().getExpr());
                    item.setTo(this.exprParser.name());
                    renameStmt.getItems().add(item);

                    return renameStmt;
                } else if (lexer.token() == Token.ORDER) {
                    throw new ParserException("TODO " + lexer.token() + " " + lexer.stringVal());
                } else if (identifierEquals("CONVERT")) {
                    throw new ParserException("TODO " + lexer.token() + " " + lexer.stringVal());
                } else if (lexer.token() == Token.DEFAULT) {
                    throw new ParserException("TODO " + lexer.token() + " " + lexer.stringVal());
                } else if (identifierEquals("DISCARD")) {
                    throw new ParserException("TODO " + lexer.token() + " " + lexer.stringVal());
                } else if (identifierEquals("IMPORT")) {
                    throw new ParserException("TODO " + lexer.token() + " " + lexer.stringVal());
                } else if (identifierEquals("FORCE")) {
                    throw new ParserException("TODO " + lexer.token() + " " + lexer.stringVal());
                } else if (identifierEquals("TRUNCATE")) {
                    throw new ParserException("TODO " + lexer.token() + " " + lexer.stringVal());
                } else if (identifierEquals("COALESCE")) {
                    throw new ParserException("TODO " + lexer.token() + " " + lexer.stringVal());

                } else if (identifierEquals("REORGANIZE")) {
                    throw new ParserException("TODO " + lexer.token() + " " + lexer.stringVal());
                } else if (identifierEquals("EXCHANGE")) {
                    throw new ParserException("TODO " + lexer.token() + " " + lexer.stringVal());
                } else if (identifierEquals("ANALYZE")) {
                    throw new ParserException("TODO " + lexer.token() + " " + lexer.stringVal());
                } else if (identifierEquals("CHECK")) {
                    throw new ParserException("TODO " + lexer.token() + " " + lexer.stringVal());
                } else if (identifierEquals("OPTIMIZE")) {
                    throw new ParserException("TODO " + lexer.token() + " " + lexer.stringVal());
                } else if (identifierEquals("REBUILD")) {
                    throw new ParserException("TODO " + lexer.token() + " " + lexer.stringVal());
                } else if (identifierEquals("REPAIR")) {
                    throw new ParserException("TODO " + lexer.token() + " " + lexer.stringVal());
                } else if (identifierEquals("REMOVE")) {
                    throw new ParserException("TODO " + lexer.token() + " " + lexer.stringVal());
                } else if (identifierEquals(ENGINE)) {
                    lexer.nextToken();
                    accept(Token.EQ);
                    stmt.getItems().add(new MySqlAlterTableOption(ENGINE, lexer.stringVal()));
                    lexer.nextToken();
                } else if (identifierEquals(COLLATE2)) {
                    lexer.nextToken();
                    accept(Token.EQ);
                    stmt.getItems().add(new MySqlAlterTableOption(COLLATE2, lexer.stringVal()));
                    lexer.nextToken();
                } else if (identifierEquals("PACK_KEYS")) {
                    lexer.nextToken();
                    accept(Token.EQ);
                    if (identifierEquals("PACK")) {
                        lexer.nextToken();
                        accept(Token.ALL);
                        stmt.getItems().add(new MySqlAlterTableOption("PACK_KEYS", "PACK ALL"));
                    } else {
                        stmt.getItems().add(new MySqlAlterTableOption("PACK_KEYS", lexer.stringVal()));
                        lexer.nextToken();
                    }
                } else if (identifierEquals(CHARACTER)) {
                    lexer.nextToken();
                    accept(Token.SET);
                    accept(Token.EQ);
                    MySqlAlterTableCharacter item = new MySqlAlterTableCharacter();
                    item.setCharacterSet(this.exprParser.primary());
                    if (lexer.token() == Token.COMMA) {
                        lexer.nextToken();
                        acceptIdentifier(COLLATE2);
                        accept(Token.EQ);
                        item.setCollate(this.exprParser.primary());
                    }
                    stmt.getItems().add(item);
                } else {
                    break;
                }
View Full Code Here

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

                    if (identifierEquals("COLUMN")) {
                        lexer.nextToken();
                        MySqlAlterTableAddColumn item = new MySqlAlterTableAddColumn();
                        SQLColumnDefinition columnDef = this.exprParser.parseColumn();
                        item.getColumns().add(columnDef);
                        if (identifierEquals("AFTER")) {
                            lexer.nextToken();
                            item.setAfterColumn(this.exprParser.name());
                        } else if (identifierEquals("FIRST")) {
                            lexer.nextToken();
                            if (lexer.token() == Token.IDENTIFIER) {
                                item.setFirstColumn(this.exprParser.name());
                            } else {
                                item.setFirst(true);
                            }
                        }
                        stmt.getItems().add(item);
                    } else if (lexer.token() == Token.INDEX) {
                        lexer.nextToken();
                        MySqlAlterTableAddIndex item = new MySqlAlterTableAddIndex();

                        if (lexer.token() == Token.LPAREN) {
                            lexer.nextToken();
                        } else {
                            item.setName(this.exprParser.name());
                            accept(Token.LPAREN);
                        }

                        for (;;) {
                            SQLSelectOrderByItem column = this.exprParser.parseSelectOrderByItem();
                            item.getItems().add(column);
                            if (lexer.token() == Token.COMMA) {
                                lexer.nextToken();
                                continue;
                            }
                            break;
                        }
                        accept(Token.RPAREN);

                        stmt.getItems().add(item);
                    } else if (lexer.token() == Token.UNIQUE) {
                        lexer.nextToken();

                        if (lexer.token() == Token.INDEX) {
                            lexer.nextToken();
                        }

                        MySqlAlterTableAddUnique item = new MySqlAlterTableAddUnique();

                        if (lexer.token() == Token.LPAREN) {
                            lexer.nextToken();
                        } else {
                            item.setName(this.exprParser.name());
                            accept(Token.LPAREN);
                        }

                        for (;;) {
                            SQLSelectOrderByItem column = this.exprParser.parseSelectOrderByItem();
                            item.getItems().add(column);
                            if (lexer.token() == Token.COMMA) {
                                lexer.nextToken();
                                continue;
                            }
                            break;
                        }
                        accept(Token.RPAREN);

                        stmt.getItems().add(item);
                    } else if (lexer.token() == Token.PRIMARY) {
                        SQLPrimaryKey primaryKey = ((MySqlExprParser) this.exprParser).parsePrimaryKey();
                        SQLAlterTableAddPrimaryKey item = new SQLAlterTableAddPrimaryKey();
                        item.setPrimaryKey(primaryKey);
                        stmt.getItems().add(item);
                    } else if (lexer.token() == Token.KEY) {
                        throw new ParserException("TODO " + lexer.token() + " " + lexer.stringVal());
                    } else if (lexer.token() == Token.CONSTRAINT) {
                        lexer.nextToken();
                        SQLName constraintName = this.exprParser.name();

                        if (lexer.token() == Token.PRIMARY) {
                            SQLPrimaryKey primaryKey = ((MySqlExprParser) this.exprParser).parsePrimaryKey();

                            primaryKey.setName(constraintName);

                            SQLAlterTableAddPrimaryKey item = new SQLAlterTableAddPrimaryKey();
                            item.setPrimaryKey(primaryKey);
                            stmt.getItems().add(item);
                        } else {
                            throw new ParserException("TODO " + lexer.token() + " " + lexer.stringVal());
                        }
                    } else if (identifierEquals(FULLTEXT)) {
                        throw new ParserException("TODO " + lexer.token() + " " + lexer.stringVal());
                    } else if (identifierEquals(SPATIAL)) {
                        throw new ParserException("TODO " + lexer.token() + " " + lexer.stringVal());
                    } else {
                        MySqlAlterTableAddColumn item = new MySqlAlterTableAddColumn();
                        SQLColumnDefinition columnDef = this.exprParser.parseColumn();
                        item.getColumns().add(columnDef);
                        if (identifierEquals("AFTER")) {
                            lexer.nextToken();
                            item.setAfterColumn(this.exprParser.name());
                        }
                        stmt.getItems().add(item);
                    }
                } else if (lexer.token() == Token.ALTER) {
                    lexer.nextToken();
                    if (identifierEquals("COLUMN")) {
                        lexer.nextToken();
                    }

                    SQLAlterTableAlterColumn alterColumn = new SQLAlterTableAlterColumn();
                    SQLColumnDefinition columnDef = this.exprParser.parseColumn();
                    alterColumn.setColumn(columnDef);

                    stmt.getItems().add(alterColumn);
                } else if (identifierEquals("CHANGE")) {
                    lexer.nextToken();
                    if (identifierEquals("COLUMN")) {
                        lexer.nextToken();
                    }
                    MySqlAlterTableChangeColumn item = new MySqlAlterTableChangeColumn();
                    item.setColumnName(this.exprParser.name());
                    item.setNewColumnDefinition(this.exprParser.parseColumn());
                    if (identifierEquals("AFTER")) {
                        lexer.nextToken();
                        item.setAfterColumn(this.exprParser.name());
                    } else if (identifierEquals("FIRST")) {
                        lexer.nextToken();
                        if (lexer.token() == Token.IDENTIFIER) {
                            item.setFirstColumn(this.exprParser.name());
                        } else {
                            item.setFirst(true);
                        }
                    }
                    stmt.getItems().add(item);
                } else if (identifierEquals("MODIFY")) {
                    lexer.nextToken();
                    if (identifierEquals("COLUMN")) {
                        lexer.nextToken();
                    }
                    MySqlAlterTableModifyColumn item = new MySqlAlterTableModifyColumn();
                    item.setNewColumnDefinition(this.exprParser.parseColumn());
                    if (identifierEquals("AFTER")) {
                        lexer.nextToken();
                        item.setAfterColumn(this.exprParser.name());
                    } else if (identifierEquals("FIRST")) {
                        lexer.nextToken();
                        if (lexer.token() == Token.IDENTIFIER) {
                            item.setFirstColumn(this.exprParser.name());
                        } else {
                            item.setFirst(true);
                        }
                    }
                    stmt.getItems().add(item);
                } else if (lexer.token() == Token.DROP) {
                    lexer.nextToken();
                    if (lexer.token() == Token.INDEX) {
                        lexer.nextToken();
                        SQLName indexName = this.exprParser.name();
                        SQLAlterTableDropIndex item = new SQLAlterTableDropIndex();
                        item.setIndexName(indexName);
                        stmt.getItems().add(item);
                    } else if (lexer.token() == Token.FOREIGN) {
                        lexer.nextToken();
                        accept(Token.KEY);
                        SQLName indexName = this.exprParser.name();
                        SQLAlterTableDropForeinKey item = new SQLAlterTableDropForeinKey();
                        item.setIndexName(indexName);
                        stmt.getItems().add(item);
                    } else if (lexer.token() == Token.PRIMARY) {
                        lexer.nextToken();
                        accept(Token.KEY);
                        SQLAlterTableDropPrimaryKey item = new SQLAlterTableDropPrimaryKey();
                        stmt.getItems().add(item);
                    } else {
                        if (identifierEquals("COLUMN")) {
                            lexer.nextToken();
                        }
                        SQLAlterTableDropColumnItem item = new SQLAlterTableDropColumnItem();
                        item.setColumnName(this.exprParser.name());
                        stmt.getItems().add(item);
                    }
                } else if (identifierEquals("DISABLE")) {
                    lexer.nextToken();
                    acceptIdentifier("KEYS");
                    SQLAlterTableDisableKeys item = new SQLAlterTableDisableKeys();
                    stmt.getItems().add(item);
                } else if (identifierEquals("ENABLE")) {
                    lexer.nextToken();
                    acceptIdentifier("KEYS");
                    SQLAlterTableEnableKeys item = new SQLAlterTableEnableKeys();
                    stmt.getItems().add(item);
                } else if (identifierEquals("RENAME")) {
                    lexer.nextToken();
                    MySqlRenameTableStatement renameStmt = new MySqlRenameTableStatement();
                    MySqlRenameTableStatement.Item item = new MySqlRenameTableStatement.Item();
                    item.setName(stmt.getTableSource().getExpr());
                    item.setTo(this.exprParser.name());
                    renameStmt.getItems().add(item);

                    return renameStmt;
                } else if (lexer.token() == Token.ORDER) {
                    throw new ParserException("TODO " + lexer.token() + " " + lexer.stringVal());
                } else if (identifierEquals("CONVERT")) {
                    throw new ParserException("TODO " + lexer.token() + " " + lexer.stringVal());
                } else if (lexer.token() == Token.DEFAULT) {
                    throw new ParserException("TODO " + lexer.token() + " " + lexer.stringVal());
                } else if (identifierEquals("DISCARD")) {
                    lexer.nextToken();
                    acceptIdentifier("TABLESPACE");
                    MySqlAlterTableDiscardTablespace item = new MySqlAlterTableDiscardTablespace();
                    stmt.getItems().add(item);
                } else if (identifierEquals("IMPORT")) {
                    lexer.nextToken();
                    acceptIdentifier("TABLESPACE");
                    MySqlAlterTableImportTablespace item = new MySqlAlterTableImportTablespace();
                    stmt.getItems().add(item);
                } else if (identifierEquals("FORCE")) {
                    throw new ParserException("TODO " + lexer.token() + " " + lexer.stringVal());
                } else if (identifierEquals("TRUNCATE")) {
                    throw new ParserException("TODO " + lexer.token() + " " + lexer.stringVal());
                } else if (identifierEquals("COALESCE")) {
                    throw new ParserException("TODO " + lexer.token() + " " + lexer.stringVal());

                } else if (identifierEquals("REORGANIZE")) {
                    throw new ParserException("TODO " + lexer.token() + " " + lexer.stringVal());
                } else if (identifierEquals("EXCHANGE")) {
                    throw new ParserException("TODO " + lexer.token() + " " + lexer.stringVal());
                } else if (identifierEquals("ANALYZE")) {
                    throw new ParserException("TODO " + lexer.token() + " " + lexer.stringVal());
                } else if (identifierEquals("CHECK")) {
                    throw new ParserException("TODO " + lexer.token() + " " + lexer.stringVal());
                } else if (identifierEquals("OPTIMIZE")) {
                    throw new ParserException("TODO " + lexer.token() + " " + lexer.stringVal());
                } else if (identifierEquals("REBUILD")) {
                    throw new ParserException("TODO " + lexer.token() + " " + lexer.stringVal());
                } else if (identifierEquals("REPAIR")) {
                    throw new ParserException("TODO " + lexer.token() + " " + lexer.stringVal());
                } else if (identifierEquals("REMOVE")) {
                    throw new ParserException("TODO " + lexer.token() + " " + lexer.stringVal());
                } else if (identifierEquals(ENGINE)) {
                    lexer.nextToken();
                    accept(Token.EQ);
                    stmt.getItems().add(new MySqlAlterTableOption(ENGINE, lexer.stringVal()));
                    lexer.nextToken();
                } else if (identifierEquals(AUTO_INCREMENT)) {
                    lexer.nextToken();
                    accept(Token.EQ);
                    stmt.getItems().add(new MySqlAlterTableOption(AUTO_INCREMENT, lexer.integerValue()));
                    lexer.nextToken();
                } else if (identifierEquals(COLLATE2)) {
                    lexer.nextToken();
                    accept(Token.EQ);
                    stmt.getItems().add(new MySqlAlterTableOption(COLLATE2, lexer.stringVal()));
                    lexer.nextToken();
                } else if (identifierEquals("PACK_KEYS")) {
                    lexer.nextToken();
                    accept(Token.EQ);
                    if (identifierEquals("PACK")) {
                        lexer.nextToken();
                        accept(Token.ALL);
                        stmt.getItems().add(new MySqlAlterTableOption("PACK_KEYS", "PACK ALL"));
                    } else {
                        stmt.getItems().add(new MySqlAlterTableOption("PACK_KEYS", lexer.stringVal()));
                        lexer.nextToken();
                    }
                } else if (identifierEquals(CHARACTER)) {
                    lexer.nextToken();
                    accept(Token.SET);
                    accept(Token.EQ);
                    MySqlAlterTableCharacter item = new MySqlAlterTableCharacter();
                    item.setCharacterSet(this.exprParser.primary());
                    if (lexer.token() == Token.COMMA) {
                        lexer.nextToken();
                        acceptIdentifier(COLLATE2);
                        accept(Token.EQ);
                        item.setCollate(this.exprParser.primary());
                    }
                    stmt.getItems().add(item);
                } else {
                    break;
                }
View Full Code Here

                } else if (identifierEquals("ADD")) {
                    lexer.nextToken();

                    if (identifierEquals("COLUMN")) {
                        lexer.nextToken();
                        MySqlAlterTableAddColumn item = new MySqlAlterTableAddColumn();
                        SQLColumnDefinition columnDef = this.exprParser.parseColumn();
                        item.getColumns().add(columnDef);
                        if (identifierEquals("AFTER")) {
                            lexer.nextToken();
                            item.setAfterColumn(this.exprParser.name());
                        } else if (identifierEquals("FIRST")) {
                            lexer.nextToken();
                            if (lexer.token() == Token.IDENTIFIER) {
                                item.setFirstColumn(this.exprParser.name());
                            } else {
                                item.setFirst(true);
                            }
                        }
                        stmt.getItems().add(item);
                    } else if (lexer.token() == Token.INDEX) {
                        lexer.nextToken();
                        MySqlAlterTableAddIndex item = new MySqlAlterTableAddIndex();

                        if (lexer.token() == Token.LPAREN) {
                            lexer.nextToken();
                        } else {
                            item.setName(this.exprParser.name());
                            accept(Token.LPAREN);
                        }

                        for (;;) {
                            SQLSelectOrderByItem column = this.exprParser.parseSelectOrderByItem();
                            item.getItems().add(column);
                            if (lexer.token() == Token.COMMA) {
                                lexer.nextToken();
                                continue;
                            }
                            break;
                        }
                        accept(Token.RPAREN);

                        stmt.getItems().add(item);
                    } else if (lexer.token() == Token.UNIQUE) {
                        lexer.nextToken();

                        if (lexer.token() == Token.INDEX) {
                            lexer.nextToken();
                        }

                        MySqlAlterTableAddUnique item = new MySqlAlterTableAddUnique();

                        if (lexer.token() == Token.LPAREN) {
                            lexer.nextToken();
                        } else {
                            item.setName(this.exprParser.name());
                            accept(Token.LPAREN);
                        }

                        for (;;) {
                            SQLSelectOrderByItem column = this.exprParser.parseSelectOrderByItem();
                            item.getItems().add(column);
                            if (lexer.token() == Token.COMMA) {
                                lexer.nextToken();
                                continue;
                            }
                            break;
                        }
                        accept(Token.RPAREN);

                        stmt.getItems().add(item);
                    } else if (lexer.token() == Token.PRIMARY) {
                        SQLPrimaryKey primaryKey = ((MySqlExprParser) this.exprParser).parsePrimaryKey();
                        SQLAlterTableAddPrimaryKey item = new SQLAlterTableAddPrimaryKey();
                        item.setPrimaryKey(primaryKey);
                        stmt.getItems().add(item);
                    } else if (lexer.token() == Token.KEY) {
                        throw new ParserException("TODO " + lexer.token() + " " + lexer.stringVal());
                    } else if (lexer.token() == Token.CONSTRAINT) {
                        lexer.nextToken();
                        SQLName constraintName = this.exprParser.name();

                        if (lexer.token() == Token.PRIMARY) {
                            SQLPrimaryKey primaryKey = ((MySqlExprParser) this.exprParser).parsePrimaryKey();

                            primaryKey.setName(constraintName);

                            SQLAlterTableAddPrimaryKey item = new SQLAlterTableAddPrimaryKey();
                            item.setPrimaryKey(primaryKey);
                            stmt.getItems().add(item);
                        } else if (lexer.token() == Token.FOREIGN) {
                            MySqlForeignKey fk = this.getExprParser().parseForeignKey();
                            fk.setName(constraintName);

                            SQLAlterTableAddForeignKey item = new SQLAlterTableAddForeignKey(fk);
                            stmt.getItems().add(item);
                        } else {
                            throw new ParserException("TODO " + lexer.token() + " " + lexer.stringVal());
                        }
                    } else if (identifierEquals(FULLTEXT)) {
                        throw new ParserException("TODO " + lexer.token() + " " + lexer.stringVal());
                    } else if (identifierEquals(SPATIAL)) {
                        throw new ParserException("TODO " + lexer.token() + " " + lexer.stringVal());
                    } else {
                        MySqlAlterTableAddColumn item = new MySqlAlterTableAddColumn();
                        SQLColumnDefinition columnDef = this.exprParser.parseColumn();
                        item.getColumns().add(columnDef);
                        if (identifierEquals("AFTER")) {
                            lexer.nextToken();
                            item.setAfterColumn(this.exprParser.name());
                        }
                        stmt.getItems().add(item);
                    }
                } else if (lexer.token() == Token.ALTER) {
                    lexer.nextToken();
                    if (identifierEquals("COLUMN")) {
                        lexer.nextToken();
                    }

                    SQLAlterTableAlterColumn alterColumn = new SQLAlterTableAlterColumn();
                    SQLColumnDefinition columnDef = this.exprParser.parseColumn();
                    alterColumn.setColumn(columnDef);

                    stmt.getItems().add(alterColumn);
                } else if (identifierEquals("CHANGE")) {
                    lexer.nextToken();
                    if (identifierEquals("COLUMN")) {
                        lexer.nextToken();
                    }
                    MySqlAlterTableChangeColumn item = new MySqlAlterTableChangeColumn();
                    item.setColumnName(this.exprParser.name());
                    item.setNewColumnDefinition(this.exprParser.parseColumn());
                    if (identifierEquals("AFTER")) {
                        lexer.nextToken();
                        item.setAfterColumn(this.exprParser.name());
                    } else if (identifierEquals("FIRST")) {
                        lexer.nextToken();
                        if (lexer.token() == Token.IDENTIFIER) {
                            item.setFirstColumn(this.exprParser.name());
                        } else {
                            item.setFirst(true);
                        }
                    }
                    stmt.getItems().add(item);
                } else if (identifierEquals("MODIFY")) {
                    lexer.nextToken();
                    if (identifierEquals("COLUMN")) {
                        lexer.nextToken();
                    }
                    MySqlAlterTableModifyColumn item = new MySqlAlterTableModifyColumn();
                    item.setNewColumnDefinition(this.exprParser.parseColumn());
                    if (identifierEquals("AFTER")) {
                        lexer.nextToken();
                        item.setAfterColumn(this.exprParser.name());
                    } else if (identifierEquals("FIRST")) {
                        lexer.nextToken();
                        if (lexer.token() == Token.IDENTIFIER) {
                            item.setFirstColumn(this.exprParser.name());
                        } else {
                            item.setFirst(true);
                        }
                    }
                    stmt.getItems().add(item);
                } else if (identifierEquals("DISABLE")) {
                    lexer.nextToken();

                    if (lexer.token() == Token.CONSTRAINT) {
                        lexer.nextToken();
                        SQLAlterTableDisableConstraint item = new SQLAlterTableDisableConstraint();
                        item.setConstraintName(this.exprParser.name());
                        stmt.getItems().add(item);
                    } else {
                        acceptIdentifier("KEYS");
                        SQLAlterTableDisableKeys item = new SQLAlterTableDisableKeys();
                        stmt.getItems().add(item);
                    }
                } else if (identifierEquals("ENABLE")) {
                    lexer.nextToken();
                    if (lexer.token() == Token.CONSTRAINT) {
                        lexer.nextToken();
                        SQLAlterTableEnableConstraint item = new SQLAlterTableEnableConstraint();
                        item.setConstraintName(this.exprParser.name());
                        stmt.getItems().add(item);
                    } else {
                        acceptIdentifier("KEYS");
                        SQLAlterTableEnableKeys item = new SQLAlterTableEnableKeys();
                        stmt.getItems().add(item);
                    }
                } else if (identifierEquals("RENAME")) {
                    lexer.nextToken();
                    MySqlRenameTableStatement renameStmt = new MySqlRenameTableStatement();
                    MySqlRenameTableStatement.Item item = new MySqlRenameTableStatement.Item();
                    item.setName(stmt.getTableSource().getExpr());
                    item.setTo(this.exprParser.name());
                    renameStmt.getItems().add(item);

                    return renameStmt;
                } else if (lexer.token() == Token.ORDER) {
                    throw new ParserException("TODO " + lexer.token() + " " + lexer.stringVal());
                } else if (identifierEquals("CONVERT")) {
                    throw new ParserException("TODO " + lexer.token() + " " + lexer.stringVal());
                } else if (lexer.token() == Token.DEFAULT) {
                    throw new ParserException("TODO " + lexer.token() + " " + lexer.stringVal());
                } else if (identifierEquals("DISCARD")) {
                    lexer.nextToken();
                    acceptIdentifier("TABLESPACE");
                    MySqlAlterTableDiscardTablespace item = new MySqlAlterTableDiscardTablespace();
                    stmt.getItems().add(item);
                } else if (identifierEquals("IMPORT")) {
                    lexer.nextToken();
                    acceptIdentifier("TABLESPACE");
                    MySqlAlterTableImportTablespace item = new MySqlAlterTableImportTablespace();
                    stmt.getItems().add(item);
                } else if (identifierEquals("FORCE")) {
                    throw new ParserException("TODO " + lexer.token() + " " + lexer.stringVal());
                } else if (identifierEquals("TRUNCATE")) {
                    throw new ParserException("TODO " + lexer.token() + " " + lexer.stringVal());
                } else if (identifierEquals("COALESCE")) {
                    throw new ParserException("TODO " + lexer.token() + " " + lexer.stringVal());
                } else if (identifierEquals("REORGANIZE")) {
                    throw new ParserException("TODO " + lexer.token() + " " + lexer.stringVal());
                } else if (identifierEquals("EXCHANGE")) {
                    throw new ParserException("TODO " + lexer.token() + " " + lexer.stringVal());
                } else if (identifierEquals("ANALYZE")) {
                    throw new ParserException("TODO " + lexer.token() + " " + lexer.stringVal());
                } else if (identifierEquals("CHECK")) {
                    throw new ParserException("TODO " + lexer.token() + " " + lexer.stringVal());
                } else if (identifierEquals("OPTIMIZE")) {
                    throw new ParserException("TODO " + lexer.token() + " " + lexer.stringVal());
                } else if (identifierEquals("REBUILD")) {
                    throw new ParserException("TODO " + lexer.token() + " " + lexer.stringVal());
                } else if (identifierEquals("REPAIR")) {
                    throw new ParserException("TODO " + lexer.token() + " " + lexer.stringVal());
                } else if (identifierEquals("REMOVE")) {
                    throw new ParserException("TODO " + lexer.token() + " " + lexer.stringVal());
                } else if (identifierEquals(ENGINE)) {
                    lexer.nextToken();
                    accept(Token.EQ);
                    stmt.getItems().add(new MySqlAlterTableOption(ENGINE, lexer.stringVal()));
                    lexer.nextToken();
                } else if (identifierEquals(AUTO_INCREMENT)) {
                    lexer.nextToken();
                    accept(Token.EQ);
                    stmt.getItems().add(new MySqlAlterTableOption(AUTO_INCREMENT, lexer.integerValue()));
                    lexer.nextToken();
                } else if (identifierEquals(COLLATE2)) {
                    lexer.nextToken();
                    accept(Token.EQ);
                    stmt.getItems().add(new MySqlAlterTableOption(COLLATE2, lexer.stringVal()));
                    lexer.nextToken();
                } else if (identifierEquals("PACK_KEYS")) {
                    lexer.nextToken();
                    accept(Token.EQ);
                    if (identifierEquals("PACK")) {
                        lexer.nextToken();
                        accept(Token.ALL);
                        stmt.getItems().add(new MySqlAlterTableOption("PACK_KEYS", "PACK ALL"));
                    } else {
                        stmt.getItems().add(new MySqlAlterTableOption("PACK_KEYS", lexer.stringVal()));
                        lexer.nextToken();
                    }
                } else if (identifierEquals(CHARACTER)) {
                    lexer.nextToken();
                    accept(Token.SET);
                    accept(Token.EQ);
                    MySqlAlterTableCharacter item = new MySqlAlterTableCharacter();
                    item.setCharacterSet(this.exprParser.primary());
                    if (lexer.token() == Token.COMMA) {
                        lexer.nextToken();
                        acceptIdentifier(COLLATE2);
                        accept(Token.EQ);
                        item.setCollate(this.exprParser.primary());
                    }
                    stmt.getItems().add(item);
                } else {
                    break;
                }
View Full Code Here

                } else if (identifierEquals("ADD")) {
                    lexer.nextToken();

                    if (identifierEquals("COLUMN")) {
                        lexer.nextToken();
                        MySqlAlterTableAddColumn item = new MySqlAlterTableAddColumn();
                        SQLColumnDefinition columnDef = this.exprParser.parseColumn();
                        item.getColumns().add(columnDef);
                        if (identifierEquals("AFTER")) {
                            lexer.nextToken();
                            item.setAfterColumn(this.exprParser.name());
                        } else if (identifierEquals("FIRST")) {
                            lexer.nextToken();
                            if (lexer.token() == Token.IDENTIFIER) {
                                item.setFirstColumn(this.exprParser.name());
                            } else {
                                item.setFirst(true);
                            }
                        }
                        stmt.getItems().add(item);
                    } else if (lexer.token() == Token.INDEX) {
                        lexer.nextToken();
                        MySqlAlterTableAddIndex item = new MySqlAlterTableAddIndex();

                        if (lexer.token() == Token.LPAREN) {
                            lexer.nextToken();
                        } else {
                            item.setName(this.exprParser.name());
                            accept(Token.LPAREN);
                        }

                        for (;;) {
                            SQLSelectOrderByItem column = this.exprParser.parseSelectOrderByItem();
                            item.getItems().add(column);
                            if (lexer.token() == Token.COMMA) {
                                lexer.nextToken();
                                continue;
                            }
                            break;
                        }
                        accept(Token.RPAREN);

                        stmt.getItems().add(item);
                    } else if (lexer.token() == Token.UNIQUE) {
                        lexer.nextToken();

                        if (lexer.token() == Token.INDEX) {
                            lexer.nextToken();
                        }

                        MySqlAlterTableAddUnique item = new MySqlAlterTableAddUnique();

                        if (lexer.token() == Token.LPAREN) {
                            lexer.nextToken();
                        } else {
                            item.setName(this.exprParser.name());
                            accept(Token.LPAREN);
                        }

                        for (;;) {
                            SQLSelectOrderByItem column = this.exprParser.parseSelectOrderByItem();
                            item.getItems().add(column);
                            if (lexer.token() == Token.COMMA) {
                                lexer.nextToken();
                                continue;
                            }
                            break;
                        }
                        accept(Token.RPAREN);

                        stmt.getItems().add(item);
                    } else if (lexer.token() == Token.PRIMARY) {
                        SQLPrimaryKey primaryKey = ((MySqlExprParser) this.exprParser).parsePrimaryKey();
                        SQLAlterTableAddPrimaryKey item = new SQLAlterTableAddPrimaryKey();
                        item.setPrimaryKey(primaryKey);
                        stmt.getItems().add(item);
                    } else if (lexer.token() == Token.KEY) {
                        throw new ParserException("TODO " + lexer.token() + " " + lexer.stringVal());
                    } else if (lexer.token() == Token.CONSTRAINT) {
                        lexer.nextToken();
                        SQLName constraintName = this.exprParser.name();

                        if (lexer.token() == Token.PRIMARY) {
                            SQLPrimaryKey primaryKey = ((MySqlExprParser) this.exprParser).parsePrimaryKey();

                            primaryKey.setName(constraintName);

                            SQLAlterTableAddPrimaryKey item = new SQLAlterTableAddPrimaryKey();
                            item.setPrimaryKey(primaryKey);
                            stmt.getItems().add(item);
                        } else if (lexer.token() == Token.FOREIGN) {
                            MySqlForeignKey fk = this.getExprParser().parseForeignKey();
                            fk.setName(constraintName);

                            SQLAlterTableAddForeignKey item = new SQLAlterTableAddForeignKey(fk);
                            stmt.getItems().add(item);
                        } else {
                            throw new ParserException("TODO " + lexer.token() + " " + lexer.stringVal());
                        }
                    } else if (identifierEquals(FULLTEXT)) {
                        throw new ParserException("TODO " + lexer.token() + " " + lexer.stringVal());
                    } else if (identifierEquals(SPATIAL)) {
                        throw new ParserException("TODO " + lexer.token() + " " + lexer.stringVal());
                    } else {
                        MySqlAlterTableAddColumn item = new MySqlAlterTableAddColumn();
                        SQLColumnDefinition columnDef = this.exprParser.parseColumn();
                        item.getColumns().add(columnDef);
                        if (identifierEquals("AFTER")) {
                            lexer.nextToken();
                            item.setAfterColumn(this.exprParser.name());
                        }
                        stmt.getItems().add(item);
                    }
                } else if (lexer.token() == Token.ALTER) {
                    lexer.nextToken();
                    if (identifierEquals("COLUMN")) {
                        lexer.nextToken();
                    }

                    SQLAlterTableAlterColumn alterColumn = new SQLAlterTableAlterColumn();
                    SQLColumnDefinition columnDef = this.exprParser.parseColumn();
                    alterColumn.setColumn(columnDef);

                    stmt.getItems().add(alterColumn);
                } else if (identifierEquals("CHANGE")) {
                    lexer.nextToken();
                    if (identifierEquals("COLUMN")) {
                        lexer.nextToken();
                    }
                    MySqlAlterTableChangeColumn item = new MySqlAlterTableChangeColumn();
                    item.setColumnName(this.exprParser.name());
                    item.setNewColumnDefinition(this.exprParser.parseColumn());
                    if (identifierEquals("AFTER")) {
                        lexer.nextToken();
                        item.setAfterColumn(this.exprParser.name());
                    } else if (identifierEquals("FIRST")) {
                        lexer.nextToken();
                        if (lexer.token() == Token.IDENTIFIER) {
                            item.setFirstColumn(this.exprParser.name());
                        } else {
                            item.setFirst(true);
                        }
                    }
                    stmt.getItems().add(item);
                } else if (identifierEquals("MODIFY")) {
                    lexer.nextToken();
                    if (identifierEquals("COLUMN")) {
                        lexer.nextToken();
                    }
                    MySqlAlterTableModifyColumn item = new MySqlAlterTableModifyColumn();
                    item.setNewColumnDefinition(this.exprParser.parseColumn());
                    if (identifierEquals("AFTER")) {
                        lexer.nextToken();
                        item.setAfterColumn(this.exprParser.name());
                    } else if (identifierEquals("FIRST")) {
                        lexer.nextToken();
                        if (lexer.token() == Token.IDENTIFIER) {
                            item.setFirstColumn(this.exprParser.name());
                        } else {
                            item.setFirst(true);
                        }
                    }
                    stmt.getItems().add(item);
                } else if (identifierEquals("DISABLE")) {
                    lexer.nextToken();

                    if (lexer.token() == Token.CONSTRAINT) {
                        lexer.nextToken();
                        SQLAlterTableDisableConstraint item = new SQLAlterTableDisableConstraint();
                        item.setConstraintName(this.exprParser.name());
                        stmt.getItems().add(item);
                    } else {
                        acceptIdentifier("KEYS");
                        SQLAlterTableDisableKeys item = new SQLAlterTableDisableKeys();
                        stmt.getItems().add(item);
                    }
                } else if (identifierEquals("ENABLE")) {
                    lexer.nextToken();
                    if (lexer.token() == Token.CONSTRAINT) {
                        lexer.nextToken();
                        SQLAlterTableEnableConstraint item = new SQLAlterTableEnableConstraint();
                        item.setConstraintName(this.exprParser.name());
                        stmt.getItems().add(item);
                    } else {
                        acceptIdentifier("KEYS");
                        SQLAlterTableEnableKeys item = new SQLAlterTableEnableKeys();
                        stmt.getItems().add(item);
                    }
                } else if (identifierEquals("RENAME")) {
                    lexer.nextToken();
                    MySqlRenameTableStatement renameStmt = new MySqlRenameTableStatement();
                    MySqlRenameTableStatement.Item item = new MySqlRenameTableStatement.Item();
                    item.setName(stmt.getTableSource().getExpr());
                    item.setTo(this.exprParser.name());
                    renameStmt.getItems().add(item);

                    return renameStmt;
                } else if (lexer.token() == Token.ORDER) {
                    throw new ParserException("TODO " + lexer.token() + " " + lexer.stringVal());
                } else if (identifierEquals("CONVERT")) {
                    throw new ParserException("TODO " + lexer.token() + " " + lexer.stringVal());
                } else if (lexer.token() == Token.DEFAULT) {
                    throw new ParserException("TODO " + lexer.token() + " " + lexer.stringVal());
                } else if (identifierEquals("DISCARD")) {
                    lexer.nextToken();
                    acceptIdentifier("TABLESPACE");
                    MySqlAlterTableDiscardTablespace item = new MySqlAlterTableDiscardTablespace();
                    stmt.getItems().add(item);
                } else if (identifierEquals("IMPORT")) {
                    lexer.nextToken();
                    acceptIdentifier("TABLESPACE");
                    MySqlAlterTableImportTablespace item = new MySqlAlterTableImportTablespace();
                    stmt.getItems().add(item);
                } else if (identifierEquals("FORCE")) {
                    throw new ParserException("TODO " + lexer.token() + " " + lexer.stringVal());
                } else if (identifierEquals("TRUNCATE")) {
                    throw new ParserException("TODO " + lexer.token() + " " + lexer.stringVal());
                } else if (identifierEquals("COALESCE")) {
                    throw new ParserException("TODO " + lexer.token() + " " + lexer.stringVal());

                } else if (identifierEquals("REORGANIZE")) {
                    throw new ParserException("TODO " + lexer.token() + " " + lexer.stringVal());
                } else if (identifierEquals("EXCHANGE")) {
                    throw new ParserException("TODO " + lexer.token() + " " + lexer.stringVal());
                } else if (identifierEquals("ANALYZE")) {
                    throw new ParserException("TODO " + lexer.token() + " " + lexer.stringVal());
                } else if (identifierEquals("CHECK")) {
                    throw new ParserException("TODO " + lexer.token() + " " + lexer.stringVal());
                } else if (identifierEquals("OPTIMIZE")) {
                    throw new ParserException("TODO " + lexer.token() + " " + lexer.stringVal());
                } else if (identifierEquals("REBUILD")) {
                    throw new ParserException("TODO " + lexer.token() + " " + lexer.stringVal());
                } else if (identifierEquals("REPAIR")) {
                    throw new ParserException("TODO " + lexer.token() + " " + lexer.stringVal());
                } else if (identifierEquals("REMOVE")) {
                    throw new ParserException("TODO " + lexer.token() + " " + lexer.stringVal());
                } else if (identifierEquals(ENGINE)) {
                    lexer.nextToken();
                    accept(Token.EQ);
                    stmt.getItems().add(new MySqlAlterTableOption(ENGINE, lexer.stringVal()));
                    lexer.nextToken();
                } else if (identifierEquals(AUTO_INCREMENT)) {
                    lexer.nextToken();
                    accept(Token.EQ);
                    stmt.getItems().add(new MySqlAlterTableOption(AUTO_INCREMENT, lexer.integerValue()));
                    lexer.nextToken();
                } else if (identifierEquals(COLLATE2)) {
                    lexer.nextToken();
                    accept(Token.EQ);
                    stmt.getItems().add(new MySqlAlterTableOption(COLLATE2, lexer.stringVal()));
                    lexer.nextToken();
                } else if (identifierEquals("PACK_KEYS")) {
                    lexer.nextToken();
                    accept(Token.EQ);
                    if (identifierEquals("PACK")) {
                        lexer.nextToken();
                        accept(Token.ALL);
                        stmt.getItems().add(new MySqlAlterTableOption("PACK_KEYS", "PACK ALL"));
                    } else {
                        stmt.getItems().add(new MySqlAlterTableOption("PACK_KEYS", lexer.stringVal()));
                        lexer.nextToken();
                    }
                } else if (identifierEquals(CHARACTER)) {
                    lexer.nextToken();
                    accept(Token.SET);
                    accept(Token.EQ);
                    MySqlAlterTableCharacter item = new MySqlAlterTableCharacter();
                    item.setCharacterSet(this.exprParser.primary());
                    if (lexer.token() == Token.COMMA) {
                        lexer.nextToken();
                        acceptIdentifier(COLLATE2);
                        accept(Token.EQ);
                        item.setCollate(this.exprParser.primary());
                    }
                    stmt.getItems().add(item);
                } else {
                    break;
                }
View Full Code Here

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

                    if (identifierEquals("COLUMN")) {
                        lexer.nextToken();
                        MySqlAlterTableAddColumn item = new MySqlAlterTableAddColumn();
                        SQLColumnDefinition columnDef = this.exprParser.parseColumn();
                        item.getColumns().add(columnDef);
                        if (identifierEquals("AFTER")) {
                            lexer.nextToken();
                            item.setAfterColumn(this.exprParser.name());
                        } else if (identifierEquals("FIRST")) {
                            lexer.nextToken();
                            if (lexer.token() == Token.IDENTIFIER) {
                                item.setFirstColumn(this.exprParser.name());
                            } else {
                                item.setFirst(true);
                            }
                        }
                        stmt.getItems().add(item);
                    } else if (lexer.token() == Token.INDEX) {
                        lexer.nextToken();
                        MySqlAlterTableAddIndex item = new MySqlAlterTableAddIndex();

                        if (lexer.token() == Token.LPAREN) {
                            lexer.nextToken();
                        } else {
                            item.setName(this.exprParser.name());
                            accept(Token.LPAREN);
                        }

                        for (;;) {
                            SQLSelectOrderByItem column = this.exprParser.parseSelectOrderByItem();
                            item.getItems().add(column);
                            if (lexer.token() == Token.COMMA) {
                                lexer.nextToken();
                                continue;
                            }
                            break;
                        }
                        accept(Token.RPAREN);

                        stmt.getItems().add(item);
                    } else if (lexer.token() == Token.UNIQUE) {
                        lexer.nextToken();

                        if (lexer.token() == Token.INDEX) {
                            lexer.nextToken();
                        }

                        MySqlAlterTableAddUnique item = new MySqlAlterTableAddUnique();

                        if (lexer.token() == Token.LPAREN) {
                            lexer.nextToken();
                        } else {
                            item.setName(this.exprParser.name());
                            accept(Token.LPAREN);
                        }

                        for (;;) {
                            SQLSelectOrderByItem column = this.exprParser.parseSelectOrderByItem();
                            item.getItems().add(column);
                            if (lexer.token() == Token.COMMA) {
                                lexer.nextToken();
                                continue;
                            }
                            break;
                        }
                        accept(Token.RPAREN);

                        stmt.getItems().add(item);
                    } else if (lexer.token() == Token.PRIMARY) {
                        SQLPrimaryKey primaryKey = ((MySqlExprParser) this.exprParser).parsePrimaryKey();
                        SQLAlterTableAddPrimaryKey item = new SQLAlterTableAddPrimaryKey();
                        item.setPrimaryKey(primaryKey);
                        stmt.getItems().add(item);
                    } else if (lexer.token() == Token.KEY) {
                        throw new ParserException("TODO " + lexer.token() + " " + lexer.stringVal());
                    } else if (lexer.token() == Token.CONSTRAINT) {
                        throw new ParserException("TODO " + lexer.token() + " " + lexer.stringVal());
                    } else if (identifierEquals(FULLTEXT)) {
                        throw new ParserException("TODO " + lexer.token() + " " + lexer.stringVal());
                    } else if (identifierEquals(SPATIAL)) {
                        throw new ParserException("TODO " + lexer.token() + " " + lexer.stringVal());
                    } else {
                        MySqlAlterTableAddColumn item = new MySqlAlterTableAddColumn();
                        SQLColumnDefinition columnDef = this.exprParser.parseColumn();
                        item.getColumns().add(columnDef);
                        if (identifierEquals("AFTER")) {
                            lexer.nextToken();
                            item.setAfterColumn(this.exprParser.name());
                        }
                        stmt.getItems().add(item);
                    }
                } else if (identifierEquals("ALTER")) {
                    throw new ParserException("TODO " + lexer.token() + " " + lexer.stringVal());
                } else if (identifierEquals("CHANGE")) {
                    lexer.nextToken();
                    if (identifierEquals("COLUMN")) {
                        lexer.nextToken();
                    }
                    MySqlAlterTableChangeColumn item = new MySqlAlterTableChangeColumn();
                    item.setColumnName(this.exprParser.name());
                    item.setNewColumnDefinition(this.exprParser.parseColumn());
                    if (identifierEquals("AFTER")) {
                        lexer.nextToken();
                        item.setAfterColumn(this.exprParser.name());
                    } else if (identifierEquals("FIRST")) {
                        lexer.nextToken();
                        if (lexer.token() == Token.IDENTIFIER) {
                            item.setFirstColumn(this.exprParser.name());
                        } else {
                            item.setFirst(true);
                        }
                    }
                    stmt.getItems().add(item);
                } else if (identifierEquals("MODIFY")) {
                    throw new ParserException("TODO " + lexer.token() + " " + lexer.stringVal());
                } else if (lexer.token() == Token.DROP) {
                    lexer.nextToken();
                    if (lexer.token() == Token.INDEX) {
                        lexer.nextToken();
                        SQLName indexName = this.exprParser.name();
                        SQLAlterTableDropIndex item = new SQLAlterTableDropIndex();
                        item.setIndexName(indexName);
                        stmt.getItems().add(item);
                    } else {
                        if (identifierEquals("COLUMN")) {
                            lexer.nextToken();
                        }
                        SQLAlterTableDropColumnItem item = new SQLAlterTableDropColumnItem();
                        item.setColumnName(this.exprParser.name());
                        stmt.getItems().add(item);
                    }
                } else if (identifierEquals("DISABLE")) {
                    throw new ParserException("TODO " + lexer.token() + " " + lexer.stringVal());
                } else if (identifierEquals("ENABLE")) {
                    throw new ParserException("TODO " + lexer.token() + " " + lexer.stringVal());
                } else if (identifierEquals("RENAME")) {
                    lexer.nextToken();
                    MySqlRenameTableStatement renameStmt = new MySqlRenameTableStatement();
                    MySqlRenameTableStatement.Item item = new MySqlRenameTableStatement.Item();
                    item.setName(stmt.getTableSource().getExpr());
                    item.setTo(this.exprParser.name());
                    renameStmt.getItems().add(item);

                    return renameStmt;
                } else if (lexer.token() == Token.ORDER) {
                    throw new ParserException("TODO " + lexer.token() + " " + lexer.stringVal());
                } else if (identifierEquals("CONVERT")) {
                    throw new ParserException("TODO " + lexer.token() + " " + lexer.stringVal());
                } else if (lexer.token() == Token.DEFAULT) {
                    throw new ParserException("TODO " + lexer.token() + " " + lexer.stringVal());
                } else if (identifierEquals("DISCARD")) {
                    throw new ParserException("TODO " + lexer.token() + " " + lexer.stringVal());
                } else if (identifierEquals("IMPORT")) {
                    throw new ParserException("TODO " + lexer.token() + " " + lexer.stringVal());
                } else if (identifierEquals("FORCE")) {
                    throw new ParserException("TODO " + lexer.token() + " " + lexer.stringVal());
                } else if (identifierEquals("TRUNCATE")) {
                    throw new ParserException("TODO " + lexer.token() + " " + lexer.stringVal());
                } else if (identifierEquals("COALESCE")) {
                    throw new ParserException("TODO " + lexer.token() + " " + lexer.stringVal());

                } else if (identifierEquals("REORGANIZE")) {
                    throw new ParserException("TODO " + lexer.token() + " " + lexer.stringVal());
                } else if (identifierEquals("EXCHANGE")) {
                    throw new ParserException("TODO " + lexer.token() + " " + lexer.stringVal());
                } else if (identifierEquals("ANALYZE")) {
                    throw new ParserException("TODO " + lexer.token() + " " + lexer.stringVal());
                } else if (identifierEquals("CHECK")) {
                    throw new ParserException("TODO " + lexer.token() + " " + lexer.stringVal());
                } else if (identifierEquals("OPTIMIZE")) {
                    throw new ParserException("TODO " + lexer.token() + " " + lexer.stringVal());
                } else if (identifierEquals("REBUILD")) {
                    throw new ParserException("TODO " + lexer.token() + " " + lexer.stringVal());
                } else if (identifierEquals("REPAIR")) {
                    throw new ParserException("TODO " + lexer.token() + " " + lexer.stringVal());
                } else if (identifierEquals("REMOVE")) {
                    throw new ParserException("TODO " + lexer.token() + " " + lexer.stringVal());
                } else if (identifierEquals(ENGINE)) {
                    lexer.nextToken();
                    accept(Token.EQ);
                    stmt.getItems().add(new MySqlAlterTableOption(ENGINE, lexer.stringVal()));
                    lexer.nextToken();
                } else if (identifierEquals(COLLATE2)) {
                    lexer.nextToken();
                    accept(Token.EQ);
                    stmt.getItems().add(new MySqlAlterTableOption(COLLATE2, lexer.stringVal()));
                    lexer.nextToken();
                } else if (identifierEquals("PACK_KEYS")) {
                    lexer.nextToken();
                    accept(Token.EQ);
                    if (identifierEquals("PACK")) {
                        lexer.nextToken();
                        accept(Token.ALL);
                        stmt.getItems().add(new MySqlAlterTableOption("PACK_KEYS", "PACK ALL"));
                    } else {
                        stmt.getItems().add(new MySqlAlterTableOption("PACK_KEYS", lexer.stringVal()));
                        lexer.nextToken();
                    }
                } else if (identifierEquals(CHARACTER)) {
                    lexer.nextToken();
                    accept(Token.SET);
                    accept(Token.EQ);
                    MySqlAlterTableCharacter item = new MySqlAlterTableCharacter();
                    item.setCharacterSet(this.exprParser.primary());
                    if (lexer.token() == Token.COMMA) {
                        lexer.nextToken();
                        acceptIdentifier(COLLATE2);
                        accept(Token.EQ);
                        item.setCollate(this.exprParser.primary());
                    }
                    stmt.getItems().add(item);
                } else {
                    break;
                }
View Full Code Here

TOP

Related Classes of com.alibaba.druid.sql.dialect.mysql.ast.statement.MySqlAlterTableAddColumn

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.