author | lana |
Thu, 26 Dec 2013 12:04:16 -0800 | |
changeset 23010 | 6dadb192ad81 |
parent 21278 | ef8a3a2a72f2 |
child 24968 | 3308660aa3f2 |
permissions | -rw-r--r-- |
2 | 1 |
/* |
23010
6dadb192ad81
8029235: Update copyright year to match last edit in jdk8 jdk repository for 2013
lana
parents:
21278
diff
changeset
|
2 |
* Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved. |
2 | 3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 |
* |
|
5 |
* This code is free software; you can redistribute it and/or modify it |
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
|
5506 | 7 |
* published by the Free Software Foundation. Oracle designates this |
2 | 8 |
* particular file as subject to the "Classpath" exception as provided |
5506 | 9 |
* by Oracle in the LICENSE file that accompanied this code. |
2 | 10 |
* |
11 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
|
12 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
13 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
14 |
* version 2 for more details (a copy is included in the LICENSE file that |
|
15 |
* accompanied this code). |
|
16 |
* |
|
17 |
* You should have received a copy of the GNU General Public License version |
|
18 |
* 2 along with this work; if not, write to the Free Software Foundation, |
|
19 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
|
20 |
* |
|
5506 | 21 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
22 |
* or visit www.oracle.com if you need additional information or have any |
|
23 |
* questions. |
|
2 | 24 |
*/ |
25 |
||
26 |
package javax.sql.rowset; |
|
27 |
||
28 |
import java.sql.*; |
|
29 |
import javax.sql.*; |
|
30 |
import javax.naming.*; |
|
31 |
import java.io.*; |
|
32 |
import java.math.*; |
|
33 |
import java.util.*; |
|
34 |
||
35 |
import javax.sql.rowset.*; |
|
36 |
||
37 |
/** |
|
38 |
* The <code>JoinRowSet</code> interface provides a mechanism for combining related |
|
39 |
* data from different <code>RowSet</code> objects into one <code>JoinRowSet</code> |
|
40 |
* object, which represents an SQL <code>JOIN</code>. |
|
41 |
* In other words, a <code>JoinRowSet</code> object acts as a |
|
42 |
* container for the data from <code>RowSet</code> objects that form an SQL |
|
43 |
* <code>JOIN</code> relationship. |
|
44 |
* <P> |
|
45 |
* The <code>Joinable</code> interface provides the methods for setting, |
|
46 |
* retrieving, and unsetting a match column, the basis for |
|
47 |
* establishing an SQL <code>JOIN</code> relationship. The match column may |
|
48 |
* alternatively be set by supplying it to the appropriate version of the |
|
49 |
* <code>JointRowSet</code> method <code>addRowSet</code>. |
|
20880
1b610151b316
8026812: doclint clean up for java.sql and javax.sql
lancea
parents:
5506
diff
changeset
|
50 |
* |
2 | 51 |
* <h3>1.0 Overview</h3> |
52 |
* Disconnected <code>RowSet</code> objects (<code>CachedRowSet</code> objects |
|
53 |
* and implementations extending the <code>CachedRowSet</code> interface) |
|
54 |
* do not have a standard way to establish an SQL <code>JOIN</code> between |
|
55 |
* <code>RowSet</code> objects without the expensive operation of |
|
56 |
* reconnecting to the data source. The <code>JoinRowSet</code> |
|
57 |
* interface is specifically designed to address this need. |
|
58 |
* <P> |
|
59 |
* Any <code>RowSet</code> object |
|
60 |
* can be added to a <code>JoinRowSet</code> object to become |
|
61 |
* part of an SQL <code>JOIN</code> relationship. This means that both connected |
|
62 |
* and disconnected <code>RowSet</code> objects can be part of a <code>JOIN</code>. |
|
63 |
* <code>RowSet</code> objects operating in a connected environment |
|
64 |
* (<code>JdbcRowSet</code> objects) are |
|
65 |
* encouraged to use the database to which they are already |
|
66 |
* connected to establish SQL <code>JOIN</code> relationships between |
|
67 |
* tables directly. However, it is possible for a |
|
68 |
* <code>JdbcRowSet</code> object to be added to a <code>JoinRowSet</code> object |
|
69 |
* if necessary. |
|
70 |
* <P> |
|
71 |
* Any number of <code>RowSet</code> objects can be added to an |
|
72 |
* instance of <code>JoinRowSet</code> provided that they |
|
73 |
* can be related in an SQL <code>JOIN</code>. |
|
74 |
* By definition, the SQL <code>JOIN</code> statement is used to |
|
75 |
* combine the data contained in two or more relational database tables based |
|
76 |
* upon a common attribute. The <code>Joinable</code> interface provides the methods |
|
77 |
* for establishing a common attribute, which is done by setting a |
|
78 |
* <i>match column</i>. The match column commonly coincides with |
|
79 |
* the primary key, but there is |
|
80 |
* no requirement that the match column be the same as the primary key. |
|
81 |
* By establishing and then enforcing column matches, |
|
82 |
* a <code>JoinRowSet</code> object establishes <code>JOIN</code> relationships |
|
83 |
* between <code>RowSet</code> objects without the assistance of an available |
|
84 |
* relational database. |
|
85 |
* <P> |
|
86 |
* The type of <code>JOIN</code> to be established is determined by setting |
|
87 |
* one of the <code>JoinRowSet</code> constants using the method |
|
88 |
* <code>setJoinType</code>. The following SQL <code>JOIN</code> types can be set: |
|
89 |
* <UL> |
|
90 |
* <LI><code>CROSS_JOIN</code> |
|
91 |
* <LI><code>FULL_JOIN</code> |
|
92 |
* <LI><code>INNER_JOIN</code> - the default if no <code>JOIN</code> type has been set |
|
93 |
* <LI><code>LEFT_OUTER_JOIN</code> |
|
94 |
* <LI><code>RIGHT_OUTER_JOIN</code> |
|
95 |
* </UL> |
|
96 |
* Note that if no type is set, the <code>JOIN</code> will automatically be an |
|
97 |
* inner join. The comments for the fields in the |
|
98 |
* <code>JoinRowSet</code> interface explain these <code>JOIN</code> types, which are |
|
99 |
* standard SQL <code>JOIN</code> types. |
|
20880
1b610151b316
8026812: doclint clean up for java.sql and javax.sql
lancea
parents:
5506
diff
changeset
|
100 |
* |
2 | 101 |
* <h3>2.0 Using a <code>JoinRowSet</code> Object for Creating a <code>JOIN</code></h3> |
102 |
* When a <code>JoinRowSet</code> object is created, it is empty. |
|
103 |
* The first <code>RowSet</code> object to be added becomes the basis for the |
|
104 |
* <code>JOIN</code> relationship. |
|
105 |
* Applications must determine which column in each of the |
|
106 |
* <code>RowSet</code> objects to be added to the <code>JoinRowSet</code> object |
|
107 |
* should be the match column. All of the |
|
108 |
* <code>RowSet</code> objects must contain a match column, and the values in |
|
109 |
* each match column must be ones that can be compared to values in the other match |
|
110 |
* columns. The columns do not have to have the same name, though they often do, |
|
111 |
* and they do not have to store the exact same data type as long as the data types |
|
112 |
* can be compared. |
|
113 |
* <P> |
|
114 |
* A match column can be be set in two ways: |
|
115 |
* <ul> |
|
116 |
* <li>By calling the <code>Joinable</code> method <code>setMatchColumn</code><br> |
|
117 |
* This is the only method that can set the match column before a <code>RowSet</code> |
|
118 |
* object is added to a <code>JoinRowSet</code> object. The <code>RowSet</code> object |
|
119 |
* must have implemented the <code>Joinable</code> interface in order to use the method |
|
120 |
* <code>setMatchColumn</code>. Once the match column value |
|
121 |
* has been set, this method can be used to reset the match column at any time. |
|
122 |
* <li>By calling one of the versions of the <code>JoinRowSet</code> method |
|
123 |
* <code>addRowSet</code> that takes a column name or number (or an array of |
|
124 |
* column names or numbers)<BR> |
|
125 |
* Four of the five <code>addRowSet</code> methods take a match column as a parameter. |
|
126 |
* These four methods set or reset the match column at the time a <code>RowSet</code> |
|
127 |
* object is being added to a <code>JoinRowSet</code> object. |
|
128 |
* </ul> |
|
129 |
* <h3>3.0 Sample Usage</h3> |
|
130 |
* <p> |
|
131 |
* The following code fragment adds two <code>CachedRowSet</code> |
|
132 |
* objects to a <code>JoinRowSet</code> object. Note that in this example, |
|
133 |
* no SQL <code>JOIN</code> type is set, so the default <code>JOIN</code> type, |
|
134 |
* which is <i>INNER_JOIN</i>, is established. |
|
135 |
* <p> |
|
136 |
* In the following code fragment, the table <code>EMPLOYEES</code>, whose match |
|
137 |
* column is set to the first column (<code>EMP_ID</code>), is added to the |
|
138 |
* <code>JoinRowSet</code> object <i>jrs</i>. Then |
|
139 |
* the table <code>ESSP_BONUS_PLAN</code>, whose match column is likewise |
|
140 |
* the <code>EMP_ID</code> column, is added. When this second |
|
141 |
* table is added to <i>jrs</i>, only the rows in |
|
142 |
* <code>ESSP_BONUS_PLAN</code> whose <code>EMP_ID</code> value matches an |
|
143 |
* <code>EMP_ID</code> value in the <code>EMPLOYEES</code> table are added. |
|
144 |
* In this case, everyone in the bonus plan is an employee, so all of the rows |
|
145 |
* in the table <code>ESSP_BONUS_PLAN</code> are added to the <code>JoinRowSet</code> |
|
146 |
* object. In this example, both <code>CachedRowSet</code> objects being added |
|
147 |
* have implemented the <code>Joinable</code> interface and can therefore call |
|
148 |
* the <code>Joinable</code> method <code>setMatchColumn</code>. |
|
149 |
* <PRE> |
|
150 |
* JoinRowSet jrs = new JoinRowSetImpl(); |
|
151 |
* |
|
152 |
* ResultSet rs1 = stmt.executeQuery("SELECT * FROM EMPLOYEES"); |
|
153 |
* CachedRowSet empl = new CachedRowSetImpl(); |
|
154 |
* empl.populate(rs1); |
|
155 |
* empl.setMatchColumn(1); |
|
156 |
* jrs.addRowSet(empl); |
|
157 |
* |
|
158 |
* ResultSet rs2 = stmt.executeQuery("SELECT * FROM ESSP_BONUS_PLAN"); |
|
159 |
* CachedRowSet bonus = new CachedRowSetImpl(); |
|
160 |
* bonus.populate(rs2); |
|
161 |
* bonus.setMatchColumn(1); // EMP_ID is the first column |
|
162 |
* jrs.addRowSet(bonus); |
|
163 |
* </PRE> |
|
164 |
* <P> |
|
165 |
* At this point, <i>jrs</i> is an inside JOIN of the two <code>RowSet</code> objects |
|
166 |
* based on their <code>EMP_ID</code> columns. The application can now browse the |
|
167 |
* combined data as if it were browsing one single <code>RowSet</code> object. |
|
168 |
* Because <i>jrs</i> is itself a <code>RowSet</code> object, an application can |
|
169 |
* navigate or modify it using <code>RowSet</code> methods. |
|
170 |
* <PRE> |
|
171 |
* jrs.first(); |
|
172 |
* int employeeID = jrs.getInt(1); |
|
173 |
* String employeeName = jrs.getString(2); |
|
174 |
* </PRE> |
|
175 |
* <P> |
|
176 |
* Note that because the SQL <code>JOIN</code> must be enforced when an application |
|
177 |
* adds a second or subsequent <code>RowSet</code> object, there |
|
178 |
* may be an initial degradation in performance while the <code>JOIN</code> is |
|
179 |
* being performed. |
|
180 |
* <P> |
|
181 |
* The following code fragment adds an additional <code>CachedRowSet</code> object. |
|
182 |
* In this case, the match column (<code>EMP_ID</code>) is set when the |
|
183 |
* <code>CachedRowSet</code> object is added to the <code>JoinRowSet</code> object. |
|
184 |
* <PRE> |
|
185 |
* ResultSet rs3 = stmt.executeQuery("SELECT * FROM 401K_CONTRIB"); |
|
186 |
* CachedRowSet fourO1k = new CachedRowSetImpl(); |
|
187 |
* four01k.populate(rs3); |
|
188 |
* jrs.addRowSet(four01k, 1); |
|
189 |
* </PRE> |
|
190 |
* <P> |
|
191 |
* The <code>JoinRowSet</code> object <i>jrs</i> now contains values from all three |
|
192 |
* tables. The data in each row in <i>four01k</i> in which the value for the |
|
193 |
* <code>EMP_ID</code> column matches a value for the <code>EMP_ID</code> column |
|
194 |
* in <i>jrs</i> has been added to <i>jrs</i>. |
|
20880
1b610151b316
8026812: doclint clean up for java.sql and javax.sql
lancea
parents:
5506
diff
changeset
|
195 |
* |
2 | 196 |
* <h3>4.0 <code>JoinRowSet</code> Methods</h3> |
197 |
* The <code>JoinRowSet</code> interface supplies several methods for adding |
|
198 |
* <code>RowSet</code> objects and for getting information about the |
|
199 |
* <code>JoinRowSet</code> object. |
|
200 |
* <UL> |
|
201 |
* <LI>Methods for adding one or more <code>RowSet</code> objects<BR> |
|
202 |
* These methods allow an application to add one <code>RowSet</code> object |
|
203 |
* at a time or to add multiple <code>RowSet</code> objects at one time. In |
|
204 |
* either case, the methods may specify the match column for each |
|
205 |
* <code>RowSet</code> object being added. |
|
206 |
* <LI>Methods for getting information<BR> |
|
207 |
* One method retrieves the <code>RowSet</code> objects in the |
|
208 |
* <code>JoinRowSet</code> object, and another method retrieves the |
|
209 |
* <code>RowSet</code> names. A third method retrieves either the SQL |
|
210 |
* <code>WHERE</code> clause used behind the scenes to form the |
|
211 |
* <code>JOIN</code> or a text description of what the <code>WHERE</code> |
|
212 |
* clause does. |
|
213 |
* <LI>Methods related to the type of <code>JOIN</code><BR> |
|
214 |
* One method sets the <code>JOIN</code> type, and five methods find out whether |
|
215 |
* the <code>JoinRowSet</code> object supports a given type. |
|
216 |
* <LI>A method to make a separate copy of the <code>JoinRowSet</code> object<BR> |
|
217 |
* This method creates a copy that can be persisted to the data source. |
|
218 |
* </UL> |
|
20880
1b610151b316
8026812: doclint clean up for java.sql and javax.sql
lancea
parents:
5506
diff
changeset
|
219 |
* |
2 | 220 |
*/ |
221 |
||
222 |
public interface JoinRowSet extends WebRowSet { |
|
223 |
||
224 |
/** |
|
225 |
* Adds the given <code>RowSet</code> object to this <code>JoinRowSet</code> |
|
226 |
* object. If the <code>RowSet</code> object |
|
227 |
* is the first to be added to this <code>JoinRowSet</code> |
|
228 |
* object, it forms the basis of the <code>JOIN</code> relationship to be |
|
229 |
* established. |
|
230 |
* <P> |
|
231 |
* This method should be used only when the given <code>RowSet</code> |
|
232 |
* object already has a match column that was set with the <code>Joinable</code> |
|
233 |
* method <code>setMatchColumn</code>. |
|
234 |
* <p> |
|
235 |
* Note: A <code>Joinable</code> object is any <code>RowSet</code> object |
|
236 |
* that has implemented the <code>Joinable</code> interface. |
|
237 |
* |
|
238 |
* @param rowset the <code>RowSet</code> object that is to be added to this |
|
239 |
* <code>JoinRowSet</code> object; it must implement the |
|
240 |
* <code>Joinable</code> interface and have a match column set |
|
241 |
* @throws SQLException if (1) an empty rowset is added to the to this |
|
242 |
* <code>JoinRowSet</code> object, (2) a match column has not been |
|
243 |
* set for <i>rowset</i>, or (3) <i>rowset</i> |
|
244 |
* violates the active <code>JOIN</code> |
|
245 |
* @see Joinable#setMatchColumn |
|
246 |
*/ |
|
247 |
public void addRowSet(Joinable rowset) throws SQLException; |
|
248 |
||
249 |
/** |
|
250 |
* Adds the given <code>RowSet</code> object to this <code>JoinRowSet</code> |
|
251 |
* object and sets the designated column as the match column for |
|
252 |
* the <code>RowSet</code> object. If the <code>RowSet</code> object |
|
253 |
* is the first to be added to this <code>JoinRowSet</code> |
|
254 |
* object, it forms the basis of the <code>JOIN</code> relationship to be |
|
255 |
* established. |
|
256 |
* <P> |
|
257 |
* This method should be used when <i>RowSet</i> does not already have a match |
|
258 |
* column set. |
|
259 |
* |
|
260 |
* @param rowset the <code>RowSet</code> object that is to be added to this |
|
261 |
* <code>JoinRowSet</code> object; it may implement the |
|
262 |
* <code>Joinable</code> interface |
|
263 |
* @param columnIdx an <code>int</code> that identifies the column to become the |
|
264 |
* match column |
|
265 |
* @throws SQLException if (1) <i>rowset</i> is an empty rowset or |
|
266 |
* (2) <i>rowset</i> violates the active <code>JOIN</code> |
|
267 |
* @see Joinable#unsetMatchColumn |
|
268 |
*/ |
|
269 |
public void addRowSet(RowSet rowset, int columnIdx) throws SQLException; |
|
270 |
||
271 |
/** |
|
272 |
* Adds <i>rowset</i> to this <code>JoinRowSet</code> object and |
|
273 |
* sets the designated column as the match column. If <i>rowset</i> |
|
274 |
* is the first to be added to this <code>JoinRowSet</code> |
|
275 |
* object, it forms the basis for the <code>JOIN</code> relationship to be |
|
276 |
* established. |
|
277 |
* <P> |
|
278 |
* This method should be used when the given <code>RowSet</code> object |
|
279 |
* does not already have a match column. |
|
280 |
* |
|
281 |
* @param rowset the <code>RowSet</code> object that is to be added to this |
|
282 |
* <code>JoinRowSet</code> object; it may implement the |
|
283 |
* <code>Joinable</code> interface |
|
284 |
* @param columnName the <code>String</code> object giving the name of the |
|
285 |
* column to be set as the match column |
|
286 |
* @throws SQLException if (1) <i>rowset</i> is an empty rowset or |
|
287 |
* (2) the match column for <i>rowset</i> does not satisfy the |
|
288 |
* conditions of the <code>JOIN</code> |
|
289 |
*/ |
|
290 |
public void addRowSet(RowSet rowset, |
|
291 |
String columnName) throws SQLException; |
|
292 |
||
293 |
/** |
|
294 |
* Adds one or more <code>RowSet</code> objects contained in the given |
|
295 |
* array of <code>RowSet</code> objects to this <code>JoinRowSet</code> |
|
296 |
* object and sets the match column for |
|
297 |
* each of the <code>RowSet</code> objects to the match columns |
|
298 |
* in the given array of column indexes. The first element in |
|
299 |
* <i>columnIdx</i> is set as the match column for the first |
|
300 |
* <code>RowSet</code> object in <i>rowset</i>, the second element of |
|
301 |
* <i>columnIdx</i> is set as the match column for the second element |
|
302 |
* in <i>rowset</i>, and so on. |
|
303 |
* <P> |
|
304 |
* The first <code>RowSet</code> object added to this <code>JoinRowSet</code> |
|
305 |
* object forms the basis for the <code>JOIN</code> relationship. |
|
306 |
* <P> |
|
307 |
* This method should be used when the given <code>RowSet</code> object |
|
308 |
* does not already have a match column. |
|
309 |
* |
|
310 |
* @param rowset an array of one or more <code>RowSet</code> objects |
|
311 |
* to be added to the <code>JOIN</code>; it may implement the |
|
312 |
* <code>Joinable</code> interface |
|
313 |
* @param columnIdx an array of <code>int</code> values indicating the index(es) |
|
314 |
* of the columns to be set as the match columns for the <code>RowSet</code> |
|
315 |
* objects in <i>rowset</i> |
|
316 |
* @throws SQLException if (1) an empty rowset is added to this |
|
317 |
* <code>JoinRowSet</code> object, (2) a match column is not set |
|
318 |
* for a <code>RowSet</code> object in <i>rowset</i>, or (3) |
|
319 |
* a <code>RowSet</code> object being added violates the active |
|
320 |
* <code>JOIN</code> |
|
321 |
*/ |
|
322 |
public void addRowSet(RowSet[] rowset, |
|
323 |
int[] columnIdx) throws SQLException; |
|
324 |
||
325 |
/** |
|
326 |
* Adds one or more <code>RowSet</code> objects contained in the given |
|
327 |
* array of <code>RowSet</code> objects to this <code>JoinRowSet</code> |
|
328 |
* object and sets the match column for |
|
329 |
* each of the <code>RowSet</code> objects to the match columns |
|
330 |
* in the given array of column names. The first element in |
|
331 |
* <i>columnName</i> is set as the match column for the first |
|
332 |
* <code>RowSet</code> object in <i>rowset</i>, the second element of |
|
333 |
* <i>columnName</i> is set as the match column for the second element |
|
334 |
* in <i>rowset</i>, and so on. |
|
335 |
* <P> |
|
336 |
* The first <code>RowSet</code> object added to this <code>JoinRowSet</code> |
|
337 |
* object forms the basis for the <code>JOIN</code> relationship. |
|
338 |
* <P> |
|
339 |
* This method should be used when the given <code>RowSet</code> object(s) |
|
340 |
* does not already have a match column. |
|
341 |
* |
|
342 |
* @param rowset an array of one or more <code>RowSet</code> objects |
|
343 |
* to be added to the <code>JOIN</code>; it may implement the |
|
344 |
* <code>Joinable</code> interface |
|
345 |
* @param columnName an array of <code>String</code> values indicating the |
|
346 |
* names of the columns to be set as the match columns for the |
|
347 |
* <code>RowSet</code> objects in <i>rowset</i> |
|
348 |
* @throws SQLException if (1) an empty rowset is added to this |
|
349 |
* <code>JoinRowSet</code> object, (2) a match column is not set |
|
350 |
* for a <code>RowSet</code> object in <i>rowset</i>, or (3) |
|
351 |
* a <code>RowSet</code> object being added violates the active |
|
352 |
* <code>JOIN</code> |
|
353 |
*/ |
|
354 |
public void addRowSet(RowSet[] rowset, |
|
355 |
String[] columnName) throws SQLException; |
|
356 |
||
357 |
/** |
|
358 |
* Returns a <code>Collection</code> object containing the |
|
359 |
* <code>RowSet</code> objects that have been added to this |
|
360 |
* <code>JoinRowSet</code> object. |
|
361 |
* This should return the 'n' number of RowSet contained |
|
21278 | 362 |
* within the <code>JOIN</code> and maintain any updates that have occurred while in |
2 | 363 |
* this union. |
364 |
* |
|
365 |
* @return a <code>Collection</code> object consisting of the |
|
366 |
* <code>RowSet</code> objects added to this <code>JoinRowSet</code> |
|
367 |
* object |
|
368 |
* @throws SQLException if an error occurs generating the |
|
369 |
* <code>Collection</code> object to be returned |
|
370 |
*/ |
|
371 |
public Collection<?> getRowSets() throws java.sql.SQLException; |
|
372 |
||
373 |
/** |
|
374 |
* Returns a <code>String</code> array containing the names of the |
|
375 |
* <code>RowSet</code> objects added to this <code>JoinRowSet</code> |
|
376 |
* object. |
|
377 |
* |
|
378 |
* @return a <code>String</code> array of the names of the |
|
379 |
* <code>RowSet</code> objects in this <code>JoinRowSet</code> |
|
380 |
* object |
|
381 |
* @throws SQLException if an error occurs retrieving the names of |
|
382 |
* the <code>RowSet</code> objects |
|
383 |
* @see CachedRowSet#setTableName |
|
384 |
*/ |
|
385 |
public String[] getRowSetNames() throws java.sql.SQLException; |
|
386 |
||
387 |
/** |
|
388 |
* Creates a new <code>CachedRowSet</code> object containing the |
|
389 |
* data in this <code>JoinRowSet</code> object, which can be saved |
|
390 |
* to a data source using the <code>SyncProvider</code> object for |
|
391 |
* the <code>CachedRowSet</code> object. |
|
392 |
* <P> |
|
393 |
* If any updates or modifications have been applied to the JoinRowSet |
|
394 |
* the CachedRowSet returned by the method will not be able to persist |
|
395 |
* it's changes back to the originating rows and tables in the |
|
396 |
* in the datasource. The CachedRowSet instance returned should not |
|
397 |
* contain modification data and it should clear all properties of |
|
398 |
* it's originating SQL statement. An application should reset the |
|
399 |
* SQL statement using the <code>RowSet.setCommand</code> method. |
|
400 |
* <p> |
|
401 |
* In order to allow changes to be persisted back to the datasource |
|
402 |
* to the originating tables, the <code>acceptChanges</code> method |
|
403 |
* should be used and called on a JoinRowSet object instance. Implementations |
|
404 |
* can leverage the internal data and update tracking in their |
|
405 |
* implementations to interact with the SyncProvider to persist any |
|
406 |
* changes. |
|
407 |
* |
|
408 |
* @return a CachedRowSet containing the contents of the JoinRowSet |
|
409 |
* @throws SQLException if an error occurs assembling the CachedRowSet |
|
410 |
* object |
|
411 |
* @see javax.sql.RowSet |
|
412 |
* @see javax.sql.rowset.CachedRowSet |
|
413 |
* @see javax.sql.rowset.spi.SyncProvider |
|
414 |
*/ |
|
415 |
public CachedRowSet toCachedRowSet() throws java.sql.SQLException; |
|
416 |
||
417 |
/** |
|
418 |
* Indicates if CROSS_JOIN is supported by a JoinRowSet |
|
419 |
* implementation |
|
420 |
* |
|
421 |
* @return true if the CROSS_JOIN is supported; false otherwise |
|
422 |
*/ |
|
423 |
public boolean supportsCrossJoin(); |
|
424 |
||
425 |
/** |
|
426 |
* Indicates if INNER_JOIN is supported by a JoinRowSet |
|
427 |
* implementation |
|
428 |
* |
|
429 |
* @return true is the INNER_JOIN is supported; false otherwise |
|
430 |
*/ |
|
431 |
public boolean supportsInnerJoin(); |
|
432 |
||
433 |
/** |
|
434 |
* Indicates if LEFT_OUTER_JOIN is supported by a JoinRowSet |
|
435 |
* implementation |
|
436 |
* |
|
437 |
* @return true is the LEFT_OUTER_JOIN is supported; false otherwise |
|
438 |
*/ |
|
439 |
public boolean supportsLeftOuterJoin(); |
|
440 |
||
441 |
/** |
|
442 |
* Indicates if RIGHT_OUTER_JOIN is supported by a JoinRowSet |
|
443 |
* implementation |
|
444 |
* |
|
445 |
* @return true is the RIGHT_OUTER_JOIN is supported; false otherwise |
|
446 |
*/ |
|
447 |
public boolean supportsRightOuterJoin(); |
|
448 |
||
449 |
/** |
|
450 |
* Indicates if FULL_JOIN is supported by a JoinRowSet |
|
451 |
* implementation |
|
452 |
* |
|
453 |
* @return true is the FULL_JOIN is supported; false otherwise |
|
454 |
*/ |
|
455 |
public boolean supportsFullJoin(); |
|
456 |
||
457 |
/** |
|
458 |
* Allow the application to adjust the type of <code>JOIN</code> imposed |
|
459 |
* on tables contained within the JoinRowSet object instance. |
|
460 |
* Implementations should throw a SQLException if they do |
|
461 |
* not support a given <code>JOIN</code> type. |
|
462 |
* |
|
463 |
* @param joinType the standard JoinRowSet.XXX static field definition |
|
464 |
* of a SQL <code>JOIN</code> to re-configure a JoinRowSet instance on |
|
465 |
* the fly. |
|
466 |
* @throws SQLException if an unsupported <code>JOIN</code> type is set |
|
467 |
* @see #getJoinType |
|
468 |
*/ |
|
469 |
public void setJoinType(int joinType) throws SQLException; |
|
470 |
||
471 |
/** |
|
472 |
* Return a SQL-like description of the WHERE clause being used |
|
473 |
* in a JoinRowSet object. An implementation can describe |
|
474 |
* the WHERE clause of the SQL <code>JOIN</code> by supplying a SQL |
|
475 |
* strings description of <code>JOIN</code> or provide a textual |
|
476 |
* description to assist applications using a <code>JoinRowSet</code> |
|
477 |
* |
|
478 |
* @return whereClause a textual or SQL description of the logical |
|
479 |
* WHERE clause used in the JoinRowSet instance |
|
480 |
* @throws SQLException if an error occurs in generating a representation |
|
481 |
* of the WHERE clause. |
|
482 |
*/ |
|
483 |
public String getWhereClause() throws SQLException; |
|
484 |
||
485 |
/** |
|
486 |
* Returns a <code>int</code> describing the set SQL <code>JOIN</code> type |
|
487 |
* governing this JoinRowSet instance. The returned type will be one of |
|
488 |
* standard JoinRowSet types: <code>CROSS_JOIN</code>, <code>INNER_JOIN</code>, |
|
489 |
* <code>LEFT_OUTER_JOIN</code>, <code>RIGHT_OUTER_JOIN</code> or |
|
490 |
* <code>FULL_JOIN</code>. |
|
491 |
* |
|
492 |
* @return joinType one of the standard JoinRowSet static field |
|
493 |
* definitions of a SQL <code>JOIN</code>. <code>JoinRowSet.INNER_JOIN</code> |
|
494 |
* is returned as the default <code>JOIN</code> type is no type has been |
|
495 |
* explicitly set. |
|
496 |
* @throws SQLException if an error occurs determining the SQL <code>JOIN</code> |
|
497 |
* type supported by the JoinRowSet instance. |
|
498 |
* @see #setJoinType |
|
499 |
*/ |
|
500 |
public int getJoinType() throws SQLException; |
|
501 |
||
502 |
/** |
|
503 |
* An ANSI-style <code>JOIN</code> providing a cross product of two tables |
|
504 |
*/ |
|
505 |
public static int CROSS_JOIN = 0; |
|
506 |
||
507 |
/** |
|
508 |
* An ANSI-style <code>JOIN</code> providing a inner join between two tables. Any |
|
509 |
* unmatched rows in either table of the join should be discarded. |
|
510 |
*/ |
|
511 |
public static int INNER_JOIN = 1; |
|
512 |
||
513 |
/** |
|
514 |
* An ANSI-style <code>JOIN</code> providing a left outer join between two |
|
515 |
* tables. In SQL, this is described where all records should be |
|
516 |
* returned from the left side of the JOIN statement. |
|
517 |
*/ |
|
518 |
public static int LEFT_OUTER_JOIN = 2; |
|
519 |
||
520 |
/** |
|
521 |
* An ANSI-style <code>JOIN</code> providing a right outer join between |
|
522 |
* two tables. In SQL, this is described where all records from the |
|
523 |
* table on the right side of the JOIN statement even if the table |
|
524 |
* on the left has no matching record. |
|
525 |
*/ |
|
526 |
public static int RIGHT_OUTER_JOIN = 3; |
|
527 |
||
528 |
/** |
|
529 |
* An ANSI-style <code>JOIN</code> providing a a full JOIN. Specifies that all |
|
530 |
* rows from either table be returned regardless of matching |
|
531 |
* records on the other table. |
|
532 |
*/ |
|
533 |
public static int FULL_JOIN = 4; |
|
534 |
||
535 |
||
536 |
} |