1 package com.daffodilwoods.daffodildb.server.sql99.dql.plan.table; 2 3 import com.daffodilwoods.daffodildb.server.datadictionarysystem.*; 4 import com.daffodilwoods.daffodildb.server.serversystem.*; 5 import com.daffodilwoods.daffodildb.server.sql99.common.*; 6 import com.daffodilwoods.daffodildb.server.sql99.dql.queryexpression.*; 7 import com.daffodilwoods.database.resource.*; 8 9 18 19 public class ViewObject implements _ViewObject { 20 21 25 26 private Object [][] mappingOfColumnAndCD; 27 28 31 32 private queryexpression queryExpression; 33 34 public ViewObject(queryexpression queryExpressionPassed) { 35 queryExpression = queryExpressionPassed; 36 } 37 38 public ViewObject(queryexpression queryExpressionPassed, Object [][] mappingOfColumnAndCD0) { 39 this(queryExpressionPassed); 40 mappingOfColumnAndCD = mappingOfColumnAndCD0; 41 } 42 43 50 51 public Object [][] getMappingOfColumnsAndColumnDetails(String [] viewColumnNames) throws DException { 52 if (mappingOfColumnAndCD != null) { 53 return mappingOfColumnAndCD; 54 } 55 int length = viewColumnNames.length; 56 ColumnDetails[] selectColumns = queryExpression.getSelectedColumns(); 57 mappingOfColumnAndCD = new Object [length][2]; 58 for (int i = 0; i < length; ++i) { 59 mappingOfColumnAndCD[i][0] = viewColumnNames[i]; 60 mappingOfColumnAndCD[i][1] = selectColumns[i]; 61 } 62 return mappingOfColumnAndCD; 63 } 64 65 71 72 public Object [][] getMappingOfColumnsAndColumnDetails() throws DException { 73 return mappingOfColumnAndCD; 74 } 75 76 80 81 public queryexpression getQueryExpression() { 82 return queryExpression; 83 } 84 85 94 95 public Object [] getForeignConstraintCharacteritics(String columnName, _ServerSession serverSession, _ColumnCharacteristics columnCharacteristics) throws DException { 96 if (mappingOfColumnAndCD == null) { 97 mappingOfColumnAndCD = getMappingOfColumnsAndColumnDetails(columnCharacteristics.getColumnNames()); 98 } 99 for (int i = 0, length = mappingOfColumnAndCD.length; i < length; i++) { 100 if ( ( (String ) mappingOfColumnAndCD[i][0]).equalsIgnoreCase(columnName)) { 101 ColumnDetails column = (ColumnDetails) mappingOfColumnAndCD[i][1]; 102 _ColumnCharacteristics columnCHS = column.getTable().cc; 103 return serverSession.getForeignConstraintCharacteritics(column.getTable().getQualifiedIdentifier(), column.getAppropriateColumn()); 104 } 105 } 106 throw new DException("DSE3515", new Object [] {columnName}); 107 } 108 } 109 | Popular Tags |