|
| 1 | +/* |
| 2 | + * #%L |
| 3 | + * JSQLParser library |
| 4 | + * %% |
| 5 | + * Copyright (C) 2004 - 2013 JSQLParser |
| 6 | + * %% |
| 7 | + * This program is free software: you can redistribute it and/or modify |
| 8 | + * it under the terms of the GNU Lesser General Public License as |
| 9 | + * published by the Free Software Foundation, either version 2.1 of the |
| 10 | + * License, or (at your option) any later version. |
| 11 | + * |
| 12 | + * This program is distributed in the hope that it will be useful, |
| 13 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 14 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 15 | + * GNU General Lesser Public License for more details. |
| 16 | + * |
| 17 | + * You should have received a copy of the GNU General Lesser Public |
| 18 | + * License along with this program. If not, see |
| 19 | + * <http://www.gnu.org/licenses/lgpl-2.1.html>. |
| 20 | + * #L% |
| 21 | + */ |
| 22 | +/* |
| 23 | + * Copyright (C) 2013 JSQLParser. |
| 24 | + * |
| 25 | + * This library is free software; you can redistribute it and/or |
| 26 | + * modify it under the terms of the GNU Lesser General Public |
| 27 | + * License as published by the Free Software Foundation; either |
| 28 | + * version 2.1 of the License, or (at your option) any later version. |
| 29 | + * |
| 30 | + * This library is distributed in the hope that it will be useful, |
| 31 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 32 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 33 | + * Lesser General Public License for more details. |
| 34 | + * |
| 35 | + * You should have received a copy of the GNU Lesser General Public |
| 36 | + * License along with this library; if not, write to the Free Software |
| 37 | + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
| 38 | + * MA 02110-1301 USA |
| 39 | + */ |
| 40 | + |
| 41 | +package net.sf.jsqlparser.statement.alter; |
| 42 | + |
| 43 | +import net.sf.jsqlparser.schema.Table; |
| 44 | +import net.sf.jsqlparser.statement.Statement; |
| 45 | +import net.sf.jsqlparser.statement.StatementVisitor; |
| 46 | +import net.sf.jsqlparser.statement.create.table.ColDataType; |
| 47 | + |
| 48 | +/** |
| 49 | + * |
| 50 | + * @author toben |
| 51 | + */ |
| 52 | +public class Alter implements Statement { |
| 53 | + private Table table; |
| 54 | + private String columnName; |
| 55 | + private ColDataType dataType; |
| 56 | + |
| 57 | + public Table getTable() { |
| 58 | + return table; |
| 59 | + } |
| 60 | + |
| 61 | + public void setTable(Table table) { |
| 62 | + this.table = table; |
| 63 | + } |
| 64 | + |
| 65 | + public String getColumnName() { |
| 66 | + return columnName; |
| 67 | + } |
| 68 | + |
| 69 | + public void setColumnName(String columnName) { |
| 70 | + this.columnName = columnName; |
| 71 | + } |
| 72 | + |
| 73 | + public ColDataType getDataType() { |
| 74 | + return dataType; |
| 75 | + } |
| 76 | + |
| 77 | + public void setDataType(ColDataType dataType) { |
| 78 | + this.dataType = dataType; |
| 79 | + } |
| 80 | + |
| 81 | + @Override |
| 82 | + public void accept(StatementVisitor statementVisitor) { |
| 83 | + statementVisitor.visit(this); |
| 84 | + } |
| 85 | + |
| 86 | + public String toString() { |
| 87 | + return "ALTER TABLE " + table.getWholeTableName() + " ADD COLUMN " + columnName + " " + dataType.toString(); |
| 88 | + } |
| 89 | +} |
0 commit comments