KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > derby > iapi > sql > execute > ExecutionFactory


1 /*
2
3    Derby - Class org.apache.derby.iapi.sql.execute.ExecutionFactory
4
5    Licensed to the Apache Software Foundation (ASF) under one or more
6    contributor license agreements. See the NOTICE file distributed with
7    this work for additional information regarding copyright ownership.
8    The ASF licenses this file to you under the Apache License, Version 2.0
9    (the "License"); you may not use this file except in compliance with
10    the License. You may obtain a copy of the License at
11
12       http://www.apache.org/licenses/LICENSE-2.0
13
14    Unless required by applicable law or agreed to in writing, software
15    distributed under the License is distributed on an "AS IS" BASIS,
16    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17    See the License for the specific language governing permissions and
18    limitations under the License.
19
20  */

21
22 package org.apache.derby.iapi.sql.execute;
23
24 import org.apache.derby.iapi.sql.Activation;
25
26 import org.apache.derby.iapi.error.StandardException;
27 import org.apache.derby.iapi.sql.conn.LanguageConnectionContext;
28 import org.apache.derby.iapi.sql.Activation;
29 import org.apache.derby.iapi.sql.ResultColumnDescriptor;
30 import org.apache.derby.iapi.sql.ResultDescription;
31
32 import org.apache.derby.iapi.store.access.DynamicCompiledOpenConglomInfo;
33 import org.apache.derby.iapi.store.access.Qualifier;
34 import org.apache.derby.iapi.sql.dictionary.IndexRowGenerator;
35 import org.apache.derby.iapi.store.access.StaticCompiledOpenConglomInfo;
36 import org.apache.derby.iapi.store.access.TransactionController;
37 import java.util.Properties JavaDoc;
38 import org.apache.derby.iapi.services.io.FormatableBitSet;
39
40 import org.apache.derby.iapi.services.loader.GeneratedMethod;
41 import org.apache.derby.iapi.services.context.ContextManager;
42
43 import org.apache.derby.catalog.TypeDescriptor;
44 import org.apache.derby.catalog.UUID;
45
46 /**
47     This is the factory for creating a factories needed by
48     execution per connection, and the context to hold them.
49     <p>
50     There is expected to be one of these configured per database.
51     <p>
52     If a factory is needed outside of execution (say,
53     data dictionary or compilation), then it belongs in the
54     LanguageConnectionContext.
55
56     @see org.apache.derby.iapi.sql.conn.LanguageConnectionContext
57     @author ames
58  */

59 public interface ExecutionFactory {
60
61         /**
62         Module name for the monitor's module locating system.
63      */

64     String JavaDoc MODULE = "org.apache.derby.iapi.sql.execute.ExecutionFactory";
65
66     /**
67         Only one result set factory is needed for a database
68         in the system.
69         We require that an execution factory be configured for
70         each database. Each execution factory then needs to
71         know about the result set factory it is maintaining
72         for its database, so that it can provide it through
73         calls to this method.
74         So, we reuse the result set factory by making it
75         available to each connection
76         in that connection's execution context.
77
78         @return the result set factory for this database.
79      */

80     ResultSetFactory getResultSetFactory();
81
82     /**
83         We want an execution context so that we can push it onto
84         the stack. We could instead require the implementation
85         push it onto the stack for us, but this way we know
86         which context object exactly was pushed onto the stack.
87
88         @param cm the context manager
89      */

90     ExecutionContext newExecutionContext(ContextManager cm);
91
92     /**
93      * Create an execution time ResultColumnDescriptor from a
94      * compile time RCD.
95      *
96      * @param compileRCD The compile time RCD.
97      *
98      * @return The execution time ResultColumnDescriptor
99      */

100     ResultColumnDescriptor getResultColumnDescriptor(ResultColumnDescriptor compileRCD);
101
102     /**
103      * Create a result description given parameters for it.
104      */

105     ResultDescription getResultDescription(ResultColumnDescriptor[] columns,
106         String JavaDoc statementType);
107
108     /**
109      * Get an array of ScanQualifiers for a scan. ScanQualifiers are used
110      * with the DataDictionary.
111      *
112      * @param numQualifiers The number of ScanQualifiers to get.
113      */

114     ScanQualifier[][] getScanQualifier(int numQualifiers);
115
116     /**
117      * Release a ScanQualifier[] (back to the pool or free it).
118      */

119
120     void releaseScanQualifier(ScanQualifier[][] scanQualifiers);
121
122     /**
123      * Get a Qualifier to use with a scan of a conglomerate.
124      *
125      * @param columnId The store id of the column to qualify
126      * @param operator One of Orderable.ORDER_OP_EQUALS,
127      * Orderable.ORDER_OP_LESSTHAN,
128      * or Orderable.ORDER_OP_LESSOREQUALS
129      * @param orderableGetter A generated method that returns the
130      * Orderable to be compared with the column
131      * @param activation The Activation that acts as the receiver for the
132      * generated method
133      * @param orderedNulls True means that null == null for the sake of
134      * this Qualifier
135      * @param unknownRV The value to return if the comparison between
136      * the column and the Orderable value returns the
137      * unknown truth value
138      * @param negateCompareResult True means to negate the result of the comparison.
139      * So, for example, to do a > comparison, you would
140      * pass ORDER_OP_LESSOREQUALS and set negate to true.
141      * @param variantType The variantType for the qualifier's orderable.
142      * (Determines whether or not to cache the value.)
143      *
144      * @return A new Qualifier
145      */

146     Qualifier getQualifier(int columnId,
147                            int operator,
148                            GeneratedMethod orderableGetter,
149                            Activation activation,
150                            boolean orderedNulls,
151                            boolean unknownRV,
152                            boolean negateCompareResult,
153                            int variantType);
154
155     /**
156       Create a new RowChanger for performing update and delete
157       operations based on full before and after rows.
158
159       @param heapConglom Conglomerate # for the heap
160       @param heapSCOCI The SCOCI for the heap.
161       @param heapDCOCI The DCOCI for the heap.
162       @param irgs the IndexRowGenerators for the table's indexes. We use
163         positions in this array as local id's for indexes. To support updates,
164         only indexes that change need be included.
165       @param indexCIDS the conglomerateids for the table's idexes.
166         indexCIDS[ix] corresponds to the same index as irgs[ix].
167       @param indexSCOCIs the SCOCIs for the table's idexes.
168         indexSCOCIs[ix] corresponds to the same index as irgs[ix].
169       @param indexDCOCIs the DCOCIs for the table's idexes.
170         indexDCOCIs[ix] corresponds to the same index as irgs[ix].
171       @param numberOfColumns Number of columns in a full row.
172       @param tc the transaction controller
173       @param streamStorableHeapColIds Column ids of stream storable
174              columns. (0 based, Only needed for sync. null if none or
175              not needed).
176       @param activation The Activation.
177       @exception StandardException Thrown on error
178       */

179     public RowChanger
180     getRowChanger(long heapConglom,
181                   StaticCompiledOpenConglomInfo heapSCOCI,
182                   DynamicCompiledOpenConglomInfo heapDCOCI,
183                   IndexRowGenerator[] irgs,
184                   long[] indexCIDS,
185                   StaticCompiledOpenConglomInfo[] indexSCOCIs,
186                   DynamicCompiledOpenConglomInfo[] indexDCOCIs,
187                   int numberOfColumns,
188                   TransactionController tc,
189                   int[] changedColumnIds,
190                   int[] streamStorableHeapColIds,
191                   Activation activation) throws StandardException;
192
193     /**
194       Create a new RowChanger for doing insert update and delete
195       operations based on partial before and after.
196
197       @param heapConglom Conglomerate # for the heap
198       @param heapSCOCI The SCOCI for the heap.
199       @param heapDCOCI The DCOCI for the heap.
200       @param irgs the IndexRowGenerators for the table's indexes. We use
201         positions in this array as local id's for indexes. To support updates,
202         only indexes that change need be included.
203       @param indexCIDS the conglomerateids for the table's idexes.
204         indexCIDS[ix] corresponds to the same index as irgs[ix].
205       @param indexSCOCIs the SCOCIs for the table's idexes.
206         indexSCOCIs[ix] corresponds to the same index as irgs[ix].
207       @param indexDCOCIs the DCOCIs for the table's idexes.
208         indexDCOCIs[ix] corresponds to the same index as irgs[ix].
209       @param numberOfColumns Number of columns in partial row.
210       @param tc the transaction controller
211       @param changedColumnIds array of 1 based ints of columns
212         to be updated. Used by update only.
213       @param baseRowReadList the columns in the base row that were
214         read (1 based)
215       @param baseRowReadMap baseRowReadMap[heapColId]->readRowColId
216              (0 based)
217       @param streamStorableColIds Column ids of stream storable
218              columns. (0 based, Only needed for sync. null if none or
219              not needed).
220       @param activation The Activation.
221
222       @exception StandardException Thrown on error
223       */

224     public RowChanger
225     getRowChanger(long heapConglom,
226                   StaticCompiledOpenConglomInfo heapSCOCI,
227                   DynamicCompiledOpenConglomInfo heapDCOCI,
228                   IndexRowGenerator[] irgs,
229                   long[] indexCIDS,
230                   StaticCompiledOpenConglomInfo[] indexSCOCIs,
231                   DynamicCompiledOpenConglomInfo[] indexDCOCIs,
232                   int numberOfColumns,
233                   TransactionController tc,
234                   int[] changedColumnIds,
235                   FormatableBitSet baseRowReadList,
236                   int[] baseRowReadMap,
237                   int[] streamStorableColIds,
238                   Activation activation) throws StandardException;
239
240
241     // Methods from old RowFactory interface
242
/**
243         This returns a new row that is storable but not indexable
244      */

245     public ExecRow getValueRow(int numColumns);
246
247     /**
248         This returns an indexable row
249      */

250     public ExecIndexRow getIndexableRow(int numColumns);
251
252     /**
253         This returns the value row as an indexable row
254      */

255     public ExecIndexRow getIndexableRow(ExecRow valueRow);
256
257     /**
258         This returns the value row as an indexable row, reusing the passed
259         in ExecIndexRow if non-null.
260      */

261     //public ExecIndexRow getIndexableRow(ExecRow valueRow, ExecIndexRow sourceExecIndexRow);
262

263
264    /**
265      Packages up a clump of constants which the Plugin uses at execute()
266      time for COPY PUBLICATION.
267     */

268     public Object JavaDoc getJdbcCopyConstants
269     (
270         int[][] paramReferences,
271         TypeDescriptor[][] columnTypes,
272         int[][] publishedTableSchemaCounts
273     );
274
275    /**
276      Packages up a clump of constants which the Plugin uses at execute()
277      time for CREATE PUBLICATION.
278     */

279     public Object JavaDoc getJdbcCreateConstants
280     (
281         UUID[] publishedJarFileIDs,
282         Object JavaDoc publishedItems,
283         int[][] tableSchemaCounts
284     );
285
286 }
287
Popular Tags