001package gudusoft.gsqlparser.nodes; 002 003import gudusoft.gsqlparser.TSourceToken; 004import gudusoft.gsqlparser.nodes.couchbase.TUseKeyIndex; 005import gudusoft.gsqlparser.nodes.mssql.TOptionClause; 006import gudusoft.gsqlparser.nodes.oracle.TErrorLoggingClause; 007 008 009public class TDeleteSqlNode extends TParseTreeNode { 010 011 private boolean fromKeyword = false; 012 013 public void setFromKeyword(boolean fromKeyword) { 014 this.fromKeyword = fromKeyword; 015 } 016 017 public boolean isFromKeyword() { 018 019 return fromKeyword; 020 } 021 022 private TErrorLoggingClause errorLoggingClause; 023 024 public void setErrorLoggingClause(TErrorLoggingClause errorLoggingClause) { 025 this.errorLoggingClause = errorLoggingClause; 026 } 027 028 public TErrorLoggingClause getErrorLoggingClause() { 029 030 return errorLoggingClause; 031 } 032 033 /** 034 * sql server option clause 035 * @see gudusoft.gsqlparser.nodes.mssql.TOptionClause 036 */ 037 private TOptionClause optionClause; 038 039 public void setOptionClause(TOptionClause optionClause) { 040 this.optionClause = optionClause; 041 } 042 043 public TOptionClause getOptionClause() { 044 045 return optionClause; 046 } 047 048 private TSourceToken deleteToken = null; 049 050 public void setDeleteToken(TSourceToken deleteToken) { 051 this.deleteToken = deleteToken; 052 } 053 054 public TSourceToken getDeleteToken() { 055 056 return this.deleteToken; 057 } 058 059 public TTopClause getTopClause() { 060 return topClause; 061 } 062 063 private TTopClause topClause = null; 064 065 public TFromTable getTargetTable() { 066 return targetTable; 067 } 068 069 private TFromTable targetTable = null; 070 071 public TReturningClause getReturningClause() { 072 return returningClause; 073 } 074 075 public TWhereClause getWhereCondition() { 076 077 return whereCondition; 078 } 079 080 private TWhereClause whereCondition = null; 081 private TReturningClause returningClause = null; 082 083 public TCTEList cteList = null; 084 085 public void setReturningClause(TReturningClause returningClause) { 086 this.returningClause = returningClause; 087 } 088 089 public void setWhereCondition(TWhereClause whereCondition) { 090 this.whereCondition = whereCondition; 091 } 092 093 public TOutputClause getOutputClause() { 094 return outputClause; 095 } 096 097 public void setOutputClause(TOutputClause outputClause) { 098 this.outputClause = outputClause; 099 } 100 101 private TOutputClause outputClause = null; 102 103 public void setSourceTableList(TFromTableList sourceTableList) { 104 this.sourceTableList = sourceTableList; 105 } 106 107 /* 108 * this is used in teradata y file, for syntax like this: 109 * delete from a,b where a.f = b.f 110 */ 111 public void setTargetTableByTableList(TFromTableList sourceTableList) { 112 this.targetTable = sourceTableList.getFromTable(0); 113 if (sourceTableList.size() > 1){ 114 this.sourceTableList = new TFromTableList(); 115 for(int i=1;i<sourceTableList.size();i++){ 116 this.sourceTableList.addFromTable(sourceTableList.getFromTable(i)); 117 } 118 } 119 } 120 121 public void setTargetTable(TFromTable targetTable) { 122 this.targetTable = targetTable; 123 } 124 125 /* 126 * This Transact-SQL extension to DELETE allows specifying data from <table_source> and deleting the corresponding rows from the table in the first FROM clause. 127 * This extension, specifying a join, can be used instead of a subquery in the WHERE clause to identify rows to be removed. 128 * */ 129 130 public TFromTableList getSourceTableList() { 131 return sourceTableList; 132 } 133 134 private TFromTableList sourceTableList = null; 135 136 public void setReferenceTableList(TFromTableList referenceTableList) { 137 this.referenceTableList = referenceTableList; 138 } 139 140 /** 141 * MySQL syntax: 142 * delete table_name1.[*],table_name2.[*] ... 143 * from table_references 144 * <p> sourceTableList represents: table_name1.[*],table_name2.[*] ... 145 * <p> referenceTableList represents: table_references 146 * @return 147 */ 148 public TFromTableList getReferenceTableList() { 149 150 return referenceTableList; 151 } 152 153 private TFromTableList referenceTableList = null; 154 155 public void setTopClause(TTopClause topClause) { 156 this.topClause = topClause; 157 } 158 159 private TOrderBy orderByClause = null; 160 161 public void setOrderByClause(TOrderBy orderByClause) { 162 this.orderByClause = orderByClause; 163 } 164 165 public TOrderBy getOrderByClause() { 166 167 return orderByClause; 168 } 169 170 private TLimitClause limitClause = null; 171 172 public void setLimitClause(TLimitClause limitClause) { 173 this.limitClause = limitClause; 174 } 175 176 public TLimitClause getLimitClause() { 177 178 return limitClause; 179 } 180 181 private TIsolationClause isolationClause = null; 182 183 public void setIsolationClause(TIsolationClause isolationClause) { 184 this.isolationClause = isolationClause; 185 } 186 187 public TIsolationClause getIsolationClause() { 188 return isolationClause; 189 } 190 191 //couchbase 192 private TUseKeyIndex useKeyIndex; 193 194 public void setUseKeyIndex(TUseKeyIndex useKeyIndex) { 195 this.useKeyIndex = useKeyIndex; 196 } 197 198 public TUseKeyIndex getUseKeyIndex() { 199 200 return useKeyIndex; 201 } 202 203 private TReturningClause returning; 204 205 public void setReturning(TReturningClause returning) { 206 this.returning = returning; 207 } 208 209 public TReturningClause getReturning() { 210 211 return returning; 212 } 213}