001package gudusoft.gsqlparser.nodes; 002 003import gudusoft.gsqlparser.EDbObjectType; 004import gudusoft.gsqlparser.EIndexType; 005import gudusoft.gsqlparser.EKeyReferenceType; 006import gudusoft.gsqlparser.TBaseType; 007import gudusoft.gsqlparser.TSourceToken; 008import gudusoft.gsqlparser.nodes.couchbase.TKeyspaceRef; 009 010public class TDropIndexSqlNode extends TParseTreeNode { 011 private boolean ifExists; 012 013 public void setIfExists(boolean ifExists) { 014 this.ifExists = ifExists; 015 } 016 017 public boolean isIfExists() { 018 return ifExists; 019 } 020 021 public TObjectNameList getIndexNameList() { 022 return indexNameList; 023 } 024 025 private TObjectNameList indexNameList; 026 private TObjectName tableName; 027 028 public TObjectName getIndexName() { 029 return indexName; 030 } 031 032 private TObjectName indexName = null; 033 private TDropIndexItemList dropIndexItemList = null; 034 035 public TDropIndexItemList getDropIndexItemList() { 036 return dropIndexItemList; 037 } 038 039 public void init(Object arg1) 040 { 041 if (arg1 instanceof TObjectName){ 042 indexName = (TObjectName)arg1; 043 //indexName.setObjectType(TObjectName.ttobjIndexName); 044 indexName.setDbObjectType(EDbObjectType.index); 045 }else if (arg1 instanceof TDropIndexItemList){ 046 this.dropIndexItemList = (TDropIndexItemList)arg1; 047 }else if (arg1 instanceof TObjectNameList){ 048 indexNameList = (TObjectNameList)arg1; 049 } 050 } 051 052 private EKeyReferenceType dropRestrictType = EKeyReferenceType.no_action; 053 054 public EKeyReferenceType getDropRestrictType() { 055 return dropRestrictType; 056 057 } 058 059 public void setDropRestrictType(TSourceToken st) { 060 if (st == null) return; 061 062 if (st.tokencode == TBaseType.rrw_cascade ){ 063 this.dropRestrictType = EKeyReferenceType.cascade; 064 }else if (st.tokencode == TBaseType.rrw_restrict){ 065 this.dropRestrictType = EKeyReferenceType.restrict; 066 } 067 068 } 069 070 public TObjectName getTableName() { 071 return tableName; 072 } 073 074 public void init(Object arg1,Object arg2){ 075 init(arg1); 076 tableName = (TObjectName)arg2; 077 } 078 079 private TKeyspaceRef keyspaceRef; 080 081 public void setKeyspaceRef(TKeyspaceRef keyspaceRef) { 082 this.keyspaceRef = keyspaceRef; 083 } 084 085 public TKeyspaceRef getKeyspaceRef() { 086 087 return keyspaceRef; 088 } 089 090 private EIndexType indexType; 091 092 public void setIndexType(EIndexType indexType) { 093 this.indexType = indexType; 094 } 095 096 public EIndexType getIndexType() { 097 098 return indexType; 099 } 100}