1 package com.daffodilwoods.daffodildb.server.sql99.dql.tableexpression. 2 fromclause; 3 4 import java.util.*; 5 6 import com.daffodilwoods.daffodildb.server.serversystem.*; 7 import com.daffodilwoods.daffodildb.server.sql99.common.*; 8 import com.daffodilwoods.daffodildb.server.sql99.dql.execution.*; 9 import com.daffodilwoods.daffodildb.server.sql99.dql.listenerevents.*; 10 import com.daffodilwoods.daffodildb.server.sql99.dql.plan.*; 11 import com.daffodilwoods.daffodildb.server.sql99.dql.plan.condition.*; 12 import com.daffodilwoods.daffodildb.server.sql99.dql.plan.order.*; 13 import com.daffodilwoods.daffodildb.server.sql99.dql.plan.table.*; 14 import com.daffodilwoods.daffodildb.server.sql99.dql.queryexpression.*; 15 import com.daffodilwoods.daffodildb.server.sql99.dql.semanticchecker.*; 16 import com.daffodilwoods.daffodildb.server.sql99.expression.*; 17 import com.daffodilwoods.daffodildb.server.sql99.token.*; 18 import com.daffodilwoods.daffodildb.server.sql99.utils.*; 19 import com.daffodilwoods.database.resource.*; 20 21 33 public class derivedtableOptSRESERVEDWORD1206543922correlationnameOptparenderivedcolumnlist extends ViewAbstract implements com.daffodilwoods.daffodildb.utils.parser.StatementExecuter,tableprimary { 34 35 39 public parenderivedcolumnlist _Optparenderivedcolumnlist0; 40 41 45 public correlationname _correlationname1; 46 47 50 public SRESERVEDWORD1206543922 _OptSRESERVEDWORD12065439222; 51 52 56 public derivedtable _derivedtable3; 57 58 61 private TableDetails[] allTableDetails; 62 63 public void verifyValues(_VariableValueOperations variableValueOperation) throws 64 DException { 65 } 66 67 public void setDefaultValues(_VariableValueOperations variableValueOperation) throws 68 DException { 69 } 70 71 92 public _TablePlan[] getTablePlan(_ServerSession session, 93 _DatedFramework datedFrameWork, 94 _BVEPlan bvePlan, _OrderPlan orderPlan, 95 _QueryColumns queryColumns, 96 ConditionArray conditionArray) throws 97 DException { 98 return getViewPlan(session, tableDetails.cc, datedFrameWork, queryColumns, 99 bvePlan, orderPlan, conditionArray); 100 } 101 102 public _TablePlan[] getTablePlans(_ServerSession session, 103 _DatedFramework datedFrameWork, 104 _BVEPlan bvePlan, _OrderPlan orderPlan, 105 _QueryColumns queryColumns, 106 ConditionArray conditionArray) throws 107 DException { 108 return getTablePlan(session, datedFrameWork, bvePlan, orderPlan, 109 queryColumns, conditionArray); 110 } 111 112 protected _DatedFramework getAdjustedDatedFrameWork(_DatedFramework 113 datedFrameWork) throws DException { 114 if (datedFrameWork != null) { 115 TableDetails tableDetail = datedFrameWork.getTableDetails(); 116 if (tableDetail != null) { if (tableDetail == tableDetails) { 118 return datedFrameWork; 119 } 120 } 121 return null; } 123 return datedFrameWork; 124 } 125 126 147 private Object [][] getMappingOfColAndCD(queryexpression queryExpression) throws 148 DException { 149 String [] viewColumnNames = null; 150 ColumnDetails[] selectColumns = queryExpression.getSelectedColumns(); 151 if (_Optparenderivedcolumnlist0 != null) { 152 viewColumnNames = (String []) _Optparenderivedcolumnlist0.run(null); 153 } else { 154 return inCaseOfAllColumnsOfQuery(selectColumns); 155 } 156 if (viewColumnNames.length != selectColumns.length) { 157 throw new DException("DSE3533", null); 158 } 159 checkViewColumns(viewColumnNames); 160 int length = viewColumnNames.length; 161 Object [][] mappingOfColumnAndCD = new Object [length][2]; 162 for (int i = 0; i < length; ++i) { 163 if (!selectColumns[i].isValidForView()) { 164 throw new DException("DSE8207", null); 165 } 166 mappingOfColumnAndCD[i][0] = viewColumnNames[i]; 167 mappingOfColumnAndCD[i][1] = selectColumns[i]; 168 } 169 return mappingOfColumnAndCD; 170 } 171 172 177 private void checkViewColumns(String [] viewColumnNames) throws DException { 178 for (int i = 0, length = viewColumnNames.length; i < length - 1; ++i) { 179 String columnName = viewColumnNames[i]; 180 for (int j = i + 1; j < length; ++j) { 181 if (columnName.equalsIgnoreCase(viewColumnNames[j])) { 182 throw new DException("DSE3535", new Object [] {columnName, columnName}); 183 } 184 } 185 } 186 } 187 188 193 private Object [][] inCaseOfAllColumnsOfQuery(ColumnDetails[] columns) throws 194 DException { 195 int length = columns.length; 196 Object [][] mappingOfColumnAndCD = new Object [length][2]; 197 for (int i = 0; i < length; ++i) { 198 if (!columns[i].isValidForView()) { 199 throw new DException("DSE3534", null); 200 } 201 mappingOfColumnAndCD[i][0] = columns[i].getAppropriateColumn(); 202 mappingOfColumnAndCD[i][1] = columns[i]; 203 } 204 return mappingOfColumnAndCD; 205 } 206 207 public Object run(Object object) throws DException { 208 if(_Optparenderivedcolumnlist0 == null) 209 return _derivedtable3.run(object); 210 else 211 throw new UnsupportedOperationException ("Method run not supported"); 212 } 213 214 public TableDetails[] getTableDetails(_ServerSession serverSession, ColumnDetails[] queryColumns) throws 215 DException { 216 if (tableDetails == null) { 217 tableDetails = new TableDetails(); 218 tableDetails.setTableName(new String [] { (String ) _correlationname1.run(null)}); 219 SemanticChecker.initializeCatalogNameAndSchemaNameOfTable(tableDetails, 220 serverSession); 221 tableDetails.cc = _derivedtable3.getColumnCharacteristics(serverSession); 222 tableDetails.setTableType(TypeConstants.VIEW); 223 tableDetails.setAsFromSubQuery(); 224 queryexpression queryExpression = _derivedtable3._derivedtable0. 225 _tablesubquery0._queryexpression0; 226 viewObject = new ViewObject(queryExpression, 227 getMappingOfColAndCD(queryExpression)); 228 } 229 return new TableDetails[] {tableDetails}; 230 } 231 232 public _Reference[] checkSemantic(com.daffodilwoods.daffodildb.server.serversystem._ServerSession parent, ColumnDetails[] queryColumns, boolean checkUserRight) throws DException { 233 if(_Optparenderivedcolumnlist0 != null) 234 throw new UnsupportedOperationException ("Method not supported"); 235 queryexpression queryExpression = _derivedtable3._derivedtable0. 236 _tablesubquery0._queryexpression0; 237 238 if(queryExpression.getOrderByclause()!=null) 239 throw new DException("DSE8207",null); 241 if ((queryExpression.toString().toLowerCase().indexOf("contains")) > 0 ) { 242 throw new DException("DSE8152", null); 243 } 244 245 _Reference[] references1 = _derivedtable3.checkSemantic(parent, checkUserRight); 246 247 SemanticChecker.checkForDuplicateColumnsInvolved(queryExpression. 248 getSelectedColumns()); 249 return references1; 250 } 251 252 public ColumnDetails[] getColumnDetails() throws DException { 253 return _derivedtable3.getColumnDetails(); 254 } 255 256 public ParameterInfo[] getParameterInfo() throws DException { 257 return _derivedtable3.getParameterInfo(); 258 } 259 260 public void getColumnsIncluded(ArrayList aList) throws DException { 261 _derivedtable3.getColumnsIncluded(aList); 262 } 263 264 public void getTablesIncluded(ArrayList aList) throws DException { 265 _derivedtable3.getTablesIncluded(aList); 266 } 267 268 public Object [] getParameters(Object object) throws DException { 269 return _derivedtable3.getParameters(object); 270 } 271 272 public TableDetails[] getTablesForBlankInsert() throws DException { 273 throw new java.lang.UnsupportedOperationException ( 274 "Method getTablesForBlankInsert() not yet implemented."); 275 } 276 277 public void setTablesForInsertion(ColumnMappingHandler parm1, 278 _VariableValueOperations vv) throws com. 279 daffodilwoods.database.resource.DException { 280 281 throw new java.lang.UnsupportedOperationException ( 282 "Method setTablesForInsertion() not yet implemented."); 283 } 284 285 public TableDetails[] getAllTableDetails() throws DException { 286 if (allTableDetails == null) { 287 allTableDetails = _derivedtable3._derivedtable0._tablesubquery0._queryexpression0.getAllTableDetails(); 288 } 289 return allTableDetails; 290 } 291 292 public TableDetails[] getViewTableDetails() throws DException { 293 ArrayList list = new ArrayList(); 294 list.add(tableDetails); 295 TableDetails[] tables = _derivedtable3._derivedtable0._tablesubquery0. 296 _queryexpression0.getViewTableDetails(); 297 if (tables != null) { 298 list.addAll(Arrays.asList(tables)); 299 } 300 return list.isEmpty() ? null : 301 (TableDetails[]) list.toArray(new TableDetails[list.size()]); 302 } 303 304 public _Reference[] getUnderlyingReferences() throws DException { 305 return null; 306 } 307 308 public String toString() { 309 StringBuffer sb = new StringBuffer (); 310 sb.append(" "); 311 sb.append(_derivedtable3); 312 sb.append(" "); 313 if (_OptSRESERVEDWORD12065439222 != null) { 314 sb.append(_OptSRESERVEDWORD12065439222); 315 } 316 sb.append(" "); 317 sb.append(_correlationname1); 318 sb.append(" "); 319 if (_Optparenderivedcolumnlist0 != null) { 320 sb.append(_Optparenderivedcolumnlist0); 321 } 322 return sb.toString(); 323 } 324 325 public Object clone() throws CloneNotSupportedException { 326 derivedtableOptSRESERVEDWORD1206543922correlationnameOptparenderivedcolumnlist 327 tempClass = new 328 derivedtableOptSRESERVEDWORD1206543922correlationnameOptparenderivedcolumnlist(); 329 if (_Optparenderivedcolumnlist0 != null) { 330 tempClass._Optparenderivedcolumnlist0 = (parenderivedcolumnlist) 331 _Optparenderivedcolumnlist0.clone(); 332 } 333 tempClass._correlationname1 = (correlationname) _correlationname1.clone(); 334 if (_OptSRESERVEDWORD12065439222 != null) { 335 tempClass._OptSRESERVEDWORD12065439222 = (SRESERVEDWORD1206543922) 336 _OptSRESERVEDWORD12065439222.clone(); 337 } 338 tempClass._derivedtable3 = (derivedtable) _derivedtable3.clone(); 339 return tempClass; 340 } 341 342 } 343 | Popular Tags |