001: /*
002:
003: Derby - Class org.apache.derby.iapi.sql.execute.NoPutResultSet
004:
005: Licensed to the Apache Software Foundation (ASF) under one or more
006: contributor license agreements. See the NOTICE file distributed with
007: this work for additional information regarding copyright ownership.
008: The ASF licenses this file to you under the Apache License, Version 2.0
009: (the "License"); you may not use this file except in compliance with
010: the License. You may obtain a copy of the License at
011:
012: http://www.apache.org/licenses/LICENSE-2.0
013:
014: Unless required by applicable law or agreed to in writing, software
015: distributed under the License is distributed on an "AS IS" BASIS,
016: WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
017: See the License for the specific language governing permissions and
018: limitations under the License.
019:
020: */
021:
022: package org.apache.derby.iapi.sql.execute;
023:
024: import org.apache.derby.iapi.sql.ResultSet;
025: import org.apache.derby.iapi.error.StandardException;
026:
027: import org.apache.derby.iapi.types.RowLocation;
028: import org.apache.derby.iapi.store.access.RowLocationRetRowSource;
029:
030: /**
031: * The NoPutResultSet interface is used to provide additional
032: * operations on result sets that can be used in returning rows
033: * up a ResultSet tree.
034: * <p>
035: * Since the ResulSet operations must also be supported by
036: * NoPutResultSets, we extend that interface here as well.
037: *
038: * @author jerry
039: */
040: public interface NoPutResultSet extends ResultSet,
041: RowLocationRetRowSource {
042: // method names for use with SQLState.LANG_RESULT_SET_NOT_OPEN exception
043:
044: public static final String ABSOLUTE = "absolute";
045: public static final String RELATIVE = "relative";
046: public static final String FIRST = "first";
047: public static final String NEXT = "next";
048: public static final String LAST = "last";
049: public static final String PREVIOUS = "previous";
050:
051: /**
052: * Mark the ResultSet as the topmost one in the ResultSet tree.
053: * Useful for closing down the ResultSet on an error.
054: */
055: public void markAsTopResultSet();
056:
057: /**
058: * open a scan on the table. scan parameters are evaluated
059: * at each open, so there is probably some way of altering
060: * their values...
061: * <p>
062: * openCore() can only be called on a closed result
063: * set. see reopenCore if you want to reuse an open
064: * result set.
065: *
066: * @exception StandardException thrown if cursor finished.
067: */
068: public void openCore() throws StandardException;
069:
070: /**
071: * reopen the scan. behaves like openCore() but is
072: * optimized where appropriate (e.g. where scanController
073: * has special logic for us).
074: * <p>
075: * used by joiners
076: * <p>
077: * scan parameters are evaluated
078: * at each open, so there is probably some way of altering
079: * their values...
080: *
081: * @exception StandardException thrown if cursor finished.
082: */
083: public void reopenCore() throws StandardException;
084:
085: /**
086: * Return the requested values computed
087: * from the next row (if any) for which
088: * the restriction evaluates to true.
089: * <p>
090: * restriction and projection parameters
091: * are evaluated for each row.
092: *
093: * @exception StandardException thrown on failure.
094: *
095: * @return the next row in the result
096: */
097: public ExecRow getNextRowCore() throws StandardException;
098:
099: /**
100: * Return the point of attachment for this subquery.
101: * (Only meaningful for Any and Once ResultSets, which can and will only
102: * be at the top of a ResultSet for a subquery.)
103: *
104: * @return int Point of attachment (result set number) for this
105: * subquery. (-1 if not a subquery - also Sanity violation)
106: */
107: public int getPointOfAttachment();
108:
109: /**
110: * Return the isolation level of the scan in the result set.
111: * Only expected to be called for those ResultSets that
112: * contain a scan.
113: *
114: * @return The isolation level of the scan (in TransactionController constants).
115: */
116: public int getScanIsolationLevel();
117:
118: /**
119: * Notify a NPRS that it is the source for the specified
120: * TargetResultSet. This is useful when doing bulk insert.
121: *
122: * @param trs The TargetResultSet.
123: */
124: public void setTargetResultSet(TargetResultSet trs);
125:
126: /**
127: * Set whether or not the NPRS need the row location when acting
128: * as a row source. (The target result set determines this.)
129: */
130: public void setNeedsRowLocation(boolean needsRowLocation);
131:
132: /**
133: * Get the estimated row count from this result set.
134: *
135: * @return The estimated row count (as a double) from this result set.
136: */
137: public double getEstimatedRowCount();
138:
139: /**
140: * Get the number of this ResultSet, which is guaranteed to be unique
141: * within a statement.
142: */
143: public int resultSetNumber();
144:
145: /**
146: * Set the current row to the row passed in.
147: *
148: * @param row the new current row
149: *
150: */
151: public void setCurrentRow(ExecRow row);
152:
153: /**
154: * Do we need to relock the row when going to the heap.
155: *
156: * @return Whether or not we need to relock the row when going to the heap.
157: */
158:
159: public boolean requiresRelocking();
160:
161: /**
162: * Is this ResultSet or it's source result set for update
163: *
164: * @return Whether or not the result set is for update.
165: */
166: public boolean isForUpdate();
167:
168: /*
169: * New methods for supporting detectability of own changes for
170: * for updates and deletes when using ResultSets of type
171: * TYPE_SCROLL_INSENSITIVE and concurrency CONCUR_UPDATABLE.
172: */
173:
174: /**
175: * Updates the resultSet's current row with it's new values after
176: * an update has been issued either using positioned update or
177: * JDBC's udpateRow method.
178: *
179: * @param row new values for the currentRow
180: *
181: * @exception StandardException thrown on failure.
182: */
183: public void updateRow(ExecRow row) throws StandardException;
184:
185: /**
186: * Marks the resultSet's currentRow as deleted after a delete has been
187: * issued by either by using positioned delete or JDBC's deleteRow
188: * method.
189: *
190: * @exception StandardException thrown on failure.
191: */
192: public void markRowAsDeleted() throws StandardException;
193:
194: /**
195: * Positions the cursor in the specified rowLocation. Used for
196: * scrollable insensitive result sets in order to position the
197: * cursor back to a row that has already be visited.
198: *
199: * @param rLoc row location of the current cursor row
200: *
201: * @exception StandardException thrown on failure to
202: * get location from storage engine
203: *
204: */
205: void positionScanAtRowLocation(RowLocation rLoc)
206: throws StandardException;
207: }
|