001package gudusoft.gsqlparser.nodes;
002
003
004import gudusoft.gsqlparser.ETableKind;
005import gudusoft.gsqlparser.TSourceToken;
006
007public class TDropTableSqlNode extends TParseTreeNode {
008
009    private ETableKind tableKind;
010
011    public void setTableKind(ETableKind tableKind) {
012        this.tableKind = tableKind;
013    }
014
015    public ETableKind getTableKind() {
016        return tableKind;
017    }
018
019    private boolean cascade;
020    private boolean restrict;
021
022    public boolean isCascade() {
023        return cascade;
024    }
025
026    public boolean isRestrict() {
027        return restrict;
028    }
029
030//    public void setCascade(boolean cascade) {
031//
032//        this.cascade = cascade;
033//    }
034//
035//    public void setRestrict(boolean restrict) {
036//        this.restrict = restrict;
037//    }
038
039    public void setDropBehavior(TSourceToken st){
040        if (st == null) return;
041        if (st.toString().equalsIgnoreCase("cascade")){
042            cascade = true;
043        }else if (st.toString().equalsIgnoreCase("restrict")){
044            restrict = true;
045        }
046    }
047    private boolean ifExists;
048
049    public void setIfExists(boolean ifExists) {
050        this.ifExists = ifExists;
051    }
052
053    public boolean isIfExists() {
054
055        return ifExists;
056    }
057
058    private TObjectName tableName ;
059
060    public TObjectNameList getTableNameList() {
061        return tableNameList;
062    }
063
064    private TObjectNameList tableNameList = null; // sql server
065
066    public void init(Object arg1)
067    {
068       if (arg1 instanceof TObjectName){
069       tableName = (TObjectName)arg1;
070       tableName.setObjectType(TObjectName.ttobjTable);
071       }else if (arg1 instanceof TObjectNameList){
072         this.tableNameList = (TObjectNameList)arg1;
073           for(int i=0;i<this.tableNameList.size();i++){
074               this.tableNameList.getObjectName(i).setObjectType(TObjectName.ttobjTable);
075           }
076       }
077    }
078
079    public TObjectName getTableName() {
080        return tableName;
081    }
082}