KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > daffodilwoods > daffodildb > server > sql99 > dql > tableexpression > fromclause > naturaljoin


1 package com.daffodilwoods.daffodildb.server.sql99.dql.tableexpression.fromclause;
2
3 import java.util.*;
4 import com.daffodilwoods.daffodildb.server.datadictionarysystem.*;
5 import com.daffodilwoods.daffodildb.server.serversystem.*;
6 import com.daffodilwoods.daffodildb.server.sql99.common.*;
7 import com.daffodilwoods.daffodildb.server.sql99.dql.execution.*;
8 import com.daffodilwoods.daffodildb.server.sql99.dql.listenerevents.*;
9 import com.daffodilwoods.daffodildb.server.sql99.dql.plan.*;
10 import com.daffodilwoods.daffodildb.server.sql99.dql.plan.condition.*;
11 import com.daffodilwoods.daffodildb.server.sql99.dql.plan.order.*;
12 import com.daffodilwoods.daffodildb.server.sql99.dql.plan.table.*;
13 import com.daffodilwoods.daffodildb.server.sql99.dql.queryexpression.*;
14 import com.daffodilwoods.daffodildb.server.sql99.expression.booleanvalueexpression.*;
15 import com.daffodilwoods.daffodildb.server.sql99.token.*;
16 import com.daffodilwoods.daffodildb.server.sql99.utils.*;
17 import com.daffodilwoods.daffodildb.utils.parser.*;
18 import com.daffodilwoods.database.resource.*;
19 import com.daffodilwoods.database.sqlinitiator.*;
20
21 /**
22  * Natural join is similar to its counterpart qualified join with the difference
23  * that condition is implicit on the common columns and if no common columns
24  * are present then it is similar to cross join.
25  * <p>Title: </p>
26  * <p>Description: </p>
27  * <p>Copyright: Copyright (c) 2003</p>
28  * <p>Company: </p>
29  * @author unascribed
30  * @version 1.0
31  */

32
33 public class naturaljoin implements com.daffodilwoods.daffodildb.utils.parser.StatementExecuter, joinedtable, Datatypes, TypeConstants, queryexpressionbody, non_joinqueryterm, tablereference {
34    /**
35     * tableprimary is on the right of the natural join
36     * e.g. select * from A NJ B
37     * B -- tablePrimary
38     */

39    public tableprimary _tableprimary0;
40    /**
41     * this is "JOIN"
42     */

43    public SRESERVEDWORD1206543922 _SRESERVEDWORD12065439221;
44    /**
45     * Optjoin type -- inner or outer
46     */

47    public jointype _Optjointype2;
48    /**
49     * this is "NATURAL"
50     */

51    public SRESERVEDWORD1206543922 _SRESERVEDWORD12065439223;
52    /**
53     * tablereference on the left of the NJ
54     */

55    public tablereference _tablereference4;
56
57    /**
58     * This is an instance of joinedtable that is initialized in the checkSemantic method.
59     */

60    private joinedtable apprpriateJoinTable;
61    /**
62     * This is a 2D mapping of the common columns found in the left and right tables
63     */

64    private Object JavaDoc[][] commonColumns;
65
66    /**
67     * Represents the tables of left side.
68     */

69
70    private TableDetails[] table1;
71
72    /**
73     * Represents the tabled of right side.
74     */

75
76    private TableDetails[] table2;
77
78    /**
79     * Represents all the tables lying under natural join.
80     */

81
82    private TableDetails[] tableDetails;
83    /**
84     * join condition is the condition that is initialized in the checkSemantic method.
85     */

86    private joinspecification joinCondition;
87
88    /**
89     * boolean flag used for the purpose that common columns of implicit condition
90     * are added only once to columns of query.
91     */

92
93    private boolean firstTime = true;
94
95    public naturaljoin() {
96    }
97
98    /**
99     * This method is used to obtain the plan of natural join. Since condition
100     * is implict, the columns of conditions are added to query columns. And for
101     * obtaining plan call is delegated to appropriate join. It makes a
102     * natural full join plan in case when join type of natural join is full outer
103     * join.
104     * @param serverSession
105     * @param datedFrameWork
106     * @param bvePlan0
107     * @param orderPlan0
108     * @param queryColumns
109     * @param conditionArray
110     * @return _TablePlan[]
111     * @throws DException
112     */

113    public _TablePlan[] getTablePlans(_ServerSession serverSession, _DatedFramework datedFrameWork, _BVEPlan bvePlan0, _OrderPlan orderPlan0, _QueryColumns queryColumns0, ConditionArray conditionArray) throws DException {
114       if (joinCondition != null && firstTime) {
115          queryColumns0.addColumnDetails(joinCondition.getColumnDetails());
116       }
117       _TablePlan[] tp = apprpriateJoinTable.getTablePlans(serverSession, datedFrameWork, bvePlan0, orderPlan0, queryColumns0, conditionArray);
118       if (tp.length == 1 && tp[0] instanceof QualifiedFullPlan) {
119          QualifiedFullPlan qfp = (QualifiedFullPlan) tp[0];
120          return new _TablePlan[] {new NaturalFullJoinPlan(qfp.getFirstPlan(), qfp.getSecondPlan(), qfp.getCondition(), qfp.getLeftPlan(), serverSession, commonColumns)};
121       }
122       return tp;
123    }
124
125
126    /**
127     * It is similar to getTablePlans.
128     * @param serverSession
129     * @param datedFramWork
130     * @param bvePlan0
131     * @param orderPlan0
132     * @param queryColumns0
133     * @param conditionArray
134     * @return _TablePlan[]
135     * @throws DException
136     */

137    public _TablePlan[] getTablePlan(_ServerSession serverSession, _DatedFramework datedFramWork, _BVEPlan bvePlan0, _OrderPlan orderPlan0, _QueryColumns queryColumns0, ConditionArray conditionArray) throws DException {
138       return getTablePlans(serverSession, datedFramWork, bvePlan0, orderPlan0, queryColumns0, conditionArray);
139    }
140
141    /**
142     * This method is used to perform semantic checking of underlying children
143     * and returns those objects which are not solvable by select query.
144     * @param serverSession
145     * @param queryColumns
146     * @param checkUserRight
147     * @return
148     * @throws DException
149     */

150
151    public _Reference[] checkSemantic(com.daffodilwoods.daffodildb.server.serversystem._ServerSession serverSession, ColumnDetails[] queryColumns, boolean checkUserRight) throws DException {
152       _Reference[] references = _tablereference4.checkSemantic(serverSession, queryColumns, checkUserRight);
153       references = GeneralPurposeStaticClass.getJointReferences(_tableprimary0.checkSemantic(serverSession, queryColumns, checkUserRight), references);
154       return references;
155    }
156
157    /**
158     * returns the appropriate tables of left side.
159     * @param joinType
160     * @return
161     */

162    private TableDetails[] getLeftTableDetails(int joinType) {
163       return joinType == RIGHT_OUTER_JOIN ? table2 : table1;
164    }
165
166    /**
167     * returns the appropriate tables of right side.
168     * @param joinType
169     * @return
170     */

171    private TableDetails[] getRightTableDetails(int joinType) {
172       return joinType == RIGHT_OUTER_JOIN ? table1 : table2;
173    }
174
175    /**
176     * this method initializes the appropiateJoinedTable based on the join type
177     * of natural join --
178     * We have the join condition which we pass to the constructor of the qualifed
179     * join class. The returned object is returned and is initialized as the
180     * appropiatejointable
181     * @param joinType
182     * @param joinCondition
183     * @param commonColumns
184     * @return
185     * @throws DException
186     */

187    private joinedtable getAppropraieJoinedTable(int joinType, joinspecification joinCondition, Object JavaDoc[][] commonColumns) throws DException {
188       return new qualifiedjoin(joinCondition, _tablereference4, _tableprimary0, _Optjointype2, table1, table2, joinType);
189    }
190
191    /**
192     * This method returns the joinSpecification using the 2D mapping of common columns.
193     * we create a new object of the Natural join predicate using the two columnDetails present in the mapping.
194     * we merge this predicate using 'and' operator to the joinSpecification
195     * we return this join specification
196     * -----
197     * e.g. select * from B natural join C;
198     * both B and c contain b1 ,b2 columns--
199     * the mapping would look like
200     * [B.b1][C.b1]
201     * [B.b2][C.b2]
202     * and the final join condition would be B.b1 = C.b1 and B.b2 = C.b2
203     * And this is returned
204     * @param commonColumns
205     * @return
206     * @throws DException
207     */

208    private joinspecification getConditionOfCommonColumns(Object JavaDoc[][] commonColumns) throws DException {
209       booleanvalueexpression joinCondition = null;
210       for (int i = 0; i < commonColumns.length; i++) {
211          ColumnDetails[] columns = (ColumnDetails[]) commonColumns[i];
212          joinCondition = BVEPlanMerger.addAndConditions(joinCondition, BVEPlanMerger.getBooleanFactor(new NaturalJoinPredicate(columns[0], columns[1])));
213       }
214       joincondition condition = new joincondition(joinCondition);
215       return condition;
216    }
217
218    /**
219     * Checks for Valid query Columns this function eliminates cases such as.
220     * Select A.* from A NJ B
221     * @param queryColumns
222     * @throws DException
223     */

224    private void checkForValidQueryColumns(ColumnDetails[] queryColumns) throws DException {
225       for (int i = 0; i < queryColumns.length; i++) {
226          if (queryColumns[i].getColumn().equalsIgnoreCase("*") && queryColumns[i].getColumnName().length != 1) {
227             for (int j = 0; j < tableDetails.length; j++) {
228                if (ifMatch(queryColumns[i].getColumnName(), tableDetails[j].getTableName())) {
229                   throw new DException("DSE3576", new Object JavaDoc[] {queryColumns[i].getAppropriateQualifiedName()});
230                }
231             }
232          }
233       }
234    }
235
236    /**
237     * This function checks for common columns in the tables on the left and those
238     * on the right of the NJ and returns a 2D mapping of common columns-----
239     * e.g.
240     * select * from A LOJ B
241     * If A and B both have a column named id then the mapping will contain [A.id] [B.id]
242     * ALGO::::::::::::::::::::::::::::
243     * Check for each columns of both tables.
244     * if both the columns have the same name
245     * if the datatypes of the two columns are comparable
246     * then we check if either side has more than one such column
247     * +++++ e.g. select * from ( A inner join B )NJ C in this case the table reference on the left has two 'id ' columns
248     * if this is the case then we throw an exception that is caught by the checksemantic function and
249     * it convert the NJ into CJ.
250     * else -- no duplicate columns on either side
251     * we check for qualified column names-- eg. A.id
252     * +++ e.g. select A.id from A NJ B -- this is an error as common columns cannot have qualified names
253     * if a qualified name is present we throw an exception.
254     * else we add the common column to the list of the excluded common columns in the RIGHT table.
255     * +++ e.g. select * from A NJ B we add the 'id' to the list of excluded columns in B.
256     * finally we use the column details of the left and right columns in the mapping of common columns
257     *
258     *
259     * If the common column mapping is empty i.e. we have not found any common columns
260     * Then we throw an exception that is caught by the checkSemantic function and it initializes
261     * a Cross join.
262     *
263     * @param leftTables
264     * @param rightTables
265     * @param queryColumns
266     * @return
267     * @throws DException
268     */

269    private Object JavaDoc[][] checkForCommonColumnsAndDatatypeCompatabilityModified(TableDetails[] leftTables, TableDetails[] rightTables, ColumnDetails[] queryColumns) throws DException {
270       ArrayList commonColumns = new ArrayList(5);
271       for (int i = 0; i < leftTables.length; i++) {
272          String JavaDoc[] leftColumns = leftTables[i].getColumnsExcludingCommonColumns();
273          outerLoop:for (int j = 0; j < leftColumns.length; j++) { // for each columns from left we are looking for right side column match
274
for (int k = 0; k < rightTables.length; k++) {
275                String JavaDoc[] rightColumns = rightTables[k].getColumnsExcludingCommonColumns();
276                for (int l = 0; l < rightColumns.length; l++) {
277                   if (leftColumns[j].equalsIgnoreCase(rightColumns[l])) {
278                      if (isDataTypeCompatibile(leftColumns[j], leftTables[i], rightTables[k])) {
279                         checkForIdenticalColumns(leftColumns[j], i + 1, leftTables);
280                         checkForIdenticalColumns(rightColumns[l], k + 1, rightTables);
281                         checkForQualifiedName(leftColumns[j], leftTables[i], rightTables[k], queryColumns);
282                         rightTables[k].addCommonColumn(rightColumns[l]);
283                         ColumnDetails leftColumn = getColumnDetail(rightColumns[l], leftTables[i]);
284                         ColumnDetails rightColumn = getColumnDetail(rightColumns[l], rightTables[k]);
285                         commonColumns.add(new ColumnDetails[] {leftColumn, rightColumn});
286                         continue outerLoop;
287                      }
288                   }
289                }
290             }
291          }
292       }
293       if (commonColumns.isEmpty()) {
294          throw new DException("DSE3577", null);
295       }
296       return (Object JavaDoc[][]) commonColumns.toArray(new Object JavaDoc[commonColumns.size()][2]);
297    }
298
299    /**
300     * This Function test whether the columns passed are of compatible data types or not.
301     * @param columnName
302     * @param leftTable
303     * @param rightTable
304     * @return
305     * @throws DException
306     */

307    private boolean isDataTypeCompatibile(String JavaDoc
308                                          columnName, TableDetails leftTable, TableDetails rightTable
309                                          ) throws DException {
310       int leftDataType = leftTable.getDataType(columnName);
311       int rightDataType = rightTable.getDataType(columnName);
312       try {
313          Check.checkForDatatype(leftDataType, rightDataType);
314       } catch (DException ex) {
315          return false;
316       }
317       return true;
318    }
319
320    /** Check for qualified name in the query columns.
321     * select A.id from A NJ B --- where both A and B contain a column named id.
322     * this method throws an exception if it finds such a column.
323     * Algo ::::::
324     * A column name is passed to this method and a list of query columns
325     * for each query column we check
326     * if the name of the query column is the same as the column name passed.
327     *
328     * @param columnName
329     * @param leftTable
330     * @param rightTable
331     * @param queryColumns
332     * @throws DException
333     */

334    private void checkForQualifiedName(String JavaDoc columnName, TableDetails leftTable, TableDetails rightTable, ColumnDetails[] queryColumns) throws DException {
335       for (int i = 0; i < queryColumns.length; i++) {
336          String JavaDoc queryColumnName = queryColumns[i].getAppropriateColumn();
337          if (queryColumnName.equalsIgnoreCase(columnName)) {
338             if (ifQueryColumnExistInNJTable(leftTable, queryColumns[i]) ||
339                 ifQueryColumnExistInNJTable(rightTable, queryColumns[i])) {
340                throw new DException("DSE3576", new Object JavaDoc[] {queryColumns[i].getAppropriateQualifiedName()});
341             }
342          }
343       }
344    }
345
346    /**
347     * This method checks for identical columns on the same side of the Natural join
348     * e.g. select * from ( A Inner join B) NJ C
349     * in this case the left hand side of NJ has two columns named 'id' one belonging
350     * to A and one belonging to B. In such cases we convert Natural join into Cross join
351     * Algo :::::::
352     * We send an index -- we search for a column of the same name in only the tables ahead of this index
353     * e.g. select * from ( A inner join B ) NJ C
354
355     * here in this case we find a column id in A and C then we search in B for id
356     * if we find id in B we throw an exception.-----------------------------------;
357     * @param columnName
358     * @param indexToStart
359     * @param tables
360     * @throws DException
361     */

362    private void checkForIdenticalColumns(String JavaDoc columnName, int indexToStart, TableDetails[] tables) throws DException {
363       for (int i = indexToStart; i < tables.length; i++) {
364          String JavaDoc[] columns = tables[i].getColumnsExcludingCommonColumns();
365          for (int j = 0; j < columns.length; j++) {
366             if (columns[j].equalsIgnoreCase(columnName)) {
367                throw new DException("DSE3577", null);
368             }
369          }
370       }
371    }
372
373    /**
374     * this method returns an object of the column details.
375     * This method uses passed column name and the table for the creation of
376     * ColumnDetails.
377     * @param columnName
378     * @param table
379     * @return
380     * @throws DException
381     */

382    private ColumnDetails getColumnDetail(String JavaDoc columnName, TableDetails table) throws
383        DException {
384       ColumnDetails columnDetail = new ColumnDetails();
385       String JavaDoc[] tableName = table.getTableName();
386       String JavaDoc[] column = new String JavaDoc[4];
387       System.arraycopy(tableName, 0, column, 0, tableName.length);
388       column[3] = columnName;
389       columnDetail.setColumnName(column);
390       columnDetail.setTableDetails(table);
391       columnDetail.setTableForDisplay(table);
392       columnDetail.setDatatype(table.getDataType(columnName));
393       columnDetail.setSize(table.getSize(columnName));
394       columnDetail.setType(REFERENCE);
395       columnDetail.setExpression(column[2] + "." + column[3]);
396       return columnDetail;
397    }
398
399    /**
400     * This method is used to check whether passed column exists in the passed
401     * table.
402     * @param table
403     * @param queryColumn
404     * @return
405     * @throws DException
406     */

407
408    private boolean ifQueryColumnExistInNJTable(TableDetails table,
409                                                ColumnDetails queryColumn) throws
410        DException {
411       String JavaDoc[] qualifiedColumnName = queryColumn.getColumnName();
412       String JavaDoc[] qualifiedTableName = table.getTableName();
413       return ifMatch(qualifiedColumnName, qualifiedTableName);
414    }
415
416    /**
417     * This method returns true if the qualified names of the column and the tables match.
418     * @param qualifiedColumnName
419     * @param qualifiedTableName
420     * @return
421     * @throws DException
422     */

423    private boolean ifMatch(String JavaDoc[] qualifiedColumnName, String JavaDoc[] qualifiedTableName) throws DException {
424       int i = 0, j = 0;
425       for (; i < qualifiedColumnName.length - 1 && j < qualifiedTableName.length; ++j, ++i) {
426          if (!qualifiedColumnName[i].equalsIgnoreCase(qualifiedTableName[j])) {
427             --i;
428          }
429       }
430       if (i == qualifiedColumnName.length - 1 && j == qualifiedTableName.length) {
431          return true;
432       }
433       return false;
434    }
435
436    /**
437     * This method is used to find out the join type.
438     * @return
439     * @throws DException
440     */

441
442    private int getJoinType() throws DException {
443       String JavaDoc joinType = "";
444       if (_Optjointype2 != null) {
445          joinType = (String JavaDoc) _Optjointype2.run(null);
446       }
447       joinType += SqlKeywords.JOIN;
448       joinType = joinType.trim();
449       if (joinType.equalsIgnoreCase(SqlKeywords.INNERJOIN)) {
450          return INNERJOIN;
451       } else if (joinType.equalsIgnoreCase(SqlKeywords.LEFTOUTERJOIN)) {
452          return LEFT_OUTER_JOIN;
453       } else if (joinType.equalsIgnoreCase(SqlKeywords.LEFTJOIN)) {
454          return LEFT_OUTER_JOIN;
455       } else if (joinType.equalsIgnoreCase(SqlKeywords.RIGHTOUTERJOIN)) {
456          return RIGHT_OUTER_JOIN;
457       } else if (joinType.equalsIgnoreCase(SqlKeywords.RIGHTJOIN)) {
458          return RIGHT_OUTER_JOIN;
459       } else if (joinType.equalsIgnoreCase(SqlKeywords.FULLOUTERJOIN)) {
460          return FULL_OUTER_JOIN;
461       } else if (joinType.equalsIgnoreCase(SqlKeywords.FULLJOIN)) {
462          return FULL_OUTER_JOIN;
463       }
464       return INNERJOIN;
465    }
466
467    public Object JavaDoc run(Object JavaDoc object) throws com.daffodilwoods.database.resource.DException {
468       throw new DException("DSE16", new Object JavaDoc[] {"run"});
469    }
470
471    /**
472     * This method initializes table1---tables of the left side
473     * and table2 ---- tables of the right side
474     * It also performs semantic checking and initializations for this natural
475     * join. It is performed in this method because we needs the common columns
476     * at the top level for rest of semantic checking. Because the common columns
477     * can't be present with qualified name in any constructs of Select Query .
478     *
479     * In the case of natural joins we need to avoid the following cases
480     * A.*
481     * A.someCommonColumn - QualifiedColumn
482     * e.g.
483     * select A.* from A NJ B; Is incorrect,
484     * select A.id from A NJ B; Is incorrect if A.id is the common columns
485     * i.e. B also contains id.
486     * select C.id from A NJ B ,C ; Is Valid even if id is the common column.
487     * Algo::::::::::::::
488     * Firstly it checks for valid query columns --- this step eliminates the possibility
489     * Of A.* occuring.
490     * Next we check the for any common columns that have the same name and compatible data types...
491     * this is done by calling the method checkforCommon.... this method returns a 2D array of common
492     * columns.. this function eliminates the possibilty of columns such as A.id where id is a common column.
493     * Also this function if finds no common column then throws an exception that is
494     * Caught and cross join is initialized.
495     * next we initialize the join condition..
496     * After initializing the join condtion we initialize the appropiateJoinTable
497     * @param serverSession
498     * @return
499     * @throws DException
500     */

501
502    public TableDetails[] getTableDetails(com.daffodilwoods.daffodildb.server.serversystem._ServerSession serverSession, ColumnDetails[] queryColumns) throws DException {
503       if (tableDetails == null) {
504          table1 = _tablereference4.getTableDetails(serverSession, queryColumns);
505          table2 = _tableprimary0.getTableDetails(serverSession, queryColumns);
506          tableDetails = GeneralPurposeStaticClass.getJointTableDetails(table1, table2);
507          int joinType = getJoinType();
508          boolean isCross = false;
509          TableDetails[] leftTables = getLeftTableDetails(joinType);
510          TableDetails[] rightTables = getRightTableDetails(joinType);
511          checkForValidQueryColumns(queryColumns); // CheckForA.*
512
try {
513             commonColumns = checkForCommonColumnsAndDatatypeCompatabilityModified(leftTables, rightTables, queryColumns);
514             joinCondition = getConditionOfCommonColumns(commonColumns);
515             apprpriateJoinTable = getAppropraieJoinedTable(joinType, joinCondition, commonColumns);
516          } catch (DException ex) {
517             if (ex.getDseCode().equalsIgnoreCase("DSE3577")) {
518                apprpriateJoinTable = new crossjoin(_tablereference4, _tableprimary0,
519                    tableDetails);
520                isCross = true;
521             } else {
522                throw ex;
523             }
524          }
525       }
526       return tableDetails;
527    }
528
529    /**
530     * <br>This method gets the column details from the two table references and from the join specification</br>
531     * <br>Then concatenates all the three to from a single array of column details that it returns</br>
532     * @return ColumnDetails[]
533     * @throws DException
534     */

535    public ColumnDetails[] getColumnDetails() throws DException {
536       ColumnDetails[] columnDetails1 = _tablereference4.getColumnDetails();
537       ColumnDetails[] columnDetails2 = _tableprimary0.getColumnDetails();
538       ColumnDetails[] result = new ColumnDetails[columnDetails1.length + columnDetails2.length];
539       int i;
540       for (i = 0; i < columnDetails1.length; i++) {
541          result[i] = columnDetails1[i];
542       }
543       for (int j = 0; j < columnDetails2.length; j++, i++) {
544          result[i] = columnDetails2[j];
545       }
546       return result;
547    }
548
549    /**
550     * For the following methods, call is delegated to appropriate join.
551     */

552
553    public void getColumnsIncluded(ArrayList aList) throws DException {
554       apprpriateJoinTable.getColumnsIncluded(aList);
555    }
556
557    public void getTablesIncluded(ArrayList aList) throws DException {
558       apprpriateJoinTable.getTablesIncluded(aList);
559    }
560
561    public ParameterInfo[] getParameterInfo() throws DException {
562       return apprpriateJoinTable.getParameterInfo();
563    }
564
565    public Object JavaDoc[] getParameters(Object JavaDoc object) throws DException {
566       return apprpriateJoinTable.getParameters(object);
567    }
568
569    public _Reference[] getUnderlyingReferences() throws DException {
570       return apprpriateJoinTable.getUnderlyingReferences();
571    }
572
573    public TableDetails[] getTablesForBlankInsert() throws DException {
574       return apprpriateJoinTable.getTablesForBlankInsert();
575    }
576
577    public void setTablesForInsertion(ColumnMappingHandler columnMapping, _VariableValueOperations vv) throws com.daffodilwoods.database.resource.DException {
578       apprpriateJoinTable.setTablesForInsertion(columnMapping, vv);
579    }
580
581    public _BVEPlan getBveExecutionPlan() throws DException {
582       return apprpriateJoinTable.getBveExecutionPlan();
583    }
584
585    public TableDetails[] getAllTableDetails() throws DException {
586       return apprpriateJoinTable.getAllTableDetails();
587    }
588
589    public TableDetails[] getViewTableDetails() throws DException {
590       return apprpriateJoinTable.getViewTableDetails();
591    }
592
593    public void verifyValues(_VariableValueOperations variableValueOperation) throws DException {
594       apprpriateJoinTable.verifyValues(variableValueOperation);
595    }
596
597    public void setDefaultValues(_VariableValueOperations variableValueOperation) throws DException {
598       apprpriateJoinTable.setDefaultValues(variableValueOperation);
599    }
600
601    public String JavaDoc toString() {
602       StringBuffer JavaDoc clause = new StringBuffer JavaDoc();
603       clause.append(" ");
604       clause.append(_tablereference4.toString());
605
606       clause.append(" ");
607       clause.append(_SRESERVEDWORD12065439223.toString());
608
609       if (_Optjointype2 != null) {
610          clause.append(" ");
611          clause.append(_Optjointype2.toString());
612       }
613       clause.append(" ");
614       clause.append(_SRESERVEDWORD12065439221.toString());
615       clause.append(" ");
616       clause.append(_tableprimary0.toString());
617       return clause.toString().trim();
618
619    }
620
621    public Object JavaDoc clone() throws CloneNotSupportedException JavaDoc {
622       tablereference Tablereference4 = (tablereference) _tablereference4.clone();
623       SRESERVEDWORD1206543922 sNATURAL_18480732073 = (SRESERVEDWORD1206543922) _SRESERVEDWORD12065439223.clone();
624       jointype Jointype = null;
625       if (_Optjointype2 != null) {
626          Jointype = (jointype) _Optjointype2.clone();
627       }
628       SRESERVEDWORD1206543922 sJOIN22827941 = (SRESERVEDWORD1206543922) _SRESERVEDWORD12065439221.clone();
629       tableprimary Tableprimary0 = (tableprimary) _tableprimary0.clone();
630
631       naturaljoin Naturaljoin = new naturaljoin();
632       Naturaljoin._tablereference4 = Tablereference4;
633       Naturaljoin._SRESERVEDWORD12065439223 = sNATURAL_18480732073;
634       if (_Optjointype2 != null) {
635          Naturaljoin._Optjointype2 = Jointype;
636       }
637       Naturaljoin._SRESERVEDWORD12065439221 = sJOIN22827941;
638       Naturaljoin._tableprimary0 = Tableprimary0;
639       return Naturaljoin;
640    }
641
642    /**
643     * For detailed documentation refer the documentation of tablereferencelist.
644     * It adds the columns of implicit condition to query columns.
645     * @param session
646     * @param orderPlan
647     * @param bvePlan
648     * @param queryColumns
649     * @param conditionArray
650     * @param isUnderLoj
651     * @return
652     * @throws DException
653     */

654
655    public OrderMappingWithTableRefernces[] checkForOrderSequencePlan(_ServerSession session, _OrderPlan orderPlan, _BVEPlan bvePlan, _QueryColumns queryColumns, ConditionArray conditionArray, boolean isUnderLoj) throws DException {
656       if (joinCondition != null) {
657          firstTime = false;
658          queryColumns.addColumnDetails(joinCondition.getColumnDetails());
659       }
660       return apprpriateJoinTable.checkForOrderSequencePlan(session, orderPlan, bvePlan, queryColumns, conditionArray, isUnderLoj);
661    }
662
663
664    /**
665     * returns true if the query does not have where, orderby, groupby, having
666     * and union clause otherwise returns false. Its invoked only from
667     * SelectColumnIterator.
668     * @return boolean
669     * @throws DException
670     */

671
672    public boolean isSimpleQuery(_ServerSession session) throws DException {
673      return false;
674    }
675
676    /**
677     * The following methods are never called. These are just place holders.
678     */

679
680    public _Reference[] checkSemantic(_ServerSession session,_OrderByClause orderClause,boolean checkUserRight,boolean checkSetOperatorPresent) throws DException {
681       throw new DException("DSE565",new Object JavaDoc[]{"checkSemantic()"});
682    }
683    public QueryProperty getStrings() throws com.daffodilwoods.database.resource.DException {
684       /**@todo: Implement this com.daffodilwoods.daffodildb.server.sql99.dql.queryexpression.queryexpressionbody method*/
685       throw new java.lang.UnsupportedOperationException JavaDoc("Method getStrings() not yet implemented.");
686    }
687
688    public _TablePlan getExecutionPlan(_ServerSession session, booleanvalueexpression bve, _DatedFramework datedCondition, _Order order, ColumnDetails[] cdsWithActualTableDetails, ConditionArray conditionArray) throws DException {
689       /**@todo Implement this com.daffodilwoods.daffodildb.server.sql99.dql.queryexpression.queryexpressionbody method*/
690       throw new java.lang.UnsupportedOperationException JavaDoc("Method getExecutionPlan() not yet implemented.");
691    }
692
693    public void setFKeyColumnDetails(ColumnDetails[] parm1) throws com.daffodilwoods.database.resource.DException {
694       /**@todo Implement this com.daffodilwoods.daffodildb.server.sql99.dql.queryexpression.queryexpressionbody method*/
695       throw new java.lang.UnsupportedOperationException JavaDoc("Method setFKeyColumnDetails() not yet implemented.");
696    }
697
698    public ColumnDetails[] getSelectedColumns() throws com.daffodilwoods.database.resource.DException {
699       /**@todo Implement this com.daffodilwoods.daffodildb.server.sql99.dql.queryexpression.queryexpressionbody method*/
700       throw new java.lang.UnsupportedOperationException JavaDoc("Method getSelectedColumns() not yet implemented.");
701    }
702
703    public _TablePlan getExecutionPlan(_ServerSession parm1) throws com.daffodilwoods.database.resource.DException {
704       /**@todo Implement this com.daffodilwoods.daffodildb.server.sql99.dql.queryexpression.queryexpressionbody method*/
705       throw new java.lang.UnsupportedOperationException JavaDoc("Method getExecutionPlan() not yet implemented.");
706    }
707
708    public _ColumnCharacteristics getColumnCharacteristics(Object JavaDoc parm1) throws com.daffodilwoods.database.resource.DException {
709       /**@todo Implement this com.daffodilwoods.daffodildb.server.sql99.dql.queryexpression.queryexpressionbody method*/
710       throw new java.lang.UnsupportedOperationException JavaDoc("Method getColumnCharacteristics() not yet implemented.");
711    }
712
713    public _Reference[] getReferences(TableDetails[] tableDetails) throws DException {
714       throw new java.lang.UnsupportedOperationException JavaDoc("Method getReferences( TableDetails[] ) not yet implemented.");
715    }
716
717    public boolean isViewOptimizationPossible() throws DException {
718       throw new UnsupportedOperationException JavaDoc("Method isViewOptimizationPossible is not supported.");
719    }
720
721    public _TablePlan[] getTablePlans(_ServerSession session, booleanvalueexpression condition, _Order order, ColumnDetails[] columnDetails, ConditionArray conditionArray) throws DException {
722       throw new UnsupportedOperationException JavaDoc("Method getTablePlans() not supported");
723    }
724
725   public boolean hasConstantSelectedColumn(booleanvalueexpression bve) throws DException {
726       throw new java.lang.UnsupportedOperationException JavaDoc("Method hasConstantSelectedColumn() not yet implemented.");
727   }
728 }
729
730
Popular Tags