KickJava   Java API By Example, From Geeks To Geeks.

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


1 package com.daffodilwoods.daffodildb.server.sql99.dql.tableexpression.fromclause;
2
3 import java.util.*;
4
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.token.*;
13 import com.daffodilwoods.daffodildb.server.sql99.utils.*;
14 import com.daffodilwoods.database.resource.*;
15 import com.daffodilwoods.database.utility.P;
16
17 /**
18  * It represents fromclause of select query.From clause contain tablereferencelist
19  * from which data is selected
20  * e.g select * from A,B
21  * <p>Title: </p>
22  * <p>Description: </p>
23  * <p>Copyright: Copyright (c) 2004</p>
24  * <p>Company: </p>
25  * @author not attributable
26  * @version 1.0
27  */

28 public class fromclause implements com.daffodilwoods.daffodildb.utils.parser.StatementExecuter {
29   /**
30    * It represents tablereferencelist in fromclause
31    */

32   public tablereferencelist _tablereferencelist0;
33   /**
34    * It represents keyword 'From'
35    */

36   public SRESERVEDWORD1206543922 _SRESERVEDWORD12065439221;
37   /**
38    * It represents list of tabledetail involved in from clause
39    */

40   private TableDetails[] tableDetails;
41
42    /**
43     * This method is used to verify the values given by the user.
44     * <ol><li>Checks the conditional Column values given by user.
45     * If the values mismatchs the join condition, exception is thrown.</li>
46     * <li>Checks the values must satisfy where clause condition, if violates,
47     * exception is thrown</li></ol>
48     * This methods calls the verifyValues method for tablereference list specified in
49     * the from clause.
50     */

51
52    public void verifyValues(_VariableValueOperations variableValueOperation) throws DException {
53       _tablereferencelist0.verifyValues(variableValueOperation);
54    }
55
56    /**
57     * This method is used to set the default values according to where clause
58     * and join condition,<li><li>If user gives value of one of the join specification
59     * conditional column used in join condition, value is set for the unspecified
60     * conditonal column to maintain the join condition.</li> <li>If the where
61     * clause conditional column value is not given by the user, it is set
62     * as default value.</li></ol>
63     * This methods calls the setDefaultValues method for tablereference list specified in
64     * the from clause.
65     */

66    public void setDefaultValues(_VariableValueOperations variableValueOperation) throws DException {
67       _tablereferencelist0.setDefaultValues(variableValueOperation);
68    }
69    /**
70     * Note:-For documentation of following method refers to queryexpressionbody
71     * @param object
72     * @return
73     * @throws com.daffodilwoods.database.resource.DException
74     */

75    public Object JavaDoc run(Object JavaDoc object) throws com.daffodilwoods.database.resource.DException {
76       return _tablereferencelist0.run(object);
77    }
78
79    public ColumnDetails[] getColumnDetails() throws DException {
80       return _tablereferencelist0.getColumnDetails();
81    }
82
83    public TableDetails[] getTableDetails(_ServerSession session, ColumnDetails[] queryColumns) throws DException {
84       tableDetails = _tablereferencelist0.getTableDetails(session, queryColumns);
85       return tableDetails;
86    }
87
88    public Object JavaDoc[] getParameters(Object JavaDoc object) throws DException {
89       return _tablereferencelist0.getParameters(object);
90    }
91
92    public com.daffodilwoods.daffodildb.server.sql99.utils._Reference[] checkSemantic(com.daffodilwoods.daffodildb.server.serversystem._ServerSession parent, ColumnDetails[] queryColumns, boolean checkUserRight) throws DException {
93       return _tablereferencelist0.checkSemantic(parent, queryColumns, checkUserRight);
94    }
95
96    public void getColumnsIncluded(ArrayList aList) throws DException {
97       _tablereferencelist0.getColumnsIncluded(aList);
98    }
99
100    public void getTablesIncluded(ArrayList aList) throws DException {
101       _tablereferencelist0.getTablesIncluded(aList);
102    }
103
104    /**
105     * This method allows a user to get information about parameter(question mark)
106     * In this first get parameterinfo from tablereferencelist then check for each
107     * parameter whether it subquery or not,if it is subquery then get all parameter
108     * of subquery and add it to the resultantparameterlist.
109     * @return
110     * @throws DException
111     */

112    public ParameterInfo[] getParameterInfo() throws DException {
113       ParameterInfo[] pi = _tablereferencelist0.getParameterInfo();
114       return pi != null ? handleForSubQuery(pi) : pi;
115    }
116
117    private ParameterInfo[] handleForSubQuery(ParameterInfo[] pi) throws DException {
118       ArrayList temp = new ArrayList(5);
119       for (int i = 0; i < pi.length; i++) {
120          if (pi[i].getSubQuery()) {
121             ParameterInfo[] array = pi[i].getParameterInfoArray();
122             if (array != null) {
123                temp.addAll(Arrays.asList(array));
124             }
125          } else {
126             temp.add(pi[i]);
127          }
128       }
129       return (ParameterInfo[]) temp.toArray(new ParameterInfo[0]);
130    }
131
132    /**
133     * Returns the Array Of TablePlans for this from clause
134     * @param session
135     * @param datedCondition
136     * @param bvePlan
137     * @param orderPlan
138     * @param queryColumns
139     * @param conditionArray
140     * @return
141     * @throws DException
142     */

143
144    public _TablePlan[] getTablePlan(_ServerSession session, _DatedFramework datedCondition, _BVEPlan bvePlan, _OrderPlan orderPlan, _QueryColumns queryColumns, ConditionArray conditionArray) throws DException {
145       return _tablereferencelist0.getTablePlan(session, datedCondition, bvePlan, orderPlan, queryColumns, conditionArray);
146    }
147
148    /**
149     * This method is used to identify the tables that are required
150     * to complete the minimum requirements of the insert,update and delete
151     * in a select query (allcolumnIterator) with Qualified Joins Chain in the
152     * from clause. This method calls the getTablesForBlankInsert method of tablereferencelist
153     * specified in the from clause.
154     */

155
156    public TableDetails[] getTablesForBlankInsert() throws DException {
157       return _tablereferencelist0.getTablesForBlankInsert();
158    }
159
160    /**
161     * In this method columnMappingHandler is passed as parameter which maintains
162     * a list of the tables in which insertion will be made for a insert operation
163     * in select query with qualified join chain. This method adds the tables if there
164     * exists one or more tables for insert operation according to the values specified by the user.
165     * This methods calls the setTablesForInsertion method for tablereference list specified in
166     * the from clause.
167     */

168
169    public void setTablesForInsertion(ColumnMappingHandler mappingHandler, _VariableValueOperations vv) throws DException {
170       _tablereferencelist0.setTablesForInsertion(mappingHandler, vv);
171    }
172
173    public _BVEPlan getBveExecutionPlan() throws DException {
174       return _tablereferencelist0.getBveExecutionPlan();
175    }
176    /**
177     * Note:-For documenatation of follwoing method please referes to documentation
178     * of queryexpression body
179     * @return
180     * @throws DException
181     */

182    public TableDetails[] getAllTableDetails() throws DException {
183       return _tablereferencelist0.getAllTableDetails();
184    }
185
186    public _Reference[] getUnderlyingReferences() throws DException {
187       return _tablereferencelist0.getUnderlyingReferences();
188    }
189
190    public TableDetails[] getViewTableDetails() throws DException {
191       return _tablereferencelist0.getViewTableDetails();
192    }
193
194    public String JavaDoc toString() {
195       StringBuffer JavaDoc sb = new StringBuffer JavaDoc();
196       sb.append(" ");
197       sb.append(_SRESERVEDWORD12065439221);
198       sb.append(" ");
199       sb.append(_tablereferencelist0);
200       return sb.toString();
201    }
202
203    public Object JavaDoc clone() throws CloneNotSupportedException JavaDoc {
204       fromclause tempClass = new fromclause();
205       tempClass._tablereferencelist0 = (tablereferencelist) _tablereferencelist0.clone();
206       tempClass._SRESERVEDWORD12065439221 = (SRESERVEDWORD1206543922) _SRESERVEDWORD12065439221.clone();
207       return tempClass;
208    }
209
210    /* Method written by Kaushik 0n 12-07-2004
211     * For Details :: refer tableexpression.isSimpleQuery()
212     */

213    public boolean isSimpleQuery(_ServerSession serverSession) throws DException {
214      return _tablereferencelist0.isSimpleQuery(serverSession);
215
216    }
217
218 }
219
Popular Tags