KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > derby > vti > IFastPath


1 /*
2
3    Derby - Class org.apache.derby.vti.IFastPath
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.vti;
23
24 import org.apache.derby.iapi.types.DataValueDescriptor;
25 import org.apache.derby.iapi.error.StandardException;
26 import java.sql.ResultSet JavaDoc;
27 import java.sql.SQLException JavaDoc;
28
29 /**
30     An internal api for VTIs to allow VTI's written
31     in terms of the datatype system, e.g. returning rows.
32     This allows passing of data from the VTI into the
33     query engine without a conversion through a JDBC ResultSet.
34 */

35 public interface IFastPath {
36
37     /**
38         Indicates nextRow() has completed its scan.
39     */

40     public int SCAN_COMPLETED = -1;
41     /**
42         Indicates nextRow() found a row..
43     */

44     public int GOT_ROW = 0;
45     /**
46         Indicates nextRow() has completed its scan but executeQuery must be called to
47         complete the query.
48     */

49     public int NEED_RS = 1;
50
51     /**
52         Start a query.
53         Returns true if the VTI will start
54         out as a fast path query and thus rows will be returned
55         by nextRow().
56         Returns false if the engine must call the VTI's PreparedStatement.executeQuery()
57         method to execute as a regular ResultSet VTI.
58     */

59     public boolean executeAsFastPath()
60         throws StandardException, SQLException JavaDoc;
61
62     /**
63         When operating in fast path mode return the next row into the passed in row parameter.
64         Returns GOT_ROW if a valid row is found.
65         Returns SCAN_COMPLETED if the scan is complete.
66         Returns NEED_RS if the rest of the query must be handled as a regular ResultSet VTI by
67         the engine calling the VTI's PreparedStatement.executeQuery()
68
69     */

70     public int nextRow(DataValueDescriptor[] row)
71         throws StandardException, SQLException JavaDoc;
72
73
74     /**
75         A call from the VTI execution layer back into the supplied VTI.
76         Presents the row just processed as an array of DataValueDescriptors.
77         This only called when the VTI is being executed as a regular ResultSet VTI
78     */

79     public void currentRow(ResultSet JavaDoc rs, DataValueDescriptor[] row)
80         throws StandardException, SQLException JavaDoc;
81
82
83     /**
84         Called once the ResultSet returned by executeQuery() has emptied all of its
85         rows (next() has returned false).
86      */

87     public void rowsDone() throws StandardException, SQLException JavaDoc;
88 }
89
Popular Tags