KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > daffodilwoods > daffodildb > server > sql99 > dml > fromsubquery


1 package com.daffodilwoods.daffodildb.server.sql99.dml;
2
3 import com.daffodilwoods.daffodildb.server.serversystem.*;
4 import com.daffodilwoods.daffodildb.server.sql99.*;
5 import com.daffodilwoods.daffodildb.server.sql99.common.*;
6 import com.daffodilwoods.daffodildb.server.sql99.dql.queryexpression.*;
7 import com.daffodilwoods.daffodildb.server.sql99.utils.*;
8 import com.daffodilwoods.database.resource.*;
9 import java.util.*;
10
11 public class fromsubquery implements com.daffodilwoods.daffodildb.utils.parser.StatementExecuter, insertcolumnsandsource {
12
13    public queryexpression _queryexpression0;
14    public dummyrule _Optdummyrule1;
15    public pareninsertcolumnlist _Optpareninsertcolumnlist2;
16    private _Reference[] references;
17    private ColumnDetails[] columnDetails;
18
19    /**
20     * This method returns the _Executer returned by the calling the run of Query Expression recieved
21     * It is for inserting multiple records through a select statement.
22     * @param obj
23     * @return _Executer
24     * @throws com.daffodilwoods.database.resource.DException
25     */

26
27    public Object JavaDoc run(Object JavaDoc obj) throws com.daffodilwoods.database.resource.DException {
28       _ServerSession ss = (_ServerSession) obj;
29       references = _queryexpression0.checkSemantic(ss, true);
30       _Executer executer = (_Executer) _queryexpression0.run(ss);
31       checkSemantic(ss);
32       return executer;
33    }
34
35    /**
36     * This method returns the parameters involved in the Query Specified.
37     * @param object
38     * @return Object[]
39     * @throws DException
40     */

41
42    public Object JavaDoc[] getParameters(Object JavaDoc object) throws DException {
43       return _queryexpression0.getParameters(object);
44    }
45
46    /**
47     * This method is for checking the validity of the columns, ie the cardinality
48     * @param length
49     * @throws DException
50     */

51
52    public void checkcolumnsValidity(int length) throws DException {
53       if (_queryexpression0.getSelectedColumns().length != length) {
54          throw new DException("DSE1256", null);
55       }
56    }
57
58    /**
59     * This method is for performing the syntax checking for the query Expression
60     * @param object
61     * @throws DException
62     */

63
64    public _Reference[] checkSemantic(_ServerSession object) throws DException {
65       return _queryexpression0.checkSemantic(object, true);
66    }
67
68    public ColumnDetails[] getColumnDetails() throws DException {
69       if (_Optpareninsertcolumnlist2 != null) {
70          if (columnDetails != null) {
71             return columnDetails;
72          }
73          columnDetails = _Optpareninsertcolumnlist2.getColumnDetails();
74          return columnDetails;
75       }
76       return null;
77    }
78
79    /**
80     * This method return the Parameter info of the Query Expression
81     * @return ParameterInfo[]
82     * @throws DException
83     */

84
85    public ParameterInfo[] getParameterInfo() throws DException {
86       return _queryexpression0.getParameterInfo();
87    }
88
89    /**
90     * This method returns the clone of it's own instance
91     * @return Object ( fromSubQuery )
92     * @throws CloneNotSupportedException
93     */

94
95    private int[] getCoulmnIntArray(_Reference[] ref) throws DException {
96       int[] toReturn = new int[ref.length];
97       for (int i = 0; i < ref.length; i++) {
98          toReturn[i] = ref[i].getIndex();
99       }
100       return toReturn;
101    }
102
103    public _Reference[] getReferences(TableDetails[] td) throws DException {
104       return references;
105    }
106
107    public Object JavaDoc clone() throws CloneNotSupportedException JavaDoc {
108       return this;
109    }
110
111    public String JavaDoc toString() {
112       StringBuffer JavaDoc sb = new StringBuffer JavaDoc();
113       sb.append(" ");
114       if (_Optpareninsertcolumnlist2 != null) {
115          sb.append(_Optpareninsertcolumnlist2);
116       }
117       sb.append(" ");
118       if (_Optdummyrule1 != null) {
119          sb.append(_Optdummyrule1);
120       }
121       sb.append(" ");
122       sb.append(_queryexpression0);
123       return sb.toString();
124    }
125
126    public void getTablesIncluded(ArrayList arrayList) throws DException{
127         _queryexpression0.getTablesIncluded(arrayList);
128       }
129
130
131
132 }
133
Popular Tags