KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > daffodilwoods > daffodildb > server > sql99 > common > searchcondition


1 package com.daffodilwoods.daffodildb.server.sql99.common;
2
3 import java.util.*;
4
5 import com.daffodilwoods.daffodildb.server.sql99.dql.execution.*;
6 import com.daffodilwoods.daffodildb.server.sql99.dql.plan.condition.*; //import com.daffodilwoods.daffodildb.server.sql99.common.BooleanValueExpressionAndBooleanValueExpression;//import com.daffodilwoods.daffodildb.server.sql99.common.BooleanValueExpressionAndBooleanValueExpression;
7
import com.daffodilwoods.daffodildb.server.sql99.expression.booleanvalueexpression.*; ////
8
import com.daffodilwoods.daffodildb.server.sql99.expression.expressionprimary.*;
9 import com.daffodilwoods.daffodildb.server.sql99.expression.rowvalueexpression.*;
10 import com.daffodilwoods.daffodildb.server.sql99.fulltext.expression.*;
11 import com.daffodilwoods.daffodildb.server.sql99.utils.*;
12 import com.daffodilwoods.database.resource.*;
13 import com.daffodilwoods.daffodildb.server.sql99.fulltext.expression.containsclause;
14 import com.daffodilwoods.database.utility.P;
15
16 public class searchcondition extends AbstractRowValueExpression implements com.daffodilwoods.daffodildb.utils.parser.StatementExecuter, TypeConstants {
17    public booleanvalueexpression _searchcondition0;
18
19    public void setDefaultValues(_VariableValueOperations variableValueOperation) throws DException {
20       _searchcondition0.setDefaultValues(variableValueOperation);
21    }
22
23    public boolean checkForSubQuery() throws DException {
24       return _searchcondition0.checkForSubQuery();
25    }
26
27    public _Reference[] getReferences(TableDetails[] tableDetails) throws DException {
28       _Reference[] result = _searchcondition0.getReferences(tableDetails);
29       ArrayList aList = new ArrayList();
30       getAllReferencesForSubQuery(aList, result, tableDetails);
31       _Reference[] res = (_Reference[]) aList.toArray(new _Reference[aList.size()]);
32       return res.length > 0 ? res : null;
33    }
34
35    private void getAllReferencesForSubQuery(ArrayList aList, _Reference[] references, TableDetails[] td) throws DException {
36       if (references == null) {
37          return;
38       }
39       for (int i = 0; i < references.length; i++) {
40          if (references[i] instanceof subquery) {
41             getAllReferencesForSubQuery(aList, ( (subquery) references[i])._queryexpression0.getReferences(td));
42          } else {
43             aList.add(references[i]);
44          }
45       }
46    }
47
48    private void getAllReferencesForSubQuery(ArrayList aList, _Reference[] references) throws DException {
49       if (references == null) {
50          return;
51       }
52       for (int i = 0; i < references.length; i++) {
53          if (references[i] instanceof subquery) {
54             getAllReferencesForSubQuery(aList, ( (subquery) references[i])._queryexpression0.getReferences(null));
55          } else {
56             aList.add(references[i]);
57          }
58       }
59    }
60
61    public Object JavaDoc run(Object JavaDoc object) throws com.daffodilwoods.database.resource.DException {
62       return _searchcondition0.run(object);
63    }
64
65    /**
66     * Checks the semantics. Calls the check semantic function of the boolean
67     * value expression.
68     * @param object
69     * @return _References[]
70     * @throws DException
71     */

72
73    public com.daffodilwoods.daffodildb.server.sql99.utils._Reference[] checkSemantic(com.daffodilwoods.daffodildb.server.serversystem._ServerSession object) throws DException {
74
75      /* Done by Kaushik on 25/08/2004 for Sequence releted work as told by Mr. Neeraj Khanna*/
76      _Reference[] unKnownReferences = _searchcondition0.checkSemantic(object);
77      if(unKnownReferences!=null){
78            for (int i = 0; i < unKnownReferences.length; i++) {
79               if (unKnownReferences[i].getReferenceType() == SimpleConstants.SEQUENCE) {
80                  throw new DException("DSE6008", null);
81               }
82            }
83         }
84
85       return unKnownReferences;
86    }
87
88    public ColumnDetails[] getColumnDetails() throws DException {
89       return _searchcondition0.getColumnDetails();
90    }
91
92    public booleanvalueexpression getWholeCondition() throws DException {
93       return _searchcondition0;
94    }
95
96    public Object JavaDoc[] getParameters(Object JavaDoc object) throws DException {
97       return _searchcondition0.getParameters(object);
98    }
99
100    public void getColumnsIncluded(ArrayList aList) throws DException {
101       _searchcondition0.getColumnsIncluded(aList);
102    }
103
104    public void getTablesIncluded(ArrayList aList) throws DException {
105       _searchcondition0.getTablesIncluded(aList);
106    }
107
108    public ParameterInfo[] getParameterInfo() throws DException {
109       return _searchcondition0.getParameterInfo();
110    }
111
112    public TableDetails[] getCorrespondingTableDetails(TableDetails[] td) throws DException {
113       if (_searchcondition0 instanceof JoinConditionTableGetter) {
114          return ( (JoinConditionTableGetter) _searchcondition0).getCorrespondingTablesInvolved(td);
115       }
116       return null;
117    }
118
119    public Object JavaDoc clone() throws CloneNotSupportedException JavaDoc {
120       searchcondition tempClass = new searchcondition();
121       tempClass._searchcondition0 = (booleanvalueexpression) _searchcondition0.clone();
122       return tempClass;
123    }
124
125    /**
126     * This method is used to verify the values given by the user
127     * corresponding to join-condition specified.
128     * If the values given mismatchs the join condition, exception is thrown.
129     */

130    public void verifyValues(_VariableValueOperations vv) throws DException {
131       if (_searchcondition0 instanceof JoinConditionTableGetter) {
132          ( (JoinConditionTableGetter) _searchcondition0).verifyValues(vv);
133       }
134    }
135
136    public AbstractRowValueExpression[] getChilds() {
137       AbstractRowValueExpression[] childs = new AbstractRowValueExpression[] { (AbstractRowValueExpression) _searchcondition0};
138       return childs;
139    }
140
141    public _QualifiedBVE getQualifiedBVE(TableDetails[] tableDetails) throws DException {
142       return _searchcondition0.getQualifiedBVE(tableDetails);
143    }
144
145    public _BVEPlan getExecutionPlan() throws DException {
146       return _searchcondition0.getExecutionPlan();
147    }
148
149    public String JavaDoc toString() {
150       StringBuffer JavaDoc sb = new StringBuffer JavaDoc();
151       sb.append(" ");
152       sb.append(_searchcondition0);
153       return sb.toString();
154    }
155
156    public _BVEPlan getBveExecutionPlan() throws DException {
157       return _searchcondition0.getExecutionPlan();
158    }
159
160    public boolean hasContainClause() throws DException {
161       if (_searchcondition0 instanceof containsclause)
162          return true;
163       else
164          return false;
165    }
166 }
167
Popular Tags