author | lancea |
Thu, 26 Jan 2012 19:41:35 -0500 | |
changeset 11683 | 5e02efd89af6 |
parent 11129 | f9ad1aadf3fa |
child 13012 | c4ef809d7fca |
permissions | -rw-r--r-- |
2 | 1 |
/* |
9257
53e6d7bc31b0
7035615: Address lint warnings for javax.sql.rowset & com.sun.rowset
lancea
parents:
6697
diff
changeset
|
2 |
* Copyright (c) 2003, 2011, 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 com.sun.rowset; |
|
27 |
||
28 |
import java.sql.*; |
|
29 |
import javax.sql.*; |
|
30 |
import java.io.*; |
|
31 |
import java.math.*; |
|
32 |
import java.util.*; |
|
33 |
import java.text.*; |
|
34 |
||
35 |
import javax.sql.rowset.*; |
|
36 |
import javax.sql.rowset.spi.*; |
|
37 |
import javax.sql.rowset.serial.*; |
|
38 |
import com.sun.rowset.internal.*; |
|
39 |
import com.sun.rowset.providers.*; |
|
40 |
||
41 |
/** |
|
42 |
* The standard implementation of the <code>CachedRowSet</code> interface. |
|
43 |
* |
|
44 |
* See interface defintion for full behaviour and implementation requirements. |
|
45 |
* This reference implementation has made provision for a one-to-one write back |
|
46 |
* facility and it is curremtly be possible to change the peristence provider |
|
47 |
* during the life-time of any CachedRowSetImpl. |
|
48 |
* |
|
49 |
* @author Jonathan Bruce, Amit Handa |
|
50 |
*/ |
|
51 |
||
52 |
public class CachedRowSetImpl extends BaseRowSet implements RowSet, RowSetInternal, Serializable, Cloneable, CachedRowSet { |
|
53 |
||
54 |
/** |
|
55 |
* The <code>SyncProvider</code> used by the CachedRowSet |
|
56 |
*/ |
|
57 |
private SyncProvider provider; |
|
58 |
||
59 |
/** |
|
60 |
* The <code>RowSetReaderImpl</code> object that is the reader |
|
61 |
* for this rowset. The method <code>execute</code> uses this |
|
62 |
* reader as part of its implementation. |
|
63 |
* @serial |
|
64 |
*/ |
|
65 |
private RowSetReader rowSetReader; |
|
66 |
||
67 |
/** |
|
68 |
* The <code>RowSetWriterImpl</code> object that is the writer |
|
69 |
* for this rowset. The method <code>acceptChanges</code> uses |
|
70 |
* this writer as part of its implementation. |
|
71 |
* @serial |
|
72 |
*/ |
|
73 |
private RowSetWriter rowSetWriter; |
|
74 |
||
75 |
/** |
|
76 |
* The <code>Connection</code> object that connects with this |
|
77 |
* <code>CachedRowSetImpl</code> object's current underlying data source. |
|
78 |
*/ |
|
79 |
private transient Connection conn; |
|
80 |
||
81 |
/** |
|
82 |
* The <code>ResultSetMetaData</code> object that contains information |
|
83 |
* about the columns in the <code>ResultSet</code> object that is the |
|
84 |
* current source of data for this <code>CachedRowSetImpl</code> object. |
|
85 |
*/ |
|
86 |
private transient ResultSetMetaData RSMD; |
|
87 |
||
88 |
/** |
|
89 |
* The <code>RowSetMetaData</code> object that contains information about |
|
90 |
* the columns in this <code>CachedRowSetImpl</code> object. |
|
91 |
* @serial |
|
92 |
*/ |
|
93 |
private RowSetMetaDataImpl RowSetMD; |
|
94 |
||
95 |
// Properties of this RowSet |
|
96 |
||
97 |
/** |
|
98 |
* An array containing the columns in this <code>CachedRowSetImpl</code> |
|
99 |
* object that form a unique identifier for a row. This array |
|
100 |
* is used by the writer. |
|
101 |
* @serial |
|
102 |
*/ |
|
103 |
private int keyCols[]; |
|
104 |
||
105 |
/** |
|
106 |
* The name of the table in the underlying database to which updates |
|
107 |
* should be written. This name is needed because most drivers |
|
108 |
* do not return this information in a <code>ResultSetMetaData</code> |
|
109 |
* object. |
|
110 |
* @serial |
|
111 |
*/ |
|
112 |
private String tableName; |
|
113 |
||
114 |
/** |
|
115 |
* A <code>Vector</code> object containing the <code>Row</code> |
|
116 |
* objects that comprise this <code>CachedRowSetImpl</code> object. |
|
117 |
* @serial |
|
118 |
*/ |
|
9257
53e6d7bc31b0
7035615: Address lint warnings for javax.sql.rowset & com.sun.rowset
lancea
parents:
6697
diff
changeset
|
119 |
private Vector<Object> rvh; |
53e6d7bc31b0
7035615: Address lint warnings for javax.sql.rowset & com.sun.rowset
lancea
parents:
6697
diff
changeset
|
120 |
|
2 | 121 |
/** |
122 |
* The current postion of the cursor in this <code>CachedRowSetImpl</code> |
|
123 |
* object. |
|
124 |
* @serial |
|
125 |
*/ |
|
126 |
private int cursorPos; |
|
127 |
||
128 |
/** |
|
129 |
* The current postion of the cursor in this <code>CachedRowSetImpl</code> |
|
130 |
* object not counting rows that have been deleted, if any. |
|
131 |
* <P> |
|
132 |
* For example, suppose that the cursor is on the last row of a rowset |
|
133 |
* that started with five rows and subsequently had the second and third |
|
134 |
* rows deleted. The <code>absolutePos</code> would be <code>3</code>, |
|
135 |
* whereas the <code>cursorPos</code> would be <code>5</code>. |
|
136 |
* @serial |
|
137 |
*/ |
|
138 |
private int absolutePos; |
|
139 |
||
140 |
/** |
|
141 |
* The number of deleted rows currently in this <code>CachedRowSetImpl</code> |
|
142 |
* object. |
|
143 |
* @serial |
|
144 |
*/ |
|
145 |
private int numDeleted; |
|
146 |
||
147 |
/** |
|
148 |
* The total number of rows currently in this <code>CachedRowSetImpl</code> |
|
149 |
* object. |
|
150 |
* @serial |
|
151 |
*/ |
|
152 |
private int numRows; |
|
153 |
||
154 |
/** |
|
155 |
* A special row used for constructing a new row. A new |
|
156 |
* row is constructed by using <code>ResultSet.updateXXX</code> |
|
157 |
* methods to insert column values into the insert row. |
|
158 |
* @serial |
|
159 |
*/ |
|
160 |
private InsertRow insertRow; |
|
161 |
||
162 |
/** |
|
163 |
* A <code>boolean</code> indicating whether the cursor is |
|
164 |
* currently on the insert row. |
|
165 |
* @serial |
|
166 |
*/ |
|
167 |
private boolean onInsertRow; |
|
168 |
||
169 |
/** |
|
170 |
* The field that temporarily holds the last position of the |
|
171 |
* cursor before it moved to the insert row, thus preserving |
|
172 |
* the number of the current row to which the cursor may return. |
|
173 |
* @serial |
|
174 |
*/ |
|
175 |
private int currentRow; |
|
176 |
||
177 |
/** |
|
178 |
* A <code>boolean</code> indicating whether the last value |
|
179 |
* returned was an SQL <code>NULL</code>. |
|
180 |
* @serial |
|
181 |
*/ |
|
182 |
private boolean lastValueNull; |
|
183 |
||
184 |
/** |
|
185 |
* A <code>SQLWarning</code> which logs on the warnings |
|
186 |
*/ |
|
187 |
private SQLWarning sqlwarn; |
|
188 |
||
189 |
/** |
|
190 |
* Used to track match column for JoinRowSet consumption |
|
191 |
*/ |
|
192 |
private String strMatchColumn =""; |
|
193 |
||
194 |
/** |
|
195 |
* Used to track match column for JoinRowSet consumption |
|
196 |
*/ |
|
197 |
private int iMatchColumn = -1; |
|
198 |
||
199 |
/** |
|
200 |
* A <code>RowSetWarning</code> which logs on the warnings |
|
201 |
*/ |
|
202 |
private RowSetWarning rowsetWarning; |
|
203 |
||
204 |
/** |
|
205 |
* The default SyncProvider for the RI CachedRowSetImpl |
|
206 |
*/ |
|
207 |
private String DEFAULT_SYNC_PROVIDER = "com.sun.rowset.providers.RIOptimisticProvider"; |
|
208 |
||
209 |
/** |
|
210 |
* The boolean variable indicating locatorsUpdateValue |
|
211 |
*/ |
|
212 |
private boolean dbmslocatorsUpdateCopy; |
|
213 |
||
214 |
/** |
|
215 |
* The <code>ResultSet</code> object that is used to maintain the data when |
|
216 |
* a ResultSet and start position are passed as parameters to the populate function |
|
217 |
*/ |
|
218 |
private transient ResultSet resultSet; |
|
219 |
||
220 |
/** |
|
221 |
* The integer value indicating the end position in the ResultSetwhere the picking |
|
222 |
* up of rows for populating a CachedRowSet object was left off. |
|
223 |
*/ |
|
224 |
private int endPos; |
|
225 |
||
226 |
/** |
|
227 |
* The integer value indicating the end position in the ResultSetwhere the picking |
|
228 |
* up of rows for populating a CachedRowSet object was left off. |
|
229 |
*/ |
|
230 |
private int prevEndPos; |
|
231 |
||
232 |
/** |
|
233 |
* The integer value indicating the position in the ResultSet, to populate the |
|
234 |
* CachedRowSet object. |
|
235 |
*/ |
|
236 |
private int startPos; |
|
237 |
||
238 |
/** |
|
239 |
* The integer value indicating the positon from where the page prior to this |
|
240 |
* was populated. |
|
241 |
*/ |
|
242 |
private int startPrev; |
|
243 |
||
244 |
/** |
|
245 |
* The integer value indicating size of the page. |
|
246 |
*/ |
|
247 |
private int pageSize; |
|
248 |
||
249 |
/** |
|
250 |
* The integer value indicating number of rows that have been processed so far. |
|
251 |
* Used for checking whether maxRows has been reached or not. |
|
252 |
*/ |
|
253 |
private int maxRowsreached; |
|
254 |
/** |
|
255 |
* The boolean value when true signifies that pages are still to follow and a |
|
256 |
* false value indicates that this is the last page. |
|
257 |
*/ |
|
258 |
private boolean pagenotend = true; |
|
259 |
||
260 |
/** |
|
261 |
* The boolean value indicating whether this is the first page or not. |
|
262 |
*/ |
|
263 |
private boolean onFirstPage; |
|
264 |
||
265 |
/** |
|
266 |
* The boolean value indicating whether this is the last page or not. |
|
267 |
*/ |
|
268 |
private boolean onLastPage; |
|
269 |
||
270 |
/** |
|
271 |
* The integer value indicating how many times the populate function has been called. |
|
272 |
*/ |
|
273 |
private int populatecallcount; |
|
274 |
||
275 |
/** |
|
276 |
* The integer value indicating the total number of rows to be processed in the |
|
277 |
* ResultSet object passed to the populate function. |
|
278 |
*/ |
|
279 |
private int totalRows; |
|
280 |
||
281 |
/** |
|
282 |
* The boolean value indicating how the CahedRowSet object has been populated for |
|
283 |
* paging purpose. True indicates that connection parameter is passed. |
|
284 |
*/ |
|
285 |
private boolean callWithCon; |
|
286 |
||
287 |
/** |
|
288 |
* CachedRowSet reader object to read the data from the ResultSet when a connection |
|
289 |
* parameter is passed to populate the CachedRowSet object for paging. |
|
290 |
*/ |
|
291 |
private CachedRowSetReader crsReader; |
|
292 |
||
293 |
/** |
|
294 |
* The Vector holding the Match Columns |
|
295 |
*/ |
|
9257
53e6d7bc31b0
7035615: Address lint warnings for javax.sql.rowset & com.sun.rowset
lancea
parents:
6697
diff
changeset
|
296 |
private Vector<Integer> iMatchColumns; |
2 | 297 |
|
298 |
/** |
|
299 |
* The Vector that will hold the Match Column names. |
|
300 |
*/ |
|
9257
53e6d7bc31b0
7035615: Address lint warnings for javax.sql.rowset & com.sun.rowset
lancea
parents:
6697
diff
changeset
|
301 |
private Vector<String> strMatchColumns; |
2 | 302 |
|
303 |
/** |
|
304 |
* Trigger that indicates whether the active SyncProvider is exposes the |
|
305 |
* additional TransactionalWriter method |
|
306 |
*/ |
|
307 |
private boolean tXWriter = false; |
|
308 |
||
309 |
/** |
|
310 |
* The field object for a transactional RowSet writer |
|
311 |
*/ |
|
312 |
private TransactionalWriter tWriter = null; |
|
313 |
||
314 |
protected transient JdbcRowSetResourceBundle resBundle; |
|
315 |
||
316 |
private boolean updateOnInsert; |
|
317 |
||
318 |
||
319 |
||
320 |
/** |
|
321 |
* Constructs a new default <code>CachedRowSetImpl</code> object with |
|
322 |
* the capacity to hold 100 rows. This new object has no metadata |
|
323 |
* and has the following default values: |
|
324 |
* <pre> |
|
325 |
* onInsertRow = false |
|
326 |
* insertRow = null |
|
327 |
* cursorPos = 0 |
|
328 |
* numRows = 0 |
|
329 |
* showDeleted = false |
|
330 |
* queryTimeout = 0 |
|
331 |
* maxRows = 0 |
|
332 |
* maxFieldSize = 0 |
|
333 |
* rowSetType = ResultSet.TYPE_SCROLL_INSENSITIVE |
|
334 |
* concurrency = ResultSet.CONCUR_UPDATABLE |
|
335 |
* readOnly = false |
|
336 |
* isolation = Connection.TRANSACTION_READ_COMMITTED |
|
337 |
* escapeProcessing = true |
|
338 |
* onInsertRow = false |
|
339 |
* insertRow = null |
|
340 |
* cursorPos = 0 |
|
341 |
* absolutePos = 0 |
|
342 |
* numRows = 0 |
|
343 |
* </pre> |
|
344 |
* A <code>CachedRowSetImpl</code> object is configured to use the default |
|
345 |
* <code>RIOptimisticProvider</code> implementation to provide connectivity |
|
346 |
* and synchronization capabilities to the set data source. |
|
347 |
* <P> |
|
348 |
* @throws SQLException if an error occurs |
|
349 |
*/ |
|
350 |
public CachedRowSetImpl() throws SQLException { |
|
351 |
||
352 |
try { |
|
353 |
resBundle = JdbcRowSetResourceBundle.getJdbcRowSetResourceBundle(); |
|
354 |
} catch(IOException ioe) { |
|
355 |
throw new RuntimeException(ioe); |
|
356 |
} |
|
357 |
||
358 |
// set the Reader, this maybe overridden latter |
|
359 |
provider = |
|
11129
f9ad1aadf3fa
7116445: Miscellaneous warnings in the JDBC/RowSet classes
lancea
parents:
9537
diff
changeset
|
360 |
SyncFactory.getInstance(DEFAULT_SYNC_PROVIDER); |
2 | 361 |
|
362 |
if (!(provider instanceof RIOptimisticProvider)) { |
|
363 |
throw new SQLException(resBundle.handleGetObject("cachedrowsetimpl.invalidp").toString()); |
|
364 |
} |
|
365 |
||
366 |
rowSetReader = (CachedRowSetReader)provider.getRowSetReader(); |
|
367 |
rowSetWriter = (CachedRowSetWriter)provider.getRowSetWriter(); |
|
368 |
||
369 |
// allocate the parameters collection |
|
370 |
initParams(); |
|
371 |
||
372 |
initContainer(); |
|
373 |
||
374 |
// set up some default values |
|
375 |
initProperties(); |
|
376 |
||
377 |
// insert row setup |
|
378 |
onInsertRow = false; |
|
379 |
insertRow = null; |
|
380 |
||
381 |
// set the warninings |
|
382 |
sqlwarn = new SQLWarning(); |
|
383 |
rowsetWarning = new RowSetWarning(); |
|
384 |
||
385 |
} |
|
386 |
||
387 |
/** |
|
388 |
* Provides a <code>CachedRowSetImpl</code> instance with the same default properties as |
|
389 |
* as the zero parameter constructor. |
|
390 |
* <pre> |
|
391 |
* onInsertRow = false |
|
392 |
* insertRow = null |
|
393 |
* cursorPos = 0 |
|
394 |
* numRows = 0 |
|
395 |
* showDeleted = false |
|
396 |
* queryTimeout = 0 |
|
397 |
* maxRows = 0 |
|
398 |
* maxFieldSize = 0 |
|
399 |
* rowSetType = ResultSet.TYPE_SCROLL_INSENSITIVE |
|
400 |
* concurrency = ResultSet.CONCUR_UPDATABLE |
|
401 |
* readOnly = false |
|
402 |
* isolation = Connection.TRANSACTION_READ_COMMITTED |
|
403 |
* escapeProcessing = true |
|
404 |
* onInsertRow = false |
|
405 |
* insertRow = null |
|
406 |
* cursorPos = 0 |
|
407 |
* absolutePos = 0 |
|
408 |
* numRows = 0 |
|
409 |
* </pre> |
|
410 |
* |
|
411 |
* However, applications will have the means to specify at runtime the |
|
412 |
* desired <code>SyncProvider</code> object. |
|
413 |
* <p> |
|
414 |
* For example, creating a <code>CachedRowSetImpl</code> object as follows ensures |
|
415 |
* that a it is established with the <code>com.foo.provider.Impl</code> synchronization |
|
416 |
* implementation providing the synchronization mechanism for this disconnected |
|
417 |
* <code>RowSet</code> object. |
|
418 |
* <pre> |
|
419 |
* Hashtable env = new Hashtable(); |
|
420 |
* env.put(javax.sql.rowset.spi.SyncFactory.ROWSET_PROVIDER_NAME, |
|
421 |
* "com.foo.provider.Impl"); |
|
422 |
* CachedRowSetImpl crs = new CachedRowSet(env); |
|
423 |
* </pre> |
|
424 |
* <p> |
|
425 |
* Calling this constructor with a <code>null</code> parameter will |
|
426 |
* cause the <code>SyncFactory</code> to provide the reference |
|
427 |
* optimistic provider <code>com.sun.rowset.providers.RIOptimisticProvider</code>. |
|
428 |
* <p> |
|
429 |
* In addition, the following properties can be associated with the |
|
430 |
* provider to assist in determining the choice of the synchronizaton |
|
431 |
* provider such as: |
|
432 |
* <ul> |
|
433 |
* <li><code>ROWSET_SYNC_PROVIDER</code> - the property specifying the the |
|
434 |
* <code>SyncProvider</code> class name to be instantiated by the |
|
435 |
* <code>SyncFacttory</code> |
|
436 |
* <li><code>ROWSET_SYNC_VENDOR</code> - the property specifying the software |
|
437 |
* vendor associated with a <code>SyncProvider</code> implementation. |
|
438 |
* <li><code>ROWSET_SYNC_PROVIDER_VER</code> - the property specifying the |
|
439 |
* version of the <code>SyncProvider</code> implementation provided by the |
|
440 |
* software vendor. |
|
441 |
* </ul> |
|
442 |
* More specific detailes are available in the <code>SyncFactory</code> |
|
443 |
* and <code>SyncProvider</code> specificiations later in this document. |
|
444 |
* <p> |
|
445 |
* @param env a <code>Hashtable</code> object with a list of desired |
|
446 |
* synchronization providers |
|
447 |
* @throws SQLException if the requested provider cannot be found by the |
|
11129
f9ad1aadf3fa
7116445: Miscellaneous warnings in the JDBC/RowSet classes
lancea
parents:
9537
diff
changeset
|
448 |
* synchronization factory |
2 | 449 |
* @see SyncProvider |
450 |
*/ |
|
11129
f9ad1aadf3fa
7116445: Miscellaneous warnings in the JDBC/RowSet classes
lancea
parents:
9537
diff
changeset
|
451 |
public CachedRowSetImpl(@SuppressWarnings("rawtypes") Hashtable env) throws SQLException { |
2 | 452 |
|
453 |
||
454 |
try { |
|
455 |
resBundle = JdbcRowSetResourceBundle.getJdbcRowSetResourceBundle(); |
|
456 |
} catch(IOException ioe) { |
|
457 |
throw new RuntimeException(ioe); |
|
458 |
} |
|
459 |
||
460 |
if (env == null) { |
|
461 |
throw new SQLException(resBundle.handleGetObject("cachedrowsetimpl.nullhash").toString()); |
|
462 |
} |
|
463 |
||
464 |
String providerName = (String)env.get( |
|
465 |
javax.sql.rowset.spi.SyncFactory.ROWSET_SYNC_PROVIDER); |
|
466 |
||
467 |
// set the Reader, this maybe overridden latter |
|
468 |
provider = |
|
11129
f9ad1aadf3fa
7116445: Miscellaneous warnings in the JDBC/RowSet classes
lancea
parents:
9537
diff
changeset
|
469 |
SyncFactory.getInstance(providerName); |
2 | 470 |
|
471 |
rowSetReader = provider.getRowSetReader(); |
|
472 |
rowSetWriter = provider.getRowSetWriter(); |
|
473 |
||
474 |
initParams(); // allocate the parameters collection |
|
475 |
initContainer(); |
|
476 |
initProperties(); // set up some default values |
|
477 |
} |
|
478 |
||
479 |
/** |
|
480 |
* Sets the <code>rvh</code> field to a new <code>Vector</code> |
|
481 |
* object with a capacity of 100 and sets the |
|
482 |
* <code>cursorPos</code> and <code>numRows</code> fields to zero. |
|
483 |
*/ |
|
484 |
private void initContainer() { |
|
485 |
||
9257
53e6d7bc31b0
7035615: Address lint warnings for javax.sql.rowset & com.sun.rowset
lancea
parents:
6697
diff
changeset
|
486 |
rvh = new Vector<Object>(100); |
2 | 487 |
cursorPos = 0; |
488 |
absolutePos = 0; |
|
489 |
numRows = 0; |
|
490 |
numDeleted = 0; |
|
491 |
} |
|
492 |
||
493 |
/** |
|
494 |
* Sets the properties for this <code>CachedRowSetImpl</code> object to |
|
495 |
* their default values. This method is called internally by the |
|
496 |
* default constructor. |
|
497 |
*/ |
|
498 |
||
499 |
private void initProperties() throws SQLException { |
|
500 |
||
501 |
if(resBundle == null) { |
|
502 |
try { |
|
503 |
resBundle = JdbcRowSetResourceBundle.getJdbcRowSetResourceBundle(); |
|
504 |
} catch(IOException ioe) { |
|
505 |
throw new RuntimeException(ioe); |
|
506 |
} |
|
507 |
} |
|
508 |
setShowDeleted(false); |
|
509 |
setQueryTimeout(0); |
|
510 |
setMaxRows(0); |
|
511 |
setMaxFieldSize(0); |
|
512 |
setType(ResultSet.TYPE_SCROLL_INSENSITIVE); |
|
513 |
setConcurrency(ResultSet.CONCUR_UPDATABLE); |
|
514 |
if((rvh.size() > 0) && (isReadOnly() == false)) |
|
515 |
setReadOnly(false); |
|
516 |
else |
|
517 |
setReadOnly(true); |
|
518 |
setTransactionIsolation(Connection.TRANSACTION_READ_COMMITTED); |
|
519 |
setEscapeProcessing(true); |
|
6530
bfb7b294dd14
6680198: UnmarshalException caused by incompatible serialVersionUID
lancea
parents:
5506
diff
changeset
|
520 |
//setTypeMap(null); |
2 | 521 |
checkTransactionalWriter(); |
522 |
||
523 |
//Instantiating the vector for MatchColumns |
|
524 |
||
9257
53e6d7bc31b0
7035615: Address lint warnings for javax.sql.rowset & com.sun.rowset
lancea
parents:
6697
diff
changeset
|
525 |
iMatchColumns = new Vector<Integer>(10); |
2 | 526 |
for(int i = 0; i < 10 ; i++) { |
11129
f9ad1aadf3fa
7116445: Miscellaneous warnings in the JDBC/RowSet classes
lancea
parents:
9537
diff
changeset
|
527 |
iMatchColumns.add(i, -1); |
2 | 528 |
} |
529 |
||
9257
53e6d7bc31b0
7035615: Address lint warnings for javax.sql.rowset & com.sun.rowset
lancea
parents:
6697
diff
changeset
|
530 |
strMatchColumns = new Vector<String>(10); |
2 | 531 |
for(int j = 0; j < 10; j++) { |
532 |
strMatchColumns.add(j,null); |
|
533 |
} |
|
534 |
} |
|
535 |
||
536 |
/** |
|
537 |
* Determine whether the SyncProvider's writer implements the |
|
538 |
* <code>TransactionalWriter<code> interface |
|
539 |
*/ |
|
540 |
private void checkTransactionalWriter() { |
|
541 |
if (rowSetWriter != null) { |
|
11129
f9ad1aadf3fa
7116445: Miscellaneous warnings in the JDBC/RowSet classes
lancea
parents:
9537
diff
changeset
|
542 |
Class<?> c = rowSetWriter.getClass(); |
2 | 543 |
if (c != null) { |
544 |
Class[] theInterfaces = c.getInterfaces(); |
|
545 |
for (int i = 0; i < theInterfaces.length; i++) { |
|
546 |
if ((theInterfaces[i].getName()).indexOf("TransactionalWriter") > 0) { |
|
547 |
tXWriter = true; |
|
548 |
establishTransactionalWriter(); |
|
549 |
} |
|
550 |
} |
|
551 |
} |
|
552 |
} |
|
553 |
} |
|
554 |
||
555 |
/** |
|
556 |
* Sets an private field to all transaction bounddaries to be set |
|
557 |
*/ |
|
558 |
private void establishTransactionalWriter() { |
|
559 |
tWriter = (TransactionalWriter)provider.getRowSetWriter(); |
|
560 |
} |
|
561 |
||
562 |
//----------------------------------------------------------------------- |
|
563 |
// Properties |
|
564 |
//----------------------------------------------------------------------- |
|
565 |
||
566 |
/** |
|
567 |
* Sets this <code>CachedRowSetImpl</code> object's command property |
|
568 |
* to the given <code>String</code> object and clears the parameters, |
|
569 |
* if any, that were set for the previous command. |
|
570 |
* <P> |
|
571 |
* The command property may not be needed |
|
572 |
* if the rowset is produced by a data source, such as a spreadsheet, |
|
573 |
* that does not support commands. Thus, this property is optional |
|
574 |
* and may be <code>null</code>. |
|
575 |
* |
|
576 |
* @param cmd a <code>String</code> object containing an SQL query |
|
577 |
* that will be set as the command; may be <code>null</code> |
|
578 |
* @throws SQLException if an error occurs |
|
579 |
*/ |
|
580 |
public void setCommand(String cmd) throws SQLException { |
|
581 |
||
582 |
super.setCommand(cmd); |
|
583 |
||
584 |
if(!buildTableName(cmd).equals("")) { |
|
585 |
this.setTableName(buildTableName(cmd)); |
|
586 |
} |
|
587 |
} |
|
588 |
||
589 |
||
590 |
//--------------------------------------------------------------------- |
|
591 |
// Reading and writing data |
|
592 |
//--------------------------------------------------------------------- |
|
593 |
||
594 |
/** |
|
595 |
* Populates this <code>CachedRowSetImpl</code> object with data from |
|
596 |
* the given <code>ResultSet</code> object. This |
|
597 |
* method is an alternative to the method <code>execute</code> |
|
598 |
* for filling the rowset with data. The method <code>populate</code> |
|
599 |
* does not require that the properties needed by the method |
|
600 |
* <code>execute</code>, such as the <code>command</code> property, |
|
601 |
* be set. This is true because the method <code>populate</code> |
|
602 |
* is given the <code>ResultSet</code> object from |
|
603 |
* which to get data and thus does not need to use the properties |
|
604 |
* required for setting up a connection and executing this |
|
605 |
* <code>CachedRowSetImpl</code> object's command. |
|
606 |
* <P> |
|
607 |
* After populating this rowset with data, the method |
|
608 |
* <code>populate</code> sets the rowset's metadata and |
|
609 |
* then sends a <code>RowSetChangedEvent</code> object |
|
610 |
* to all registered listeners prior to returning. |
|
611 |
* |
|
612 |
* @param data the <code>ResultSet</code> object containing the data |
|
613 |
* to be read into this <code>CachedRowSetImpl</code> object |
|
614 |
* @throws SQLException if an error occurs; or the max row setting is |
|
615 |
* violated while populating the RowSet |
|
616 |
* @see #execute |
|
617 |
*/ |
|
618 |
||
619 |
public void populate(ResultSet data) throws SQLException { |
|
620 |
int rowsFetched; |
|
621 |
Row currentRow; |
|
622 |
int numCols; |
|
623 |
int i; |
|
9257
53e6d7bc31b0
7035615: Address lint warnings for javax.sql.rowset & com.sun.rowset
lancea
parents:
6697
diff
changeset
|
624 |
Map<String, Class<?>> map = getTypeMap(); |
2 | 625 |
Object obj; |
626 |
int mRows; |
|
627 |
||
628 |
if (data == null) { |
|
629 |
throw new SQLException(resBundle.handleGetObject("cachedrowsetimpl.populate").toString()); |
|
630 |
} |
|
631 |
this.resultSet = data; |
|
632 |
||
633 |
// get the meta data for this ResultSet |
|
634 |
RSMD = data.getMetaData(); |
|
635 |
||
636 |
// set up the metadata |
|
637 |
RowSetMD = new RowSetMetaDataImpl(); |
|
638 |
initMetaData(RowSetMD, RSMD); |
|
639 |
||
640 |
// release the meta-data so that aren't tempted to use it. |
|
641 |
RSMD = null; |
|
642 |
numCols = RowSetMD.getColumnCount(); |
|
643 |
mRows = this.getMaxRows(); |
|
644 |
rowsFetched = 0; |
|
645 |
currentRow = null; |
|
646 |
||
647 |
while ( data.next()) { |
|
648 |
||
649 |
currentRow = new Row(numCols); |
|
650 |
||
651 |
if ( rowsFetched > mRows && mRows > 0) { |
|
652 |
rowsetWarning.setNextWarning(new RowSetWarning("Populating rows " |
|
653 |
+ "setting has exceeded max row setting")); |
|
654 |
} |
|
655 |
for ( i = 1; i <= numCols; i++) { |
|
656 |
/* |
|
657 |
* check if the user has set a map. If no map |
|
658 |
* is set then use plain getObject. This lets |
|
659 |
* us work with drivers that do not support |
|
660 |
* getObject with a map in fairly sensible way |
|
661 |
*/ |
|
662 |
if (map == null) { |
|
663 |
obj = data.getObject(i); |
|
664 |
} else { |
|
665 |
obj = data.getObject(i, map); |
|
666 |
} |
|
667 |
/* |
|
668 |
* the following block checks for the various |
|
669 |
* types that we have to serialize in order to |
|
670 |
* store - right now only structs have been tested |
|
671 |
*/ |
|
672 |
if (obj instanceof Struct) { |
|
673 |
obj = new SerialStruct((Struct)obj, map); |
|
674 |
} else if (obj instanceof SQLData) { |
|
675 |
obj = new SerialStruct((SQLData)obj, map); |
|
676 |
} else if (obj instanceof Blob) { |
|
677 |
obj = new SerialBlob((Blob)obj); |
|
678 |
} else if (obj instanceof Clob) { |
|
679 |
obj = new SerialClob((Clob)obj); |
|
680 |
} else if (obj instanceof java.sql.Array) { |
|
6530
bfb7b294dd14
6680198: UnmarshalException caused by incompatible serialVersionUID
lancea
parents:
5506
diff
changeset
|
681 |
if(map != null) |
bfb7b294dd14
6680198: UnmarshalException caused by incompatible serialVersionUID
lancea
parents:
5506
diff
changeset
|
682 |
obj = new SerialArray((java.sql.Array)obj, map); |
bfb7b294dd14
6680198: UnmarshalException caused by incompatible serialVersionUID
lancea
parents:
5506
diff
changeset
|
683 |
else |
bfb7b294dd14
6680198: UnmarshalException caused by incompatible serialVersionUID
lancea
parents:
5506
diff
changeset
|
684 |
obj = new SerialArray((java.sql.Array)obj); |
2 | 685 |
} |
686 |
||
11129
f9ad1aadf3fa
7116445: Miscellaneous warnings in the JDBC/RowSet classes
lancea
parents:
9537
diff
changeset
|
687 |
currentRow.initColumnObject(i, obj); |
2 | 688 |
} |
689 |
rowsFetched++; |
|
690 |
rvh.add(currentRow); |
|
691 |
} |
|
692 |
||
693 |
numRows = rowsFetched ; |
|
694 |
// Also rowsFetched should be equal to rvh.size() |
|
695 |
||
696 |
// notify any listeners that the rowset has changed |
|
697 |
notifyRowSetChanged(); |
|
698 |
||
699 |
||
700 |
} |
|
701 |
||
702 |
/** |
|
703 |
* Initializes the given <code>RowSetMetaData</code> object with the values |
|
704 |
* in the given <code>ResultSetMetaData</code> object. |
|
705 |
* |
|
706 |
* @param md the <code>RowSetMetaData</code> object for this |
|
707 |
* <code>CachedRowSetImpl</code> object, which will be set with |
|
708 |
* values from rsmd |
|
709 |
* @param rsmd the <code>ResultSetMetaData</code> object from which new |
|
710 |
* values for md will be read |
|
711 |
* @throws SQLException if an error occurs |
|
712 |
*/ |
|
713 |
private void initMetaData(RowSetMetaDataImpl md, ResultSetMetaData rsmd) throws SQLException { |
|
714 |
int numCols = rsmd.getColumnCount(); |
|
715 |
||
716 |
md.setColumnCount(numCols); |
|
717 |
for (int col=1; col <= numCols; col++) { |
|
718 |
md.setAutoIncrement(col, rsmd.isAutoIncrement(col)); |
|
719 |
if(rsmd.isAutoIncrement(col)) |
|
720 |
updateOnInsert = true; |
|
721 |
md.setCaseSensitive(col, rsmd.isCaseSensitive(col)); |
|
722 |
md.setCurrency(col, rsmd.isCurrency(col)); |
|
723 |
md.setNullable(col, rsmd.isNullable(col)); |
|
724 |
md.setSigned(col, rsmd.isSigned(col)); |
|
725 |
md.setSearchable(col, rsmd.isSearchable(col)); |
|
726 |
/* |
|
727 |
* The PostgreSQL drivers sometimes return negative columnDisplaySize, |
|
728 |
* which causes an exception to be thrown. Check for it. |
|
729 |
*/ |
|
730 |
int size = rsmd.getColumnDisplaySize(col); |
|
731 |
if (size < 0) { |
|
732 |
size = 0; |
|
733 |
} |
|
734 |
md.setColumnDisplaySize(col, size); |
|
735 |
md.setColumnLabel(col, rsmd.getColumnLabel(col)); |
|
736 |
md.setColumnName(col, rsmd.getColumnName(col)); |
|
737 |
md.setSchemaName(col, rsmd.getSchemaName(col)); |
|
738 |
/* |
|
739 |
* Drivers return some strange values for precision, for non-numeric data, including reports of |
|
740 |
* non-integer values; maybe we should check type, & set to 0 for non-numeric types. |
|
741 |
*/ |
|
742 |
int precision = rsmd.getPrecision(col); |
|
743 |
if (precision < 0) { |
|
744 |
precision = 0; |
|
745 |
} |
|
746 |
md.setPrecision(col, precision); |
|
747 |
||
748 |
/* |
|
749 |
* It seems, from a bug report, that a driver can sometimes return a negative |
|
750 |
* value for scale. javax.sql.rowset.RowSetMetaDataImpl will throw an exception |
|
751 |
* if we attempt to set a negative value. As such, we'll check for this case. |
|
752 |
*/ |
|
753 |
int scale = rsmd.getScale(col); |
|
754 |
if (scale < 0) { |
|
755 |
scale = 0; |
|
756 |
} |
|
757 |
md.setScale(col, scale); |
|
758 |
md.setTableName(col, rsmd.getTableName(col)); |
|
759 |
md.setCatalogName(col, rsmd.getCatalogName(col)); |
|
760 |
md.setColumnType(col, rsmd.getColumnType(col)); |
|
761 |
md.setColumnTypeName(col, rsmd.getColumnTypeName(col)); |
|
762 |
} |
|
763 |
||
764 |
if( conn != null){ |
|
765 |
// JDBC 4.0 mandates as does the Java EE spec that all DataBaseMetaData methods |
|
766 |
// must be implemented, therefore, the previous fix for 5055528 is being backed out |
|
6530
bfb7b294dd14
6680198: UnmarshalException caused by incompatible serialVersionUID
lancea
parents:
5506
diff
changeset
|
767 |
dbmslocatorsUpdateCopy = conn.getMetaData().locatorsUpdateCopy(); |
2 | 768 |
} |
769 |
} |
|
770 |
||
771 |
/** |
|
772 |
* Populates this <code>CachedRowSetImpl</code> object with data, |
|
773 |
* using the given connection to produce the result set from |
|
774 |
* which data will be read. A second form of this method, |
|
775 |
* which takes no arguments, uses the values from this rowset's |
|
776 |
* user, password, and either url or data source properties to |
|
777 |
* create a new database connection. The form of <code>execute</code> |
|
778 |
* that is given a connection ignores these properties. |
|
779 |
* |
|
780 |
* @param conn A standard JDBC <code>Connection</code> object that this |
|
781 |
* <code>CachedRowSet</code> object can pass to a synchronization provider |
|
782 |
* to establish a connection to the data source |
|
783 |
* @throws SQLException if an invalid <code>Connection</code> is supplied |
|
784 |
* or an error occurs in establishing the connection to the |
|
785 |
* data source |
|
786 |
* @see #populate |
|
787 |
* @see java.sql.Connection |
|
788 |
*/ |
|
789 |
public void execute(Connection conn) throws SQLException { |
|
790 |
// store the connection so the reader can find it. |
|
791 |
setConnection(conn); |
|
792 |
||
793 |
if(getPageSize() != 0){ |
|
794 |
crsReader = (CachedRowSetReader)provider.getRowSetReader(); |
|
795 |
crsReader.setStartPosition(1); |
|
796 |
callWithCon = true; |
|
797 |
crsReader.readData((RowSetInternal)this); |
|
798 |
} |
|
799 |
||
800 |
// Now call the current reader's readData method |
|
801 |
else { |
|
802 |
rowSetReader.readData((RowSetInternal)this); |
|
803 |
} |
|
804 |
RowSetMD = (RowSetMetaDataImpl)this.getMetaData(); |
|
805 |
||
806 |
if(conn != null){ |
|
807 |
// JDBC 4.0 mandates as does the Java EE spec that all DataBaseMetaData methods |
|
808 |
// must be implemented, therefore, the previous fix for 5055528 is being backed out |
|
809 |
dbmslocatorsUpdateCopy = conn.getMetaData().locatorsUpdateCopy(); |
|
810 |
} |
|
811 |
||
812 |
} |
|
813 |
||
814 |
/** |
|
815 |
* Sets this <code>CachedRowSetImpl</code> object's connection property |
|
816 |
* to the given <code>Connection</code> object. This method is called |
|
817 |
* internally by the version of the method <code>execute</code> that takes a |
|
818 |
* <code>Connection</code> object as an argument. The reader for this |
|
819 |
* <code>CachedRowSetImpl</code> object can retrieve the connection stored |
|
820 |
* in the rowset's connection property by calling its |
|
821 |
* <code>getConnection</code> method. |
|
822 |
* |
|
823 |
* @param connection the <code>Connection</code> object that was passed in |
|
824 |
* to the method <code>execute</code> and is to be stored |
|
825 |
* in this <code>CachedRowSetImpl</code> object's connection |
|
826 |
* property |
|
827 |
*/ |
|
828 |
private void setConnection (Connection connection) { |
|
829 |
conn = connection; |
|
830 |
} |
|
831 |
||
832 |
||
833 |
/** |
|
834 |
* Propagates all row update, insert, and delete changes to the |
|
835 |
* underlying data source backing this <code>CachedRowSetImpl</code> |
|
836 |
* object. |
|
837 |
* <P> |
|
838 |
* <b>Note</b>In the reference implementation an optimistic concurrency implementation |
|
839 |
* is provided as a sample implementation of a the <code>SyncProvider</code> |
|
840 |
* abstract class. |
|
841 |
* <P> |
|
842 |
* This method fails if any of the updates cannot be propagated back |
|
843 |
* to the data source. When it fails, the caller can assume that |
|
844 |
* none of the updates are reflected in the data source. |
|
845 |
* When an exception is thrown, the current row |
|
846 |
* is set to the first "updated" row that resulted in an exception |
|
847 |
* unless the row that caused the exception is a "deleted" row. |
|
848 |
* In that case, when deleted rows are not shown, which is usually true, |
|
849 |
* the current row is not affected. |
|
850 |
* <P> |
|
851 |
* If no <code>SyncProvider</code> is configured, the reference implementation |
|
852 |
* leverages the <code>RIOptimisticProvider</code> available which provides the |
|
853 |
* default and reference synchronization capabilities for disconnected |
|
854 |
* <code>RowSets</code>. |
|
855 |
* |
|
856 |
* @throws SQLException if the cursor is on the insert row or the underlying |
|
857 |
* reference synchronization provider fails to commit the updates |
|
858 |
* to the datasource |
|
859 |
* @throws SyncProviderException if an internal error occurs within the |
|
860 |
* <code>SyncProvider</code> instance during either during the |
|
861 |
* process or at any time when the <code>SyncProvider</code> |
|
862 |
* instance touches the data source. |
|
863 |
* @see #acceptChanges(java.sql.Connection) |
|
864 |
* @see javax.sql.RowSetWriter |
|
865 |
* @see javax.sql.rowset.spi.SyncProvider |
|
866 |
*/ |
|
867 |
public void acceptChanges() throws SyncProviderException { |
|
868 |
if (onInsertRow == true) { |
|
869 |
throw new SyncProviderException(resBundle.handleGetObject("cachedrowsetimpl.invalidop").toString()); |
|
870 |
} |
|
871 |
||
872 |
int saveCursorPos = cursorPos; |
|
873 |
boolean success = false; |
|
874 |
boolean conflict = false; |
|
875 |
||
876 |
try { |
|
877 |
if (rowSetWriter != null) { |
|
878 |
saveCursorPos = cursorPos; |
|
879 |
conflict = rowSetWriter.writeData((RowSetInternal)this); |
|
880 |
cursorPos = saveCursorPos; |
|
881 |
} |
|
882 |
||
11129
f9ad1aadf3fa
7116445: Miscellaneous warnings in the JDBC/RowSet classes
lancea
parents:
9537
diff
changeset
|
883 |
if (tXWriter) { |
2 | 884 |
// do commit/rollback's here |
885 |
if (!conflict) { |
|
886 |
tWriter = (TransactionalWriter)rowSetWriter; |
|
887 |
tWriter.rollback(); |
|
888 |
success = false; |
|
889 |
} else { |
|
890 |
tWriter = (TransactionalWriter)rowSetWriter; |
|
6664
979f457afd3a
6983452: SyncProvider issue for JoinRowSet implementation
lancea
parents:
6540
diff
changeset
|
891 |
if (tWriter instanceof CachedRowSetWriter) { |
979f457afd3a
6983452: SyncProvider issue for JoinRowSet implementation
lancea
parents:
6540
diff
changeset
|
892 |
((CachedRowSetWriter)tWriter).commit(this, updateOnInsert); |
979f457afd3a
6983452: SyncProvider issue for JoinRowSet implementation
lancea
parents:
6540
diff
changeset
|
893 |
} else { |
979f457afd3a
6983452: SyncProvider issue for JoinRowSet implementation
lancea
parents:
6540
diff
changeset
|
894 |
tWriter.commit(); |
979f457afd3a
6983452: SyncProvider issue for JoinRowSet implementation
lancea
parents:
6540
diff
changeset
|
895 |
} |
979f457afd3a
6983452: SyncProvider issue for JoinRowSet implementation
lancea
parents:
6540
diff
changeset
|
896 |
|
2 | 897 |
success = true; |
898 |
} |
|
899 |
} |
|
900 |
||
901 |
if (success == true) { |
|
902 |
setOriginal(); |
|
11129
f9ad1aadf3fa
7116445: Miscellaneous warnings in the JDBC/RowSet classes
lancea
parents:
9537
diff
changeset
|
903 |
} else if (!(success) ) { |
2 | 904 |
throw new SyncProviderException(resBundle.handleGetObject("cachedrowsetimpl.accfailed").toString()); |
905 |
} |
|
906 |
||
907 |
} catch (SyncProviderException spe) { |
|
908 |
throw spe; |
|
909 |
} catch (SQLException e) { |
|
910 |
e.printStackTrace(); |
|
911 |
throw new SyncProviderException(e.getMessage()); |
|
912 |
} catch (SecurityException e) { |
|
913 |
throw new SyncProviderException(e.getMessage()); |
|
914 |
} |
|
915 |
} |
|
916 |
||
917 |
/** |
|
918 |
* Propagates all row update, insert, and delete changes to the |
|
919 |
* data source backing this <code>CachedRowSetImpl</code> object |
|
920 |
* using the given <code>Connection</code> object. |
|
921 |
* <P> |
|
922 |
* The reference implementation <code>RIOptimisticProvider</code> |
|
923 |
* modifies its synchronization to a write back function given |
|
924 |
* the updated connection |
|
925 |
* The reference implementation modifies its synchronization behaviour |
|
926 |
* via the <code>SyncProvider</code> to ensure the synchronization |
|
927 |
* occurs according to the updated JDBC <code>Connection</code> |
|
928 |
* properties. |
|
929 |
* |
|
930 |
* @param con a standard JDBC <code>Connection</code> object |
|
931 |
* @throws SQLException if the cursor is on the insert row or the underlying |
|
932 |
* synchronization provider fails to commit the updates |
|
933 |
* back to the data source |
|
934 |
* @see #acceptChanges |
|
935 |
* @see javax.sql.RowSetWriter |
|
936 |
* @see javax.sql.rowset.spi.SyncFactory |
|
937 |
* @see javax.sql.rowset.spi.SyncProvider |
|
938 |
*/ |
|
939 |
public void acceptChanges(Connection con) throws SyncProviderException{ |
|
9257
53e6d7bc31b0
7035615: Address lint warnings for javax.sql.rowset & com.sun.rowset
lancea
parents:
6697
diff
changeset
|
940 |
setConnection(con); |
53e6d7bc31b0
7035615: Address lint warnings for javax.sql.rowset & com.sun.rowset
lancea
parents:
6697
diff
changeset
|
941 |
acceptChanges(); |
2 | 942 |
} |
943 |
||
944 |
/** |
|
945 |
* Restores this <code>CachedRowSetImpl</code> object to its original state, |
|
946 |
* that is, its state before the last set of changes. |
|
947 |
* <P> |
|
948 |
* Before returning, this method moves the cursor before the first row |
|
949 |
* and sends a <code>rowSetChanged</code> event to all registered |
|
950 |
* listeners. |
|
951 |
* @throws SQLException if an error is occurs rolling back the RowSet |
|
952 |
* state to the definied original value. |
|
953 |
* @see javax.sql.RowSetListener#rowSetChanged |
|
954 |
*/ |
|
955 |
public void restoreOriginal() throws SQLException { |
|
956 |
Row currentRow; |
|
11129
f9ad1aadf3fa
7116445: Miscellaneous warnings in the JDBC/RowSet classes
lancea
parents:
9537
diff
changeset
|
957 |
for (Iterator<?> i = rvh.iterator(); i.hasNext();) { |
2 | 958 |
currentRow = (Row)i.next(); |
959 |
if (currentRow.getInserted() == true) { |
|
960 |
i.remove(); |
|
961 |
--numRows; |
|
962 |
} else { |
|
963 |
if (currentRow.getDeleted() == true) { |
|
964 |
currentRow.clearDeleted(); |
|
965 |
} |
|
966 |
if (currentRow.getUpdated() == true) { |
|
967 |
currentRow.clearUpdated(); |
|
968 |
} |
|
969 |
} |
|
970 |
} |
|
971 |
// move to before the first |
|
972 |
cursorPos = 0; |
|
973 |
||
974 |
// notify any listeners |
|
975 |
notifyRowSetChanged(); |
|
976 |
} |
|
977 |
||
978 |
/** |
|
979 |
* Releases the current contents of this <code>CachedRowSetImpl</code> |
|
980 |
* object and sends a <code>rowSetChanged</code> event object to all |
|
981 |
* registered listeners. |
|
982 |
* |
|
983 |
* @throws SQLException if an error occurs flushing the contents of |
|
984 |
* RowSet. |
|
985 |
* @see javax.sql.RowSetListener#rowSetChanged |
|
986 |
*/ |
|
987 |
public void release() throws SQLException { |
|
988 |
initContainer(); |
|
989 |
notifyRowSetChanged(); |
|
990 |
} |
|
991 |
||
992 |
/** |
|
993 |
* Cancels deletion of the current row and notifies listeners that |
|
994 |
* a row has changed. |
|
995 |
* <P> |
|
996 |
* Note: This method can be ignored if deleted rows are not being shown, |
|
997 |
* which is the normal case. |
|
998 |
* |
|
999 |
* @throws SQLException if the cursor is not on a valid row |
|
1000 |
*/ |
|
1001 |
public void undoDelete() throws SQLException { |
|
1002 |
if (getShowDeleted() == false) { |
|
1003 |
return; |
|
1004 |
} |
|
1005 |
// make sure we are on a row |
|
1006 |
checkCursor(); |
|
1007 |
||
1008 |
// don't want this to happen... |
|
1009 |
if (onInsertRow == true) { |
|
1010 |
throw new SQLException(resBundle.handleGetObject("cachedrowsetimpl.invalidcp").toString()); |
|
1011 |
} |
|
1012 |
||
1013 |
Row currentRow = (Row)getCurrentRow(); |
|
1014 |
if (currentRow.getDeleted() == true) { |
|
1015 |
currentRow.clearDeleted(); |
|
1016 |
--numDeleted; |
|
1017 |
notifyRowChanged(); |
|
1018 |
} |
|
1019 |
} |
|
1020 |
||
1021 |
/** |
|
1022 |
* Immediately removes the current row from this |
|
1023 |
* <code>CachedRowSetImpl</code> object if the row has been inserted, and |
|
1024 |
* also notifies listeners the a row has changed. An exception is thrown |
|
1025 |
* if the row is not a row that has been inserted or the cursor is before |
|
1026 |
* the first row, after the last row, or on the insert row. |
|
1027 |
* <P> |
|
1028 |
* This operation cannot be undone. |
|
1029 |
* |
|
1030 |
* @throws SQLException if an error occurs, |
|
1031 |
* the cursor is not on a valid row, |
|
1032 |
* or the row has not been inserted |
|
1033 |
*/ |
|
1034 |
public void undoInsert() throws SQLException { |
|
1035 |
// make sure we are on a row |
|
1036 |
checkCursor(); |
|
1037 |
||
1038 |
// don't want this to happen... |
|
1039 |
if (onInsertRow == true) { |
|
1040 |
throw new SQLException(resBundle.handleGetObject("cachedrowsetimpl.invalidcp").toString()); |
|
1041 |
} |
|
1042 |
||
1043 |
Row currentRow = (Row)getCurrentRow(); |
|
1044 |
if (currentRow.getInserted() == true) { |
|
1045 |
rvh.remove(cursorPos-1); |
|
1046 |
--numRows; |
|
1047 |
notifyRowChanged(); |
|
1048 |
} else { |
|
1049 |
throw new SQLException(resBundle.handleGetObject("cachedrowsetimpl.illegalop").toString()); |
|
1050 |
} |
|
1051 |
} |
|
1052 |
||
1053 |
/** |
|
1054 |
* Immediately reverses the last update operation if the |
|
1055 |
* row has been modified. This method can be |
|
1056 |
* called to reverse updates on a all columns until all updates in a row have |
|
1057 |
* been rolled back to their originating state since the last synchronization |
|
1058 |
* (<code>acceptChanges</code>) or population. This method may also be called |
|
1059 |
* while performing updates to the insert row. |
|
1060 |
* <P> |
|
1061 |
* <code>undoUpdate</code may be called at any time during the life-time of a |
|
1062 |
* rowset, however after a synchronization has occurs this method has no |
|
1063 |
* affect until further modification to the RowSet data occurs. |
|
1064 |
* |
|
1065 |
* @throws SQLException if cursor is before the first row, after the last |
|
1066 |
* row in rowset. |
|
1067 |
* @see #undoDelete |
|
1068 |
* @see #undoInsert |
|
1069 |
* @see java.sql.ResultSet#cancelRowUpdates |
|
1070 |
*/ |
|
1071 |
public void undoUpdate() throws SQLException { |
|
1072 |
// if on insert row, cancel the insert row |
|
1073 |
// make the insert row flag, |
|
1074 |
// cursorPos back to the current row |
|
1075 |
moveToCurrentRow(); |
|
1076 |
||
1077 |
// else if not on insert row |
|
1078 |
// call undoUpdate or undoInsert |
|
1079 |
undoDelete(); |
|
1080 |
||
1081 |
undoInsert(); |
|
1082 |
||
1083 |
} |
|
1084 |
||
1085 |
//-------------------------------------------------------------------- |
|
1086 |
// Views |
|
1087 |
//-------------------------------------------------------------------- |
|
1088 |
||
1089 |
/** |
|
1090 |
* Returns a new <code>RowSet</code> object backed by the same data as |
|
1091 |
* that of this <code>CachedRowSetImpl</code> object and sharing a set of cursors |
|
1092 |
* with it. This allows cursors to interate over a shared set of rows, providing |
|
1093 |
* multiple views of the underlying data. |
|
1094 |
* |
|
1095 |
* @return a <code>RowSet</code> object that is a copy of this <code>CachedRowSetImpl</code> |
|
1096 |
* object and shares a set of cursors with it |
|
1097 |
* @throws SQLException if an error occurs or cloning is |
|
1098 |
* not supported |
|
1099 |
* @see javax.sql.RowSetEvent |
|
1100 |
* @see javax.sql.RowSetListener |
|
1101 |
*/ |
|
1102 |
public RowSet createShared() throws SQLException { |
|
1103 |
RowSet clone; |
|
1104 |
try { |
|
1105 |
clone = (RowSet)clone(); |
|
1106 |
} catch (CloneNotSupportedException ex) { |
|
1107 |
throw new SQLException(ex.getMessage()); |
|
1108 |
} |
|
1109 |
return clone; |
|
1110 |
} |
|
1111 |
||
1112 |
/** |
|
1113 |
* Returns a new <code>RowSet</code> object containing by the same data |
|
1114 |
* as this <code>CachedRowSetImpl</code> object. This method |
|
1115 |
* differs from the method <code>createCopy</code> in that it throws a |
|
1116 |
* <code>CloneNotSupportedException</code> object instead of an |
|
1117 |
* <code>SQLException</code> object, as the method <code>createShared</code> |
|
1118 |
* does. This <code>clone</code> |
|
1119 |
* method is called internally by the method <code>createShared</code>, |
|
1120 |
* which catches the <code>CloneNotSupportedException</code> object |
|
1121 |
* and in turn throws a new <code>SQLException</code> object. |
|
1122 |
* |
|
1123 |
* @return a copy of this <code>CachedRowSetImpl</code> object |
|
1124 |
* @throws CloneNotSupportedException if an error occurs when |
|
1125 |
* attempting to clone this <code>CachedRowSetImpl</code> object |
|
1126 |
* @see #createShared |
|
1127 |
*/ |
|
1128 |
protected Object clone() throws CloneNotSupportedException { |
|
1129 |
return (super.clone()); |
|
1130 |
} |
|
1131 |
||
1132 |
/** |
|
1133 |
* Creates a <code>RowSet</code> object that is a deep copy of |
|
1134 |
* this <code>CachedRowSetImpl</code> object's data, including |
|
1135 |
* constraints. Updates made |
|
1136 |
* on a copy are not visible to the original rowset; |
|
1137 |
* a copy of a rowset is completely independent from the original. |
|
1138 |
* <P> |
|
1139 |
* Making a copy saves the cost of creating an identical rowset |
|
1140 |
* from first principles, which can be quite expensive. |
|
1141 |
* For example, it can eliminate the need to query a |
|
1142 |
* remote database server. |
|
1143 |
* @return a new <code>CachedRowSet</code> object that is a deep copy |
|
1144 |
* of this <code>CachedRowSet</code> object and is |
|
1145 |
* completely independent from this <code>CachedRowSetImpl</code> |
|
1146 |
* object. |
|
1147 |
* @throws SQLException if an error occurs in generating the copy of this |
|
1148 |
* of the <code>CachedRowSetImpl</code> |
|
1149 |
* @see #createShared |
|
1150 |
* @see javax.sql.RowSetEvent |
|
1151 |
* @see javax.sql.RowSetListener |
|
1152 |
*/ |
|
1153 |
public CachedRowSet createCopy() throws SQLException { |
|
1154 |
ObjectOutputStream out; |
|
1155 |
ByteArrayOutputStream bOut = new ByteArrayOutputStream(); |
|
1156 |
try { |
|
1157 |
out = new ObjectOutputStream(bOut); |
|
1158 |
out.writeObject(this); |
|
1159 |
} catch (IOException ex) { |
|
1160 |
throw new SQLException(MessageFormat.format(resBundle.handleGetObject("cachedrowsetimpl.clonefail").toString() , ex.getMessage())); |
|
1161 |
} |
|
1162 |
||
1163 |
ObjectInputStream in; |
|
1164 |
||
1165 |
try { |
|
1166 |
ByteArrayInputStream bIn = new ByteArrayInputStream(bOut.toByteArray()); |
|
1167 |
in = new ObjectInputStream(bIn); |
|
1168 |
} catch (StreamCorruptedException ex) { |
|
1169 |
throw new SQLException(MessageFormat.format(resBundle.handleGetObject("cachedrowsetimpl.clonefail").toString() , ex.getMessage())); |
|
1170 |
} catch (IOException ex) { |
|
1171 |
throw new SQLException(MessageFormat.format(resBundle.handleGetObject("cachedrowsetimpl.clonefail").toString() , ex.getMessage())); |
|
1172 |
} |
|
1173 |
||
1174 |
try { |
|
1175 |
//return ((CachedRowSet)(in.readObject())); |
|
1176 |
CachedRowSetImpl crsTemp = (CachedRowSetImpl)in.readObject(); |
|
1177 |
crsTemp.resBundle = this.resBundle; |
|
1178 |
return ((CachedRowSet)crsTemp); |
|
1179 |
||
1180 |
} catch (ClassNotFoundException ex) { |
|
1181 |
throw new SQLException(MessageFormat.format(resBundle.handleGetObject("cachedrowsetimpl.clonefail").toString() , ex.getMessage())); |
|
1182 |
} catch (OptionalDataException ex) { |
|
1183 |
throw new SQLException(MessageFormat.format(resBundle.handleGetObject("cachedrowsetimpl.clonefail").toString() , ex.getMessage())); |
|
1184 |
} catch (IOException ex) { |
|
1185 |
throw new SQLException(MessageFormat.format(resBundle.handleGetObject("cachedrowsetimpl.clonefail").toString() , ex.getMessage())); |
|
1186 |
} |
|
1187 |
} |
|
1188 |
||
1189 |
/** |
|
1190 |
* Creates a <code>RowSet</code> object that is a copy of |
|
1191 |
* this <code>CachedRowSetImpl</code> object's table structure |
|
1192 |
* and the constraints only. |
|
1193 |
* There will be no data in the object being returned. |
|
1194 |
* Updates made on a copy are not visible to the original rowset. |
|
1195 |
* <P> |
|
1196 |
* This helps in getting the underlying XML schema which can |
|
1197 |
* be used as the basis for populating a <code>WebRowSet</code>. |
|
1198 |
* |
|
1199 |
* @return a new <code>CachedRowSet</code> object that is a copy |
|
1200 |
* of this <code>CachedRowSetImpl</code> object's schema and |
|
1201 |
* retains all the constraints on the original rowset but contains |
|
1202 |
* no data |
|
1203 |
* @throws SQLException if an error occurs in generating the copy |
|
1204 |
* of the <code>CachedRowSet</code> object |
|
1205 |
* @see #createShared |
|
1206 |
* @see #createCopy |
|
1207 |
* @see #createCopyNoConstraints |
|
1208 |
* @see javax.sql.RowSetEvent |
|
1209 |
* @see javax.sql.RowSetListener |
|
1210 |
*/ |
|
1211 |
public CachedRowSet createCopySchema() throws SQLException { |
|
1212 |
// Copy everything except data i.e all constraints |
|
1213 |
||
1214 |
// Store the number of rows of "this" |
|
1215 |
// and make numRows equals zero. |
|
1216 |
// and make data also zero. |
|
1217 |
int nRows = numRows; |
|
1218 |
numRows = 0; |
|
1219 |
||
1220 |
CachedRowSet crs = this.createCopy(); |
|
1221 |
||
1222 |
// reset this object back to number of rows. |
|
1223 |
numRows = nRows; |
|
1224 |
||
1225 |
return crs; |
|
1226 |
} |
|
1227 |
||
1228 |
/** |
|
1229 |
* Creates a <code>CachedRowSet</code> object that is a copy of |
|
1230 |
* this <code>CachedRowSetImpl</code> object's data only. |
|
1231 |
* All constraints set in this object will not be there |
|
1232 |
* in the returning object. Updates made |
|
1233 |
* on a copy are not visible to the original rowset. |
|
1234 |
* |
|
1235 |
* @return a new <code>CachedRowSet</code> object that is a deep copy |
|
1236 |
* of this <code>CachedRowSetImpl</code> object and is |
|
1237 |
* completely independent from this <code>CachedRowSetImpl</code> object |
|
1238 |
* @throws SQLException if an error occurs in generating the copy of the |
|
1239 |
* of the <code>CachedRowSet</code> |
|
1240 |
* @see #createShared |
|
1241 |
* @see #createCopy |
|
1242 |
* @see #createCopySchema |
|
1243 |
* @see javax.sql.RowSetEvent |
|
1244 |
* @see javax.sql.RowSetListener |
|
1245 |
*/ |
|
1246 |
public CachedRowSet createCopyNoConstraints() throws SQLException { |
|
1247 |
// Copy the whole data ONLY without any constraints. |
|
1248 |
CachedRowSetImpl crs; |
|
1249 |
crs = (CachedRowSetImpl)this.createCopy(); |
|
1250 |
||
1251 |
crs.initProperties(); |
|
1252 |
try { |
|
1253 |
crs.unsetMatchColumn(crs.getMatchColumnIndexes()); |
|
1254 |
} catch(SQLException sqle) { |
|
1255 |
//do nothing, if the setMatchColumn is not set. |
|
1256 |
} |
|
1257 |
||
1258 |
try { |
|
1259 |
crs.unsetMatchColumn(crs.getMatchColumnNames()); |
|
1260 |
} catch(SQLException sqle) { |
|
1261 |
//do nothing, if the setMatchColumn is not set. |
|
1262 |
} |
|
1263 |
||
1264 |
return crs; |
|
1265 |
} |
|
1266 |
||
1267 |
/** |
|
1268 |
* Converts this <code>CachedRowSetImpl</code> object to a collection |
|
1269 |
* of tables. The sample implementation utilitizes the <code>TreeMap</code> |
|
1270 |
* collection type. |
|
1271 |
* This class guarantees that the map will be in ascending key order, |
|
1272 |
* sorted according to the natural order for the key's class. |
|
1273 |
* |
|
1274 |
* @return a <code>Collection</code> object consisting of tables, |
|
1275 |
* each of which is a copy of a row in this |
|
1276 |
* <code>CachedRowSetImpl</code> object |
|
1277 |
* @throws SQLException if an error occurs in generating the collection |
|
1278 |
* @see #toCollection(int) |
|
1279 |
* @see #toCollection(String) |
|
1280 |
* @see java.util.TreeMap |
|
1281 |
*/ |
|
1282 |
public Collection<?> toCollection() throws SQLException { |
|
1283 |
||
9257
53e6d7bc31b0
7035615: Address lint warnings for javax.sql.rowset & com.sun.rowset
lancea
parents:
6697
diff
changeset
|
1284 |
TreeMap<Integer, Object> tMap = new TreeMap<>(); |
2 | 1285 |
|
1286 |
for (int i = 0; i<numRows; i++) { |
|
11129
f9ad1aadf3fa
7116445: Miscellaneous warnings in the JDBC/RowSet classes
lancea
parents:
9537
diff
changeset
|
1287 |
tMap.put(i, rvh.get(i)); |
2 | 1288 |
} |
1289 |
||
1290 |
return (tMap.values()); |
|
1291 |
} |
|
1292 |
||
1293 |
/** |
|
1294 |
* Returns the specified column of this <code>CachedRowSetImpl</code> object |
|
1295 |
* as a <code>Collection</code> object. This method makes a copy of the |
|
1296 |
* column's data and utilitizes the <code>Vector</code> to establish the |
|
1297 |
* collection. The <code>Vector</code> class implements a growable array |
|
1298 |
* objects allowing the individual components to be accessed using an |
|
1299 |
* an integer index similar to that of an array. |
|
1300 |
* |
|
1301 |
* @return a <code>Collection</code> object that contains the value(s) |
|
1302 |
* stored in the specified column of this |
|
1303 |
* <code>CachedRowSetImpl</code> |
|
1304 |
* object |
|
1305 |
* @throws SQLException if an error occurs generated the collection; or |
|
1306 |
* an invalid column is provided. |
|
1307 |
* @see #toCollection() |
|
1308 |
* @see #toCollection(String) |
|
1309 |
* @see java.util.Vector |
|
1310 |
*/ |
|
1311 |
public Collection<?> toCollection(int column) throws SQLException { |
|
1312 |
||
1313 |
int nRows = numRows; |
|
9257
53e6d7bc31b0
7035615: Address lint warnings for javax.sql.rowset & com.sun.rowset
lancea
parents:
6697
diff
changeset
|
1314 |
Vector<Object> vec = new Vector<>(nRows); |
2 | 1315 |
|
1316 |
// create a copy |
|
1317 |
CachedRowSetImpl crsTemp; |
|
1318 |
crsTemp = (CachedRowSetImpl) this.createCopy(); |
|
1319 |
||
1320 |
while(nRows!=0) { |
|
1321 |
crsTemp.next(); |
|
1322 |
vec.add(crsTemp.getObject(column)); |
|
1323 |
nRows--; |
|
1324 |
} |
|
1325 |
||
1326 |
return (Collection)vec; |
|
1327 |
} |
|
1328 |
||
1329 |
/** |
|
1330 |
* Returns the specified column of this <code>CachedRowSetImpl</code> object |
|
1331 |
* as a <code>Collection</code> object. This method makes a copy of the |
|
1332 |
* column's data and utilitizes the <code>Vector</code> to establish the |
|
1333 |
* collection. The <code>Vector</code> class implements a growable array |
|
1334 |
* objects allowing the individual components to be accessed using an |
|
1335 |
* an integer index similar to that of an array. |
|
1336 |
* |
|
1337 |
* @return a <code>Collection</code> object that contains the value(s) |
|
1338 |
* stored in the specified column of this |
|
1339 |
* <code>CachedRowSetImpl</code> |
|
1340 |
* object |
|
1341 |
* @throws SQLException if an error occurs generated the collection; or |
|
1342 |
* an invalid column is provided. |
|
1343 |
* @see #toCollection() |
|
1344 |
* @see #toCollection(int) |
|
1345 |
* @see java.util.Vector |
|
1346 |
*/ |
|
1347 |
public Collection<?> toCollection(String column) throws SQLException { |
|
1348 |
return toCollection(getColIdxByName(column)); |
|
1349 |
} |
|
1350 |
||
1351 |
//-------------------------------------------------------------------- |
|
1352 |
// Advanced features |
|
1353 |
//-------------------------------------------------------------------- |
|
1354 |
||
1355 |
||
1356 |
/** |
|
1357 |
* Returns the <code>SyncProvider</code> implementation being used |
|
1358 |
* with this <code>CachedRowSetImpl</code> implementation rowset. |
|
1359 |
* |
|
1360 |
* @return the SyncProvider used by the rowset. If not provider was |
|
1361 |
* set when the rowset was instantiated, the reference |
|
1362 |
* implementation (default) provider is returned. |
|
1363 |
* @throws SQLException if error occurs while return the |
|
1364 |
* <code>SyncProvider</code> instance. |
|
1365 |
*/ |
|
1366 |
public SyncProvider getSyncProvider() throws SQLException { |
|
1367 |
return provider; |
|
1368 |
} |
|
1369 |
||
1370 |
/** |
|
1371 |
* Sets the active <code>SyncProvider</code> and attempts to load |
|
1372 |
* load the new provider using the <code>SyncFactory</code> SPI. |
|
1373 |
* |
|
1374 |
* @throws SQLException if an error occurs while resetting the |
|
1375 |
* <code>SyncProvider</code>. |
|
1376 |
*/ |
|
1377 |
public void setSyncProvider(String providerStr) throws SQLException { |
|
1378 |
provider = |
|
11129
f9ad1aadf3fa
7116445: Miscellaneous warnings in the JDBC/RowSet classes
lancea
parents:
9537
diff
changeset
|
1379 |
SyncFactory.getInstance(providerStr); |
2 | 1380 |
|
1381 |
rowSetReader = provider.getRowSetReader(); |
|
1382 |
rowSetWriter = provider.getRowSetWriter(); |
|
1383 |
} |
|
1384 |
||
1385 |
||
1386 |
//----------------- |
|
1387 |
// methods inherited from RowSet |
|
1388 |
//----------------- |
|
1389 |
||
1390 |
||
1391 |
||
1392 |
||
1393 |
||
1394 |
||
1395 |
//--------------------------------------------------------------------- |
|
1396 |
// Reading and writing data |
|
1397 |
//--------------------------------------------------------------------- |
|
1398 |
||
1399 |
/** |
|
1400 |
* Populates this <code>CachedRowSetImpl</code> object with data. |
|
1401 |
* This form of the method uses the rowset's user, password, and url or |
|
1402 |
* data source name properties to create a database |
|
1403 |
* connection. If properties that are needed |
|
1404 |
* have not been set, this method will throw an exception. |
|
1405 |
* <P> |
|
1406 |
* Another form of this method uses an existing JDBC <code>Connection</code> |
|
1407 |
* object instead of creating a new one; therefore, it ignores the |
|
1408 |
* properties used for establishing a new connection. |
|
1409 |
* <P> |
|
1410 |
* The query specified by the command property is executed to create a |
|
1411 |
* <code>ResultSet</code> object from which to retrieve data. |
|
1412 |
* The current contents of the rowset are discarded, and the |
|
1413 |
* rowset's metadata is also (re)set. If there are outstanding updates, |
|
1414 |
* they are also ignored. |
|
1415 |
* <P> |
|
1416 |
* The method <code>execute</code> closes any database connections that it |
|
1417 |
* creates. |
|
1418 |
* |
|
1419 |
* @throws SQLException if an error occurs or the |
|
1420 |
* necessary properties have not been set |
|
1421 |
*/ |
|
1422 |
public void execute() throws SQLException { |
|
1423 |
execute(null); |
|
1424 |
} |
|
1425 |
||
1426 |
||
1427 |
||
1428 |
//----------------------------------- |
|
1429 |
// Methods inherited from ResultSet |
|
1430 |
//----------------------------------- |
|
1431 |
||
1432 |
/** |
|
1433 |
* Moves the cursor down one row from its current position and |
|
1434 |
* returns <code>true</code> if the new cursor position is a |
|
1435 |
* valid row. |
|
1436 |
* The cursor for a new <code>ResultSet</code> object is initially |
|
1437 |
* positioned before the first row. The first call to the method |
|
1438 |
* <code>next</code> moves the cursor to the first row, making it |
|
1439 |
* the current row; the second call makes the second row the |
|
1440 |
* current row, and so on. |
|
1441 |
* |
|
1442 |
* <P>If an input stream from the previous row is open, it is |
|
1443 |
* implicitly closed. The <code>ResultSet</code> object's warning |
|
1444 |
* chain is cleared when a new row is read. |
|
1445 |
* |
|
1446 |
* @return <code>true</code> if the new current row is valid; |
|
1447 |
* <code>false</code> if there are no more rows |
|
1448 |
* @throws SQLException if an error occurs or |
|
1449 |
* the cursor is not positioned in the rowset, before |
|
1450 |
* the first row, or after the last row |
|
1451 |
*/ |
|
1452 |
public boolean next() throws SQLException { |
|
1453 |
/* |
|
1454 |
* make sure things look sane. The cursor must be |
|
1455 |
* positioned in the rowset or before first (0) or |
|
1456 |
* after last (numRows + 1) |
|
1457 |
*/ |
|
1458 |
if (cursorPos < 0 || cursorPos >= numRows + 1) { |
|
1459 |
throw new SQLException(resBundle.handleGetObject("cachedrowsetimpl.invalidcp").toString()); |
|
1460 |
} |
|
1461 |
// now move and notify |
|
1462 |
boolean ret = this.internalNext(); |
|
1463 |
notifyCursorMoved(); |
|
1464 |
||
1465 |
return ret; |
|
1466 |
} |
|
1467 |
||
1468 |
/** |
|
1469 |
* Moves this <code>CachedRowSetImpl</code> object's cursor to the next |
|
1470 |
* row and returns <code>true</code> if the cursor is still in the rowset; |
|
1471 |
* returns <code>false</code> if the cursor has moved to the position after |
|
1472 |
* the last row. |
|
1473 |
* <P> |
|
1474 |
* This method handles the cases where the cursor moves to a row that |
|
1475 |
* has been deleted. |
|
1476 |
* If this rowset shows deleted rows and the cursor moves to a row |
|
1477 |
* that has been deleted, this method moves the cursor to the next |
|
1478 |
* row until the cursor is on a row that has not been deleted. |
|
1479 |
* <P> |
|
1480 |
* The method <code>internalNext</code> is called by methods such as |
|
1481 |
* <code>next</code>, <code>absolute</code>, and <code>relative</code>, |
|
1482 |
* and, as its name implies, is only called internally. |
|
1483 |
* <p> |
|
1484 |
* This is a implementation only method and is not required as a standard |
|
1485 |
* implementation of the <code>CachedRowSet</code> interface. |
|
1486 |
* |
|
1487 |
* @return <code>true</code> if the cursor is on a valid row in this |
|
1488 |
* rowset; <code>false</code> if it is after the last row |
|
1489 |
* @throws SQLException if an error occurs |
|
1490 |
*/ |
|
1491 |
protected boolean internalNext() throws SQLException { |
|
1492 |
boolean ret = false; |
|
1493 |
||
1494 |
do { |
|
1495 |
if (cursorPos < numRows) { |
|
1496 |
++cursorPos; |
|
1497 |
ret = true; |
|
1498 |
} else if (cursorPos == numRows) { |
|
1499 |
// increment to after last |
|
1500 |
++cursorPos; |
|
1501 |
ret = false; |
|
1502 |
break; |
|
1503 |
} |
|
1504 |
} while ((getShowDeleted() == false) && (rowDeleted() == true)); |
|
1505 |
||
1506 |
/* each call to internalNext may increment cursorPos multiple |
|
1507 |
* times however, the absolutePos only increments once per call. |
|
1508 |
*/ |
|
1509 |
if (ret == true) |
|
1510 |
absolutePos++; |
|
1511 |
else |
|
1512 |
absolutePos = 0; |
|
1513 |
||
1514 |
return ret; |
|
1515 |
} |
|
1516 |
||
1517 |
/** |
|
1518 |
* Closes this <code>CachedRowSetImpl</code> objecy and releases any resources |
|
1519 |
* it was using. |
|
1520 |
* |
|
1521 |
* @throws SQLException if an error occurs when releasing any resources in use |
|
1522 |
* by this <code>CachedRowSetImpl</code> object |
|
1523 |
*/ |
|
1524 |
public void close() throws SQLException { |
|
1525 |
||
1526 |
// close all data structures holding |
|
1527 |
// the disconnected rowset |
|
1528 |
||
1529 |
cursorPos = 0; |
|
1530 |
absolutePos = 0; |
|
1531 |
numRows = 0; |
|
1532 |
numDeleted = 0; |
|
1533 |
||
1534 |
// set all insert(s), update(s) & delete(s), |
|
1535 |
// if at all, to their initial values. |
|
1536 |
initProperties(); |
|
1537 |
||
1538 |
// clear the vector of it's present contents |
|
1539 |
rvh.clear(); |
|
1540 |
||
1541 |
// this will make it eligible for gc |
|
1542 |
// rvh = null; |
|
1543 |
} |
|
1544 |
||
1545 |
/** |
|
1546 |
* Reports whether the last column read was SQL <code>NULL</code>. |
|
1547 |
* Note that you must first call the method <code>getXXX</code> |
|
1548 |
* on a column to try to read its value and then call the method |
|
1549 |
* <code>wasNull</code> to determine whether the value was |
|
1550 |
* SQL <code>NULL</code>. |
|
1551 |
* |
|
1552 |
* @return <code>true</code> if the value in the last column read |
|
1553 |
* was SQL <code>NULL</code>; <code>false</code> otherwise |
|
1554 |
* @throws SQLException if an error occurs |
|
1555 |
*/ |
|
1556 |
public boolean wasNull() throws SQLException { |
|
1557 |
return lastValueNull; |
|
1558 |
} |
|
1559 |
||
1560 |
/** |
|
1561 |
* Sets the field <code>lastValueNull</code> to the given |
|
1562 |
* <code>boolean</code> value. |
|
1563 |
* |
|
1564 |
* @param value <code>true</code> to indicate that the value of |
|
1565 |
* the last column read was SQL <code>NULL</code>; |
|
1566 |
* <code>false</code> to indicate that it was not |
|
1567 |
*/ |
|
1568 |
private void setLastValueNull(boolean value) { |
|
1569 |
lastValueNull = value; |
|
1570 |
} |
|
1571 |
||
1572 |
// Methods for accessing results by column index |
|
1573 |
||
1574 |
/** |
|
1575 |
* Checks to see whether the given index is a valid column number |
|
1576 |
* in this <code>CachedRowSetImpl</code> object and throws |
|
1577 |
* an <code>SQLException</code> if it is not. The index is out of bounds |
|
1578 |
* if it is less than <code>1</code> or greater than the number of |
|
1579 |
* columns in this rowset. |
|
1580 |
* <P> |
|
1581 |
* This method is called internally by the <code>getXXX</code> and |
|
1582 |
* <code>updateXXX</code> methods. |
|
1583 |
* |
|
1584 |
* @param idx the number of a column in this <code>CachedRowSetImpl</code> |
|
1585 |
* object; must be between <code>1</code> and the number of |
|
1586 |
* rows in this rowset |
|
1587 |
* @throws SQLException if the given index is out of bounds |
|
1588 |
*/ |
|
1589 |
private void checkIndex(int idx) throws SQLException { |
|
1590 |
if (idx < 1 || idx > RowSetMD.getColumnCount()) { |
|
1591 |
throw new SQLException(resBundle.handleGetObject("cachedrowsetimpl.invalidcol").toString()); |
|
1592 |
} |
|
1593 |
} |
|
1594 |
||
1595 |
/** |
|
1596 |
* Checks to see whether the cursor for this <code>CachedRowSetImpl</code> |
|
1597 |
* object is on a row in the rowset and throws an |
|
1598 |
* <code>SQLException</code> if it is not. |
|
1599 |
* <P> |
|
1600 |
* This method is called internally by <code>getXXX</code> methods, by |
|
1601 |
* <code>updateXXX</code> methods, and by methods that update, insert, |
|
1602 |
* or delete a row or that cancel a row update, insert, or delete. |
|
1603 |
* |
|
1604 |
* @throws SQLException if the cursor for this <code>CachedRowSetImpl</code> |
|
1605 |
* object is not on a valid row |
|
1606 |
*/ |
|
1607 |
private void checkCursor() throws SQLException { |
|
1608 |
if (isAfterLast() == true || isBeforeFirst() == true) { |
|
1609 |
throw new SQLException(resBundle.handleGetObject("cachedrowsetimpl.invalidcp").toString()); |
|
1610 |
} |
|
1611 |
} |
|
1612 |
||
1613 |
/** |
|
1614 |
* Returns the column number of the column with the given name in this |
|
1615 |
* <code>CachedRowSetImpl</code> object. This method throws an |
|
1616 |
* <code>SQLException</code> if the given name is not the name of |
|
1617 |
* one of the columns in this rowset. |
|
1618 |
* |
|
1619 |
* @param name a <code>String</code> object that is the name of a column in |
|
1620 |
* this <code>CachedRowSetImpl</code> object |
|
1621 |
* @throws SQLException if the given name does not match the name of one of |
|
1622 |
* the columns in this rowset |
|
1623 |
*/ |
|
1624 |
private int getColIdxByName(String name) throws SQLException { |
|
1625 |
RowSetMD = (RowSetMetaDataImpl)this.getMetaData(); |
|
1626 |
int cols = RowSetMD.getColumnCount(); |
|
1627 |
||
1628 |
for (int i=1; i <= cols; ++i) { |
|
1629 |
String colName = RowSetMD.getColumnName(i); |
|
1630 |
if (colName != null) |
|
1631 |
if (name.equalsIgnoreCase(colName)) |
|
1632 |
return (i); |
|
1633 |
else |
|
1634 |
continue; |
|
1635 |
} |
|
1636 |
throw new SQLException(resBundle.handleGetObject("cachedrowsetimpl.invalcolnm").toString()); |
|
1637 |
||
1638 |
} |
|
1639 |
||
1640 |
/** |
|
1641 |
* Returns the insert row or the current row of this |
|
1642 |
* <code>CachedRowSetImpl</code>object. |
|
1643 |
* |
|
1644 |
* @return the <code>Row</code> object on which this <code>CachedRowSetImpl</code> |
|
1645 |
* objects's cursor is positioned |
|
1646 |
*/ |
|
1647 |
protected BaseRow getCurrentRow() { |
|
1648 |
if (onInsertRow == true) { |
|
1649 |
return (BaseRow)insertRow; |
|
1650 |
} else { |
|
1651 |
return (BaseRow)(rvh.get(cursorPos - 1)); |
|
1652 |
} |
|
1653 |
} |
|
1654 |
||
1655 |
/** |
|
1656 |
* Removes the row on which the cursor is positioned. |
|
1657 |
* <p> |
|
1658 |
* This is a implementation only method and is not required as a standard |
|
1659 |
* implementation of the <code>CachedRowSet</code> interface. |
|
1660 |
* |
|
1661 |
* @throws SQLException if the cursor is positioned on the insert |
|
1662 |
* row |
|
1663 |
*/ |
|
1664 |
protected void removeCurrentRow() { |
|
1665 |
((Row)getCurrentRow()).setDeleted(); |
|
9537
bfddc73b74b9
7040150: Indexing Error in CachedRowSetImpl.removeCurrentRow
lancea
parents:
9257
diff
changeset
|
1666 |
rvh.remove(cursorPos - 1); |
2 | 1667 |
--numRows; |
1668 |
} |
|
1669 |
||
1670 |
||
1671 |
/** |
|
1672 |
* Retrieves the value of the designated column in the current row |
|
1673 |
* of this <code>CachedRowSetImpl</code> object as a |
|
1674 |
* <code>String</code> object. |
|
1675 |
* |
|
1676 |
* @param columnIndex the first column is <code>1</code>, the second |
|
1677 |
* is <code>2</code>, and so on; must be <code>1</code> or larger |
|
1678 |
* and equal to or less than the number of columns in the rowset |
|
1679 |
* @return the column value; if the value is SQL <code>NULL</code>, the |
|
1680 |
* result is <code>null</code> |
|
1681 |
* @throws SQLException if (1) the given column index is out of bounds, |
|
1682 |
* (2) the cursor is not on one of this rowset's rows or its |
|
1683 |
* insert row, or (3) the designated column does not store an |
|
1684 |
* SQL <code>TINYINT, SMALLINT, INTEGER, BIGINT, REAL, |
|
1685 |
* FLOAT, DOUBLE, DECIMAL, NUMERIC, BIT, <b>CHAR</b>, <b>VARCHAR</b></code> |
|
1686 |
* or <code>LONGVARCHAR</code> value. The bold SQL type designates the |
|
1687 |
* recommended return type. |
|
1688 |
*/ |
|
1689 |
public String getString(int columnIndex) throws SQLException { |
|
1690 |
Object value; |
|
1691 |
||
1692 |
// sanity check. |
|
1693 |
checkIndex(columnIndex); |
|
1694 |
// make sure the cursor is on a valid row |
|
1695 |
checkCursor(); |
|
1696 |
||
1697 |
setLastValueNull(false); |
|
1698 |
value = getCurrentRow().getColumnObject(columnIndex); |
|
1699 |
||
1700 |
// check for SQL NULL |
|
1701 |
if (value == null) { |
|
1702 |
setLastValueNull(true); |
|
1703 |
return null; |
|
1704 |
} |
|
1705 |
||
1706 |
return value.toString(); |
|
1707 |
} |
|
1708 |
||
1709 |
/** |
|
1710 |
* Retrieves the value of the designated column in the current row |
|
1711 |
* of this <code>CachedRowSetImpl</code> object as a |
|
1712 |
* <code>boolean</code> value. |
|
1713 |
* |
|
1714 |
* @param columnIndex the first column is <code>1</code>, the second |
|
1715 |
* is <code>2</code>, and so on; must be <code>1</code> or larger |
|
1716 |
* and equal to or less than the number of columns in the rowset |
|
1717 |
* @return the column value as a <code>boolean</code> in the Java progamming language; |
|
1718 |
* if the value is SQL <code>NULL</code>, the result is <code>false</code> |
|
1719 |
* @throws SQLException if (1) the given column index is out of bounds, |
|
1720 |
* (2) the cursor is not on one of this rowset's rows or its |
|
1721 |
* insert row, or (3) the designated column does not store an |
|
1722 |
* SQL <code>BOOLEAN</code> value |
|
1723 |
* @see #getBoolean(String) |
|
1724 |
*/ |
|
1725 |
public boolean getBoolean(int columnIndex) throws SQLException { |
|
1726 |
Object value; |
|
1727 |
||
1728 |
// sanity check. |
|
1729 |
checkIndex(columnIndex); |
|
1730 |
// make sure the cursor is on a valid row |
|
1731 |
checkCursor(); |
|
1732 |
||
1733 |
setLastValueNull(false); |
|
1734 |
value = getCurrentRow().getColumnObject(columnIndex); |
|
1735 |
||
1736 |
// check for SQL NULL |
|
1737 |
if (value == null) { |
|
1738 |
setLastValueNull(true); |
|
1739 |
return false; |
|
1740 |
} |
|
1741 |
||
1742 |
// check for Boolean... |
|
1743 |
if (value instanceof Boolean) { |
|
1744 |
return ((Boolean)value).booleanValue(); |
|
1745 |
} |
|
1746 |
||
1747 |
// convert to a Double and compare to zero |
|
1748 |
try { |
|
1749 |
Double d = new Double(value.toString()); |
|
1750 |
if (d.compareTo(new Double((double)0)) == 0) { |
|
1751 |
return false; |
|
1752 |
} else { |
|
1753 |
return true; |
|
1754 |
} |
|
1755 |
} catch (NumberFormatException ex) { |
|
1756 |
throw new SQLException(MessageFormat.format(resBundle.handleGetObject("cachedrowsetimpl.boolfail").toString(), |
|
1757 |
new Object[] {value.toString().trim(), columnIndex})); |
|
1758 |
} |
|
1759 |
} |
|
1760 |
||
1761 |
/** |
|
1762 |
* Retrieves the value of the designated column in the current row |
|
1763 |
* of this <code>CachedRowSetImpl</code> object as a |
|
1764 |
* <code>byte</code> value. |
|
1765 |
* |
|
1766 |
* @param columnIndex the first column is <code>1</code>, the second |
|
1767 |
* is <code>2</code>, and so on; must be <code>1</code> or larger |
|
1768 |
* and equal to or less than the number of columns in the rowset |
|
1769 |
* @return the column value as a <code>byte</code> in the Java programming |
|
1770 |
* language; if the value is SQL <code>NULL</code>, the result is <code>0</code> |
|
1771 |
* @throws SQLException if (1) the given column index is out of bounds, |
|
1772 |
* (2) the cursor is not on one of this rowset's rows or its |
|
1773 |
* insert row, or (3) the designated column does not store an |
|
1774 |
* SQL <code><b>TINYINT</b>, SMALLINT, INTEGER, BIGINT, REAL, |
|
1775 |
* FLOAT, DOUBLE, DECIMAL, NUMERIC, BIT, CHAR, VARCHAR</code> |
|
1776 |
* or <code>LONGVARCHAR</code> value. The bold SQL type |
|
1777 |
* designates the recommended return type. |
|
1778 |
* @see #getByte(String) |
|
1779 |
*/ |
|
1780 |
public byte getByte(int columnIndex) throws SQLException { |
|
1781 |
Object value; |
|
1782 |
||
1783 |
// sanity check. |
|
1784 |
checkIndex(columnIndex); |
|
1785 |
// make sure the cursor is on a valid row |
|
1786 |
checkCursor(); |
|
1787 |
||
1788 |
setLastValueNull(false); |
|
1789 |
value = getCurrentRow().getColumnObject(columnIndex); |
|
1790 |
||
1791 |
// check for SQL NULL |
|
1792 |
if (value == null) { |
|
1793 |
setLastValueNull(true); |
|
1794 |
return (byte)0; |
|
1795 |
} |
|
1796 |
try { |
|
6697
39929804f9d4
6989139: Address JDBC Findbugs where Number type Constructor are used
lancea
parents:
6692
diff
changeset
|
1797 |
return ((Byte.valueOf(value.toString())).byteValue()); |
2 | 1798 |
} catch (NumberFormatException ex) { |
1799 |
throw new SQLException(MessageFormat.format(resBundle.handleGetObject("cachedrowsetimpl.bytefail").toString(), |
|
1800 |
new Object[] {value.toString().trim(), columnIndex})); |
|
1801 |
} |
|
1802 |
} |
|
1803 |
||
1804 |
/** |
|
1805 |
* Retrieves the value of the designated column in the current row |
|
1806 |
* of this <code>CachedRowSetImpl</code> object as a |
|
1807 |
* <code>short</code> value. |
|
1808 |
* |
|
1809 |
* @param columnIndex the first column is <code>1</code>, the second |
|
1810 |
* is <code>2</code>, and so on; must be <code>1</code> or larger |
|
1811 |
* and equal to or less than the number of columns in the rowset |
|
1812 |
* @return the column value; if the value is SQL <code>NULL</code>, the |
|
1813 |
* result is <code>0</code> |
|
1814 |
* @throws SQLException if (1) the given column index is out of bounds, |
|
1815 |
* (2) the cursor is not on one of this rowset's rows or its |
|
1816 |
* insert row, or (3) the designated column does not store an |
|
1817 |
* SQL <code>TINYINT, <b>SMALLINT</b>, INTEGER, BIGINT, REAL |
|
1818 |
* FLOAT, DOUBLE, DECIMAL, NUMERIC, BIT, CHAR, VARCHAR</code> |
|
1819 |
* or <code>LONGVARCHAR</code> value. The bold SQL type designates the |
|
1820 |
* recommended return type. |
|
1821 |
* @see #getShort(String) |
|
1822 |
*/ |
|
1823 |
public short getShort(int columnIndex) throws SQLException { |
|
1824 |
Object value; |
|
1825 |
||
1826 |
// sanity check. |
|
1827 |
checkIndex(columnIndex); |
|
1828 |
// make sure the cursor is on a valid row |
|
1829 |
checkCursor(); |
|
1830 |
||
1831 |
setLastValueNull(false); |
|
1832 |
value = getCurrentRow().getColumnObject(columnIndex); |
|
1833 |
||
1834 |
// check for SQL NULL |
|
1835 |
if (value == null) { |
|
1836 |
setLastValueNull(true); |
|
1837 |
return (short)0; |
|
1838 |
} |
|
1839 |
||
1840 |
try { |
|
6697
39929804f9d4
6989139: Address JDBC Findbugs where Number type Constructor are used
lancea
parents:
6692
diff
changeset
|
1841 |
return ((Short.valueOf(value.toString().trim())).shortValue()); |
2 | 1842 |
} catch (NumberFormatException ex) { |
1843 |
throw new SQLException(MessageFormat.format(resBundle.handleGetObject("cachedrowsetimpl.shortfail").toString(), |
|
1844 |
new Object[] {value.toString().trim(), columnIndex})); |
|
1845 |
} |
|
1846 |
} |
|
1847 |
||
1848 |
/** |
|
1849 |
* Retrieves the value of the designated column in the current row |
|
1850 |
* of this <code>CachedRowSetImpl</code> object as an |
|
1851 |
* <code>int</code> value. |
|
1852 |
* |
|
1853 |
* @param columnIndex the first column is <code>1</code>, the second |
|
1854 |
* is <code>2</code>, and so on; must be <code>1</code> or larger |
|
1855 |
* and equal to or less than the number of columns in the rowset |
|
1856 |
* @return the column value; if the value is SQL <code>NULL</code>, the |
|
1857 |
* result is <code>0</code> |
|
1858 |
* @throws SQLException if (1) the given column index is out of bounds, |
|
1859 |
* (2) the cursor is not on one of this rowset's rows or its |
|
1860 |
* insert row, or (3) the designated column does not store an |
|
1861 |
* SQL <code>TINYINT, SMALLINT, <b>INTEGER</b>, BIGINT, REAL |
|
1862 |
* FLOAT, DOUBLE, DECIMAL, NUMERIC, BIT, CHAR, VARCHAR</code> |
|
1863 |
* or <code>LONGVARCHAR</code> value. The bold SQL type designates the |
|
1864 |
* recommended return type. |
|
1865 |
*/ |
|
1866 |
public int getInt(int columnIndex) throws SQLException { |
|
1867 |
Object value; |
|
1868 |
||
1869 |
// sanity check. |
|
1870 |
checkIndex(columnIndex); |
|
1871 |
// make sure the cursor is on a valid row |
|
1872 |
checkCursor(); |
|
1873 |
||
1874 |
setLastValueNull(false); |
|
1875 |
value = getCurrentRow().getColumnObject(columnIndex); |
|
1876 |
||
1877 |
// check for SQL NULL |
|
1878 |
if (value == null) { |
|
1879 |
setLastValueNull(true); |
|
11129
f9ad1aadf3fa
7116445: Miscellaneous warnings in the JDBC/RowSet classes
lancea
parents:
9537
diff
changeset
|
1880 |
return 0; |
2 | 1881 |
} |
1882 |
||
1883 |
try { |
|
6697
39929804f9d4
6989139: Address JDBC Findbugs where Number type Constructor are used
lancea
parents:
6692
diff
changeset
|
1884 |
return ((Integer.valueOf(value.toString().trim())).intValue()); |
2 | 1885 |
} catch (NumberFormatException ex) { |
1886 |
throw new SQLException(MessageFormat.format(resBundle.handleGetObject("cachedrowsetimpl.intfail").toString(), |
|
1887 |
new Object[] {value.toString().trim(), columnIndex})); |
|
1888 |
} |
|
1889 |
} |
|
1890 |
||
1891 |
/** |
|
1892 |
* Retrieves the value of the designated column in the current row |
|
1893 |
* of this <code>CachedRowSetImpl</code> object as a |
|
1894 |
* <code>long</code> value. |
|
1895 |
* |
|
1896 |
* @param columnIndex the first column is <code>1</code>, the second |
|
1897 |
* is <code>2</code>, and so on; must be <code>1</code> or larger |
|
1898 |
* and equal to or less than the number of columns in the rowset |
|
1899 |
* @return the column value; if the value is SQL <code>NULL</code>, the |
|
1900 |
* result is <code>0</code> |
|
1901 |
* @throws SQLException if (1) the given column index is out of bounds, |
|
1902 |
* (2) the cursor is not on one of this rowset's rows or its |
|
1903 |
* insert row, or (3) the designated column does not store an |
|
1904 |
* SQL <code>TINYINT, SMALLINT, INTEGER, <b>BIGINT</b>, REAL |
|
1905 |
* FLOAT, DOUBLE, DECIMAL, NUMERIC, BIT, CHAR, VARCHAR</code> |
|
1906 |
* or <code>LONGVARCHAR</code> value. The bold SQL type designates the |
|
1907 |
* recommended return type. |
|
1908 |
* @see #getLong(String) |
|
1909 |
*/ |
|
1910 |
public long getLong(int columnIndex) throws SQLException { |
|
1911 |
Object value; |
|
1912 |
||
1913 |
// sanity check. |
|
1914 |
checkIndex(columnIndex); |
|
1915 |
// make sure the cursor is on a valid row |
|
1916 |
checkCursor(); |
|
1917 |
||
1918 |
setLastValueNull(false); |
|
1919 |
value = getCurrentRow().getColumnObject(columnIndex); |
|
1920 |
||
1921 |
// check for SQL NULL |
|
1922 |
if (value == null) { |
|
1923 |
setLastValueNull(true); |
|
1924 |
return (long)0; |
|
1925 |
} |
|
1926 |
try { |
|
6697
39929804f9d4
6989139: Address JDBC Findbugs where Number type Constructor are used
lancea
parents:
6692
diff
changeset
|
1927 |
return ((Long.valueOf(value.toString().trim())).longValue()); |
2 | 1928 |
} catch (NumberFormatException ex) { |
1929 |
throw new SQLException(MessageFormat.format(resBundle.handleGetObject("cachedrowsetimpl.longfail").toString(), |
|
1930 |
new Object[] {value.toString().trim(), columnIndex})); |
|
1931 |
} |
|
1932 |
} |
|
1933 |
||
1934 |
/** |
|
1935 |
* Retrieves the value of the designated column in the current row |
|
1936 |
* of this <code>CachedRowSetImpl</code> object as a |
|
1937 |
* <code>float</code> value. |
|
1938 |
* |
|
1939 |
* @param columnIndex the first column is <code>1</code>, the second |
|
1940 |
* is <code>2</code>, and so on; must be <code>1</code> or larger |
|
1941 |
* and equal to or less than the number of columns in the rowset |
|
1942 |
* @return the column value; if the value is SQL <code>NULL</code>, the |
|
1943 |
* result is <code>0</code> |
|
1944 |
* @throws SQLException if (1) the given column index is out of bounds, |
|
1945 |
* (2) the cursor is not on one of this rowset's rows or its |
|
1946 |
* insert row, or (3) the designated column does not store an |
|
1947 |
* SQL <code>TINYINT, SMALLINT, INTEGER, BIGINT, <b>REAL</b>, |
|
1948 |
* FLOAT, DOUBLE, DECIMAL, NUMERIC, BIT, CHAR, VARCHAR</code> |
|
1949 |
* or <code>LONGVARCHAR</code> value. The bold SQL type designates the |
|
1950 |
* recommended return type. |
|
1951 |
* @see #getFloat(String) |
|
1952 |
*/ |
|
1953 |
public float getFloat(int columnIndex) throws SQLException { |
|
1954 |
Object value; |
|
1955 |
||
1956 |
// sanity check. |
|
1957 |
checkIndex(columnIndex); |
|
1958 |
// make sure the cursor is on a valid row |
|
1959 |
checkCursor(); |
|
1960 |
||
1961 |
setLastValueNull(false); |
|
1962 |
value = getCurrentRow().getColumnObject(columnIndex); |
|
1963 |
||
1964 |
// check for SQL NULL |
|
1965 |
if (value == null) { |
|
1966 |
setLastValueNull(true); |
|
1967 |
return (float)0; |
|
1968 |
} |
|
1969 |
try { |
|
1970 |
return ((new Float(value.toString())).floatValue()); |
|
1971 |
} catch (NumberFormatException ex) { |
|
1972 |
throw new SQLException(MessageFormat.format(resBundle.handleGetObject("cachedrowsetimpl.floatfail").toString(), |
|
1973 |
new Object[] {value.toString().trim(), columnIndex})); |
|
1974 |
} |
|
1975 |
} |
|
1976 |
||
1977 |
/** |
|
1978 |
* Retrieves the value of the designated column in the current row |
|
1979 |
* of this <code>CachedRowSetImpl</code> object as a |
|
1980 |
* <code>double</code> value. |
|
1981 |
* |
|
1982 |
* @param columnIndex the first column is <code>1</code>, the second |
|
1983 |
* is <code>2</code>, and so on; must be <code>1</code> or larger |
|
1984 |
* and equal to or less than the number of columns in the rowset |
|
1985 |
* @return the column value; if the value is SQL <code>NULL</code>, the |
|
1986 |
* result is <code>0</code> |
|
1987 |
* @throws SQLException if (1) the given column index is out of bounds, |
|
1988 |
* (2) the cursor is not on one of this rowset's rows or its |
|
1989 |
* insert row, or (3) the designated column does not store an |
|
1990 |
* SQL <code>TINYINT, SMALLINT, INTEGER, BIGINT, REAL, |
|
1991 |
* <b>FLOAT</b>, <b>DOUBLE</b>, DECIMAL, NUMERIC, BIT, CHAR, VARCHAR</code> |
|
1992 |
* or <code>LONGVARCHAR</code> value. The bold SQL type designates the |
|
1993 |
* recommended return type. |
|
1994 |
* @see #getDouble(String) |
|
1995 |
* |
|
1996 |
*/ |
|
1997 |
public double getDouble(int columnIndex) throws SQLException { |
|
1998 |
Object value; |
|
1999 |
||
2000 |
// sanity check. |
|
2001 |
checkIndex(columnIndex); |
|
2002 |
// make sure the cursor is on a valid row |
|
2003 |
checkCursor(); |
|
2004 |
||
2005 |
setLastValueNull(false); |
|
2006 |
value = getCurrentRow().getColumnObject(columnIndex); |
|
2007 |
||
2008 |
// check for SQL NULL |
|
2009 |
if (value == null) { |
|
2010 |
setLastValueNull(true); |
|
2011 |
return (double)0; |
|
2012 |
} |
|
2013 |
try { |
|
2014 |
return ((new Double(value.toString().trim())).doubleValue()); |
|
2015 |
} catch (NumberFormatException ex) { |
|
2016 |
throw new SQLException(MessageFormat.format(resBundle.handleGetObject("cachedrowsetimpl.doublefail").toString(), |
|
2017 |
new Object[] {value.toString().trim(), columnIndex})); |
|
2018 |
} |
|
2019 |
} |
|
2020 |
||
2021 |
/** |
|
2022 |
* Retrieves the value of the designated column in the current row |
|
2023 |
* of this <code>CachedRowSetImpl</code> object as a |
|
2024 |
* <code>java.math.BigDecimal</code> object. |
|
2025 |
* <P> |
|
2026 |
* This method is deprecated; use the version of <code>getBigDecimal</code> |
|
2027 |
* that does not take a scale parameter and returns a value with full |
|
2028 |
* precision. |
|
2029 |
* |
|
2030 |
* @param columnIndex the first column is <code>1</code>, the second |
|
2031 |
* is <code>2</code>, and so on; must be <code>1</code> or larger |
|
2032 |
* and equal to or less than the number of columns in the rowset |
|
2033 |
* @param scale the number of digits to the right of the decimal point in the |
|
2034 |
* value returned |
|
2035 |
* @return the column value with the specified number of digits to the right |
|
2036 |
* of the decimal point; if the value is SQL <code>NULL</code>, the |
|
2037 |
* result is <code>null</code> |
|
2038 |
* @throws SQLException if the given column index is out of bounds, |
|
2039 |
* the cursor is not on a valid row, or this method fails |
|
2040 |
* @deprecated |
|
2041 |
*/ |
|
2042 |
public BigDecimal getBigDecimal(int columnIndex, int scale) throws SQLException { |
|
2043 |
Object value; |
|
2044 |
BigDecimal bDecimal, retVal; |
|
2045 |
||
2046 |
// sanity check. |
|
2047 |
checkIndex(columnIndex); |
|
2048 |
// make sure the cursor is on a valid row |
|
2049 |
checkCursor(); |
|
2050 |
||
2051 |
setLastValueNull(false); |
|
2052 |
value = getCurrentRow().getColumnObject(columnIndex); |
|
2053 |
||
2054 |
// check for SQL NULL |
|
2055 |
if (value == null) { |
|
2056 |
setLastValueNull(true); |
|
2057 |
return (new BigDecimal(0)); |
|
2058 |
} |
|
2059 |
||
2060 |
bDecimal = this.getBigDecimal(columnIndex); |
|
2061 |
||
2062 |
retVal = bDecimal.setScale(scale); |
|
2063 |
||
2064 |
return retVal; |
|
2065 |
} |
|
2066 |
||
2067 |
/** |
|
2068 |
* Retrieves the value of the designated column in the current row |
|
2069 |
* of this <code>CachedRowSetImpl</code> object as a |
|
2070 |
* <code>byte</code> array value. |
|
2071 |
* |
|
2072 |
* @param columnIndex the first column is <code>1</code>, the second |
|
2073 |
* is <code>2</code>, and so on; must be <code>1</code> or larger |
|
2074 |
* and equal to or less than the number of columns in the rowset |
|
2075 |
* @return the column value as a <code>byte</code> array in the Java programming |
|
2076 |
* language; if the value is SQL <code>NULL</code>, the |
|
2077 |
* result is <code>null</code> |
|
2078 |
* |
|
2079 |
* @throws SQLException if (1) the given column index is out of bounds, |
|
2080 |
* (2) the cursor is not on one of this rowset's rows or its |
|
2081 |
* insert row, or (3) the designated column does not store an |
|
2082 |
* SQL <code><b>BINARY</b>, <b>VARBINARY</b> or |
|
2083 |
* LONGVARBINARY</code> value. |
|
2084 |
* The bold SQL type designates the recommended return type. |
|
2085 |
* @see #getBytes(String) |
|
2086 |
*/ |
|
2087 |
public byte[] getBytes(int columnIndex) throws SQLException { |
|
2088 |
// sanity check. |
|
2089 |
checkIndex(columnIndex); |
|
2090 |
// make sure the cursor is on a valid row |
|
2091 |
checkCursor(); |
|
2092 |
||
2093 |
if (isBinary(RowSetMD.getColumnType(columnIndex)) == false) { |
|
2094 |
throw new SQLException(resBundle.handleGetObject("cachedrowsetimpl.dtypemismt").toString()); |
|
2095 |
} |
|
2096 |
||
2097 |
return (byte[])(getCurrentRow().getColumnObject(columnIndex)); |
|
2098 |
} |
|
2099 |
||
2100 |
/** |
|
2101 |
* Retrieves the value of the designated column in the current row |
|
2102 |
* of this <code>CachedRowSetImpl</code> object as a |
|
2103 |
* <code>java.sql.Date</code> object. |
|
2104 |
* |
|
2105 |
* @param columnIndex the first column is <code>1</code>, the second |
|
2106 |
* is <code>2</code>, and so on; must be <code>1</code> or larger |
|
2107 |
* and equal to or less than the number of columns in the rowset |
|
2108 |
* @return the column value as a <code>java.sql.Data</code> object; if |
|
2109 |
* the value is SQL <code>NULL</code>, the |
|
2110 |
* result is <code>null</code> |
|
2111 |
* @throws SQLException if the given column index is out of bounds, |
|
2112 |
* the cursor is not on a valid row, or this method fails |
|
2113 |
*/ |
|
2114 |
public java.sql.Date getDate(int columnIndex) throws SQLException { |
|
2115 |
Object value; |
|
2116 |
||
2117 |
// sanity check. |
|
2118 |
checkIndex(columnIndex); |
|
2119 |
// make sure the cursor is on a valid row |
|
2120 |
checkCursor(); |
|
2121 |
||
2122 |
setLastValueNull(false); |
|
2123 |
value = getCurrentRow().getColumnObject(columnIndex); |
|
2124 |
||
2125 |
// check for SQL NULL |
|
2126 |
if (value == null) { |
|
2127 |
setLastValueNull(true); |
|
2128 |
return null; |
|
2129 |
} |
|
2130 |
||
2131 |
/* |
|
2132 |
* The object coming back from the db could be |
|
2133 |
* a date, a timestamp, or a char field variety. |
|
2134 |
* If it's a date type return it, a timestamp |
|
2135 |
* we turn into a long and then into a date, |
|
2136 |
* char strings we try to parse. Yuck. |
|
2137 |
*/ |
|
2138 |
switch (RowSetMD.getColumnType(columnIndex)) { |
|
2139 |
case java.sql.Types.DATE: { |
|
2140 |
long sec = ((java.sql.Date)value).getTime(); |
|
2141 |
return new java.sql.Date(sec); |
|
2142 |
} |
|
2143 |
case java.sql.Types.TIMESTAMP: { |
|
2144 |
long sec = ((java.sql.Timestamp)value).getTime(); |
|
2145 |
return new java.sql.Date(sec); |
|
2146 |
} |
|
2147 |
case java.sql.Types.CHAR: |
|
2148 |
case java.sql.Types.VARCHAR: |
|
2149 |
case java.sql.Types.LONGVARCHAR: { |
|
2150 |
try { |
|
2151 |
DateFormat df = DateFormat.getDateInstance(); |
|
2152 |
return ((java.sql.Date)(df.parse(value.toString()))); |
|
2153 |
} catch (ParseException ex) { |
|
2154 |
throw new SQLException(MessageFormat.format(resBundle.handleGetObject("cachedrowsetimpl.datefail").toString(), |
|
2155 |
new Object[] {value.toString().trim(), columnIndex})); |
|
2156 |
} |
|
2157 |
} |
|
2158 |
default: { |
|
2159 |
throw new SQLException(MessageFormat.format(resBundle.handleGetObject("cachedrowsetimpl.datefail").toString(), |
|
2160 |
new Object[] {value.toString().trim(), columnIndex})); |
|
2161 |
} |
|
2162 |
} |
|
2163 |
} |
|
2164 |
||
2165 |
/** |
|
2166 |
* Retrieves the value of the designated column in the current row |
|
2167 |
* of this <code>CachedRowSetImpl</code> object as a |
|
2168 |
* <code>java.sql.Time</code> object. |
|
2169 |
* |
|
2170 |
* @param columnIndex the first column is <code>1</code>, the second |
|
2171 |
* is <code>2</code>, and so on; must be <code>1</code> or larger |
|
2172 |
* and equal to or less than the number of columns in the rowset |
|
2173 |
* @return the column value; if the value is SQL <code>NULL</code>, the |
|
2174 |
* result is <code>null</code> |
|
2175 |
* @throws SQLException if the given column index is out of bounds, |
|
2176 |
* the cursor is not on a valid row, or this method fails |
|
2177 |
*/ |
|
2178 |
public java.sql.Time getTime(int columnIndex) throws SQLException { |
|
2179 |
Object value; |
|
2180 |
||
2181 |
// sanity check. |
|
2182 |
checkIndex(columnIndex); |
|
2183 |
// make sure the cursor is on a valid row |
|
2184 |
checkCursor(); |
|
2185 |
||
2186 |
setLastValueNull(false); |
|
2187 |
value = getCurrentRow().getColumnObject(columnIndex); |
|
2188 |
||
2189 |
// check for SQL NULL |
|
2190 |
if (value == null) { |
|
2191 |
setLastValueNull(true); |
|
2192 |
return null; |
|
2193 |
} |
|
2194 |
||
2195 |
/* |
|
2196 |
* The object coming back from the db could be |
|
2197 |
* a date, a timestamp, or a char field variety. |
|
2198 |
* If it's a date type return it, a timestamp |
|
2199 |
* we turn into a long and then into a date, |
|
2200 |
* char strings we try to parse. Yuck. |
|
2201 |
*/ |
|
2202 |
switch (RowSetMD.getColumnType(columnIndex)) { |
|
2203 |
case java.sql.Types.TIME: { |
|
2204 |
return (java.sql.Time)value; |
|
2205 |
} |
|
2206 |
case java.sql.Types.TIMESTAMP: { |
|
2207 |
long sec = ((java.sql.Timestamp)value).getTime(); |
|
2208 |
return new java.sql.Time(sec); |
|
2209 |
} |
|
2210 |
case java.sql.Types.CHAR: |
|
2211 |
case java.sql.Types.VARCHAR: |
|
2212 |
case java.sql.Types.LONGVARCHAR: { |
|
2213 |
try { |
|
2214 |
DateFormat tf = DateFormat.getTimeInstance(); |
|
2215 |
return ((java.sql.Time)(tf.parse(value.toString()))); |
|
2216 |
} catch (ParseException ex) { |
|
2217 |
throw new SQLException(MessageFormat.format(resBundle.handleGetObject("cachedrowsetimpl.timefail").toString(), |
|
2218 |
new Object[] {value.toString().trim(), columnIndex})); |
|
2219 |
} |
|
2220 |
} |
|
2221 |
default: { |
|
2222 |
throw new SQLException(MessageFormat.format(resBundle.handleGetObject("cachedrowsetimpl.timefail").toString(), |
|
2223 |
new Object[] {value.toString().trim(), columnIndex})); |
|
2224 |
} |
|
2225 |
} |
|
2226 |
} |
|
2227 |
||
2228 |
/** |
|
2229 |
* Retrieves the value of the designated column in the current row |
|
2230 |
* of this <code>CachedRowSetImpl</code> object as a |
|
2231 |
* <code>java.sql.Timestamp</code> object. |
|
2232 |
* |
|
2233 |
* @param columnIndex the first column is <code>1</code>, the second |
|
2234 |
* is <code>2</code>, and so on; must be <code>1</code> or larger |
|
2235 |
* and equal to or less than the number of columns in the rowset |
|
2236 |
* @return the column value; if the value is SQL <code>NULL</code>, the |
|
2237 |
* result is <code>null</code> |
|
2238 |
* @throws SQLException if the given column index is out of bounds, |
|
2239 |
* the cursor is not on a valid row, or this method fails |
|
2240 |
*/ |
|
2241 |
public java.sql.Timestamp getTimestamp(int columnIndex) throws SQLException { |
|
2242 |
Object value; |
|
2243 |
||
2244 |
// sanity check. |
|
2245 |
checkIndex(columnIndex); |
|
2246 |
// make sure the cursor is on a valid row |
|
2247 |
checkCursor(); |
|
2248 |
||
2249 |
setLastValueNull(false); |
|
2250 |
value = getCurrentRow().getColumnObject(columnIndex); |
|
2251 |
||
2252 |
// check for SQL NULL |
|
2253 |
if (value == null) { |
|
2254 |
setLastValueNull(true); |
|
2255 |
return null; |
|
2256 |
} |
|
2257 |
||
2258 |
/* |
|
2259 |
* The object coming back from the db could be |
|
2260 |
* a date, a timestamp, or a char field variety. |
|
2261 |
* If it's a date type return it; a timestamp |
|
2262 |
* we turn into a long and then into a date; |
|
2263 |
* char strings we try to parse. Yuck. |
|
2264 |
*/ |
|
2265 |
switch (RowSetMD.getColumnType(columnIndex)) { |
|
2266 |
case java.sql.Types.TIMESTAMP: { |
|
2267 |
return (java.sql.Timestamp)value; |
|
2268 |
} |
|
2269 |
case java.sql.Types.TIME: { |
|
2270 |
long sec = ((java.sql.Time)value).getTime(); |
|
2271 |
return new java.sql.Timestamp(sec); |
|
2272 |
} |
|
2273 |
case java.sql.Types.DATE: { |
|
2274 |
long sec = ((java.sql.Date)value).getTime(); |
|
2275 |
return new java.sql.Timestamp(sec); |
|
2276 |
} |
|
2277 |
case java.sql.Types.CHAR: |
|
2278 |
case java.sql.Types.VARCHAR: |
|
2279 |
case java.sql.Types.LONGVARCHAR: { |
|
2280 |
try { |
|
2281 |
DateFormat tf = DateFormat.getTimeInstance(); |
|
2282 |
return ((java.sql.Timestamp)(tf.parse(value.toString()))); |
|
2283 |
} catch (ParseException ex) { |
|
2284 |
throw new SQLException(MessageFormat.format(resBundle.handleGetObject("cachedrowsetimpl.timefail").toString(), |
|
2285 |
new Object[] {value.toString().trim(), columnIndex})); |
|
2286 |
} |
|
2287 |
} |
|
2288 |
default: { |
|
2289 |
throw new SQLException(MessageFormat.format(resBundle.handleGetObject("cachedrowsetimpl.timefail").toString(), |
|
2290 |
new Object[] {value.toString().trim(), columnIndex})); |
|
2291 |
} |
|
2292 |
} |
|
2293 |
} |
|
2294 |
||
2295 |
/** |
|
2296 |
* Retrieves the value of the designated column in the current row of this |
|
2297 |
* <code>CachedRowSetImpl</code> object as a <code>java.io.InputStream</code> |
|
2298 |
* object. |
|
2299 |
* |
|
2300 |
* A column value can be retrieved as a stream of ASCII characters |
|
2301 |
* and then read in chunks from the stream. This method is particularly |
|
2302 |
* suitable for retrieving large <code>LONGVARCHAR</code> values. The JDBC |
|
2303 |
* driver will do any necessary conversion from the database format into ASCII. |
|
2304 |
* |
|
2305 |
* <P><B>Note:</B> All the data in the returned stream must be |
|
2306 |
* read prior to getting the value of any other column. The next |
|
2307 |
* call to a get method implicitly closes the stream. . Also, a |
|
2308 |
* stream may return <code>0</code> for <code>CachedRowSetImpl.available()</code> |
|
2309 |
* whether there is data available or not. |
|
2310 |
* |
|
2311 |
* @param columnIndex the first column is <code>1</code>, the second |
|
2312 |
* is <code>2</code>, and so on; must be <code>1</code> or larger |
|
2313 |
* and equal to or less than the number of columns in this rowset |
|
2314 |
* @return a Java input stream that delivers the database column value |
|
2315 |
* as a stream of one-byte ASCII characters. If the value is SQL |
|
2316 |
* <code>NULL</code>, the result is <code>null</code>. |
|
2317 |
* @throws SQLException if (1) the given column index is out of bounds, |
|
2318 |
* (2) the cursor is not on one of this rowset's rows or its |
|
2319 |
* insert row, or (3) the designated column does not store an |
|
2320 |
* SQL <code>CHAR, VARCHAR</code>, <code><b>LONGVARCHAR</b></code> |
|
2321 |
* <code>BINARY, VARBINARY</code> or <code>LONGVARBINARY</code> value. The |
|
2322 |
* bold SQL type designates the recommended return types that this method is |
|
2323 |
* used to retrieve. |
|
2324 |
* @see #getAsciiStream(String) |
|
2325 |
*/ |
|
2326 |
public java.io.InputStream getAsciiStream(int columnIndex) throws SQLException { |
|
2327 |
Object value; |
|
2328 |
||
2329 |
// always free an old stream |
|
2330 |
asciiStream = null; |
|
2331 |
||
2332 |
// sanity check |
|
2333 |
checkIndex(columnIndex); |
|
2334 |
//make sure the cursor is on a vlid row |
|
2335 |
checkCursor(); |
|
2336 |
||
2337 |
value = getCurrentRow().getColumnObject(columnIndex); |
|
2338 |
if (value == null) { |
|
2339 |
lastValueNull = true; |
|
2340 |
return null; |
|
2341 |
} |
|
2342 |
||
2343 |
try { |
|
2344 |
if (isString(RowSetMD.getColumnType(columnIndex))) { |
|
2345 |
asciiStream = new ByteArrayInputStream(((String)value).getBytes("ASCII")); |
|
2346 |
} else { |
|
2347 |
throw new SQLException(resBundle.handleGetObject("cachedrowsetimpl.dtypemismt").toString()); |
|
2348 |
} |
|
2349 |
} catch (java.io.UnsupportedEncodingException ex) { |
|
2350 |
throw new SQLException(ex.getMessage()); |
|
2351 |
} |
|
2352 |
||
11129
f9ad1aadf3fa
7116445: Miscellaneous warnings in the JDBC/RowSet classes
lancea
parents:
9537
diff
changeset
|
2353 |
return asciiStream; |
2 | 2354 |
} |
2355 |
||
2356 |
/** |
|
2357 |
* A column value can be retrieved as a stream of Unicode characters |
|
2358 |
* and then read in chunks from the stream. This method is particularly |
|
2359 |
* suitable for retrieving large LONGVARCHAR values. The JDBC driver will |
|
2360 |
* do any necessary conversion from the database format into Unicode. |
|
2361 |
* |
|
2362 |
* <P><B>Note:</B> All the data in the returned stream must be |
|
2363 |
* read prior to getting the value of any other column. The next |
|
2364 |
* call to a get method implicitly closes the stream. . Also, a |
|
2365 |
* stream may return 0 for available() whether there is data |
|
2366 |
* available or not. |
|
2367 |
* |
|
2368 |
* @param columnIndex the first column is <code>1</code>, the second |
|
2369 |
* is <code>2</code>, and so on; must be <code>1</code> or larger |
|
2370 |
* and equal to or less than the number of columns in this rowset |
|
2371 |
* @return a Java input stream that delivers the database column value |
|
2372 |
* as a stream of two byte Unicode characters. If the value is SQL NULL |
|
2373 |
* then the result is null. |
|
2374 |
* @throws SQLException if an error occurs |
|
2375 |
* @deprecated |
|
2376 |
*/ |
|
2377 |
public java.io.InputStream getUnicodeStream(int columnIndex) throws SQLException { |
|
2378 |
// always free an old stream |
|
2379 |
unicodeStream = null; |
|
2380 |
||
2381 |
// sanity check. |
|
2382 |
checkIndex(columnIndex); |
|
2383 |
// make sure the cursor is on a valid row |
|
2384 |
checkCursor(); |
|
2385 |
||
2386 |
if (isBinary(RowSetMD.getColumnType(columnIndex)) == false && |
|
2387 |
isString(RowSetMD.getColumnType(columnIndex)) == false) { |
|
2388 |
throw new SQLException(resBundle.handleGetObject("cachedrowsetimpl.dtypemismt").toString()); |
|
2389 |
} |
|
2390 |
||
2391 |
Object value = getCurrentRow().getColumnObject(columnIndex); |
|
2392 |
if (value == null) { |
|
2393 |
lastValueNull = true; |
|
2394 |
return null; |
|
2395 |
} |
|
2396 |
||
2397 |
unicodeStream = new StringBufferInputStream(value.toString()); |
|
2398 |
||
11129
f9ad1aadf3fa
7116445: Miscellaneous warnings in the JDBC/RowSet classes
lancea
parents:
9537
diff
changeset
|
2399 |
return unicodeStream; |
2 | 2400 |
} |
2401 |
||
2402 |
/** |
|
2403 |
* Retrieves the value of the designated column in the current row of this |
|
2404 |
* <code>CachedRowSetImpl</code> object as a <code>java.io.InputStream</code> |
|
2405 |
* object. |
|
2406 |
* <P> |
|
2407 |
* A column value can be retrieved as a stream of uninterpreted bytes |
|
2408 |
* and then read in chunks from the stream. This method is particularly |
|
2409 |
* suitable for retrieving large <code>LONGVARBINARY</code> values. |
|
2410 |
* |
|
2411 |
* <P><B>Note:</B> All the data in the returned stream must be |
|
2412 |
* read prior to getting the value of any other column. The next |
|
2413 |
* call to a get method implicitly closes the stream. Also, a |
|
2414 |
* stream may return <code>0</code> for |
|
2415 |
* <code>CachedRowSetImpl.available()</code> whether there is data |
|
2416 |
* available or not. |
|
2417 |
* |
|
2418 |
* @param columnIndex the first column is <code>1</code>, the second |
|
2419 |
* is <code>2</code>, and so on; must be <code>1</code> or larger |
|
2420 |
* and equal to or less than the number of columns in the rowset |
|
2421 |
* @return a Java input stream that delivers the database column value |
|
2422 |
* as a stream of uninterpreted bytes. If the value is SQL <code>NULL</code> |
|
2423 |
* then the result is <code>null</code>. |
|
2424 |
* @throws SQLException if (1) the given column index is out of bounds, |
|
2425 |
* (2) the cursor is not on one of this rowset's rows or its |
|
2426 |
* insert row, or (3) the designated column does not store an |
|
2427 |
* SQL <code>BINARY, VARBINARY</code> or <code><b>LONGVARBINARY</b></code> |
|
2428 |
* The bold type indicates the SQL type that this method is recommened |
|
2429 |
* to retrieve. |
|
2430 |
* @see #getBinaryStream(String) |
|
2431 |
*/ |
|
2432 |
public java.io.InputStream getBinaryStream(int columnIndex) throws SQLException { |
|
2433 |
||
2434 |
// always free an old stream |
|
2435 |
binaryStream = null; |
|
2436 |
||
2437 |
// sanity check. |
|
2438 |
checkIndex(columnIndex); |
|
2439 |
// make sure the cursor is on a valid row |
|
2440 |
checkCursor(); |
|
2441 |
||
2442 |
if (isBinary(RowSetMD.getColumnType(columnIndex)) == false) { |
|
2443 |
throw new SQLException(resBundle.handleGetObject("cachedrowsetimpl.dtypemismt").toString()); |
|
2444 |
} |
|
2445 |
||
2446 |
Object value = getCurrentRow().getColumnObject(columnIndex); |
|
2447 |
if (value == null) { |
|
2448 |
lastValueNull = true; |
|
2449 |
return null; |
|
2450 |
} |
|
2451 |
||
2452 |
binaryStream = new ByteArrayInputStream((byte[])value); |
|
2453 |
||
11129
f9ad1aadf3fa
7116445: Miscellaneous warnings in the JDBC/RowSet classes
lancea
parents:
9537
diff
changeset
|
2454 |
return binaryStream; |
2 | 2455 |
|
2456 |
} |
|
2457 |
||
2458 |
||
2459 |
// Methods for accessing results by column name |
|
2460 |
||
2461 |
/** |
|
2462 |
* Retrieves the value stored in the designated column |
|
2463 |
* of the current row as a <code>String</code> object. |
|
2464 |
* |
|
2465 |
* @param columnName a <code>String</code> object giving the SQL name of |
|
2466 |
* a column in this <code>CachedRowSetImpl</code> object |
|
2467 |
* @return the column value; if the value is SQL <code>NULL</code>, |
|
2468 |
* the result is <code>null</code> |
|
2469 |
* @throws SQLException if (1) the given column name is not the name of |
|
2470 |
* a column in this rowset, (2) the cursor is not on one of |
|
2471 |
* this rowset's rows or its insert row, or (3) the designated |
|
2472 |
* column does not store an SQL <code>TINYINT, SMALLINT, INTEGER |
|
2473 |
* BIGINT, REAL, FLOAT, DOUBLE, DECIMAL, NUMERIC, BIT, <b>CHAR</b>, |
|
2474 |
* <b>VARCHAR</b></code> or <code>LONGVARCHAR<</code> value. The bold SQL type |
|
2475 |
* designates the recommended return type. |
|
2476 |
*/ |
|
2477 |
public String getString(String columnName) throws SQLException { |
|
2478 |
return getString(getColIdxByName(columnName)); |
|
2479 |
} |
|
2480 |
||
2481 |
/** |
|
2482 |
* Retrieves the value stored in the designated column |
|
2483 |
* of the current row as a <code>boolean</code> value. |
|
2484 |
* |
|
2485 |
* @param columnName a <code>String</code> object giving the SQL name of |
|
2486 |
* a column in this <code>CachedRowSetImpl</code> object |
|
2487 |
* @return the column value as a <code>boolean</code> in the Java programming |
|
2488 |
* language; if the value is SQL <code>NULL</code>, |
|
2489 |
* the result is <code>false</code> |
|
2490 |
* @throws SQLException if (1) the given column name is not the name of |
|
2491 |
* a column in this rowset, (2) the cursor is not on one of |
|
2492 |
* this rowset's rows or its insert row, or (3) the designated |
|
2493 |
* column does not store an SQL <code>BOOLEAN</code> value |
|
2494 |
* @see #getBoolean(int) |
|
2495 |
*/ |
|
2496 |
public boolean getBoolean(String columnName) throws SQLException { |
|
2497 |
return getBoolean(getColIdxByName(columnName)); |
|
2498 |
} |
|
2499 |
||
2500 |
/** |
|
2501 |
* Retrieves the value stored in the designated column |
|
2502 |
* of the current row as a <code>byte</code> value. |
|
2503 |
* |
|
2504 |
* @param columnName a <code>String</code> object giving the SQL name of |
|
2505 |
* a column in this <code>CachedRowSetImpl</code> object |
|
2506 |
* @return the column value as a <code>byte</code> in the Java programming |
|
2507 |
* language; if the value is SQL <code>NULL</code>, the result is <code>0</code> |
|
2508 |
* @throws SQLException if (1) the given column name is not the name of |
|
2509 |
* a column in this rowset, (2) the cursor is not on one of |
|
2510 |
* this rowset's rows or its insert row, or (3) the designated |
|
2511 |
* column does not store an SQL <code><B>TINYINT</B>, SMALLINT, INTEGER, |
|
2512 |
* BIGINT, REAL, FLOAT, DOUBLE, DECIMAL, NUMERIC, BIT, CHAR, |
|
2513 |
* VARCHAR</code> or <code>LONGVARCHAR</code> value. The |
|
2514 |
* bold type designates the recommended return type |
|
2515 |
*/ |
|
2516 |
public byte getByte(String columnName) throws SQLException { |
|
2517 |
return getByte(getColIdxByName(columnName)); |
|
2518 |
} |
|
2519 |
||
2520 |
/** |
|
2521 |
* Retrieves the value stored in the designated column |
|
2522 |
* of the current row as a <code>short</code> value. |
|
2523 |
* |
|
2524 |
* @param columnName a <code>String</code> object giving the SQL name of |
|
2525 |
* a column in this <code>CachedRowSetImpl</code> object |
|
2526 |
* @return the column value; if the value is SQL <code>NULL</code>, |
|
2527 |
* the result is <code>0</code> |
|
2528 |
* @throws SQLException if (1) the given column name is not the name of |
|
2529 |
* a column in this rowset, (2) the cursor is not on one of |
|
2530 |
* this rowset's rows or its insert row, or (3) the designated |
|
2531 |
* column does not store an SQL <code>TINYINT, <b>SMALLINT</b>, INTEGER |
|
2532 |
* BIGINT, REAL, FLOAT, DOUBLE, DECIMAL, NUMERIC, BIT, CHAR, |
|
2533 |
* VARCHAR</code> or <code>LONGVARCHAR</code> value. The bold SQL type |
|
2534 |
* designates the recommended return type. |
|
2535 |
* @see #getShort(int) |
|
2536 |
*/ |
|
2537 |
public short getShort(String columnName) throws SQLException { |
|
2538 |
return getShort(getColIdxByName(columnName)); |
|
2539 |
} |
|
2540 |
||
2541 |
/** |
|
2542 |
* Retrieves the value stored in the designated column |
|
2543 |
* of the current row as an <code>int</code> value. |
|
2544 |
* |
|
2545 |
* @param columnName a <code>String</code> object giving the SQL name of |
|
2546 |
* a column in this <code>CachedRowSetImpl</code> object |
|
2547 |
* @return the column value; if the value is SQL <code>NULL</code>, |
|
2548 |
* the result is <code>0</code> |
|
2549 |
* @throws SQLException if (1) the given column name is not the name |
|
2550 |
* of a column in this rowset, |
|
2551 |
* (2) the cursor is not on one of this rowset's rows or its |
|
2552 |
* insert row, or (3) the designated column does not store an |
|
2553 |
* SQL <code>TINYINT, SMALLINT, <b>INTEGER</b>, BIGINT, REAL |
|
2554 |
* FLOAT, DOUBLE, DECIMAL, NUMERIC, BIT, CHAR, VARCHAR</code> |
|
2555 |
* or <code>LONGVARCHAR</code> value. The bold SQL type designates the |
|
2556 |
* recommended return type. |
|
2557 |
*/ |
|
2558 |
public int getInt(String columnName) throws SQLException { |
|
2559 |
return getInt(getColIdxByName(columnName)); |
|
2560 |
} |
|
2561 |
||
2562 |
/** |
|
2563 |
* Retrieves the value stored in the designated column |
|
2564 |
* of the current row as a <code>long</code> value. |
|
2565 |
* |
|
2566 |
* @param columnName a <code>String</code> object giving the SQL name of |
|
2567 |
* a column in this <code>CachedRowSetImpl</code> object |
|
2568 |
* @return the column value; if the value is SQL <code>NULL</code>, |
|
2569 |
* the result is <code>0</code> |
|
2570 |
* @throws SQLException if (1) the given column name is not the name of |
|
2571 |
* a column in this rowset, (2) the cursor is not on one of |
|
2572 |
* this rowset's rows or its insert row, or (3) the designated |
|
2573 |
* column does not store an SQL <code>TINYINT, SMALLINT, INTEGER |
|
2574 |
* <b>BIGINT</b>, REAL, FLOAT, DOUBLE, DECIMAL, NUMERIC, BIT, CHAR, |
|
2575 |
* VARCHAR</code> or <code>LONGVARCHAR</code> value. The bold SQL type |
|
2576 |
* designates the recommended return type. |
|
2577 |
* @see #getLong(int) |
|
2578 |
*/ |
|
2579 |
public long getLong(String columnName) throws SQLException { |
|
2580 |
return getLong(getColIdxByName(columnName)); |
|
2581 |
} |
|
2582 |
||
2583 |
/** |
|
2584 |
* Retrieves the value stored in the designated column |
|
2585 |
* of the current row as a <code>float</code> value. |
|
2586 |
* |
|
2587 |
* @param columnName a <code>String</code> object giving the SQL name of |
|
2588 |
* a column in this <code>CachedRowSetImpl</code> object |
|
2589 |
* @return the column value; if the value is SQL <code>NULL</code>, |
|
2590 |
* the result is <code>0</code> |
|
2591 |
* @throws SQLException if (1) the given column name is not the name of |
|
2592 |
* a column in this rowset, (2) the cursor is not on one of |
|
2593 |
* this rowset's rows or its insert row, or (3) the designated |
|
2594 |
* column does not store an SQL <code>TINYINT, SMALLINT, INTEGER |
|
2595 |
* BIGINT, <b>REAL</b>, FLOAT, DOUBLE, DECIMAL, NUMERIC, BIT, CHAR, |
|
2596 |
* VARCHAR</code> or <code>LONGVARCHAR</code> value. The bold SQL type |
|
2597 |
* designates the recommended return type. |
|
2598 |
* @see #getFloat(String) |
|
2599 |
*/ |
|
2600 |
public float getFloat(String columnName) throws SQLException { |
|
2601 |
return getFloat(getColIdxByName(columnName)); |
|
2602 |
} |
|
2603 |
||
2604 |
/** |
|
2605 |
* Retrieves the value stored in the designated column |
|
2606 |
* of the current row of this <code>CachedRowSetImpl</code> object |
|
2607 |
* as a <code>double</code> value. |
|
2608 |
* |
|
2609 |
* @param columnName a <code>String</code> object giving the SQL name of |
|
2610 |
* a column in this <code>CachedRowSetImpl</code> object |
|
2611 |
* @return the column value; if the value is SQL <code>NULL</code>, |
|
2612 |
* the result is <code>0</code> |
|
2613 |
* @throws SQLException if (1) the given column name is not the name of |
|
2614 |
* a column in this rowset, (2) the cursor is not on one of |
|
2615 |
* this rowset's rows or its insert row, or (3) the designated |
|
2616 |
* column does not store an SQL <code>TINYINT, SMALLINT, INTEGER |
|
2617 |
* BIGINT, REAL, <b>FLOAT</b>, <b>DOUBLE</b>, DECIMAL, NUMERIC, BIT, CHAR, |
|
2618 |
* VARCHAR</code> or <code>LONGVARCHAR</code> value. The bold SQL type |
|
2619 |
* designates the recommended return types. |
|
2620 |
* @see #getDouble(int) |
|
2621 |
*/ |
|
2622 |
public double getDouble(String columnName) throws SQLException { |
|
2623 |
return getDouble(getColIdxByName(columnName)); |
|
2624 |
} |
|
2625 |
||
2626 |
/** |
|
2627 |
* Retrieves the value stored in the designated column |
|
2628 |
* of the current row as a <code>java.math.BigDecimal</code> object. |
|
2629 |
* |
|
2630 |
* @param columnName a <code>String</code> object giving the SQL name of |
|
2631 |
* a column in this <code>CachedRowSetImpl</code> object |
|
2632 |
* @param scale the number of digits to the right of the decimal point |
|
2633 |
* @return a java.math.BugDecimal object with <code><i>scale</i></code> |
|
2634 |
* number of digits to the right of the decimal point. |
|
2635 |
* @throws SQLException if (1) the given column name is not the name of |
|
2636 |
* a column in this rowset, (2) the cursor is not on one of |
|
2637 |
* this rowset's rows or its insert row, or (3) the designated |
|
2638 |
* column does not store an SQL <code>TINYINT, SMALLINT, INTEGER |
|
2639 |
* BIGINT, REAL, FLOAT, DOUBLE, <b>DECIMAL</b>, <b>NUMERIC</b>, BIT CHAR, |
|
2640 |
* VARCHAR</code> or <code>LONGVARCHAR</code> value. The bold SQL type |
|
2641 |
* designates the recommended return type that this method is used to |
|
2642 |
* retrieve. |
|
2643 |
* @deprecated Use the <code>getBigDecimal(String columnName)</code> |
|
2644 |
* method instead |
|
2645 |
*/ |
|
2646 |
public BigDecimal getBigDecimal(String columnName, int scale) throws SQLException { |
|
2647 |
return getBigDecimal(getColIdxByName(columnName), scale); |
|
2648 |
} |
|
2649 |
||
2650 |
/** |
|
2651 |
* Retrieves the value stored in the designated column |
|
2652 |
* of the current row as a <code>byte</code> array. |
|
2653 |
* The bytes represent the raw values returned by the driver. |
|
2654 |
* |
|
2655 |
* @param columnName a <code>String</code> object giving the SQL name of |
|
2656 |
* a column in this <code>CachedRowSetImpl</code> object |
|
2657 |
* @return the column value as a <code>byte</code> array in the Java programming |
|
2658 |
* language; if the value is SQL <code>NULL</code>, the result is <code>null</code> |
|
2659 |
* @throws SQLException if (1) the given column name is not the name of |
|
2660 |
* a column in this rowset, (2) the cursor is not on one of |
|
2661 |
* this rowset's rows or its insert row, or (3) the designated |
|
2662 |
* column does not store an SQL <code><b>BINARY</b>, <b>VARBINARY</b> |
|
2663 |
* </code> or <code>LONGVARBINARY</code> values |
|
2664 |
* The bold SQL type designates the recommended return type. |
|
2665 |
* @see #getBytes(int) |
|
2666 |
*/ |
|
2667 |
public byte[] getBytes(String columnName) throws SQLException { |
|
2668 |
return getBytes(getColIdxByName(columnName)); |
|
2669 |
} |
|
2670 |
||
2671 |
/** |
|
2672 |
* Retrieves the value stored in the designated column |
|
2673 |
* of the current row as a <code>java.sql.Date</code> object. |
|
2674 |
* |
|
2675 |
* @param columnName a <code>String</code> object giving the SQL name of |
|
2676 |
* a column in this <code>CachedRowSetImpl</code> object |
|
2677 |
* @return the column value; if the value is SQL <code>NULL</code>, |
|
2678 |
* the result is <code>null</code> |
|
2679 |
* @throws SQLException if (1) the given column name is not the name of |
|
2680 |
* a column in this rowset, (2) the cursor is not on one of |
|
2681 |
* this rowset's rows or its insert row, or (3) the designated |
|
2682 |
* column does not store an SQL <code>DATE</code> or |
|
2683 |
* <code>TIMESTAMP</code> value |
|
2684 |
*/ |
|
2685 |
public java.sql.Date getDate(String columnName) throws SQLException { |
|
2686 |
return getDate(getColIdxByName(columnName)); |
|
2687 |
} |
|
2688 |
||
2689 |
/** |
|
2690 |
* Retrieves the value stored in the designated column |
|
2691 |
* of the current row as a <code>java.sql.Time</code> object. |
|
2692 |
* |
|
2693 |
* @param columnName a <code>String</code> object giving the SQL name of |
|
2694 |
* a column in this <code>CachedRowSetImpl</code> object |
|
2695 |
* @return the column value; if the value is SQL <code>NULL</code>, |
|
2696 |
* the result is <code>null</code> |
|
2697 |
* @throws SQLException if the given column name does not match one of |
|
2698 |
* this rowset's column names or the cursor is not on one of |
|
2699 |
* this rowset's rows or its insert row |
|
2700 |
*/ |
|
2701 |
public java.sql.Time getTime(String columnName) throws SQLException { |
|
2702 |
return getTime(getColIdxByName(columnName)); |
|
2703 |
} |
|
2704 |
||
2705 |
/** |
|
2706 |
* Retrieves the value stored in the designated column |
|
2707 |
* of the current row as a <code>java.sql.Timestamp</code> object. |
|
2708 |
* |
|
2709 |
* @param columnName a <code>String</code> object giving the SQL name of |
|
2710 |
* a column in this <code>CachedRowSetImpl</code> object |
|
2711 |
* @return the column value; if the value is SQL <code>NULL</code>, |
|
2712 |
* the result is <code>null</code> |
|
2713 |
* @throws SQLException if the given column name does not match one of |
|
2714 |
* this rowset's column names or the cursor is not on one of |
|
2715 |
* this rowset's rows or its insert row |
|
2716 |
*/ |
|
2717 |
public java.sql.Timestamp getTimestamp(String columnName) throws SQLException { |
|
2718 |
return getTimestamp(getColIdxByName(columnName)); |
|
2719 |
} |
|
2720 |
||
2721 |
/** |
|
2722 |
* Retrieves the value of the designated column in the current row of this |
|
2723 |
* <code>CachedRowSetImpl</code> object as a <code>java.io.InputStream</code> |
|
2724 |
* object. |
|
2725 |
* |
|
2726 |
* A column value can be retrieved as a stream of ASCII characters |
|
2727 |
* and then read in chunks from the stream. This method is particularly |
|
2728 |
* suitable for retrieving large <code>LONGVARCHAR</code> values. The |
|
2729 |
* <code>SyncProvider</code> will rely on the JDBC driver to do any necessary |
|
2730 |
* conversion from the database format into ASCII format. |
|
2731 |
* |
|
2732 |
* <P><B>Note:</B> All the data in the returned stream must |
|
2733 |
* be read prior to getting the value of any other column. The |
|
2734 |
* next call to a <code>getXXX</code> method implicitly closes the stream. |
|
2735 |
* |
|
2736 |
* @param columnName a <code>String</code> object giving the SQL name of |
|
2737 |
* a column in this <code>CachedRowSetImpl</code> object |
|
2738 |
* @return a Java input stream that delivers the database column value |
|
2739 |
* as a stream of one-byte ASCII characters. If the value is SQL |
|
2740 |
* <code>NULL</code>, the result is <code>null</code>. |
|
2741 |
* @throws SQLException if (1) the given column name is not the name of |
|
2742 |
* a column in this rowset |
|
2743 |
* (2) the cursor is not on one of this rowset's rows or its |
|
2744 |
* insert row, or (3) the designated column does not store an |
|
2745 |
* SQL <code>CHAR, VARCHAR</code>, <code><b>LONGVARCHAR</b></code> |
|
2746 |
* <code>BINARY, VARBINARY</code> or <code>LONGVARBINARY</code> value. The |
|
2747 |
* bold SQL type designates the recommended return types that this method is |
|
2748 |
* used to retrieve. |
|
2749 |
* @see #getAsciiStream(int) |
|
2750 |
*/ |
|
2751 |
public java.io.InputStream getAsciiStream(String columnName) throws SQLException { |
|
2752 |
return getAsciiStream(getColIdxByName(columnName)); |
|
2753 |
||
2754 |
} |
|
2755 |
||
2756 |
/** |
|
2757 |
* A column value can be retrieved as a stream of Unicode characters |
|
2758 |
* and then read in chunks from the stream. This method is particularly |
|
2759 |
* suitable for retrieving large <code>LONGVARCHAR</code> values. |
|
2760 |
* The JDBC driver will do any necessary conversion from the database |
|
2761 |
* format into Unicode. |
|
2762 |
* |
|
2763 |
* <P><B>Note:</B> All the data in the returned stream must |
|
2764 |
* be read prior to getting the value of any other column. The |
|
2765 |
* next call to a <code>getXXX</code> method implicitly closes the stream. |
|
2766 |
* |
|
2767 |
* @param columnName a <code>String</code> object giving the SQL name of |
|
2768 |
* a column in this <code>CachedRowSetImpl</code> object |
|
2769 |
* @return a Java input stream that delivers the database column value |
|
2770 |
* as a stream of two-byte Unicode characters. If the value is |
|
2771 |
* SQL <code>NULL</code>, the result is <code>null</code>. |
|
2772 |
* @throws SQLException if the given column name does not match one of |
|
2773 |
* this rowset's column names or the cursor is not on one of |
|
2774 |
* this rowset's rows or its insert row |
|
2775 |
* @deprecated use the method <code>getCharacterStream</code> instead |
|
2776 |
*/ |
|
2777 |
public java.io.InputStream getUnicodeStream(String columnName) throws SQLException { |
|
2778 |
return getUnicodeStream(getColIdxByName(columnName)); |
|
2779 |
} |
|
2780 |
||
2781 |
/** |
|
2782 |
* Retrieves the value of the designated column in the current row of this |
|
2783 |
* <code>CachedRowSetImpl</code> object as a <code>java.io.InputStream</code> |
|
2784 |
* object. |
|
2785 |
* <P> |
|
2786 |
* A column value can be retrieved as a stream of uninterpreted bytes |
|
2787 |
* and then read in chunks from the stream. This method is particularly |
|
2788 |
* suitable for retrieving large <code>LONGVARBINARY</code> values. |
|
2789 |
* |
|
2790 |
* <P><B>Note:</B> All the data in the returned stream must be |
|
2791 |
* read prior to getting the value of any other column. The next |
|
2792 |
* call to a get method implicitly closes the stream. Also, a |
|
2793 |
* stream may return <code>0</code> for <code>CachedRowSetImpl.available()</code> |
|
2794 |
* whether there is data available or not. |
|
2795 |
* |
|
2796 |
* @param columnName a <code>String</code> object giving the SQL name of |
|
2797 |
* a column in this <code>CachedRowSetImpl</code> object |
|
2798 |
* @return a Java input stream that delivers the database column value |
|
2799 |
* as a stream of uninterpreted bytes. If the value is SQL |
|
2800 |
* <code>NULL</code>, the result is <code>null</code>. |
|
2801 |
* @throws SQLException if (1) the given column name is unknown, |
|
2802 |
* (2) the cursor is not on one of this rowset's rows or its |
|
2803 |
* insert row, or (3) the designated column does not store an |
|
2804 |
* SQL <code>BINARY, VARBINARY</code> or <code><b>LONGVARBINARY</b></code> |
|
2805 |
* The bold type indicates the SQL type that this method is recommened |
|
2806 |
* to retrieve. |
|
2807 |
* @see #getBinaryStream(int) |
|
2808 |
* |
|
2809 |
*/ |
|
2810 |
public java.io.InputStream getBinaryStream(String columnName) throws SQLException { |
|
2811 |
return getBinaryStream(getColIdxByName(columnName)); |
|
2812 |
} |
|
2813 |
||
2814 |
||
2815 |
// Advanced features: |
|
2816 |
||
2817 |
/** |
|
2818 |
* The first warning reported by calls on this <code>CachedRowSetImpl</code> |
|
2819 |
* object is returned. Subsequent <code>CachedRowSetImpl</code> warnings will |
|
2820 |
* be chained to this <code>SQLWarning</code>. |
|
2821 |
* |
|
2822 |
* <P>The warning chain is automatically cleared each time a new |
|
2823 |
* row is read. |
|
2824 |
* |
|
2825 |
* <P><B>Note:</B> This warning chain only covers warnings caused |
|
2826 |
* by <code>ResultSet</code> methods. Any warning caused by statement |
|
2827 |
* methods (such as reading OUT parameters) will be chained on the |
|
2828 |
* <code>Statement</code> object. |
|
2829 |
* |
|
2830 |
* @return the first SQLWarning or null |
|
2831 |
*/ |
|
2832 |
public SQLWarning getWarnings() { |
|
2833 |
return sqlwarn; |
|
2834 |
} |
|
2835 |
||
2836 |
/** |
|
2837 |
* Clears all the warnings reporeted for the <code>CachedRowSetImpl</code> |
|
2838 |
* object. After a call to this method, the <code>getWarnings</code> method |
|
2839 |
* returns <code>null</code> until a new warning is reported for this |
|
2840 |
* <code>CachedRowSetImpl</code> object. |
|
2841 |
*/ |
|
2842 |
public void clearWarnings() { |
|
2843 |
sqlwarn = null; |
|
2844 |
} |
|
2845 |
||
2846 |
/** |
|
2847 |
* Retrieves the name of the SQL cursor used by this |
|
2848 |
* <code>CachedRowSetImpl</code> object. |
|
2849 |
* |
|
2850 |
* <P>In SQL, a result table is retrieved through a cursor that is |
|
2851 |
* named. The current row of a <code>ResultSet</code> can be updated or deleted |
|
2852 |
* using a positioned update/delete statement that references the |
|
2853 |
* cursor name. To ensure that the cursor has the proper isolation |
|
2854 |
* level to support an update operation, the cursor's <code>SELECT</code> |
|
2855 |
* statement should be of the form <code>select for update</code>. |
|
2856 |
* If the <code>for update</code> clause |
|
2857 |
* is omitted, positioned updates may fail. |
|
2858 |
* |
|
2859 |
* <P>JDBC supports this SQL feature by providing the name of the |
|
2860 |
* SQL cursor used by a <code>ResultSet</code> object. The current row |
|
2861 |
* of a result set is also the current row of this SQL cursor. |
|
2862 |
* |
|
2863 |
* <P><B>Note:</B> If positioned updates are not supported, an |
|
2864 |
* <code>SQLException</code> is thrown. |
|
2865 |
* |
|
2866 |
* @return the SQL cursor name for this <code>CachedRowSetImpl</code> object's |
|
2867 |
* cursor |
|
2868 |
* @throws SQLException if an error occurs |
|
2869 |
*/ |
|
2870 |
public String getCursorName() throws SQLException { |
|
2871 |
throw new SQLException(resBundle.handleGetObject("cachedrowsetimpl.posupdate").toString()); |
|
2872 |
} |
|
2873 |
||
2874 |
/** |
|
2875 |
* Retrieves a <code>ResultSetMetaData</code> object instance that |
|
2876 |
* contains information about the <code>CachedRowSet</code> object. |
|
2877 |
* However, applications should cast the returned object to a |
|
2878 |
* <code>RowSetMetaData</code> interface implementation. In the |
|
2879 |
* reference implementation, this cast can be done on the |
|
2880 |
* <code>RowSetMetaDataImpl</code> class. |
|
2881 |
* <P> |
|
2882 |
* For example: |
|
2883 |
* <pre> |
|
2884 |
* CachedRowSet crs = new CachedRowSetImpl(); |
|
2885 |
* RowSetMetaDataImpl metaData = |
|
2886 |
* (RowSetMetaDataImpl)crs.getMetaData(); |
|
2887 |
* // Set the number of columns in the RowSet object for |
|
2888 |
* // which this RowSetMetaDataImpl object was created to the |
|
2889 |
* // given number. |
|
2890 |
* metaData.setColumnCount(3); |
|
2891 |
* crs.setMetaData(metaData); |
|
2892 |
* </pre> |
|
2893 |
* |
|
2894 |
* @return the <code>ResultSetMetaData</code> object that describes this |
|
2895 |
* <code>CachedRowSetImpl</code> object's columns |
|
2896 |
* @throws SQLException if an error occurs in generating the RowSet |
|
2897 |
* meta data; or if the <code>CachedRowSetImpl</code> is empty. |
|
2898 |
* @see javax.sql.RowSetMetaData |
|
2899 |
*/ |
|
2900 |
public ResultSetMetaData getMetaData() throws SQLException { |
|
2901 |
return (ResultSetMetaData)RowSetMD; |
|
2902 |
} |
|
2903 |
||
2904 |
||
2905 |
/** |
|
2906 |
* Retrieves the value of the designated column in the current row |
|
2907 |
* of this <code>CachedRowSetImpl</code> object as an |
|
2908 |
* <code>Object</code> value. |
|
2909 |
* <P> |
|
2910 |
* The type of the <code>Object</code> will be the default |
|
2911 |
* Java object type corresponding to the column's SQL type, |
|
2912 |
* following the mapping for built-in types specified in the JDBC 3.0 |
|
2913 |
* specification. |
|
2914 |
* <P> |
|
2915 |
* This method may also be used to read datatabase-specific |
|
2916 |
* abstract data types. |
|
2917 |
* <P> |
|
2918 |
* This implementation of the method <code>getObject</code> extends its |
|
2919 |
* behavior so that it gets the attributes of an SQL structured type |
|
2920 |
* as an array of <code>Object</code> values. This method also custom |
|
2921 |
* maps SQL user-defined types to classes in the Java programming language. |
|
2922 |
* When the specified column contains |
|
2923 |
* a structured or distinct value, the behavior of this method is as |
|
2924 |
* if it were a call to the method <code>getObject(columnIndex, |
|
2925 |
* this.getStatement().getConnection().getTypeMap())</code>. |
|
2926 |
* |
|
2927 |
* @param columnIndex the first column is <code>1</code>, the second |
|
2928 |
* is <code>2</code>, and so on; must be <code>1</code> or larger |
|
2929 |
* and equal to or less than the number of columns in the rowset |
|
2930 |
* @return a <code>java.lang.Object</code> holding the column value; |
|
2931 |
* if the value is SQL <code>NULL</code>, the result is <code>null</code> |
|
2932 |
* @throws SQLException if the given column index is out of bounds, |
|
2933 |
* the cursor is not on a valid row, or there is a problem getting |
|
2934 |
* the <code>Class</code> object for a custom mapping |
|
2935 |
* @see #getObject(String) |
|
2936 |
*/ |
|
2937 |
public Object getObject(int columnIndex) throws SQLException { |
|
2938 |
Object value; |
|
9257
53e6d7bc31b0
7035615: Address lint warnings for javax.sql.rowset & com.sun.rowset
lancea
parents:
6697
diff
changeset
|
2939 |
Map<String, Class<?>> map; |
2 | 2940 |
|
2941 |
// sanity check. |
|
2942 |
checkIndex(columnIndex); |
|
2943 |
// make sure the cursor is on a valid row |
|
2944 |
checkCursor(); |
|
2945 |
||
2946 |
setLastValueNull(false); |
|
2947 |
value = getCurrentRow().getColumnObject(columnIndex); |
|
2948 |
||
2949 |
// check for SQL NULL |
|
2950 |
if (value == null) { |
|
2951 |
setLastValueNull(true); |
|
2952 |
return null; |
|
2953 |
} |
|
2954 |
if (value instanceof Struct) { |
|
2955 |
Struct s = (Struct)value; |
|
2956 |
map = getTypeMap(); |
|
2957 |
// look up the class in the map |
|
11129
f9ad1aadf3fa
7116445: Miscellaneous warnings in the JDBC/RowSet classes
lancea
parents:
9537
diff
changeset
|
2958 |
Class<?> c = map.get(s.getSQLTypeName()); |
2 | 2959 |
if (c != null) { |
2960 |
// create new instance of the class |
|
2961 |
SQLData obj = null; |
|
2962 |
try { |
|
2963 |
obj = (SQLData)c.newInstance(); |
|
2964 |
} catch (java.lang.InstantiationException ex) { |
|
2965 |
throw new SQLException(MessageFormat.format(resBundle.handleGetObject("cachedrowsetimpl.unableins").toString(), |
|
2966 |
ex.getMessage())); |
|
2967 |
} catch (java.lang.IllegalAccessException ex) { |
|
2968 |
throw new SQLException(MessageFormat.format(resBundle.handleGetObject("cachedrowsetimpl.unableins").toString(), |
|
2969 |
ex.getMessage())); |
|
2970 |
} |
|
2971 |
// get the attributes from the struct |
|
2972 |
Object attribs[] = s.getAttributes(map); |
|
2973 |
// create the SQLInput "stream" |
|
2974 |
SQLInputImpl sqlInput = new SQLInputImpl(attribs, map); |
|
2975 |
// read the values... |
|
2976 |
obj.readSQL(sqlInput, s.getSQLTypeName()); |
|
2977 |
return (Object)obj; |
|
2978 |
} |
|
2979 |
} |
|
2980 |
return value; |
|
2981 |
} |
|
2982 |
||
2983 |
/** |
|
2984 |
* Retrieves the value of the designated column in the current row |
|
2985 |
* of this <code>CachedRowSetImpl</code> object as an |
|
2986 |
* <code>Object</code> value. |
|
2987 |
* <P> |
|
2988 |
* The type of the <code>Object</code> will be the default |
|
2989 |
* Java object type corresponding to the column's SQL type, |
|
2990 |
* following the mapping for built-in types specified in the JDBC 3.0 |
|
2991 |
* specification. |
|
2992 |
* <P> |
|
2993 |
* This method may also be used to read datatabase-specific |
|
2994 |
* abstract data types. |
|
2995 |
* <P> |
|
2996 |
* This implementation of the method <code>getObject</code> extends its |
|
2997 |
* behavior so that it gets the attributes of an SQL structured type |
|
2998 |
* as an array of <code>Object</code> values. This method also custom |
|
2999 |
* maps SQL user-defined types to classes |
|
3000 |
* in the Java programming language. When the specified column contains |
|
3001 |
* a structured or distinct value, the behavior of this method is as |
|
3002 |
* if it were a call to the method <code>getObject(columnIndex, |
|
3003 |
* this.getStatement().getConnection().getTypeMap())</code>. |
|
3004 |
* |
|
3005 |
* @param columnName a <code>String</code> object that must match the |
|
3006 |
* SQL name of a column in this rowset, ignoring case |
|
3007 |
* @return a <code>java.lang.Object</code> holding the column value; |
|
3008 |
* if the value is SQL <code>NULL</code>, the result is <code>null</code> |
|
3009 |
* @throws SQLException if (1) the given column name does not match one of |
|
3010 |
* this rowset's column names, (2) the cursor is not |
|
3011 |
* on a valid row, or (3) there is a problem getting |
|
3012 |
* the <code>Class</code> object for a custom mapping |
|
3013 |
* @see #getObject(int) |
|
3014 |
*/ |
|
3015 |
public Object getObject(String columnName) throws SQLException { |
|
3016 |
return getObject(getColIdxByName(columnName)); |
|
3017 |
} |
|
3018 |
||
3019 |
//---------------------------------------------------------------- |
|
3020 |
||
3021 |
/** |
|
3022 |
* Maps the given column name for one of this <code>CachedRowSetImpl</code> |
|
3023 |
* object's columns to its column number. |
|
3024 |
* |
|
3025 |
* @param columnName a <code>String</code> object that must match the |
|
3026 |
* SQL name of a column in this rowset, ignoring case |
|
3027 |
* @return the column index of the given column name |
|
3028 |
* @throws SQLException if the given column name does not match one |
|
3029 |
* of this rowset's column names |
|
3030 |
*/ |
|
3031 |
public int findColumn(String columnName) throws SQLException { |
|
3032 |
return getColIdxByName(columnName); |
|
3033 |
} |
|
3034 |
||
3035 |
||
3036 |
//--------------------------JDBC 2.0----------------------------------- |
|
3037 |
||
3038 |
//--------------------------------------------------------------------- |
|
3039 |
// Getter's and Setter's |
|
3040 |
//--------------------------------------------------------------------- |
|
3041 |
||
3042 |
/** |
|
3043 |
* Retrieves the value stored in the designated column |
|
3044 |
* of the current row as a <code>java.io.Reader</code> object. |
|
3045 |
* |
|
3046 |
* <P><B>Note:</B> All the data in the returned stream must |
|
3047 |
* be read prior to getting the value of any other column. The |
|
3048 |
* next call to a <code>getXXX</code> method implicitly closes the stream. |
|
3049 |
* |
|
3050 |
* @param columnIndex the first column is <code>1</code>, the second |
|
3051 |
* is <code>2</code>, and so on; must be <code>1</code> or larger |
|
3052 |
* and equal to or less than the number of columns in the rowset |
|
3053 |
* @return a Java character stream that delivers the database column value |
|
3054 |
* as a stream of two-byte unicode characters in a |
|
3055 |
* <code>java.io.Reader</code> object. If the value is |
|
3056 |
* SQL <code>NULL</code>, the result is <code>null</code>. |
|
3057 |
* @throws SQLException if (1) the given column index is out of bounds, |
|
3058 |
* (2) the cursor is not on one of this rowset's rows or its |
|
3059 |
* insert row, or (3) the designated column does not store an |
|
3060 |
* SQL <code>CHAR, VARCHAR, <b>LONGVARCHAR</b>, BINARY, VARBINARY</code> or |
|
3061 |
* <code>LONGVARBINARY</code> value. |
|
3062 |
* The bold SQL type designates the recommended return type. |
|
3063 |
* @see #getCharacterStream(String) |
|
3064 |
*/ |
|
3065 |
public java.io.Reader getCharacterStream(int columnIndex) throws SQLException{ |
|
3066 |
||
3067 |
// sanity check. |
|
3068 |
checkIndex(columnIndex); |
|
3069 |
// make sure the cursor is on a valid row |
|
3070 |
checkCursor(); |
|
3071 |
||
3072 |
if (isBinary(RowSetMD.getColumnType(columnIndex))) { |
|
3073 |
Object value = getCurrentRow().getColumnObject(columnIndex); |
|
3074 |
if (value == null) { |
|
3075 |
lastValueNull = true; |
|
3076 |
return null; |
|
3077 |
} |
|
3078 |
charStream = new InputStreamReader |
|
3079 |
(new ByteArrayInputStream((byte[])value)); |
|
3080 |
} else if (isString(RowSetMD.getColumnType(columnIndex))) { |
|
3081 |
Object value = getCurrentRow().getColumnObject(columnIndex); |
|
3082 |
if (value == null) { |
|
3083 |
lastValueNull = true; |
|
3084 |
return null; |
|
3085 |
} |
|
3086 |
charStream = new StringReader(value.toString()); |
|
3087 |
} else { |
|
3088 |
throw new SQLException(resBundle.handleGetObject("cachedrowsetimpl.dtypemismt").toString()); |
|
3089 |
} |
|
3090 |
||
11129
f9ad1aadf3fa
7116445: Miscellaneous warnings in the JDBC/RowSet classes
lancea
parents:
9537
diff
changeset
|
3091 |
return charStream; |
2 | 3092 |
} |
3093 |
||
3094 |
/** |
|
3095 |
* Retrieves the value stored in the designated column |
|
3096 |
* of the current row as a <code>java.io.Reader</code> object. |
|
3097 |
* |
|
3098 |
* <P><B>Note:</B> All the data in the returned stream must |
|
3099 |
* be read prior to getting the value of any other column. The |
|
3100 |
* next call to a <code>getXXX</code> method implicitly closes the stream. |
|
3101 |
* |
|
3102 |
* @param columnName a <code>String</code> object giving the SQL name of |
|
3103 |
* a column in this <code>CachedRowSetImpl</code> object |
|
3104 |
* @return a Java input stream that delivers the database column value |
|
3105 |
* as a stream of two-byte Unicode characters. If the value is |
|
3106 |
* SQL <code>NULL</code>, the result is <code>null</code>. |
|
3107 |
* @throws SQLException if (1) the given column name is not the name of |
|
3108 |
* a column in this rowset, (2) the cursor is not on one of |
|
3109 |
* this rowset's rows or its insert row, or (3) the designated |
|
3110 |
* column does not store an SQL <code>CHAR, VARCHAR, <b>LONGVARCHAR</b>, |
|
3111 |
* BINARY, VARYBINARY</code> or <code>LONGVARBINARY</code> value. |
|
3112 |
* The bold SQL type designates the recommended return type. |
|
3113 |
*/ |
|
3114 |
public java.io.Reader getCharacterStream(String columnName) throws SQLException { |
|
3115 |
return getCharacterStream(getColIdxByName(columnName)); |
|
3116 |
} |
|
3117 |
||
3118 |
/** |
|
3119 |
* Retrieves the value of the designated column in the current row |
|
3120 |
* of this <code>CachedRowSetImpl</code> object as a |
|
3121 |
* <code>java.math.BigDecimal</code> object. |
|
3122 |
* |
|
3123 |
* @param columnIndex the first column is <code>1</code>, the second |
|
3124 |
* is <code>2</code>, and so on; must be <code>1</code> or larger |
|
3125 |
* and equal to or less than the number of columns in the rowset |
|
3126 |
* @return a <code>java.math.BigDecimal</code> value with full precision; |
|
3127 |
* if the value is SQL <code>NULL</code>, the result is <code>null</code> |
|
3128 |
* @throws SQLException if (1) the given column index is out of bounds, |
|
3129 |
* (2) the cursor is not on one of this rowset's rows or its |
|
3130 |
* insert row, or (3) the designated column does not store an |
|
3131 |
* SQL <code>TINYINT, SMALLINT, INTEGER, BIGINT, REAL, |
|
3132 |
* FLOAT, DOUBLE, <b>DECIMAL</b>, <b>NUMERIC</b>, BIT, CHAR, VARCHAR</code> |
|
3133 |
* or <code>LONGVARCHAR</code> value. The bold SQL type designates the |
|
3134 |
* recommended return types that this method is used to retrieve. |
|
3135 |
* @see #getBigDecimal(String) |
|
3136 |
*/ |
|
3137 |
public BigDecimal getBigDecimal(int columnIndex) throws SQLException { |
|
3138 |
Object value; |
|
3139 |
||
3140 |
// sanity check. |
|
3141 |
checkIndex(columnIndex); |
|
3142 |
// make sure the cursor is on a valid row |
|
3143 |
checkCursor(); |
|
3144 |
||
3145 |
setLastValueNull(false); |
|
3146 |
value = getCurrentRow().getColumnObject(columnIndex); |
|
3147 |
||
3148 |
// check for SQL NULL |
|
3149 |
if (value == null) { |
|
3150 |
setLastValueNull(true); |
|
3151 |
return null; |
|
3152 |
} |
|
3153 |
try { |
|
3154 |
return (new BigDecimal(value.toString().trim())); |
|
3155 |
} catch (NumberFormatException ex) { |
|
3156 |
throw new SQLException(MessageFormat.format(resBundle.handleGetObject("cachedrowsetimpl.doublefail").toString(), |
|
3157 |
new Object[] {value.toString().trim(), columnIndex})); |
|
3158 |
} |
|
3159 |
} |
|
3160 |
||
3161 |
/** |
|
3162 |
* Retrieves the value of the designated column in the current row |
|
3163 |
* of this <code>CachedRowSetImpl</code> object as a |
|
3164 |
* <code>java.math.BigDecimal</code> object. |
|
3165 |
* |
|
3166 |
* @param columnName a <code>String</code> object that must match the |
|
3167 |
* SQL name of a column in this rowset, ignoring case |
|
3168 |
* @return a <code>java.math.BigDecimal</code> value with full precision; |
|
3169 |
* if the value is SQL <code>NULL</code>, the result is <code>null</code> |
|
3170 |
* @throws SQLException if (1) the given column name is not the name of |
|
3171 |
* a column in this rowset, (2) the cursor is not on one of |
|
3172 |
* this rowset's rows or its insert row, or (3) the designated |
|
3173 |
* column does not store an SQL <code>TINYINT, SMALLINT, INTEGER |
|
3174 |
* BIGINT, REAL, FLOAT, DOUBLE, <b>DECIMAL</b>, <b>NUMERIC</b>, BIT CHAR, |
|
3175 |
* VARCHAR</code> or <code>LONGVARCHAR</code> value. The bold SQL type |
|
3176 |
* designates the recommended return type that this method is used to |
|
3177 |
* retrieve |
|
3178 |
* @see #getBigDecimal(int) |
|
3179 |
*/ |
|
3180 |
public BigDecimal getBigDecimal(String columnName) throws SQLException { |
|
3181 |
return getBigDecimal(getColIdxByName(columnName)); |
|
3182 |
} |
|
3183 |
||
3184 |
//--------------------------------------------------------------------- |
|
3185 |
// Traversal/Positioning |
|
3186 |
//--------------------------------------------------------------------- |
|
3187 |
||
3188 |
/** |
|
3189 |
* Returns the number of rows in this <code>CachedRowSetImpl</code> object. |
|
3190 |
* |
|
3191 |
* @return number of rows in the rowset |
|
3192 |
*/ |
|
3193 |
public int size() { |
|
3194 |
return numRows; |
|
3195 |
} |
|
3196 |
||
3197 |
/** |
|
3198 |
* Indicates whether the cursor is before the first row in this |
|
3199 |
* <code>CachedRowSetImpl</code> object. |
|
3200 |
* |
|
3201 |
* @return <code>true</code> if the cursor is before the first row; |
|
3202 |
* <code>false</code> otherwise or if the rowset contains no rows |
|
3203 |
* @throws SQLException if an error occurs |
|
3204 |
*/ |
|
3205 |
public boolean isBeforeFirst() throws SQLException { |
|
3206 |
if (cursorPos == 0 && numRows > 0) { |
|
3207 |
return true; |
|
3208 |
} else { |
|
3209 |
return false; |
|
3210 |
} |
|
3211 |
} |
|
3212 |
||
3213 |
/** |
|
3214 |
* Indicates whether the cursor is after the last row in this |
|
3215 |
* <code>CachedRowSetImpl</code> object. |
|
3216 |
* |
|
3217 |
* @return <code>true</code> if the cursor is after the last row; |
|
3218 |
* <code>false</code> otherwise or if the rowset contains no rows |
|
3219 |
* @throws SQLException if an error occurs |
|
3220 |
*/ |
|
3221 |
public boolean isAfterLast() throws SQLException { |
|
3222 |
if (cursorPos == numRows+1 && numRows > 0) { |
|
3223 |
return true; |
|
3224 |
} else { |
|
3225 |
return false; |
|
3226 |
} |
|
3227 |
} |
|
3228 |
||
3229 |
/** |
|
3230 |
* Indicates whether the cursor is on the first row in this |
|
3231 |
* <code>CachedRowSetImpl</code> object. |
|
3232 |
* |
|
3233 |
* @return <code>true</code> if the cursor is on the first row; |
|
3234 |
* <code>false</code> otherwise or if the rowset contains no rows |
|
3235 |
* @throws SQLException if an error occurs |
|
3236 |
*/ |
|
3237 |
public boolean isFirst() throws SQLException { |
|
3238 |
// this becomes nasty because of deletes. |
|
3239 |
int saveCursorPos = cursorPos; |
|
3240 |
int saveAbsoluteCursorPos = absolutePos; |
|
3241 |
internalFirst(); |
|
3242 |
if (cursorPos == saveCursorPos) { |
|
3243 |
return true; |
|
3244 |
} else { |
|
3245 |
cursorPos = saveCursorPos; |
|
3246 |
absolutePos = saveAbsoluteCursorPos; |
|
3247 |
return false; |
|
3248 |
} |
|
3249 |
} |
|
3250 |
||
3251 |
/** |
|
3252 |
* Indicates whether the cursor is on the last row in this |
|
3253 |
* <code>CachedRowSetImpl</code> object. |
|
3254 |
* <P> |
|
3255 |
* Note: Calling the method <code>isLast</code> may be expensive |
|
3256 |
* because the JDBC driver might need to fetch ahead one row in order |
|
3257 |
* to determine whether the current row is the last row in this rowset. |
|
3258 |
* |
|
3259 |
* @return <code>true</code> if the cursor is on the last row; |
|
3260 |
* <code>false</code> otherwise or if this rowset contains no rows |
|
3261 |
* @throws SQLException if an error occurs |
|
3262 |
*/ |
|
3263 |
public boolean isLast() throws SQLException { |
|
3264 |
int saveCursorPos = cursorPos; |
|
3265 |
int saveAbsoluteCursorPos = absolutePos; |
|
3266 |
boolean saveShowDeleted = getShowDeleted(); |
|
3267 |
setShowDeleted(true); |
|
3268 |
internalLast(); |
|
3269 |
if (cursorPos == saveCursorPos) { |
|
3270 |
setShowDeleted(saveShowDeleted); |
|
3271 |
return true; |
|
3272 |
} else { |
|
3273 |
setShowDeleted(saveShowDeleted); |
|
3274 |
cursorPos = saveCursorPos; |
|
3275 |
absolutePos = saveAbsoluteCursorPos; |
|
3276 |
return false; |
|
3277 |
} |
|
3278 |
} |
|
3279 |
||
3280 |
/** |
|
3281 |
* Moves this <code>CachedRowSetImpl</code> object's cursor to the front of |
|
3282 |
* the rowset, just before the first row. This method has no effect if |
|
3283 |
* this rowset contains no rows. |
|
3284 |
* |
|
3285 |
* @throws SQLException if an error occurs or the type of this rowset |
|
3286 |
* is <code>ResultSet.TYPE_FORWARD_ONLY</code> |
|
3287 |
*/ |
|
3288 |
public void beforeFirst() throws SQLException { |
|
3289 |
if (getType() == ResultSet.TYPE_FORWARD_ONLY) { |
|
3290 |
throw new SQLException(resBundle.handleGetObject("cachedrowsetimpl.beforefirst").toString()); |
|
3291 |
} |
|
3292 |
cursorPos = 0; |
|
3293 |
absolutePos = 0; |
|
3294 |
notifyCursorMoved(); |
|
3295 |
} |
|
3296 |
||
3297 |
/** |
|
3298 |
* Moves this <code>CachedRowSetImpl</code> object's cursor to the end of |
|
3299 |
* the rowset, just after the last row. This method has no effect if |
|
3300 |
* this rowset contains no rows. |
|
3301 |
* |
|
3302 |
* @throws SQLException if an error occurs |
|
3303 |
*/ |
|
3304 |
public void afterLast() throws SQLException { |
|
3305 |
if (numRows > 0) { |
|
3306 |
cursorPos = numRows + 1; |
|
3307 |
absolutePos = 0; |
|
3308 |
notifyCursorMoved(); |
|
3309 |
} |
|
3310 |
} |
|
3311 |
||
3312 |
/** |
|
3313 |
* Moves this <code>CachedRowSetImpl</code> object's cursor to the first row |
|
3314 |
* and returns <code>true</code> if the operation was successful. This |
|
3315 |
* method also notifies registered listeners that the cursor has moved. |
|
3316 |
* |
|
3317 |
* @return <code>true</code> if the cursor is on a valid row; |
|
3318 |
* <code>false</code> otherwise or if there are no rows in this |
|
3319 |
* <code>CachedRowSetImpl</code> object |
|
3320 |
* @throws SQLException if the type of this rowset |
|
3321 |
* is <code>ResultSet.TYPE_FORWARD_ONLY</code> |
|
3322 |
*/ |
|
3323 |
public boolean first() throws SQLException { |
|
3324 |
if(getType() == ResultSet.TYPE_FORWARD_ONLY) { |
|
3325 |
throw new SQLException(resBundle.handleGetObject("cachedrowsetimpl.first").toString()); |
|
3326 |
} |
|
3327 |
||
3328 |
// move and notify |
|
3329 |
boolean ret = this.internalFirst(); |
|
3330 |
notifyCursorMoved(); |
|
3331 |
||
3332 |
return ret; |
|
3333 |
} |
|
3334 |
||
3335 |
/** |
|
3336 |
* Moves this <code>CachedRowSetImpl</code> object's cursor to the first |
|
3337 |
* row and returns <code>true</code> if the operation is successful. |
|
3338 |
* <P> |
|
3339 |
* This method is called internally by the methods <code>first</code>, |
|
3340 |
* <code>isFirst</code>, and <code>absolute</code>. |
|
3341 |
* It in turn calls the method <code>internalNext</code> in order to |
|
3342 |
* handle the case where the first row is a deleted row that is not visible. |
|
3343 |
* <p> |
|
3344 |
* This is a implementation only method and is not required as a standard |
|
3345 |
* implementation of the <code>CachedRowSet</code> interface. |
|
3346 |
* |
|
3347 |
* @return <code>true</code> if the cursor moved to the first row; |
|
3348 |
* <code>false</code> otherwise |
|
3349 |
* @throws SQLException if an error occurs |
|
3350 |
*/ |
|
3351 |
protected boolean internalFirst() throws SQLException { |
|
3352 |
boolean ret = false; |
|
3353 |
||
3354 |
if (numRows > 0) { |
|
3355 |
cursorPos = 1; |
|
3356 |
if ((getShowDeleted() == false) && (rowDeleted() == true)) { |
|
3357 |
ret = internalNext(); |
|
3358 |
} else { |
|
3359 |
ret = true; |
|
3360 |
} |
|
3361 |
} |
|
3362 |
||
3363 |
if (ret == true) |
|
3364 |
absolutePos = 1; |
|
3365 |
else |
|
3366 |
absolutePos = 0; |
|
3367 |
||
3368 |
return ret; |
|
3369 |
} |
|
3370 |
||
3371 |
/** |
|
3372 |
* Moves this <code>CachedRowSetImpl</code> object's cursor to the last row |
|
3373 |
* and returns <code>true</code> if the operation was successful. This |
|
3374 |
* method also notifies registered listeners that the cursor has moved. |
|
3375 |
* |
|
3376 |
* @return <code>true</code> if the cursor is on a valid row; |
|
3377 |
* <code>false</code> otherwise or if there are no rows in this |
|
3378 |
* <code>CachedRowSetImpl</code> object |
|
3379 |
* @throws SQLException if the type of this rowset |
|
3380 |
* is <code>ResultSet.TYPE_FORWARD_ONLY</code> |
|
3381 |
*/ |
|
3382 |
public boolean last() throws SQLException { |
|
3383 |
if (getType() == ResultSet.TYPE_FORWARD_ONLY) { |
|
3384 |
throw new SQLException(resBundle.handleGetObject("cachedrowsetimpl.last").toString()); |
|
3385 |
} |
|
3386 |
||
3387 |
// move and notify |
|
3388 |
boolean ret = this.internalLast(); |
|
3389 |
notifyCursorMoved(); |
|
3390 |
||
3391 |
return ret; |
|
3392 |
} |
|
3393 |
||
3394 |
/** |
|
3395 |
* Moves this <code>CachedRowSetImpl</code> object's cursor to the last |
|
3396 |
* row and returns <code>true</code> if the operation is successful. |
|
3397 |
* <P> |
|
3398 |
* This method is called internally by the method <code>last</code> |
|
3399 |
* when rows have been deleted and the deletions are not visible. |
|
3400 |
* The method <code>internalLast</code> handles the case where the |
|
3401 |
* last row is a deleted row that is not visible by in turn calling |
|
3402 |
* the method <code>internalPrevious</code>. |
|
3403 |
* <p> |
|
3404 |
* This is a implementation only method and is not required as a standard |
|
3405 |
* implementation of the <code>CachedRowSet</code> interface. |
|
3406 |
* |
|
3407 |
* @return <code>true</code> if the cursor moved to the last row; |
|
3408 |
* <code>false</code> otherwise |
|
3409 |
* @throws SQLException if an error occurs |
|
3410 |
*/ |
|
3411 |
protected boolean internalLast() throws SQLException { |
|
3412 |
boolean ret = false; |
|
3413 |
||
3414 |
if (numRows > 0) { |
|
3415 |
cursorPos = numRows; |
|
3416 |
if ((getShowDeleted() == false) && (rowDeleted() == true)) { |
|
3417 |
ret = internalPrevious(); |
|
3418 |
} else { |
|
3419 |
ret = true; |
|
3420 |
} |
|
3421 |
} |
|
3422 |
if (ret == true) |
|
3423 |
absolutePos = numRows - numDeleted; |
|
3424 |
else |
|
3425 |
absolutePos = 0; |
|
3426 |
return ret; |
|
3427 |
} |
|
3428 |
||
3429 |
/** |
|
3430 |
* Returns the number of the current row in this <code>CachedRowSetImpl</code> |
|
3431 |
* object. The first row is number 1, the second number 2, and so on. |
|
3432 |
* |
|
3433 |
* @return the number of the current row; <code>0</code> if there is no |
|
3434 |
* current row |
|
3435 |
* @throws SQLException if an error occurs; or if the <code>CacheRowSetImpl</code> |
|
3436 |
* is empty |
|
3437 |
*/ |
|
3438 |
public int getRow() throws SQLException { |
|
3439 |
// are we on a valid row? Valid rows are between first and last |
|
3440 |
if (numRows > 0 && |
|
3441 |
cursorPos > 0 && |
|
3442 |
cursorPos < (numRows + 1) && |
|
3443 |
(getShowDeleted() == false && rowDeleted() == false)) { |
|
3444 |
return absolutePos; |
|
3445 |
} else if (getShowDeleted() == true) { |
|
3446 |
return cursorPos; |
|
3447 |
} else { |
|
3448 |
return 0; |
|
3449 |
} |
|
3450 |
} |
|
3451 |
||
3452 |
/** |
|
3453 |
* Moves this <code>CachedRowSetImpl</code> object's cursor to the row number |
|
3454 |
* specified. |
|
3455 |
* |
|
3456 |
* <p>If the number is positive, the cursor moves to an absolute row with |
|
3457 |
* respect to the beginning of the rowset. The first row is row 1, the second |
|
3458 |
* is row 2, and so on. For example, the following command, in which |
|
3459 |
* <code>crs</code> is a <code>CachedRowSetImpl</code> object, moves the cursor |
|
3460 |
* to the fourth row, starting from the beginning of the rowset. |
|
3461 |
* <PRE><code> |
|
3462 |
* |
|
3463 |
* crs.absolute(4); |
|
3464 |
* |
|
3465 |
* </code> </PRE> |
|
3466 |
* <P> |
|
3467 |
* If the number is negative, the cursor moves to an absolute row position |
|
3468 |
* with respect to the end of the rowset. For example, calling |
|
3469 |
* <code>absolute(-1)</code> positions the cursor on the last row, |
|
3470 |
* <code>absolute(-2)</code> moves it on the next-to-last row, and so on. |
|
3471 |
* If the <code>CachedRowSetImpl</code> object <code>crs</code> has five rows, |
|
3472 |
* the following command moves the cursor to the fourth-to-last row, which |
|
3473 |
* in the case of a rowset with five rows, is also the second row, counting |
|
3474 |
* from the beginning. |
|
3475 |
* <PRE><code> |
|
3476 |
* |
|
3477 |
* crs.absolute(-4); |
|
3478 |
* |
|
3479 |
* </code> </PRE> |
|
3480 |
* |
|
3481 |
* If the number specified is larger than the number of rows, the cursor |
|
3482 |
* will move to the position after the last row. If the number specified |
|
3483 |
* would move the cursor one or more rows before the first row, the cursor |
|
3484 |
* moves to the position before the first row. |
|
3485 |
* <P> |
|
3486 |
* Note: Calling <code>absolute(1)</code> is the same as calling the |
|
3487 |
* method <code>first()</code>. Calling <code>absolute(-1)</code> is the |
|
3488 |
* same as calling <code>last()</code>. |
|
3489 |
* |
|
3490 |
* @param row a positive number to indicate the row, starting row numbering from |
|
3491 |
* the first row, which is <code>1</code>; a negative number to indicate |
|
3492 |
* the row, starting row numbering from the last row, which is |
|
3493 |
* <code>-1</code>; it must not be <code>0</code> |
|
3494 |
* @return <code>true</code> if the cursor is on the rowset; <code>false</code> |
|
3495 |
* otherwise |
|
3496 |
* @throws SQLException if the given cursor position is <code>0</code> or the |
|
3497 |
* type of this rowset is <code>ResultSet.TYPE_FORWARD_ONLY</code> |
|
3498 |
*/ |
|
3499 |
public boolean absolute( int row ) throws SQLException { |
|
3500 |
if (row == 0 || getType() == ResultSet.TYPE_FORWARD_ONLY) { |
|
3501 |
throw new SQLException(resBundle.handleGetObject("cachedrowsetimpl.absolute").toString()); |
|
3502 |
} |
|
3503 |
||
3504 |
if (row > 0) { // we are moving foward |
|
3505 |
if (row > numRows) { |
|
3506 |
// fell off the end |
|
3507 |
afterLast(); |
|
3508 |
return false; |
|
3509 |
} else { |
|
3510 |
if (absolutePos <= 0) |
|
3511 |
internalFirst(); |
|
3512 |
} |
|
3513 |
} else { // we are moving backward |
|
3514 |
if (cursorPos + row < 0) { |
|
3515 |
// fell off the front |
|
3516 |
beforeFirst(); |
|
3517 |
return false; |
|
3518 |
} else { |
|
3519 |
if (absolutePos >= 0) |
|
3520 |
internalLast(); |
|
3521 |
} |
|
3522 |
} |
|
3523 |
||
3524 |
// Now move towards the absolute row that we're looking for |
|
3525 |
while (absolutePos != row) { |
|
3526 |
if (absolutePos < row) { |
|
3527 |
if (!internalNext()) |
|
3528 |
break; |
|
3529 |
} |
|
3530 |
else { |
|
3531 |
if (!internalPrevious()) |
|
3532 |
break; |
|
3533 |
} |
|
3534 |
} |
|
3535 |
||
3536 |
notifyCursorMoved(); |
|
3537 |
||
3538 |
if (isAfterLast() || isBeforeFirst()) { |
|
3539 |
return false; |
|
3540 |
} else { |
|
3541 |
return true; |
|
3542 |
} |
|
3543 |
} |
|
3544 |
||
3545 |
/** |
|
3546 |
* Moves the cursor the specified number of rows from the current |
|
3547 |
* position, with a positive number moving it forward and a |
|
3548 |
* negative number moving it backward. |
|
3549 |
* <P> |
|
3550 |
* If the number is positive, the cursor moves the specified number of |
|
3551 |
* rows toward the end of the rowset, starting at the current row. |
|
3552 |
* For example, the following command, in which |
|
3553 |
* <code>crs</code> is a <code>CachedRowSetImpl</code> object with 100 rows, |
|
3554 |
* moves the cursor forward four rows from the current row. If the |
|
3555 |
* current row is 50, the cursor would move to row 54. |
|
3556 |
* <PRE><code> |
|
3557 |
* |
|
3558 |
* crs.relative(4); |
|
3559 |
* |
|
3560 |
* </code> </PRE> |
|
3561 |
* <P> |
|
3562 |
* If the number is negative, the cursor moves back toward the beginning |
|
3563 |
* the specified number of rows, starting at the current row. |
|
3564 |
* For example, calling the method |
|
3565 |
* <code>absolute(-1)</code> positions the cursor on the last row, |
|
3566 |
* <code>absolute(-2)</code> moves it on the next-to-last row, and so on. |
|
3567 |
* If the <code>CachedRowSetImpl</code> object <code>crs</code> has five rows, |
|
3568 |
* the following command moves the cursor to the fourth-to-last row, which |
|
3569 |
* in the case of a rowset with five rows, is also the second row |
|
3570 |
* from the beginning. |
|
3571 |
* <PRE><code> |
|
3572 |
* |
|
3573 |
* crs.absolute(-4); |
|
3574 |
* |
|
3575 |
* </code> </PRE> |
|
3576 |
* |
|
3577 |
* If the number specified is larger than the number of rows, the cursor |
|
3578 |
* will move to the position after the last row. If the number specified |
|
3579 |
* would move the cursor one or more rows before the first row, the cursor |
|
3580 |
* moves to the position before the first row. In both cases, this method |
|
3581 |
* throws an <code>SQLException</code>. |
|
3582 |
* <P> |
|
3583 |
* Note: Calling <code>absolute(1)</code> is the same as calling the |
|
3584 |
* method <code>first()</code>. Calling <code>absolute(-1)</code> is the |
|
3585 |
* same as calling <code>last()</code>. Calling <code>relative(0)</code> |
|
3586 |
* is valid, but it does not change the cursor position. |
|
3587 |
* |
|
3588 |
* @param rows an <code>int</code> indicating the number of rows to move |
|
3589 |
* the cursor, starting at the current row; a positive number |
|
3590 |
* moves the cursor forward; a negative number moves the cursor |
|
3591 |
* backward; must not move the cursor past the valid |
|
3592 |
* rows |
|
3593 |
* @return <code>true</code> if the cursor is on a row in this |
|
3594 |
* <code>CachedRowSetImpl</code> object; <code>false</code> |
|
3595 |
* otherwise |
|
3596 |
* @throws SQLException if there are no rows in this rowset, the cursor is |
|
3597 |
* positioned either before the first row or after the last row, or |
|
3598 |
* the rowset is type <code>ResultSet.TYPE_FORWARD_ONLY</code> |
|
3599 |
*/ |
|
3600 |
public boolean relative(int rows) throws SQLException { |
|
3601 |
if (numRows == 0 || isBeforeFirst() || |
|
3602 |
isAfterLast() || getType() == ResultSet.TYPE_FORWARD_ONLY) { |
|
3603 |
throw new SQLException(resBundle.handleGetObject("cachedrowsetimpl.relative").toString()); |
|
3604 |
} |
|
3605 |
||
3606 |
if (rows == 0) { |
|
3607 |
return true; |
|
3608 |
} |
|
3609 |
||
3610 |
if (rows > 0) { // we are moving forward |
|
3611 |
if (cursorPos + rows > numRows) { |
|
3612 |
// fell off the end |
|
3613 |
afterLast(); |
|
3614 |
} else { |
|
3615 |
for (int i=0; i < rows; i++) { |
|
3616 |
if (!internalNext()) |
|
3617 |
break; |
|
3618 |
} |
|
3619 |
} |
|
3620 |
} else { // we are moving backward |
|
3621 |
if (cursorPos + rows < 0) { |
|
3622 |
// fell off the front |
|
3623 |
beforeFirst(); |
|
3624 |
} else { |
|
3625 |
for (int i=rows; i < 0; i++) { |
|
3626 |
if (!internalPrevious()) |
|
3627 |
break; |
|
3628 |
} |
|
3629 |
} |
|
3630 |
} |
|
3631 |
notifyCursorMoved(); |
|
3632 |
||
3633 |
if (isAfterLast() || isBeforeFirst()) { |
|
3634 |
return false; |
|
3635 |
} else { |
|
3636 |
return true; |
|
3637 |
} |
|
3638 |
} |
|
3639 |
||
3640 |
/** |
|
3641 |
* Moves this <code>CachedRowSetImpl</code> object's cursor to the |
|
3642 |
* previous row and returns <code>true</code> if the cursor is on |
|
3643 |
* a valid row or <code>false</code> if it is not. |
|
3644 |
* This method also notifies all listeners registered with this |
|
3645 |
* <code>CachedRowSetImpl</code> object that its cursor has moved. |
|
3646 |
* <P> |
|
3647 |
* Note: calling the method <code>previous()</code> is not the same |
|
3648 |
* as calling the method <code>relative(-1)</code>. This is true |
|
3649 |
* because it is possible to call <code>previous()</code> from the insert |
|
3650 |
* row, from after the last row, or from the current row, whereas |
|
3651 |
* <code>relative</code> may only be called from the current row. |
|
3652 |
* <P> |
|
3653 |
* The method <code>previous</code> may used in a <code>while</code> |
|
3654 |
* loop to iterate through a rowset starting after the last row |
|
3655 |
* and moving toward the beginning. The loop ends when <code>previous</code> |
|
3656 |
* returns <code>false</code>, meaning that there are no more rows. |
|
3657 |
* For example, the following code fragment retrieves all the data in |
|
3658 |
* the <code>CachedRowSetImpl</code> object <code>crs</code>, which has |
|
3659 |
* three columns. Note that the cursor must initially be positioned |
|
3660 |
* after the last row so that the first call to the method |
|
3661 |
* <code>previous</code> places the cursor on the last line. |
|
3662 |
* <PRE> <code> |
|
3663 |
* |
|
3664 |
* crs.afterLast(); |
|
3665 |
* while (previous()) { |
|
3666 |
* String name = crs.getString(1); |
|
3667 |
* int age = crs.getInt(2); |
|
3668 |
* short ssn = crs.getShort(3); |
|
3669 |
* System.out.println(name + " " + age + " " + ssn); |
|
3670 |
* } |
|
3671 |
* |
|
3672 |
* </code> </PRE> |
|
3673 |
* This method throws an <code>SQLException</code> if the cursor is not |
|
3674 |
* on a row in the rowset, before the first row, or after the last row. |
|
3675 |
* |
|
3676 |
* @return <code>true</code> if the cursor is on a valid row; |
|
3677 |
* <code>false</code> if it is before the first row or after the |
|
3678 |
* last row |
|
3679 |
* @throws SQLException if the cursor is not on a valid position or the |
|
3680 |
* type of this rowset is <code>ResultSet.TYPE_FORWARD_ONLY</code> |
|
3681 |
*/ |
|
3682 |
public boolean previous() throws SQLException { |
|
3683 |
if (getType() == ResultSet.TYPE_FORWARD_ONLY) { |
|
3684 |
throw new SQLException(resBundle.handleGetObject("cachedrowsetimpl.last").toString()); |
|
3685 |
} |
|
3686 |
/* |
|
3687 |
* make sure things look sane. The cursor must be |
|
3688 |
* positioned in the rowset or before first (0) or |
|
3689 |
* after last (numRows + 1) |
|
3690 |
*/ |
|
3691 |
if (cursorPos < 0 || cursorPos > numRows + 1) { |
|
3692 |
throw new SQLException(resBundle.handleGetObject("cachedrowsetimpl.invalidcp").toString()); |
|
3693 |
} |
|
3694 |
// move and notify |
|
3695 |
boolean ret = this.internalPrevious(); |
|
3696 |
notifyCursorMoved(); |
|
3697 |
||
3698 |
return ret; |
|
3699 |
} |
|
3700 |
||
3701 |
/** |
|
3702 |
* Moves the cursor to the previous row in this <code>CachedRowSetImpl</code> |
|
3703 |
* object, skipping past deleted rows that are not visible; returns |
|
3704 |
* <code>true</code> if the cursor is on a row in this rowset and |
|
3705 |
* <code>false</code> when the cursor goes before the first row. |
|
3706 |
* <P> |
|
3707 |
* This method is called internally by the method <code>previous</code>. |
|
3708 |
* <P> |
|
3709 |
* This is a implementation only method and is not required as a standard |
|
3710 |
* implementation of the <code>CachedRowSet</code> interface. |
|
3711 |
* |
|
3712 |
* @return <code>true</code> if the cursor is on a row in this rowset; |
|
3713 |
* <code>false</code> when the cursor reaches the position before |
|
3714 |
* the first row |
|
3715 |
* @throws SQLException if an error occurs |
|
3716 |
*/ |
|
3717 |
protected boolean internalPrevious() throws SQLException { |
|
3718 |
boolean ret = false; |
|
3719 |
||
3720 |
do { |
|
3721 |
if (cursorPos > 1) { |
|
3722 |
--cursorPos; |
|
3723 |
ret = true; |
|
3724 |
} else if (cursorPos == 1) { |
|
3725 |
// decrement to before first |
|
3726 |
--cursorPos; |
|
3727 |
ret = false; |
|
3728 |
break; |
|
3729 |
} |
|
3730 |
} while ((getShowDeleted() == false) && (rowDeleted() == true)); |
|
3731 |
||
3732 |
/* |
|
3733 |
* Each call to internalPrevious may move the cursor |
|
3734 |
* over multiple rows, the absolute postion moves one one row |
|
3735 |
*/ |
|
3736 |
if (ret == true) |
|
3737 |
--absolutePos; |
|
3738 |
else |
|
3739 |
absolutePos = 0; |
|
3740 |
||
3741 |
return ret; |
|
3742 |
} |
|
3743 |
||
3744 |
||
3745 |
//--------------------------------------------------------------------- |
|
3746 |
// Updates |
|
3747 |
//--------------------------------------------------------------------- |
|
3748 |
||
3749 |
/** |
|
3750 |
* Indicates whether the current row of this <code>CachedRowSetImpl</code> |
|
3751 |
* object has been updated. The value returned |
|
3752 |
* depends on whether this rowset can detect updates: <code>false</code> |
|
3753 |
* will always be returned if it does not detect updates. |
|
3754 |
* |
|
3755 |
* @return <code>true</code> if the row has been visibly updated |
|
3756 |
* by the owner or another and updates are detected; |
|
3757 |
* <code>false</code> otherwise |
|
3758 |
* @throws SQLException if the cursor is on the insert row or not |
|
3759 |
* not on a valid row |
|
3760 |
* |
|
3761 |
* @see DatabaseMetaData#updatesAreDetected |
|
3762 |
*/ |
|
3763 |
public boolean rowUpdated() throws SQLException { |
|
3764 |
// make sure the cursor is on a valid row |
|
3765 |
checkCursor(); |
|
3766 |
if (onInsertRow == true) { |
|
3767 |
throw new SQLException(resBundle.handleGetObject("cachedrowsetimpl.invalidop").toString()); |
|
3768 |
} |
|
3769 |
return(((Row)getCurrentRow()).getUpdated()); |
|
3770 |
} |
|
3771 |
||
3772 |
/** |
|
3773 |
* Indicates whether the designated column of the current row of |
|
3774 |
* this <code>CachedRowSetImpl</code> object has been updated. The |
|
3775 |
* value returned depends on whether this rowset can detcted updates: |
|
3776 |
* <code>false</code> will always be returned if it does not detect updates. |
|
3777 |
* |
|
3778 |
* @param idx the index identifier of the column that may be have been updated. |
|
3779 |
* @return <code>true</code> is the designated column has been updated |
|
3780 |
* and the rowset detects updates; <code>false</code> if the rowset has not |
|
3781 |
* been updated or the rowset does not detect updates |
|
3782 |
* @throws SQLException if the cursor is on the insert row or not |
|
3783 |
* on a valid row |
|
3784 |
* @see DatabaseMetaData#updatesAreDetected |
|
3785 |
*/ |
|
3786 |
public boolean columnUpdated(int idx) throws SQLException { |
|
3787 |
// make sure the cursor is on a valid row |
|
3788 |
checkCursor(); |
|
3789 |
if (onInsertRow == true) { |
|
3790 |
throw new SQLException(resBundle.handleGetObject("cachedrowsetimpl.invalidop").toString()); |
|
3791 |
} |
|
3792 |
return (((Row)getCurrentRow()).getColUpdated(idx - 1)); |
|
3793 |
} |
|
3794 |
||
3795 |
/** |
|
3796 |
* Indicates whether the designated column of the current row of |
|
3797 |
* this <code>CachedRowSetImpl</code> object has been updated. The |
|
3798 |
* value returned depends on whether this rowset can detcted updates: |
|
3799 |
* <code>false</code> will always be returned if it does not detect updates. |
|
3800 |
* |
|
3801 |
* @param columnName the <code>String</code> column name column that may be have |
|
3802 |
* been updated. |
|
3803 |
* @return <code>true</code> is the designated column has been updated |
|
3804 |
* and the rowset detects updates; <code>false</code> if the rowset has not |
|
3805 |
* been updated or the rowset does not detect updates |
|
3806 |
* @throws SQLException if the cursor is on the insert row or not |
|
3807 |
* on a valid row |
|
3808 |
* @see DatabaseMetaData#updatesAreDetected |
|
3809 |
*/ |
|
3810 |
public boolean columnUpdated(String columnName) throws SQLException { |
|
3811 |
return columnUpdated(getColIdxByName(columnName)); |
|
3812 |
} |
|
3813 |
||
3814 |
/** |
|
3815 |
* Indicates whether the current row has been inserted. The value returned |
|
3816 |
* depends on whether or not the rowset can detect visible inserts. |
|
3817 |
* |
|
3818 |
* @return <code>true</code> if a row has been inserted and inserts are detected; |
|
3819 |
* <code>false</code> otherwise |
|
3820 |
* @throws SQLException if the cursor is on the insert row or not |
|
3821 |
* not on a valid row |
|
3822 |
* |
|
3823 |
* @see DatabaseMetaData#insertsAreDetected |
|
3824 |
*/ |
|
3825 |
public boolean rowInserted() throws SQLException { |
|
3826 |
// make sure the cursor is on a valid row |
|
3827 |
checkCursor(); |
|
3828 |
if (onInsertRow == true) { |
|
3829 |
throw new SQLException(resBundle.handleGetObject("cachedrowsetimpl.invalidop").toString()); |
|
3830 |
} |
|
3831 |
return(((Row)getCurrentRow()).getInserted()); |
|
3832 |
} |
|
3833 |
||
3834 |
/** |
|
3835 |
* Indicates whether the current row has been deleted. A deleted row |
|
3836 |
* may leave a visible "hole" in a rowset. This method can be used to |
|
3837 |
* detect such holes if the rowset can detect deletions. This method |
|
3838 |
* will always return <code>false</code> if this rowset cannot detect |
|
3839 |
* deletions. |
|
3840 |
* |
|
3841 |
* @return <code>true</code> if (1)the current row is blank, indicating that |
|
3842 |
* the row has been deleted, and (2)deletions are detected; |
|
3843 |
* <code>false</code> otherwise |
|
3844 |
* @throws SQLException if the cursor is on a valid row in this rowset |
|
3845 |
* @see DatabaseMetaData#deletesAreDetected |
|
3846 |
*/ |
|
3847 |
public boolean rowDeleted() throws SQLException { |
|
3848 |
// make sure the cursor is on a valid row |
|
3849 |
||
3850 |
if (isAfterLast() == true || |
|
3851 |
isBeforeFirst() == true || |
|
3852 |
onInsertRow == true) { |
|
3853 |
||
3854 |
throw new SQLException(resBundle.handleGetObject("cachedrowsetimpl.invalidcp").toString()); |
|
3855 |
} |
|
3856 |
return(((Row)getCurrentRow()).getDeleted()); |
|
3857 |
} |
|
3858 |
||
3859 |
/** |
|
3860 |
* Indicates whether the given SQL data type is a numberic type. |
|
3861 |
* |
|
3862 |
* @param type one of the constants from <code>java.sql.Types</code> |
|
3863 |
* @return <code>true</code> if the given type is <code>NUMERIC</code>,' |
|
3864 |
* <code>DECIMAL</code>, <code>BIT</code>, <code>TINYINT</code>, |
|
3865 |
* <code>SMALLINT</code>, <code>INTEGER</code>, <code>BIGINT</code>, |
|
3866 |
* <code>REAL</code>, <code>DOUBLE</code>, or <code>FLOAT</code>; |
|
3867 |
* <code>false</code> otherwise |
|
3868 |
*/ |
|
3869 |
private boolean isNumeric(int type) { |
|
3870 |
switch (type) { |
|
3871 |
case java.sql.Types.NUMERIC: |
|
3872 |
case java.sql.Types.DECIMAL: |
|
3873 |
case java.sql.Types.BIT: |
|
3874 |
case java.sql.Types.TINYINT: |
|
3875 |
case java.sql.Types.SMALLINT: |
|
3876 |
case java.sql.Types.INTEGER: |
|
3877 |
case java.sql.Types.BIGINT: |
|
3878 |
case java.sql.Types.REAL: |
|
3879 |
case java.sql.Types.DOUBLE: |
|
3880 |
case java.sql.Types.FLOAT: |
|
3881 |
return true; |
|
3882 |
default: |
|
3883 |
return false; |
|
3884 |
} |
|
3885 |
} |
|
3886 |
||
3887 |
/** |
|
3888 |
* Indicates whether the given SQL data type is a string type. |
|
3889 |
* |
|
3890 |
* @param type one of the constants from <code>java.sql.Types</code> |
|
3891 |
* @return <code>true</code> if the given type is <code>CHAR</code>,' |
|
3892 |
* <code>VARCHAR</code>, or <code>LONGVARCHAR</code>; |
|
3893 |
* <code>false</code> otherwise |
|
3894 |
*/ |
|
3895 |
private boolean isString(int type) { |
|
3896 |
switch (type) { |
|
3897 |
case java.sql.Types.CHAR: |
|
3898 |
case java.sql.Types.VARCHAR: |
|
3899 |
case java.sql.Types.LONGVARCHAR: |
|
3900 |
return true; |
|
3901 |
default: |
|
3902 |
return false; |
|
3903 |
} |
|
3904 |
} |
|
3905 |
||
3906 |
/** |
|
3907 |
* Indicates whether the given SQL data type is a binary type. |
|
3908 |
* |
|
3909 |
* @param type one of the constants from <code>java.sql.Types</code> |
|
3910 |
* @return <code>true</code> if the given type is <code>BINARY</code>,' |
|
3911 |
* <code>VARBINARY</code>, or <code>LONGVARBINARY</code>; |
|
3912 |
* <code>false</code> otherwise |
|
3913 |
*/ |
|
3914 |
private boolean isBinary(int type) { |
|
3915 |
switch (type) { |
|
3916 |
case java.sql.Types.BINARY: |
|
3917 |
case java.sql.Types.VARBINARY: |
|
3918 |
case java.sql.Types.LONGVARBINARY: |
|
3919 |
return true; |
|
3920 |
default: |
|
3921 |
return false; |
|
3922 |
} |
|
3923 |
} |
|
3924 |
||
3925 |
/** |
|
3926 |
* Indicates whether the given SQL data type is a temporal type. |
|
3927 |
* This method is called internally by the conversion methods |
|
3928 |
* <code>convertNumeric</code> and <code>convertTemporal</code>. |
|
3929 |
* |
|
3930 |
* @param type one of the constants from <code>java.sql.Types</code> |
|
3931 |
* @return <code>true</code> if the given type is <code>DATE</code>, |
|
3932 |
* <code>TIME</code>, or <code>TIMESTAMP</code>; |
|
3933 |
* <code>false</code> otherwise |
|
3934 |
*/ |
|
3935 |
private boolean isTemporal(int type) { |
|
3936 |
switch (type) { |
|
3937 |
case java.sql.Types.DATE: |
|
3938 |
case java.sql.Types.TIME: |
|
3939 |
case java.sql.Types.TIMESTAMP: |
|
3940 |
return true; |
|
3941 |
default: |
|
3942 |
return false; |
|
3943 |
} |
|
3944 |
} |
|
3945 |
||
3946 |
/** |
|
3947 |
* Indicates whether the given SQL data type is a boolean type. |
|
3948 |
* This method is called internally by the conversion methods |
|
3949 |
* <code>convertNumeric</code> and <code>convertBoolean</code>. |
|
3950 |
* |
|
3951 |
* @param type one of the constants from <code>java.sql.Types</code> |
|
3952 |
* @return <code>true</code> if the given type is <code>BIT</code>, |
|
3953 |
* , or <code>BOOLEAN</code>; |
|
3954 |
* <code>false</code> otherwise |
|
3955 |
*/ |
|
3956 |
private boolean isBoolean(int type) { |
|
3957 |
switch (type) { |
|
3958 |
case java.sql.Types.BIT: |
|
3959 |
case java.sql.Types.BOOLEAN: |
|
3960 |
return true; |
|
3961 |
default: |
|
3962 |
return false; |
|
3963 |
} |
|
3964 |
} |
|
3965 |
||
3966 |
||
3967 |
/** |
|
3968 |
* Converts the given <code>Object</code> in the Java programming language |
|
3969 |
* to the standard mapping for the specified SQL target data type. |
|
3970 |
* The conversion must be to a string or numeric type, but there are no |
|
3971 |
* restrictions on the type to be converted. If the source type and target |
|
3972 |
* type are the same, the given object is simply returned. |
|
3973 |
* |
|
3974 |
* @param srcObj the <code>Object</code> in the Java programming language |
|
3975 |
* that is to be converted to the target type |
|
3976 |
* @param srcType the data type that is the standard mapping in SQL of the |
|
3977 |
* object to be converted; must be one of the constants in |
|
3978 |
* <code>java.sql.Types</code> |
|
3979 |
* @param trgType the SQL data type to which to convert the given object; |
|
3980 |
* must be one of the following constants in |
|
3981 |
* <code>java.sql.Types</code>: <code>NUMERIC</code>, |
|
3982 |
* <code>DECIMAL</code>, <code>BIT</code>, <code>TINYINT</code>, |
|
3983 |
* <code>SMALLINT</code>, <code>INTEGER</code>, <code>BIGINT</code>, |
|
3984 |
* <code>REAL</code>, <code>DOUBLE</code>, <code>FLOAT</code>, |
|
3985 |
* <code>VARCHAR</code>, <code>LONGVARCHAR</code>, or <code>CHAR</code> |
|
3986 |
* @return an <code>Object</code> value.that is |
|
3987 |
* the standard object mapping for the target SQL type |
|
3988 |
* @throws SQLException if the given target type is not one of the string or |
|
3989 |
* numeric types in <code>java.sql.Types</code> |
|
3990 |
*/ |
|
3991 |
private Object convertNumeric(Object srcObj, int srcType, |
|
3992 |
int trgType) throws SQLException { |
|
3993 |
||
3994 |
if (srcType == trgType) { |
|
3995 |
return srcObj; |
|
3996 |
} |
|
3997 |
||
3998 |
if (isNumeric(trgType) == false && isString(trgType) == false) { |
|
3999 |
throw new SQLException(resBundle.handleGetObject("cachedrowsetimpl.dtypemismt").toString() + trgType); |
|
4000 |
} |
|
4001 |
||
4002 |
try { |
|
4003 |
switch (trgType) { |
|
4004 |
case java.sql.Types.BIT: |
|
6697
39929804f9d4
6989139: Address JDBC Findbugs where Number type Constructor are used
lancea
parents:
6692
diff
changeset
|
4005 |
Integer i = Integer.valueOf(srcObj.toString().trim()); |
11129
f9ad1aadf3fa
7116445: Miscellaneous warnings in the JDBC/RowSet classes
lancea
parents:
9537
diff
changeset
|
4006 |
return i.equals(0) ? |
6697
39929804f9d4
6989139: Address JDBC Findbugs where Number type Constructor are used
lancea
parents:
6692
diff
changeset
|
4007 |
Boolean.valueOf(false) : |
39929804f9d4
6989139: Address JDBC Findbugs where Number type Constructor are used
lancea
parents:
6692
diff
changeset
|
4008 |
Boolean.valueOf(true); |
2 | 4009 |
case java.sql.Types.TINYINT: |
6697
39929804f9d4
6989139: Address JDBC Findbugs where Number type Constructor are used
lancea
parents:
6692
diff
changeset
|
4010 |
return Byte.valueOf(srcObj.toString().trim()); |
2 | 4011 |
case java.sql.Types.SMALLINT: |
6697
39929804f9d4
6989139: Address JDBC Findbugs where Number type Constructor are used
lancea
parents:
6692
diff
changeset
|
4012 |
return Short.valueOf(srcObj.toString().trim()); |
2 | 4013 |
case java.sql.Types.INTEGER: |
6697
39929804f9d4
6989139: Address JDBC Findbugs where Number type Constructor are used
lancea
parents:
6692
diff
changeset
|
4014 |
return Integer.valueOf(srcObj.toString().trim()); |
2 | 4015 |
case java.sql.Types.BIGINT: |
6697
39929804f9d4
6989139: Address JDBC Findbugs where Number type Constructor are used
lancea
parents:
6692
diff
changeset
|
4016 |
return Long.valueOf(srcObj.toString().trim()); |
2 | 4017 |
case java.sql.Types.NUMERIC: |
4018 |
case java.sql.Types.DECIMAL: |
|
4019 |
return new BigDecimal(srcObj.toString().trim()); |
|
4020 |
case java.sql.Types.REAL: |
|
4021 |
case java.sql.Types.FLOAT: |
|
4022 |
return new Float(srcObj.toString().trim()); |
|
4023 |
case java.sql.Types.DOUBLE: |
|
4024 |
return new Double(srcObj.toString().trim()); |
|
4025 |
case java.sql.Types.CHAR: |
|
4026 |
case java.sql.Types.VARCHAR: |
|
4027 |
case java.sql.Types.LONGVARCHAR: |
|
6692
aef4e294026f
6988993: Address Findbugs warnings for the use of String Constructor
lancea
parents:
6664
diff
changeset
|
4028 |
return srcObj.toString(); |
2 | 4029 |
default: |
4030 |
throw new SQLException(resBundle.handleGetObject("cachedrowsetimpl.dtypemismt").toString()+ trgType); |
|
4031 |
} |
|
4032 |
} catch (NumberFormatException ex) { |
|
4033 |
throw new SQLException(resBundle.handleGetObject("cachedrowsetimpl.dtypemismt").toString() + trgType); |
|
4034 |
} |
|
4035 |
} |
|
4036 |
||
4037 |
/** |
|
4038 |
* Converts the given <code>Object</code> in the Java programming language |
|
4039 |
* to the standard object mapping for the specified SQL target data type. |
|
4040 |
* The conversion must be to a string or temporal type, and there are also |
|
4041 |
* restrictions on the type to be converted. |
|
4042 |
* <P> |
|
4043 |
* <TABLE ALIGN="CENTER" BORDER CELLPADDING=10 BORDERCOLOR="#0000FF" |
|
4044 |
* <CAPTION ALIGN="CENTER"><B>Parameters and Return Values</B></CAPTION> |
|
4045 |
* <TR> |
|
4046 |
* <TD><B>Source SQL Type</B> |
|
4047 |
* <TD><B>Target SQL Type</B> |
|
4048 |
* <TD><B>Object Returned</B> |
|
4049 |
* </TR> |
|
4050 |
* <TR> |
|
4051 |
* <TD><code>TIMESTAMP</code> |
|
4052 |
* <TD><code>DATE</code> |
|
4053 |
* <TD><code>java.sql.Date</code> |
|
4054 |
* </TR> |
|
4055 |
* <TR> |
|
4056 |
* <TD><code>TIMESTAMP</code> |
|
4057 |
* <TD><code>TIME</code> |
|
4058 |
* <TD><code>java.sql.Time</code> |
|
4059 |
* </TR> |
|
4060 |
* <TR> |
|
4061 |
* <TD><code>TIME</code> |
|
4062 |
* <TD><code>TIMESTAMP</code> |
|
4063 |
* <TD><code>java.sql.Timestamp</code> |
|
4064 |
* </TR> |
|
4065 |
* <TR> |
|
4066 |
* <TD><code>DATE</code>, <code>TIME</code>, or <code>TIMESTAMP</code> |
|
4067 |
* <TD><code>CHAR</code>, <code>VARCHAR</code>, or <code>LONGVARCHAR</code> |
|
4068 |
* <TD><code>java.lang.String</code> |
|
4069 |
* </TR> |
|
4070 |
* </TABLE> |
|
4071 |
* <P> |
|
4072 |
* If the source type and target type are the same, |
|
4073 |
* the given object is simply returned. |
|
4074 |
* |
|
4075 |
* @param srcObj the <code>Object</code> in the Java programming language |
|
4076 |
* that is to be converted to the target type |
|
4077 |
* @param srcType the data type that is the standard mapping in SQL of the |
|
4078 |
* object to be converted; must be one of the constants in |
|
4079 |
* <code>java.sql.Types</code> |
|
4080 |
* @param trgType the SQL data type to which to convert the given object; |
|
4081 |
* must be one of the following constants in |
|
4082 |
* <code>java.sql.Types</code>: <code>DATE</code>, |
|
4083 |
* <code>TIME</code>, <code>TIMESTAMP</code>, <code>CHAR</code>, |
|
4084 |
* <code>VARCHAR</code>, or <code>LONGVARCHAR</code> |
|
4085 |
* @return an <code>Object</code> value.that is |
|
4086 |
* the standard object mapping for the target SQL type |
|
4087 |
* @throws SQLException if the given target type is not one of the string or |
|
4088 |
* temporal types in <code>java.sql.Types</code> |
|
4089 |
*/ |
|
4090 |
private Object convertTemporal(Object srcObj, |
|
4091 |
int srcType, int trgType) throws SQLException { |
|
4092 |
||
4093 |
if (srcType == trgType) { |
|
4094 |
return srcObj; |
|
4095 |
} |
|
4096 |
||
4097 |
if (isNumeric(trgType) == true || |
|
4098 |
(isString(trgType) == false && isTemporal(trgType) == false)) { |
|
4099 |
throw new SQLException(resBundle.handleGetObject("cachedrowsetimpl.dtypemismt").toString()); |
|
4100 |
} |
|
4101 |
||
4102 |
try { |
|
4103 |
switch (trgType) { |
|
4104 |
case java.sql.Types.DATE: |
|
4105 |
if (srcType == java.sql.Types.TIMESTAMP) { |
|
4106 |
return new java.sql.Date(((java.sql.Timestamp)srcObj).getTime()); |
|
4107 |
} else { |
|
4108 |
throw new SQLException(resBundle.handleGetObject("cachedrowsetimpl.dtypemismt").toString()); |
|
4109 |
} |
|
4110 |
case java.sql.Types.TIMESTAMP: |
|
4111 |
if (srcType == java.sql.Types.TIME) { |
|
4112 |
return new Timestamp(((java.sql.Time)srcObj).getTime()); |
|
4113 |
} else { |
|
4114 |
return new Timestamp(((java.sql.Date)srcObj).getTime()); |
|
4115 |
} |
|
4116 |
case java.sql.Types.TIME: |
|
4117 |
if (srcType == java.sql.Types.TIMESTAMP) { |
|
4118 |
return new Time(((java.sql.Timestamp)srcObj).getTime()); |
|
4119 |
} else { |
|
4120 |
throw new SQLException(resBundle.handleGetObject("cachedrowsetimpl.dtypemismt").toString()); |
|
4121 |
} |
|
4122 |
case java.sql.Types.CHAR: |
|
4123 |
case java.sql.Types.VARCHAR: |
|
4124 |
case java.sql.Types.LONGVARCHAR: |
|
6692
aef4e294026f
6988993: Address Findbugs warnings for the use of String Constructor
lancea
parents:
6664
diff
changeset
|
4125 |
return srcObj.toString(); |
2 | 4126 |
default: |
4127 |
throw new SQLException(resBundle.handleGetObject("cachedrowsetimpl.dtypemismt").toString()); |
|
4128 |
} |
|
4129 |
} catch (NumberFormatException ex) { |
|
4130 |
throw new SQLException(resBundle.handleGetObject("cachedrowsetimpl.dtypemismt").toString()); |
|
4131 |
} |
|
4132 |
||
4133 |
} |
|
4134 |
||
4135 |
/** |
|
4136 |
* Converts the given <code>Object</code> in the Java programming language |
|
4137 |
* to the standard mapping for the specified SQL target data type. |
|
4138 |
* The conversion must be to a string or numeric type, but there are no |
|
4139 |
* restrictions on the type to be converted. If the source type and target |
|
4140 |
* type are the same, the given object is simply returned. |
|
4141 |
* |
|
4142 |
* @param srcObj the <code>Object</code> in the Java programming language |
|
4143 |
* that is to be converted to the target type |
|
4144 |
* @param srcType the data type that is the standard mapping in SQL of the |
|
4145 |
* object to be converted; must be one of the constants in |
|
4146 |
* <code>java.sql.Types</code> |
|
4147 |
* @param trgType the SQL data type to which to convert the given object; |
|
4148 |
* must be one of the following constants in |
|
4149 |
* <code>java.sql.Types</code>: <code>BIT</code>, |
|
4150 |
* or <code>BOOLEAN</code> |
|
4151 |
* @return an <code>Object</code> value.that is |
|
4152 |
* the standard object mapping for the target SQL type |
|
4153 |
* @throws SQLException if the given target type is not one of the Boolean |
|
4154 |
* types in <code>java.sql.Types</code> |
|
4155 |
*/ |
|
4156 |
private Object convertBoolean(Object srcObj, int srcType, |
|
4157 |
int trgType) throws SQLException { |
|
4158 |
||
4159 |
if (srcType == trgType) { |
|
4160 |
return srcObj; |
|
4161 |
} |
|
4162 |
||
4163 |
if (isNumeric(trgType) == true || |
|
4164 |
(isString(trgType) == false && isBoolean(trgType) == false)) { |
|
4165 |
throw new SQLException(resBundle.handleGetObject("cachedrowsetimpl.dtypemismt").toString()); |
|
4166 |
} |
|
4167 |
||
4168 |
||
4169 |
try { |
|
4170 |
switch (trgType) { |
|
4171 |
case java.sql.Types.BIT: |
|
6697
39929804f9d4
6989139: Address JDBC Findbugs where Number type Constructor are used
lancea
parents:
6692
diff
changeset
|
4172 |
Integer i = Integer.valueOf(srcObj.toString().trim()); |
11129
f9ad1aadf3fa
7116445: Miscellaneous warnings in the JDBC/RowSet classes
lancea
parents:
9537
diff
changeset
|
4173 |
return i.equals(0) ? |
6697
39929804f9d4
6989139: Address JDBC Findbugs where Number type Constructor are used
lancea
parents:
6692
diff
changeset
|
4174 |
Boolean.valueOf(false) : |
39929804f9d4
6989139: Address JDBC Findbugs where Number type Constructor are used
lancea
parents:
6692
diff
changeset
|
4175 |
Boolean.valueOf(true); |
2 | 4176 |
case java.sql.Types.BOOLEAN: |
6697
39929804f9d4
6989139: Address JDBC Findbugs where Number type Constructor are used
lancea
parents:
6692
diff
changeset
|
4177 |
return Boolean.valueOf(srcObj.toString().trim()); |
2 | 4178 |
default: |
4179 |
throw new SQLException(resBundle.handleGetObject("cachedrowsetimpl.dtypemismt").toString()+ trgType); |
|
4180 |
} |
|
4181 |
} catch (NumberFormatException ex) { |
|
4182 |
throw new SQLException(resBundle.handleGetObject("cachedrowsetimpl.dtypemismt").toString() + trgType); |
|
4183 |
} |
|
4184 |
} |
|
4185 |
||
4186 |
/** |
|
4187 |
* Sets the designated nullable column in the current row or the |
|
4188 |
* insert row of this <code>CachedRowSetImpl</code> object with |
|
4189 |
* <code>null</code> value. |
|
4190 |
* <P> |
|
4191 |
* This method updates a column value in the current row or the insert |
|
4192 |
* row of this rowset; however, another method must be called to complete |
|
4193 |
* the update process. If the cursor is on a row in the rowset, the |
|
4194 |
* method {@link #updateRow} must be called to mark the row as updated |
|
4195 |
* and to notify listeners that the row has changed. |
|
4196 |
* If the cursor is on the insert row, the method {@link #insertRow} |
|
4197 |
* must be called to insert the new row into this rowset and to notify |
|
4198 |
* listeners that a row has changed. |
|
4199 |
* <P> |
|
4200 |
* In order to propagate updates in this rowset to the underlying |
|
4201 |
* data source, an application must call the method {@link #acceptChanges} |
|
4202 |
* after it calls either <code>updateRow</code> or <code>insertRow</code>. |
|
4203 |
* |
|
4204 |
* @param columnIndex the first column is <code>1</code>, the second |
|
4205 |
* is <code>2</code>, and so on; must be <code>1</code> or larger |
|
4206 |
* and equal to or less than the number of columns in this rowset |
|
4207 |
* @throws SQLException if (1) the given column index is out of bounds, |
|
4208 |
* (2) the cursor is not on one of this rowset's rows or its |
|
4209 |
* insert row, or (3) this rowset is |
|
4210 |
* <code>ResultSet.CONCUR_READ_ONLY</code> |
|
4211 |
*/ |
|
4212 |
public void updateNull(int columnIndex) throws SQLException { |
|
4213 |
// sanity check. |
|
4214 |
checkIndex(columnIndex); |
|
4215 |
// make sure the cursor is on a valid row |
|
4216 |
checkCursor(); |
|
4217 |
||
4218 |
BaseRow row = getCurrentRow(); |
|
4219 |
row.setColumnObject(columnIndex, null); |
|
4220 |
||
4221 |
} |
|
4222 |
||
4223 |
/** |
|
4224 |
* Sets the designated column in either the current row or the insert |
|
4225 |
* row of this <code>CachedRowSetImpl</code> object with the given |
|
4226 |
* <code>boolean</code> value. |
|
4227 |
* <P> |
|
4228 |
* This method updates a column value in the current row or the insert |
|
4229 |
* row of this rowset, but it does not update the database. |
|
4230 |
* If the cursor is on a row in the rowset, the |
|
4231 |
* method {@link #updateRow} must be called to update the database. |
|
4232 |
* If the cursor is on the insert row, the method {@link #insertRow} |
|
4233 |
* must be called, which will insert the new row into both this rowset |
|
4234 |
* and the database. Both of these methods must be called before the |
|
4235 |
* cursor moves to another row. |
|
4236 |
* |
|
4237 |
* @param columnIndex the first column is <code>1</code>, the second |
|
4238 |
* is <code>2</code>, and so on; must be <code>1</code> or larger |
|
4239 |
* and equal to or less than the number of columns in this rowset |
|
4240 |
* @param x the new column value |
|
4241 |
* @throws SQLException if (1) the given column index is out of bounds, |
|
4242 |
* (2) the cursor is not on one of this rowset's rows or its |
|
4243 |
* insert row, or (3) this rowset is |
|
4244 |
* <code>ResultSet.CONCUR_READ_ONLY</code> |
|
4245 |
*/ |
|
4246 |
public void updateBoolean(int columnIndex, boolean x) throws SQLException { |
|
4247 |
// sanity check. |
|
4248 |
checkIndex(columnIndex); |
|
4249 |
// make sure the cursor is on a valid row |
|
4250 |
checkCursor(); |
|
6697
39929804f9d4
6989139: Address JDBC Findbugs where Number type Constructor are used
lancea
parents:
6692
diff
changeset
|
4251 |
Object obj = convertBoolean(Boolean.valueOf(x), |
2 | 4252 |
java.sql.Types.BIT, |
4253 |
RowSetMD.getColumnType(columnIndex)); |
|
4254 |
||
4255 |
getCurrentRow().setColumnObject(columnIndex, obj); |
|
4256 |
} |
|
4257 |
||
4258 |
/** |
|
4259 |
* Sets the designated column in either the current row or the insert |
|
4260 |
* row of this <code>CachedRowSetImpl</code> object with the given |
|
4261 |
* <code>byte</code> value. |
|
4262 |
* <P> |
|
4263 |
* This method updates a column value in the current row or the insert |
|
4264 |
* row of this rowset, but it does not update the database. |
|
4265 |
* If the cursor is on a row in the rowset, the |
|
4266 |
* method {@link #updateRow} must be called to update the database. |
|
4267 |
* If the cursor is on the insert row, the method {@link #insertRow} |
|
4268 |
* must be called, which will insert the new row into both this rowset |
|
4269 |
* and the database. Both of these methods must be called before the |
|
4270 |
* cursor moves to another row. |
|
4271 |
* |
|
4272 |
* @param columnIndex the first column is <code>1</code>, the second |
|
4273 |
* is <code>2</code>, and so on; must be <code>1</code> or larger |
|
4274 |
* and equal to or less than the number of columns in this rowset |
|
4275 |
* @param x the new column value |
|
4276 |
* @throws SQLException if (1) the given column index is out of bounds, |
|
4277 |
* (2) the cursor is not on one of this rowset's rows or its |
|
4278 |
* insert row, or (3) this rowset is |
|
4279 |
* <code>ResultSet.CONCUR_READ_ONLY</code> |
|
4280 |
*/ |
|
4281 |
public void updateByte(int columnIndex, byte x) throws SQLException { |
|
4282 |
// sanity check. |
|
4283 |
checkIndex(columnIndex); |
|
4284 |
// make sure the cursor is on a valid row |
|
4285 |
checkCursor(); |
|
4286 |
||
6697
39929804f9d4
6989139: Address JDBC Findbugs where Number type Constructor are used
lancea
parents:
6692
diff
changeset
|
4287 |
Object obj = convertNumeric(Byte.valueOf(x), |
2 | 4288 |
java.sql.Types.TINYINT, |
4289 |
RowSetMD.getColumnType(columnIndex)); |
|
4290 |
||
4291 |
getCurrentRow().setColumnObject(columnIndex, obj); |
|
4292 |
} |
|
4293 |
||
4294 |
/** |
|
4295 |
* Sets the designated column in either the current row or the insert |
|
4296 |
* row of this <code>CachedRowSetImpl</code> object with the given |
|
4297 |
* <code>short</code> value. |
|
4298 |
* <P> |
|
4299 |
* This method updates a column value in the current row or the insert |
|
4300 |
* row of this rowset, but it does not update the database. |
|
4301 |
* If the cursor is on a row in the rowset, the |
|
4302 |
* method {@link #updateRow} must be called to update the database. |
|
4303 |
* If the cursor is on the insert row, the method {@link #insertRow} |
|
4304 |
* must be called, which will insert the new row into both this rowset |
|
4305 |
* and the database. Both of these methods must be called before the |
|
4306 |
* cursor moves to another row. |
|
4307 |
* |
|
4308 |
* @param columnIndex the first column is <code>1</code>, the second |
|
4309 |
* is <code>2</code>, and so on; must be <code>1</code> or larger |
|
4310 |
* and equal to or less than the number of columns in this rowset |
|
4311 |
* @param x the new column value |
|
4312 |
* @throws SQLException if (1) the given column index is out of bounds, |
|
4313 |
* (2) the cursor is not on one of this rowset's rows or its |
|
4314 |
* insert row, or (3) this rowset is |
|
4315 |
* <code>ResultSet.CONCUR_READ_ONLY</code> |
|
4316 |
*/ |
|
4317 |
public void updateShort(int columnIndex, short x) throws SQLException { |
|
4318 |
// sanity check. |
|
4319 |
checkIndex(columnIndex); |
|
4320 |
// make sure the cursor is on a valid row |
|
4321 |
checkCursor(); |
|
4322 |
||
6697
39929804f9d4
6989139: Address JDBC Findbugs where Number type Constructor are used
lancea
parents:
6692
diff
changeset
|
4323 |
Object obj = convertNumeric(Short.valueOf(x), |
2 | 4324 |
java.sql.Types.SMALLINT, |
4325 |
RowSetMD.getColumnType(columnIndex)); |
|
4326 |
||
4327 |
getCurrentRow().setColumnObject(columnIndex, obj); |
|
4328 |
} |
|
4329 |
||
4330 |
/** |
|
4331 |
* Sets the designated column in either the current row or the insert |
|
4332 |
* row of this <code>CachedRowSetImpl</code> object with the given |
|
4333 |
* <code>int</code> value. |
|
4334 |
* <P> |
|
4335 |
* This method updates a column value in the current row or the insert |
|
4336 |
* row of this rowset, but it does not update the database. |
|
4337 |
* If the cursor is on a row in the rowset, the |
|
4338 |
* method {@link #updateRow} must be called to update the database. |
|
4339 |
* If the cursor is on the insert row, the method {@link #insertRow} |
|
4340 |
* must be called, which will insert the new row into both this rowset |
|
4341 |
* and the database. Both of these methods must be called before the |
|
4342 |
* cursor moves to another row. |
|
4343 |
* |
|
4344 |
* @param columnIndex the first column is <code>1</code>, the second |
|
4345 |
* is <code>2</code>, and so on; must be <code>1</code> or larger |
|
4346 |
* and equal to or less than the number of columns in this rowset |
|
4347 |
* @param x the new column value |
|
4348 |
* @throws SQLException if (1) the given column index is out of bounds, |
|
4349 |
* (2) the cursor is not on one of this rowset's rows or its |
|
4350 |
* insert row, or (3) this rowset is |
|
4351 |
* <code>ResultSet.CONCUR_READ_ONLY</code> |
|
4352 |
*/ |
|
4353 |
public void updateInt(int columnIndex, int x) throws SQLException { |
|
4354 |
// sanity check. |
|
4355 |
checkIndex(columnIndex); |
|
4356 |
// make sure the cursor is on a valid row |
|
4357 |
checkCursor(); |
|
11129
f9ad1aadf3fa
7116445: Miscellaneous warnings in the JDBC/RowSet classes
lancea
parents:
9537
diff
changeset
|
4358 |
Object obj = convertNumeric(x, |
2 | 4359 |
java.sql.Types.INTEGER, |
4360 |
RowSetMD.getColumnType(columnIndex)); |
|
4361 |
||
4362 |
getCurrentRow().setColumnObject(columnIndex, obj); |
|
4363 |
} |
|
4364 |
||
4365 |
/** |
|
4366 |
* Sets the designated column in either the current row or the insert |
|
4367 |
* row of this <code>CachedRowSetImpl</code> object with the given |
|
4368 |
* <code>long</code> value. |
|
4369 |
* <P> |
|
4370 |
* This method updates a column value in the current row or the insert |
|
4371 |
* row of this rowset, but it does not update the database. |
|
4372 |
* If the cursor is on a row in the rowset, the |
|
4373 |
* method {@link #updateRow} must be called to update the database. |
|
4374 |
* If the cursor is on the insert row, the method {@link #insertRow} |
|
4375 |
* must be called, which will insert the new row into both this rowset |
|
4376 |
* and the database. Both of these methods must be called before the |
|
4377 |
* cursor moves to another row. |
|
4378 |
* |
|
4379 |
* @param columnIndex the first column is <code>1</code>, the second |
|
4380 |
* is <code>2</code>, and so on; must be <code>1</code> or larger |
|
4381 |
* and equal to or less than the number of columns in this rowset |
|
4382 |
* @param x the new column value |
|
4383 |
* @throws SQLException if (1) the given column index is out of bounds, |
|
4384 |
* (2) the cursor is not on one of this rowset's rows or its |
|
4385 |
* insert row, or (3) this rowset is |
|
4386 |
* <code>ResultSet.CONCUR_READ_ONLY</code> |
|
4387 |
*/ |
|
4388 |
public void updateLong(int columnIndex, long x) throws SQLException { |
|
4389 |
// sanity check. |
|
4390 |
checkIndex(columnIndex); |
|
4391 |
// make sure the cursor is on a valid row |
|
4392 |
checkCursor(); |
|
4393 |
||
6697
39929804f9d4
6989139: Address JDBC Findbugs where Number type Constructor are used
lancea
parents:
6692
diff
changeset
|
4394 |
Object obj = convertNumeric(Long.valueOf(x), |
2 | 4395 |
java.sql.Types.BIGINT, |
4396 |
RowSetMD.getColumnType(columnIndex)); |
|
4397 |
||
4398 |
getCurrentRow().setColumnObject(columnIndex, obj); |
|
4399 |
||
4400 |
} |
|
4401 |
||
4402 |
/** |
|
4403 |
* Sets the designated column in either the current row or the insert |
|
4404 |
* row of this <code>CachedRowSetImpl</code> object with the given |
|
4405 |
* <code>float</code> value. |
|
4406 |
* <P> |
|
4407 |
* This method updates a column value in the current row or the insert |
|
4408 |
* row of this rowset, but it does not update the database. |
|
4409 |
* If the cursor is on a row in the rowset, the |
|
4410 |
* method {@link #updateRow} must be called to update the database. |
|
4411 |
* If the cursor is on the insert row, the method {@link #insertRow} |
|
4412 |
* must be called, which will insert the new row into both this rowset |
|
4413 |
* and the database. Both of these methods must be called before the |
|
4414 |
* cursor moves to another row. |
|
4415 |
* |
|
4416 |
* @param columnIndex the first column is <code>1</code>, the second |
|
4417 |
* is <code>2</code>, and so on; must be <code>1</code> or larger |
|
4418 |
* and equal to or less than the number of columns in this rowset |
|
4419 |
* @param x the new column value |
|
4420 |
* @throws SQLException if (1) the given column index is out of bounds, |
|
4421 |
* (2) the cursor is not on one of this rowset's rows or its |
|
4422 |
* insert row, or (3) this rowset is |
|
4423 |
* <code>ResultSet.CONCUR_READ_ONLY</code> |
|
4424 |
*/ |
|
4425 |
public void updateFloat(int columnIndex, float x) throws SQLException { |
|
4426 |
// sanity check. |
|
4427 |
checkIndex(columnIndex); |
|
4428 |
// make sure the cursor is on a valid row |
|
4429 |
checkCursor(); |
|
4430 |
||
4431 |
Object obj = convertNumeric(new Float(x), |
|
4432 |
java.sql.Types.REAL, |
|
4433 |
RowSetMD.getColumnType(columnIndex)); |
|
4434 |
||
4435 |
getCurrentRow().setColumnObject(columnIndex, obj); |
|
4436 |
} |
|
4437 |
||
4438 |
/** |
|
4439 |
* Sets the designated column in either the current row or the insert |
|
4440 |
* row of this <code>CachedRowSetImpl</code> object with the given |
|
4441 |
* <code>double</code> value. |
|
4442 |
* |
|
4443 |
* This method updates a column value in either the current row or |
|
4444 |
* the insert row of this rowset, but it does not update the |
|
4445 |
* database. If the cursor is on a row in the rowset, the |
|
4446 |
* method {@link #updateRow} must be called to update the database. |
|
4447 |
* If the cursor is on the insert row, the method {@link #insertRow} |
|
4448 |
* must be called, which will insert the new row into both this rowset |
|
4449 |
* and the database. Both of these methods must be called before the |
|
4450 |
* cursor moves to another row. |
|
4451 |
* |
|
4452 |
* @param columnIndex the first column is <code>1</code>, the second |
|
4453 |
* is <code>2</code>, and so on; must be <code>1</code> or larger |
|
4454 |
* and equal to or less than the number of columns in this rowset |
|
4455 |
* @param x the new column value |
|
4456 |
* @throws SQLException if (1) the given column index is out of bounds, |
|
4457 |
* (2) the cursor is not on one of this rowset's rows or its |
|
4458 |
* insert row, or (3) this rowset is |
|
4459 |
* <code>ResultSet.CONCUR_READ_ONLY</code> |
|
4460 |
*/ |
|
4461 |
public void updateDouble(int columnIndex, double x) throws SQLException { |
|
4462 |
// sanity check. |
|
4463 |
checkIndex(columnIndex); |
|
4464 |
// make sure the cursor is on a valid row |
|
4465 |
checkCursor(); |
|
4466 |
Object obj = convertNumeric(new Double(x), |
|
4467 |
java.sql.Types.DOUBLE, |
|
4468 |
RowSetMD.getColumnType(columnIndex)); |
|
4469 |
||
4470 |
getCurrentRow().setColumnObject(columnIndex, obj); |
|
4471 |
} |
|
4472 |
||
4473 |
/** |
|
4474 |
* Sets the designated column in either the current row or the insert |
|
4475 |
* row of this <code>CachedRowSetImpl</code> object with the given |
|
4476 |
* <code>java.math.BigDecimal</code> object. |
|
4477 |
* <P> |
|
4478 |
* This method updates a column value in the current row or the insert |
|
4479 |
* row of this rowset, but it does not update the database. |
|
4480 |
* If the cursor is on a row in the rowset, the |
|
4481 |
* method {@link #updateRow} must be called to update the database. |
|
4482 |
* If the cursor is on the insert row, the method {@link #insertRow} |
|
4483 |
* must be called, which will insert the new row into both this rowset |
|
4484 |
* and the database. Both of these methods must be called before the |
|
4485 |
* cursor moves to another row. |
|
4486 |
* |
|
4487 |
* @param columnIndex the first column is <code>1</code>, the second |
|
4488 |
* is <code>2</code>, and so on; must be <code>1</code> or larger |
|
4489 |
* and equal to or less than the number of columns in this rowset |
|
4490 |
* @param x the new column value |
|
4491 |
* @throws SQLException if (1) the given column index is out of bounds, |
|
4492 |
* (2) the cursor is not on one of this rowset's rows or its |
|
4493 |
* insert row, or (3) this rowset is |
|
4494 |
* <code>ResultSet.CONCUR_READ_ONLY</code> |
|
4495 |
*/ |
|
4496 |
public void updateBigDecimal(int columnIndex, BigDecimal x) throws SQLException { |
|
4497 |
// sanity check. |
|
4498 |
checkIndex(columnIndex); |
|
4499 |
// make sure the cursor is on a valid row |
|
4500 |
checkCursor(); |
|
4501 |
||
4502 |
Object obj = convertNumeric(x, |
|
4503 |
java.sql.Types.NUMERIC, |
|
4504 |
RowSetMD.getColumnType(columnIndex)); |
|
4505 |
||
4506 |
getCurrentRow().setColumnObject(columnIndex, obj); |
|
4507 |
} |
|
4508 |
||
4509 |
/** |
|
4510 |
* Sets the designated column in either the current row or the insert |
|
4511 |
* row of this <code>CachedRowSetImpl</code> object with the given |
|
4512 |
* <code>String</code> object. |
|
4513 |
* <P> |
|
4514 |
* This method updates a column value in either the current row or |
|
4515 |
* the insert row of this rowset, but it does not update the |
|
4516 |
* database. If the cursor is on a row in the rowset, the |
|
4517 |
* method {@link #updateRow} must be called to mark the row as updated. |
|
4518 |
* If the cursor is on the insert row, the method {@link #insertRow} |
|
4519 |
* must be called to insert the new row into this rowset and mark it |
|
4520 |
* as inserted. Both of these methods must be called before the |
|
4521 |
* cursor moves to another row. |
|
4522 |
* <P> |
|
4523 |
* The method <code>acceptChanges</code> must be called if the |
|
4524 |
* updated values are to be written back to the underlying database. |
|
4525 |
* |
|
4526 |
* @param columnIndex the first column is <code>1</code>, the second |
|
4527 |
* is <code>2</code>, and so on; must be <code>1</code> or larger |
|
4528 |
* and equal to or less than the number of columns in this rowset |
|
4529 |
* @param x the new column value |
|
4530 |
* @throws SQLException if (1) the given column index is out of bounds, |
|
4531 |
* (2) the cursor is not on one of this rowset's rows or its |
|
4532 |
* insert row, or (3) this rowset is |
|
4533 |
* <code>ResultSet.CONCUR_READ_ONLY</code> |
|
4534 |
*/ |
|
4535 |
public void updateString(int columnIndex, String x) throws SQLException { |
|
4536 |
// sanity check. |
|
4537 |
checkIndex(columnIndex); |
|
4538 |
// make sure the cursor is on a valid row |
|
4539 |
checkCursor(); |
|
4540 |
||
4541 |
getCurrentRow().setColumnObject(columnIndex, x); |
|
4542 |
} |
|
4543 |
||
4544 |
/** |
|
4545 |
* Sets the designated column in either the current row or the insert |
|
4546 |
* row of this <code>CachedRowSetImpl</code> object with the given |
|
4547 |
* <code>byte</code> array. |
|
4548 |
* |
|
4549 |
* This method updates a column value in either the current row or |
|
4550 |
* the insert row of this rowset, but it does not update the |
|
4551 |
* database. If the cursor is on a row in the rowset, the |
|
4552 |
* method {@link #updateRow} must be called to update the database. |
|
4553 |
* If the cursor is on the insert row, the method {@link #insertRow} |
|
4554 |
* must be called, which will insert the new row into both this rowset |
|
4555 |
* and the database. Both of these methods must be called before the |
|
4556 |
* cursor moves to another row. |
|
4557 |
* |
|
4558 |
* @param columnIndex the first column is <code>1</code>, the second |
|
4559 |
* is <code>2</code>, and so on; must be <code>1</code> or larger |
|
4560 |
* and equal to or less than the number of columns in this rowset |
|
4561 |
* @param x the new column value |
|
4562 |
* @throws SQLException if (1) the given column index is out of bounds, |
|
4563 |
* (2) the cursor is not on one of this rowset's rows or its |
|
4564 |
* insert row, or (3) this rowset is |
|
4565 |
* <code>ResultSet.CONCUR_READ_ONLY</code> |
|
4566 |
*/ |
|
4567 |
public void updateBytes(int columnIndex, byte x[]) throws SQLException { |
|
4568 |
// sanity check. |
|
4569 |
checkIndex(columnIndex); |
|
4570 |
// make sure the cursor is on a valid row |
|
4571 |
checkCursor(); |
|
4572 |
||
4573 |
if (isBinary(RowSetMD.getColumnType(columnIndex)) == false) { |
|
4574 |
throw new SQLException(resBundle.handleGetObject("cachedrowsetimpl.dtypemismt").toString()); |
|
4575 |
} |
|
4576 |
||
4577 |
getCurrentRow().setColumnObject(columnIndex, x); |
|
4578 |
} |
|
4579 |
||
4580 |
/** |
|
4581 |
* Sets the designated column in either the current row or the insert |
|
4582 |
* row of this <code>CachedRowSetImpl</code> object with the given |
|
4583 |
* <code>Date</code> object. |
|
4584 |
* |
|
4585 |
* This method updates a column value in either the current row or |
|
4586 |
* the insert row of this rowset, but it does not update the |
|
4587 |
* database. If the cursor is on a row in the rowset, the |
|
4588 |
* method {@link #updateRow} must be called to update the database. |
|
4589 |
* If the cursor is on the insert row, the method {@link #insertRow} |
|
4590 |
* must be called, which will insert the new row into both this rowset |
|
4591 |
* and the database. Both of these methods must be called before the |
|
4592 |
* cursor moves to another row. |
|
4593 |
* |
|
4594 |
* @param columnIndex the first column is <code>1</code>, the second |
|
4595 |
* is <code>2</code>, and so on; must be <code>1</code> or larger |
|
4596 |
* and equal to or less than the number of columns in this rowset |
|
4597 |
* @param x the new column value |
|
4598 |
* @throws SQLException if (1) the given column index is out of bounds, |
|
4599 |
* (2) the cursor is not on one of this rowset's rows or its |
|
4600 |
* insert row, (3) the type of the designated column is not |
|
4601 |
* an SQL <code>DATE</code> or <code>TIMESTAMP</code>, or |
|
4602 |
* (4) this rowset is <code>ResultSet.CONCUR_READ_ONLY</code> |
|
4603 |
*/ |
|
4604 |
public void updateDate(int columnIndex, java.sql.Date x) throws SQLException { |
|
4605 |
// sanity check. |
|
4606 |
checkIndex(columnIndex); |
|
4607 |
// make sure the cursor is on a valid row |
|
4608 |
checkCursor(); |
|
4609 |
||
4610 |
Object obj = convertTemporal(x, |
|
4611 |
java.sql.Types.DATE, |
|
4612 |
RowSetMD.getColumnType(columnIndex)); |
|
4613 |
||
4614 |
getCurrentRow().setColumnObject(columnIndex, obj); |
|
4615 |
} |
|
4616 |
||
4617 |
/** |
|
4618 |
* Sets the designated column in either the current row or the insert |
|
4619 |
* row of this <code>CachedRowSetImpl</code> object with the given |
|
4620 |
* <code>Time</code> object. |
|
4621 |
* |
|
4622 |
* This method updates a column value in either the current row or |
|
4623 |
* the insert row of this rowset, but it does not update the |
|
4624 |
* database. If the cursor is on a row in the rowset, the |
|
4625 |
* method {@link #updateRow} must be called to update the database. |
|
4626 |
* If the cursor is on the insert row, the method {@link #insertRow} |
|
4627 |
* must be called, which will insert the new row into both this rowset |
|
4628 |
* and the database. Both of these methods must be called before the |
|
4629 |
* cursor moves to another row. |
|
4630 |
* |
|
4631 |
* @param columnIndex the first column is <code>1</code>, the second |
|
4632 |
* is <code>2</code>, and so on; must be <code>1</code> or larger |
|
4633 |
* and equal to or less than the number of columns in this rowset |
|
4634 |
* @param x the new column value |
|
4635 |
* @throws SQLException if (1) the given column index is out of bounds, |
|
4636 |
* (2) the cursor is not on one of this rowset's rows or its |
|
4637 |
* insert row, (3) the type of the designated column is not |
|
4638 |
* an SQL <code>TIME</code> or <code>TIMESTAMP</code>, or |
|
4639 |
* (4) this rowset is <code>ResultSet.CONCUR_READ_ONLY</code> |
|
4640 |
*/ |
|
4641 |
public void updateTime(int columnIndex, java.sql.Time x) throws SQLException { |
|
4642 |
// sanity check. |
|
4643 |
checkIndex(columnIndex); |
|
4644 |
// make sure the cursor is on a valid row |
|
4645 |
checkCursor(); |
|
4646 |
||
4647 |
Object obj = convertTemporal(x, |
|
4648 |
java.sql.Types.TIME, |
|
4649 |
RowSetMD.getColumnType(columnIndex)); |
|
4650 |
||
4651 |
getCurrentRow().setColumnObject(columnIndex, obj); |
|
4652 |
} |
|
4653 |
||
4654 |
/** |
|
4655 |
* Sets the designated column in either the current row or the insert |
|
4656 |
* row of this <code>CachedRowSetImpl</code> object with the given |
|
4657 |
* <code>Timestamp</code> object. |
|
4658 |
* |
|
4659 |
* This method updates a column value in either the current row or |
|
4660 |
* the insert row of this rowset, but it does not update the |
|
4661 |
* database. If the cursor is on a row in the rowset, the |
|
4662 |
* method {@link #updateRow} must be called to update the database. |
|
4663 |
* If the cursor is on the insert row, the method {@link #insertRow} |
|
4664 |
* must be called, which will insert the new row into both this rowset |
|
4665 |
* and the database. Both of these methods must be called before the |
|
4666 |
* cursor moves to another row. |
|
4667 |
* |
|
4668 |
* @param columnIndex the first column is <code>1</code>, the second |
|
4669 |
* is <code>2</code>, and so on; must be <code>1</code> or larger |
|
4670 |
* and equal to or less than the number of columns in this rowset |
|
4671 |
* @param x the new column value |
|
4672 |
* @throws SQLException if (1) the given column index is out of bounds, |
|
4673 |
* (2) the cursor is not on one of this rowset's rows or its |
|
4674 |
* insert row, (3) the type of the designated column is not |
|
4675 |
* an SQL <code>DATE</code>, <code>TIME</code>, or |
|
4676 |
* <code>TIMESTAMP</code>, or (4) this rowset is |
|
4677 |
* <code>ResultSet.CONCUR_READ_ONLY</code> |
|
4678 |
*/ |
|
4679 |
public void updateTimestamp(int columnIndex, java.sql.Timestamp x) throws SQLException { |
|
4680 |
// sanity check. |
|
4681 |
checkIndex(columnIndex); |
|
4682 |
// make sure the cursor is on a valid row |
|
4683 |
checkCursor(); |
|
4684 |
||
4685 |
Object obj = convertTemporal(x, |
|
4686 |
java.sql.Types.TIMESTAMP, |
|
4687 |
RowSetMD.getColumnType(columnIndex)); |
|
4688 |
||
4689 |
getCurrentRow().setColumnObject(columnIndex, obj); |
|
4690 |
} |
|
4691 |
||
4692 |
/** |
|
4693 |
* Sets the designated column in either the current row or the insert |
|
4694 |
* row of this <code>CachedRowSetImpl</code> object with the given |
|
4695 |
* ASCII stream value. |
|
4696 |
* <P> |
|
4697 |
* This method updates a column value in either the current row or |
|
4698 |
* the insert row of this rowset, but it does not update the |
|
4699 |
* database. If the cursor is on a row in the rowset, the |
|
4700 |
* method {@link #updateRow} must be called to update the database. |
|
4701 |
* If the cursor is on the insert row, the method {@link #insertRow} |
|
4702 |
* must be called, which will insert the new row into both this rowset |
|
4703 |
* and the database. Both of these methods must be called before the |
|
4704 |
* cursor moves to another row. |
|
4705 |
* |
|
4706 |
* @param columnIndex the first column is <code>1</code>, the second |
|
4707 |
* is <code>2</code>, and so on; must be <code>1</code> or larger |
|
4708 |
* and equal to or less than the number of columns in this rowset |
|
4709 |
* @param x the new column value |
|
4710 |
* @param length the number of one-byte ASCII characters in the stream |
|
4711 |
* @throws SQLException if this method is invoked |
|
4712 |
*/ |
|
4713 |
public void updateAsciiStream(int columnIndex, java.io.InputStream x, int length) throws SQLException { |
|
4714 |
// sanity Check |
|
4715 |
checkIndex(columnIndex); |
|
4716 |
// make sure the cursor is on a valid row |
|
4717 |
checkCursor(); |
|
4718 |
||
4719 |
||
4720 |
if (isString(RowSetMD.getColumnType(columnIndex)) == false && |
|
4721 |
isBinary(RowSetMD.getColumnType(columnIndex)) == false) { |
|
4722 |
throw new SQLException(resBundle.handleGetObject("cachedrowsetimpl.dtypemismt").toString()); |
|
4723 |
} |
|
4724 |
||
4725 |
byte buf[] = new byte[length]; |
|
4726 |
try { |
|
4727 |
int charsRead = 0; |
|
4728 |
do { |
|
4729 |
charsRead += x.read(buf, charsRead, length - charsRead); |
|
4730 |
} while (charsRead != length); |
|
4731 |
//Changed the condition check to check for length instead of -1 |
|
4732 |
} catch (java.io.IOException ex) { |
|
4733 |
throw new SQLException(resBundle.handleGetObject("cachedrowsetimpl.asciistream").toString()); |
|
4734 |
} |
|
4735 |
String str = new String(buf); |
|
4736 |
||
4737 |
getCurrentRow().setColumnObject(columnIndex, str); |
|
4738 |
||
4739 |
} |
|
4740 |
||
4741 |
/** |
|
4742 |
* Sets the designated column in either the current row or the insert |
|
4743 |
* row of this <code>CachedRowSetImpl</code> object with the given |
|
4744 |
* <code>java.io.InputStream</code> object. |
|
4745 |
* <P> |
|
4746 |
* This method updates a column value in either the current row or |
|
4747 |
* the insert row of this rowset, but it does not update the |
|
4748 |
* database. If the cursor is on a row in the rowset, the |
|
4749 |
* method {@link #updateRow} must be called to update the database. |
|
4750 |
* If the cursor is on the insert row, the method {@link #insertRow} |
|
4751 |
* must be called, which will insert the new row into both this rowset |
|
4752 |
* and the database. Both of these methods must be called before the |
|
4753 |
* cursor moves to another row. |
|
4754 |
* |
|
4755 |
* @param columnIndex the first column is <code>1</code>, the second |
|
4756 |
* is <code>2</code>, and so on; must be <code>1</code> or larger |
|
4757 |
* and equal to or less than the number of columns in this rowset |
|
4758 |
* @param x the new column value; must be a <code>java.io.InputStream</code> |
|
4759 |
* containing <code>BINARY</code>, <code>VARBINARY</code>, or |
|
4760 |
* <code>LONGVARBINARY</code> data |
|
4761 |
* @param length the length of the stream in bytes |
|
4762 |
* @throws SQLException if (1) the given column index is out of bounds, |
|
4763 |
* (2) the cursor is not on one of this rowset's rows or its |
|
4764 |
* insert row, (3) the data in the stream is not binary, or |
|
4765 |
* (4) this rowset is <code>ResultSet.CONCUR_READ_ONLY</code> |
|
4766 |
*/ |
|
4767 |
public void updateBinaryStream(int columnIndex, java.io.InputStream x,int length) throws SQLException { |
|
4768 |
// sanity Check |
|
4769 |
checkIndex(columnIndex); |
|
4770 |
// make sure the cursor is on a valid row |
|
4771 |
checkCursor(); |
|
4772 |
||
4773 |
if (isBinary(RowSetMD.getColumnType(columnIndex)) == false) { |
|
4774 |
throw new SQLException(resBundle.handleGetObject("cachedrowsetimpl.dtypemismt").toString()); |
|
4775 |
} |
|
4776 |
||
4777 |
byte buf[] = new byte[length]; |
|
4778 |
try { |
|
4779 |
int bytesRead = 0; |
|
4780 |
do { |
|
4781 |
bytesRead += x.read(buf, bytesRead, length - bytesRead); |
|
4782 |
} while (bytesRead != -1); |
|
4783 |
} catch (java.io.IOException ex) { |
|
4784 |
throw new SQLException(resBundle.handleGetObject("cachedrowsetimpl.binstream").toString()); |
|
4785 |
} |
|
4786 |
||
4787 |
getCurrentRow().setColumnObject(columnIndex, buf); |
|
4788 |
} |
|
4789 |
||
4790 |
/** |
|
4791 |
* Sets the designated column in either the current row or the insert |
|
4792 |
* row of this <code>CachedRowSetImpl</code> object with the given |
|
4793 |
* <code>java.io.Reader</code> object. |
|
4794 |
* <P> |
|
4795 |
* This method updates a column value in either the current row or |
|
4796 |
* the insert row of this rowset, but it does not update the |
|
4797 |
* database. If the cursor is on a row in the rowset, the |
|
4798 |
* method {@link #updateRow} must be called to update the database. |
|
4799 |
* If the cursor is on the insert row, the method {@link #insertRow} |
|
4800 |
* must be called, which will insert the new row into both this rowset |
|
4801 |
* and the database. Both of these methods must be called before the |
|
4802 |
* cursor moves to another row. |
|
4803 |
* |
|
4804 |
* @param columnIndex the first column is <code>1</code>, the second |
|
4805 |
* is <code>2</code>, and so on; must be <code>1</code> or larger |
|
4806 |
* and equal to or less than the number of columns in this rowset |
|
4807 |
* @param x the new column value; must be a <code>java.io.Reader</code> |
|
4808 |
* containing <code>BINARY</code>, <code>VARBINARY</code>, |
|
4809 |
* <code>LONGVARBINARY</code>, <code>CHAR</code>, <code>VARCHAR</code>, |
|
4810 |
* or <code>LONGVARCHAR</code> data |
|
4811 |
* @param length the length of the stream in characters |
|
4812 |
* @throws SQLException if (1) the given column index is out of bounds, |
|
4813 |
* (2) the cursor is not on one of this rowset's rows or its |
|
4814 |
* insert row, (3) the data in the stream is not a binary or |
|
4815 |
* character type, or (4) this rowset is |
|
4816 |
* <code>ResultSet.CONCUR_READ_ONLY</code> |
|
4817 |
*/ |
|
4818 |
public void updateCharacterStream(int columnIndex, java.io.Reader x, int length) throws SQLException { |
|
4819 |
// sanity Check |
|
4820 |
checkIndex(columnIndex); |
|
4821 |
// make sure the cursor is on a valid row |
|
4822 |
checkCursor(); |
|
4823 |
||
4824 |
if (isString(RowSetMD.getColumnType(columnIndex)) == false && |
|
4825 |
isBinary(RowSetMD.getColumnType(columnIndex)) == false) { |
|
4826 |
throw new SQLException(resBundle.handleGetObject("cachedrowsetimpl.dtypemismt").toString()); |
|
4827 |
} |
|
4828 |
||
4829 |
char buf[] = new char[length]; |
|
4830 |
try { |
|
4831 |
int charsRead = 0; |
|
4832 |
do { |
|
4833 |
charsRead += x.read(buf, charsRead, length - charsRead); |
|
4834 |
} while (charsRead != length); |
|
4835 |
//Changed the condition checking to check for length instead of -1 |
|
4836 |
} catch (java.io.IOException ex) { |
|
4837 |
throw new SQLException(resBundle.handleGetObject("cachedrowsetimpl.binstream").toString()); |
|
4838 |
} |
|
4839 |
String str = new String(buf); |
|
4840 |
||
4841 |
getCurrentRow().setColumnObject(columnIndex, str); |
|
4842 |
} |
|
4843 |
||
4844 |
/** |
|
4845 |
* Sets the designated column in either the current row or the insert |
|
4846 |
* row of this <code>CachedRowSetImpl</code> object with the given |
|
4847 |
* <code>Object</code> value. The <code>scale</code> parameter indicates |
|
4848 |
* the number of digits to the right of the decimal point and is ignored |
|
4849 |
* if the new column value is not a type that will be mapped to an SQL |
|
4850 |
* <code>DECIMAL</code> or <code>NUMERIC</code> value. |
|
4851 |
* <P> |
|
4852 |
* This method updates a column value in either the current row or |
|
4853 |
* the insert row of this rowset, but it does not update the |
|
4854 |
* database. If the cursor is on a row in the rowset, the |
|
4855 |
* method {@link #updateRow} must be called to update the database. |
|
4856 |
* If the cursor is on the insert row, the method {@link #insertRow} |
|
4857 |
* must be called, which will insert the new row into both this rowset |
|
4858 |
* and the database. Both of these methods must be called before the |
|
4859 |
* cursor moves to another row. |
|
4860 |
* |
|
4861 |
* @param columnIndex the first column is <code>1</code>, the second |
|
4862 |
* is <code>2</code>, and so on; must be <code>1</code> or larger |
|
4863 |
* and equal to or less than the number of columns in this rowset |
|
4864 |
* @param x the new column value |
|
4865 |
* @param scale the number of digits to the right of the decimal point (for |
|
4866 |
* <code>DECIMAL</code> and <code>NUMERIC</code> types only) |
|
4867 |
* @throws SQLException if (1) the given column index is out of bounds, |
|
4868 |
* (2) the cursor is not on one of this rowset's rows or its |
|
4869 |
* insert row, or (3) this rowset is |
|
4870 |
* <code>ResultSet.CONCUR_READ_ONLY</code> |
|
4871 |
*/ |
|
4872 |
public void updateObject(int columnIndex, Object x, int scale) throws SQLException { |
|
4873 |
// sanity check. |
|
4874 |
checkIndex(columnIndex); |
|
4875 |
// make sure the cursor is on a valid row |
|
4876 |
checkCursor(); |
|
4877 |
||
4878 |
int type = RowSetMD.getColumnType(columnIndex); |
|
4879 |
if (type == Types.DECIMAL || type == Types.NUMERIC) { |
|
4880 |
((java.math.BigDecimal)x).setScale(scale); |
|
4881 |
} |
|
4882 |
getCurrentRow().setColumnObject(columnIndex, x); |
|
4883 |
} |
|
4884 |
||
4885 |
/** |
|
4886 |
* Sets the designated column in either the current row or the insert |
|
4887 |
* row of this <code>CachedRowSetImpl</code> object with the given |
|
4888 |
* <code>Object</code> value. |
|
4889 |
* <P> |
|
4890 |
* This method updates a column value in either the current row or |
|
4891 |
* the insert row of this rowset, but it does not update the |
|
4892 |
* database. If the cursor is on a row in the rowset, the |
|
4893 |
* method {@link #updateRow} must be called to update the database. |
|
4894 |
* If the cursor is on the insert row, the method {@link #insertRow} |
|
4895 |
* must be called, which will insert the new row into both this rowset |
|
4896 |
* and the database. Both of these methods must be called before the |
|
4897 |
* cursor moves to another row. |
|
4898 |
* |
|
4899 |
* @param columnIndex the first column is <code>1</code>, the second |
|
4900 |
* is <code>2</code>, and so on; must be <code>1</code> or larger |
|
4901 |
* and equal to or less than the number of columns in this rowset |
|
4902 |
* @param x the new column value |
|
4903 |
* @throws SQLException if (1) the given column index is out of bounds, |
|
4904 |
* (2) the cursor is not on one of this rowset's rows or its |
|
4905 |
* insert row, or (3) this rowset is |
|
4906 |
* <code>ResultSet.CONCUR_READ_ONLY</code> |
|
4907 |
*/ |
|
4908 |
public void updateObject(int columnIndex, Object x) throws SQLException { |
|
4909 |
// sanity check. |
|
4910 |
checkIndex(columnIndex); |
|
4911 |
// make sure the cursor is on a valid row |
|
4912 |
checkCursor(); |
|
4913 |
||
4914 |
getCurrentRow().setColumnObject(columnIndex, x); |
|
4915 |
} |
|
4916 |
||
4917 |
/** |
|
4918 |
* Sets the designated nullable column in the current row or the |
|
4919 |
* insert row of this <code>CachedRowSetImpl</code> object with |
|
4920 |
* <code>null</code> value. |
|
4921 |
* <P> |
|
4922 |
* This method updates a column value in the current row or the insert |
|
4923 |
* row of this rowset, but it does not update the database. |
|
4924 |
* If the cursor is on a row in the rowset, the |
|
4925 |
* method {@link #updateRow} must be called to update the database. |
|
4926 |
* If the cursor is on the insert row, the method {@link #insertRow} |
|
4927 |
* must be called, which will insert the new row into both this rowset |
|
4928 |
* and the database. |
|
4929 |
* |
|
4930 |
* @param columnName a <code>String</code> object that must match the |
|
4931 |
* SQL name of a column in this rowset, ignoring case |
|
4932 |
* @throws SQLException if (1) the given column name does not match the |
|
4933 |
* name of a column in this rowset, (2) the cursor is not on |
|
4934 |
* one of this rowset's rows or its insert row, or (3) this |
|
4935 |
* rowset is <code>ResultSet.CONCUR_READ_ONLY</code> |
|
4936 |
*/ |
|
4937 |
public void updateNull(String columnName) throws SQLException { |
|
4938 |
updateNull(getColIdxByName(columnName)); |
|
4939 |
} |
|
4940 |
||
4941 |
/** |
|
4942 |
* Sets the designated column in either the current row or the insert |
|
4943 |
* row of this <code>CachedRowSetImpl</code> object with the given |
|
4944 |
* <code>boolean</code> value. |
|
4945 |
* <P> |
|
4946 |
* This method updates a column value in the current row or the insert |
|
4947 |
* row of this rowset, but it does not update the database. |
|
4948 |
* If the cursor is on a row in the rowset, the |
|
4949 |
* method {@link #updateRow} must be called to update the database. |
|
4950 |
* If the cursor is on the insert row, the method {@link #insertRow} |
|
4951 |
* must be called, which will insert the new row into both this rowset |
|
4952 |
* and the database. Both of these methods must be called before the |
|
4953 |
* cursor moves to another row. |
|
4954 |
* |
|
4955 |
* @param columnName a <code>String</code> object that must match the |
|
4956 |
* SQL name of a column in this rowset, ignoring case |
|
4957 |
* @param x the new column value |
|
4958 |
* @throws SQLException if (1) the given column name does not match the |
|
4959 |
* name of a column in this rowset, (2) the cursor is not on |
|
4960 |
* one of this rowset's rows or its insert row, or (3) this |
|
4961 |
* rowset is <code>ResultSet.CONCUR_READ_ONLY</code> |
|
4962 |
*/ |
|
4963 |
public void updateBoolean(String columnName, boolean x) throws SQLException { |
|
4964 |
updateBoolean(getColIdxByName(columnName), x); |
|
4965 |
} |
|
4966 |
||
4967 |
/** |
|
4968 |
* Sets the designated column in either the current row or the insert |
|
4969 |
* row of this <code>CachedRowSetImpl</code> object with the given |
|
4970 |
* <code>byte</code> value. |
|
4971 |
* <P> |
|
4972 |
* This method updates a column value in the current row or the insert |
|
4973 |
* row of this rowset, but it does not update the database. |
|
4974 |
* If the cursor is on a row in the rowset, the |
|
4975 |
* method {@link #updateRow} must be called to update the database. |
|
4976 |
* If the cursor is on the insert row, the method {@link #insertRow} |
|
4977 |
* must be called, which will insert the new row into both this rowset |
|
4978 |
* and the database. Both of these methods must be called before the |
|
4979 |
* cursor moves to another row. |
|
4980 |
* |
|
4981 |
* @param columnName a <code>String</code> object that must match the |
|
4982 |
* SQL name of a column in this rowset, ignoring case |
|
4983 |
* @param x the new column value |
|
4984 |
* @throws SQLException if (1) the given column name does not match the |
|
4985 |
* name of a column in this rowset, (2) the cursor is not on |
|
4986 |
* one of this rowset's rows or its insert row, or (3) this |
|
4987 |
* rowset is <code>ResultSet.CONCUR_READ_ONLY</code> |
|
4988 |
*/ |
|
4989 |
public void updateByte(String columnName, byte x) throws SQLException { |
|
4990 |
updateByte(getColIdxByName(columnName), x); |
|
4991 |
} |
|
4992 |
||
4993 |
/** |
|
4994 |
* Sets the designated column in either the current row or the insert |
|
4995 |
* row of this <code>CachedRowSetImpl</code> object with the given |
|
4996 |
* <code>short</code> value. |
|
4997 |
* <P> |
|
4998 |
* This method updates a column value in the current row or the insert |
|
4999 |
* row of this rowset, but it does not update the database. |
|
5000 |
* If the cursor is on a row in the rowset, the |
|
5001 |
* method {@link #updateRow} must be called to update the database. |
|
5002 |
* If the cursor is on the insert row, the method {@link #insertRow} |
|
5003 |
* must be called, which will insert the new row into both this rowset |
|
5004 |
* and the database. Both of these methods must be called before the |
|
5005 |
* cursor moves to another row. |
|
5006 |
* |
|
5007 |
* @param columnName a <code>String</code> object that must match the |
|
5008 |
* SQL name of a column in this rowset, ignoring case |
|
5009 |
* @param x the new column value |
|
5010 |
* @throws SQLException if (1) the given column name does not match the |
|
5011 |
* name of a column in this rowset, (2) the cursor is not on |
|
5012 |
* one of this rowset's rows or its insert row, or (3) this |
|
5013 |
* rowset is <code>ResultSet.CONCUR_READ_ONLY</code> |
|
5014 |
*/ |
|
5015 |
public void updateShort(String columnName, short x) throws SQLException { |
|
5016 |
updateShort(getColIdxByName(columnName), x); |
|
5017 |
} |
|
5018 |
||
5019 |
/** |
|
5020 |
* Sets the designated column in either the current row or the insert |
|
5021 |
* row of this <code>CachedRowSetImpl</code> object with the given |
|
5022 |
* <code>int</code> value. |
|
5023 |
* <P> |
|
5024 |
* This method updates a column value in the current row or the insert |
|
5025 |
* row of this rowset, but it does not update the database. |
|
5026 |
* If the cursor is on a row in the rowset, the |
|
5027 |
* method {@link #updateRow} must be called to update the database. |
|
5028 |
* If the cursor is on the insert row, the method {@link #insertRow} |
|
5029 |
* must be called, which will insert the new row into both this rowset |
|
5030 |
* and the database. Both of these methods must be called before the |
|
5031 |
* cursor moves to another row. |
|
5032 |
* |
|
5033 |
* @param columnName a <code>String</code> object that must match the |
|
5034 |
* SQL name of a column in this rowset, ignoring case |
|
5035 |
* @param x the new column value |
|
5036 |
* @throws SQLException if (1) the given column name does not match the |
|
5037 |
* name of a column in this rowset, (2) the cursor is not on |
|
5038 |
* one of this rowset's rows or its insert row, or (3) this |
|
5039 |
* rowset is <code>ResultSet.CONCUR_READ_ONLY</code> |
|
5040 |
*/ |
|
5041 |
public void updateInt(String columnName, int x) throws SQLException { |
|
5042 |
updateInt(getColIdxByName(columnName), x); |
|
5043 |
} |
|
5044 |
||
5045 |
/** |
|
5046 |
* Sets the designated column in either the current row or the insert |
|
5047 |
* row of this <code>CachedRowSetImpl</code> object with the given |
|
5048 |
* <code>long</code> value. |
|
5049 |
* <P> |
|
5050 |
* This method updates a column value in the current row or the insert |
|
5051 |
* row of this rowset, but it does not update the database. |
|
5052 |
* If the cursor is on a row in the rowset, the |
|
5053 |
* method {@link #updateRow} must be called to update the database. |
|
5054 |
* If the cursor is on the insert row, the method {@link #insertRow} |
|
5055 |
* must be called, which will insert the new row into both this rowset |
|
5056 |
* and the database. Both of these methods must be called before the |
|
5057 |
* cursor moves to another row. |
|
5058 |
* |
|
5059 |
* @param columnName a <code>String</code> object that must match the |
|
5060 |
* SQL name of a column in this rowset, ignoring case |
|
5061 |
* @param x the new column value |
|
5062 |
* @throws SQLException if (1) the given column name does not match the |
|
5063 |
* name of a column in this rowset, (2) the cursor is not on |
|
5064 |
* one of this rowset's rows or its insert row, or (3) this |
|
5065 |
* rowset is <code>ResultSet.CONCUR_READ_ONLY</code> |
|
5066 |
*/ |
|
5067 |
public void updateLong(String columnName, long x) throws SQLException { |
|
5068 |
updateLong(getColIdxByName(columnName), x); |
|
5069 |
} |
|
5070 |
||
5071 |
/** |
|
5072 |
* Sets the designated column in either the current row or the insert |
|
5073 |
* row of this <code>CachedRowSetImpl</code> object with the given |
|
5074 |
* <code>float</code> value. |
|
5075 |
* <P> |
|
5076 |
* This method updates a column value in the current row or the insert |
|
5077 |
* row of this rowset, but it does not update the database. |
|
5078 |
* If the cursor is on a row in the rowset, the |
|
5079 |
* method {@link #updateRow} must be called to update the database. |
|
5080 |
* If the cursor is on the insert row, the method {@link #insertRow} |
|
5081 |
* must be called, which will insert the new row into both this rowset |
|
5082 |
* and the database. Both of these methods must be called before the |
|
5083 |
* cursor moves to another row. |
|
5084 |
* |
|
5085 |
* @param columnName a <code>String</code> object that must match the |
|
5086 |
* SQL name of a column in this rowset, ignoring case |
|
5087 |
* @param x the new column value |
|
5088 |
* @throws SQLException if (1) the given column name does not match the |
|
5089 |
* name of a column in this rowset, (2) the cursor is not on |
|
5090 |
* one of this rowset's rows or its insert row, or (3) this |
|
5091 |
* rowset is <code>ResultSet.CONCUR_READ_ONLY</code> |
|
5092 |
*/ |
|
5093 |
public void updateFloat(String columnName, float x) throws SQLException { |
|
5094 |
updateFloat(getColIdxByName(columnName), x); |
|
5095 |
} |
|
5096 |
||
5097 |
/** |
|
5098 |
* Sets the designated column in either the current row or the insert |
|
5099 |
* row of this <code>CachedRowSetImpl</code> object with the given |
|
5100 |
* <code>double</code> value. |
|
5101 |
* |
|
5102 |
* This method updates a column value in either the current row or |
|
5103 |
* the insert row of this rowset, but it does not update the |
|
5104 |
* database. If the cursor is on a row in the rowset, the |
|
5105 |
* method {@link #updateRow} must be called to update the database. |
|
5106 |
* If the cursor is on the insert row, the method {@link #insertRow} |
|
5107 |
* must be called, which will insert the new row into both this rowset |
|
5108 |
* and the database. Both of these methods must be called before the |
|
5109 |
* cursor moves to another row. |
|
5110 |
* |
|
5111 |
* @param columnName a <code>String</code> object that must match the |
|
5112 |
* SQL name of a column in this rowset, ignoring case |
|
5113 |
* @param x the new column value |
|
5114 |
* @throws SQLException if (1) the given column name does not match the |
|
5115 |
* name of a column in this rowset, (2) the cursor is not on |
|
5116 |
* one of this rowset's rows or its insert row, or (3) this |
|
5117 |
* rowset is <code>ResultSet.CONCUR_READ_ONLY</code> |
|
5118 |
*/ |
|
5119 |
public void updateDouble(String columnName, double x) throws SQLException { |
|
5120 |
updateDouble(getColIdxByName(columnName), x); |
|
5121 |
} |
|
5122 |
||
5123 |
/** |
|
5124 |
* Sets the designated column in either the current row or the insert |
|
5125 |
* row of this <code>CachedRowSetImpl</code> object with the given |
|
5126 |
* <code>java.math.BigDecimal</code> object. |
|
5127 |
* <P> |
|
5128 |
* This method updates a column value in the current row or the insert |
|
5129 |
* row of this rowset, but it does not update the database. |
|
5130 |
* If the cursor is on a row in the rowset, the |
|
5131 |
* method {@link #updateRow} must be called to update the database. |
|
5132 |
* If the cursor is on the insert row, the method {@link #insertRow} |
|
5133 |
* must be called, which will insert the new row into both this rowset |
|
5134 |
* and the database. Both of these methods must be called before the |
|
5135 |
* cursor moves to another row. |
|
5136 |
* |
|
5137 |
* @param columnName a <code>String</code> object that must match the |
|
5138 |
* SQL name of a column in this rowset, ignoring case |
|
5139 |
* @param x the new column value |
|
5140 |
* @throws SQLException if (1) the given column name does not match the |
|
5141 |
* name of a column in this rowset, (2) the cursor is not on |
|
5142 |
* one of this rowset's rows or its insert row, or (3) this |
|
5143 |
* rowset is <code>ResultSet.CONCUR_READ_ONLY</code> |
|
5144 |
*/ |
|
5145 |
public void updateBigDecimal(String columnName, BigDecimal x) throws SQLException { |
|
5146 |
updateBigDecimal(getColIdxByName(columnName), x); |
|
5147 |
} |
|
5148 |
||
5149 |
/** |
|
5150 |
* Sets the designated column in either the current row or the insert |
|
5151 |
* row of this <code>CachedRowSetImpl</code> object with the given |
|
5152 |
* <code>String</code> object. |
|
5153 |
* |
|
5154 |
* This method updates a column value in either the current row or |
|
5155 |
* the insert row of this rowset, but it does not update the |
|
5156 |
* database. If the cursor is on a row in the rowset, the |
|
5157 |
* method {@link #updateRow} must be called to update the database. |
|
5158 |
* If the cursor is on the insert row, the method {@link #insertRow} |
|
5159 |
* must be called, which will insert the new row into both this rowset |
|
5160 |
* and the database. Both of these methods must be called before the |
|
5161 |
* cursor moves to another row. |
|
5162 |
* |
|
5163 |
* @param columnName a <code>String</code> object that must match the |
|
5164 |
* SQL name of a column in this rowset, ignoring case |
|
5165 |
* @param x the new column value |
|
5166 |
* @throws SQLException if (1) the given column name does not match the |
|
5167 |
* name of a column in this rowset, (2) the cursor is not on |
|
5168 |
* one of this rowset's rows or its insert row, or (3) this |
|
5169 |
* rowset is <code>ResultSet.CONCUR_READ_ONLY</code> |
|
5170 |
*/ |
|
5171 |
public void updateString(String columnName, String x) throws SQLException { |
|
5172 |
updateString(getColIdxByName(columnName), x); |
|
5173 |
} |
|
5174 |
||
5175 |
/** |
|
5176 |
* Sets the designated column in either the current row or the insert |
|
5177 |
* row of this <code>CachedRowSetImpl</code> object with the given |
|
5178 |
* <code>byte</code> array. |
|
5179 |
* |
|
5180 |
* This method updates a column value in either the current row or |
|
5181 |
* the insert row of this rowset, but it does not update the |
|
5182 |
* database. If the cursor is on a row in the rowset, the |
|
5183 |
* method {@link #updateRow} must be called to update the database. |
|
5184 |
* If the cursor is on the insert row, the method {@link #insertRow} |
|
5185 |
* must be called, which will insert the new row into both this rowset |
|
5186 |
* and the database. Both of these methods must be called before the |
|
5187 |
* cursor moves to another row. |
|
5188 |
* |
|
5189 |
* @param columnName a <code>String</code> object that must match the |
|
5190 |
* SQL name of a column in this rowset, ignoring case |
|
5191 |
* @param x the new column value |
|
5192 |
* @throws SQLException if (1) the given column name does not match the |
|
5193 |
* name of a column in this rowset, (2) the cursor is not on |
|
5194 |
* one of this rowset's rows or its insert row, or (3) this |
|
5195 |
* rowset is <code>ResultSet.CONCUR_READ_ONLY</code> |
|
5196 |
*/ |
|
5197 |
public void updateBytes(String columnName, byte x[]) throws SQLException { |
|
5198 |
updateBytes(getColIdxByName(columnName), x); |
|
5199 |
} |
|
5200 |
||
5201 |
/** |
|
5202 |
* Sets the designated column in either the current row or the insert |
|
5203 |
* row of this <code>CachedRowSetImpl</code> object with the given |
|
5204 |
* <code>Date</code> object. |
|
5205 |
* |
|
5206 |
* This method updates a column value in either the current row or |
|
5207 |
* the insert row of this rowset, but it does not update the |
|
5208 |
* database. If the cursor is on a row in the rowset, the |
|
5209 |
* method {@link #updateRow} must be called to update the database. |
|
5210 |
* If the cursor is on the insert row, the method {@link #insertRow} |
|
5211 |
* must be called, which will insert the new row into both this rowset |
|
5212 |
* and the database. Both of these methods must be called before the |
|
5213 |
* cursor moves to another row. |
|
5214 |
* |
|
5215 |
* @param columnName a <code>String</code> object that must match the |
|
5216 |
* SQL name of a column in this rowset, ignoring case |
|
5217 |
* @param x the new column value |
|
5218 |
* @throws SQLException if (1) the given column name does not match the |
|
5219 |
* name of a column in this rowset, (2) the cursor is not on |
|
5220 |
* one of this rowset's rows or its insert row, (3) the type |
|
5221 |
* of the designated column is not an SQL <code>DATE</code> or |
|
5222 |
* <code>TIMESTAMP</code>, or (4) this rowset is |
|
5223 |
* <code>ResultSet.CONCUR_READ_ONLY</code> |
|
5224 |
*/ |
|
5225 |
public void updateDate(String columnName, java.sql.Date x) throws SQLException { |
|
5226 |
updateDate(getColIdxByName(columnName), x); |
|
5227 |
} |
|
5228 |
||
5229 |
/** |
|
5230 |
* Sets the designated column in either the current row or the insert |
|
5231 |
* row of this <code>CachedRowSetImpl</code> object with the given |
|
5232 |
* <code>Time</code> object. |
|
5233 |
* |
|
5234 |
* This method updates a column value in either the current row or |
|
5235 |
* the insert row of this rowset, but it does not update the |
|
5236 |
* database. If the cursor is on a row in the rowset, the |
|
5237 |
* method {@link #updateRow} must be called to update the database. |
|
5238 |
* If the cursor is on the insert row, the method {@link #insertRow} |
|
5239 |
* must be called, which will insert the new row into both this rowset |
|
5240 |
* and the database. Both of these methods must be called before the |
|
5241 |
* cursor moves to another row. |
|
5242 |
* |
|
5243 |
* @param columnName a <code>String</code> object that must match the |
|
5244 |
* SQL name of a column in this rowset, ignoring case |
|
5245 |
* @param x the new column value |
|
5246 |
* @throws SQLException if (1) the given column name does not match the |
|
5247 |
* name of a column in this rowset, (2) the cursor is not on |
|
5248 |
* one of this rowset's rows or its insert row, (3) the type |
|
5249 |
* of the designated column is not an SQL <code>TIME</code> or |
|
5250 |
* <code>TIMESTAMP</code>, or (4) this rowset is |
|
5251 |
* <code>ResultSet.CONCUR_READ_ONLY</code> |
|
5252 |
*/ |
|
5253 |
public void updateTime(String columnName, java.sql.Time x) throws SQLException { |
|
5254 |
updateTime(getColIdxByName(columnName), x); |
|
5255 |
} |
|
5256 |
||
5257 |
/** |
|
5258 |
* Sets the designated column in either the current row or the insert |
|
5259 |
* row of this <code>CachedRowSetImpl</code> object with the given |
|
5260 |
* <code>Timestamp</code> object. |
|
5261 |
* |
|
5262 |
* This method updates a column value in either the current row or |
|
5263 |
* the insert row of this rowset, but it does not update the |
|
5264 |
* database. If the cursor is on a row in the rowset, the |
|
5265 |
* method {@link #updateRow} must be called to update the database. |
|
5266 |
* If the cursor is on the insert row, the method {@link #insertRow} |
|
5267 |
* must be called, which will insert the new row into both this rowset |
|
5268 |
* and the database. Both of these methods must be called before the |
|
5269 |
* cursor moves to another row. |
|
5270 |
* |
|
5271 |
* @param columnName a <code>String</code> object that must match the |
|
5272 |
* SQL name of a column in this rowset, ignoring case |
|
5273 |
* @param x the new column value |
|
5274 |
* @throws SQLException if the given column index is out of bounds or |
|
5275 |
* the cursor is not on one of this rowset's rows or its |
|
5276 |
* insert row |
|
5277 |
* @throws SQLException if (1) the given column name does not match the |
|
5278 |
* name of a column in this rowset, (2) the cursor is not on |
|
5279 |
* one of this rowset's rows or its insert row, (3) the type |
|
5280 |
* of the designated column is not an SQL <code>DATE</code>, |
|
5281 |
* <code>TIME</code>, or <code>TIMESTAMP</code>, or (4) this |
|
5282 |
* rowset is <code>ResultSet.CONCUR_READ_ONLY</code> |
|
5283 |
*/ |
|
5284 |
public void updateTimestamp(String columnName, java.sql.Timestamp x) throws SQLException { |
|
5285 |
updateTimestamp(getColIdxByName(columnName), x); |
|
5286 |
} |
|
5287 |
||
5288 |
/** |
|
5289 |
* Sets the designated column in either the current row or the insert |
|
5290 |
* row of this <code>CachedRowSetImpl</code> object with the given |
|
5291 |
* ASCII stream value. |
|
5292 |
* <P> |
|
5293 |
* This method updates a column value in either the current row or |
|
5294 |
* the insert row of this rowset, but it does not update the |
|
5295 |
* database. If the cursor is on a row in the rowset, the |
|
5296 |
* method {@link #updateRow} must be called to update the database. |
|
5297 |
* If the cursor is on the insert row, the method {@link #insertRow} |
|
5298 |
* must be called, which will insert the new row into both this rowset |
|
5299 |
* and the database. Both of these methods must be called before the |
|
5300 |
* cursor moves to another row. |
|
5301 |
* |
|
5302 |
* @param columnName a <code>String</code> object that must match the |
|
5303 |
* SQL name of a column in this rowset, ignoring case |
|
5304 |
* @param x the new column value |
|
5305 |
* @param length the number of one-byte ASCII characters in the stream |
|
5306 |
*/ |
|
5307 |
public void updateAsciiStream(String columnName, |
|
5308 |
java.io.InputStream x, |
|
5309 |
int length) throws SQLException { |
|
5310 |
updateAsciiStream(getColIdxByName(columnName), x, length); |
|
5311 |
} |
|
5312 |
||
5313 |
/** |
|
5314 |
* Sets the designated column in either the current row or the insert |
|
5315 |
* row of this <code>CachedRowSetImpl</code> object with the given |
|
5316 |
* <code>java.io.InputStream</code> object. |
|
5317 |
* <P> |
|
5318 |
* This method updates a column value in either the current row or |
|
5319 |
* the insert row of this rowset, but it does not update the |
|
5320 |
* database. If the cursor is on a row in the rowset, the |
|
5321 |
* method {@link #updateRow} must be called to update the database. |
|
5322 |
* If the cursor is on the insert row, the method {@link #insertRow} |
|
5323 |
* must be called, which will insert the new row into both this rowset |
|
5324 |
* and the database. Both of these methods must be called before the |
|
5325 |
* cursor moves to another row. |
|
5326 |
* |
|
5327 |
* @param columnName a <code>String</code> object that must match the |
|
5328 |
* SQL name of a column in this rowset, ignoring case |
|
5329 |
* @param x the new column value; must be a <code>java.io.InputStream</code> |
|
5330 |
* containing <code>BINARY</code>, <code>VARBINARY</code>, or |
|
5331 |
* <code>LONGVARBINARY</code> data |
|
5332 |
* @param length the length of the stream in bytes |
|
5333 |
* @throws SQLException if (1) the given column name does not match the |
|
5334 |
* name of a column in this rowset, (2) the cursor is not on |
|
5335 |
* one of this rowset's rows or its insert row, (3) the data |
|
5336 |
* in the stream is not binary, or (4) this rowset is |
|
5337 |
* <code>ResultSet.CONCUR_READ_ONLY</code> |
|
5338 |
*/ |
|
5339 |
public void updateBinaryStream(String columnName, java.io.InputStream x, int length) throws SQLException { |
|
5340 |
updateBinaryStream(getColIdxByName(columnName), x, length); |
|
5341 |
} |
|
5342 |
||
5343 |
/** |
|
5344 |
* Sets the designated column in either the current row or the insert |
|
5345 |
* row of this <code>CachedRowSetImpl</code> object with the given |
|
5346 |
* <code>java.io.Reader</code> object. |
|
5347 |
* <P> |
|
5348 |
* This method updates a column value in either the current row or |
|
5349 |
* the insert row of this rowset, but it does not update the |
|
5350 |
* database. If the cursor is on a row in the rowset, the |
|
5351 |
* method {@link #updateRow} must be called to update the database. |
|
5352 |
* If the cursor is on the insert row, the method {@link #insertRow} |
|
5353 |
* must be called, which will insert the new row into both this rowset |
|
5354 |
* and the database. Both of these methods must be called before the |
|
5355 |
* cursor moves to another row. |
|
5356 |
* |
|
5357 |
* @param columnName a <code>String</code> object that must match the |
|
5358 |
* SQL name of a column in this rowset, ignoring case |
|
5359 |
* @param reader the new column value; must be a |
|
5360 |
* <code>java.io.Reader</code> containing <code>BINARY</code>, |
|
5361 |
* <code>VARBINARY</code>, <code>LONGVARBINARY</code>, <code>CHAR</code>, |
|
5362 |
* <code>VARCHAR</code>, or <code>LONGVARCHAR</code> data |
|
5363 |
* @param length the length of the stream in characters |
|
5364 |
* @throws SQLException if (1) the given column name does not match the |
|
5365 |
* name of a column in this rowset, (2) the cursor is not on |
|
5366 |
* one of this rowset's rows or its insert row, (3) the data |
|
5367 |
* in the stream is not a binary or character type, or (4) this |
|
5368 |
* rowset is <code>ResultSet.CONCUR_READ_ONLY</code> |
|
5369 |
*/ |
|
5370 |
public void updateCharacterStream(String columnName, |
|
5371 |
java.io.Reader reader, |
|
5372 |
int length) throws SQLException { |
|
5373 |
updateCharacterStream(getColIdxByName(columnName), reader, length); |
|
5374 |
} |
|
5375 |
||
5376 |
/** |
|
5377 |
* Sets the designated column in either the current row or the insert |
|
5378 |
* row of this <code>CachedRowSetImpl</code> object with the given |
|
5379 |
* <code>Object</code> value. The <code>scale</code> parameter |
|
5380 |
* indicates the number of digits to the right of the decimal point |
|
5381 |
* and is ignored if the new column value is not a type that will be |
|
5382 |
* mapped to an SQL <code>DECIMAL</code> or <code>NUMERIC</code> value. |
|
5383 |
* <P> |
|
5384 |
* This method updates a column value in either the current row or |
|
5385 |
* the insert row of this rowset, but it does not update the |
|
5386 |
* database. If the cursor is on a row in the rowset, the |
|
5387 |
* method {@link #updateRow} must be called to update the database. |
|
5388 |
* If the cursor is on the insert row, the method {@link #insertRow} |
|
5389 |
* must be called, which will insert the new row into both this rowset |
|
5390 |
* and the database. Both of these methods must be called before the |
|
5391 |
* cursor moves to another row. |
|
5392 |
* |
|
5393 |
* @param columnName a <code>String</code> object that must match the |
|
5394 |
* SQL name of a column in this rowset, ignoring case |
|
5395 |
* @param x the new column value |
|
5396 |
* @param scale the number of digits to the right of the decimal point (for |
|
5397 |
* <code>DECIMAL</code> and <code>NUMERIC</code> types only) |
|
5398 |
* @throws SQLException if (1) the given column name does not match the |
|
5399 |
* name of a column in this rowset, (2) the cursor is not on |
|
5400 |
* one of this rowset's rows or its insert row, or (3) this |
|
5401 |
* rowset is <code>ResultSet.CONCUR_READ_ONLY</code> |
|
5402 |
*/ |
|
5403 |
public void updateObject(String columnName, Object x, int scale) throws SQLException { |
|
5404 |
updateObject(getColIdxByName(columnName), x, scale); |
|
5405 |
} |
|
5406 |
||
5407 |
/** |
|
5408 |
* Sets the designated column in either the current row or the insert |
|
5409 |
* row of this <code>CachedRowSetImpl</code> object with the given |
|
5410 |
* <code>Object</code> value. |
|
5411 |
* <P> |
|
5412 |
* This method updates a column value in either the current row or |
|
5413 |
* the insert row of this rowset, but it does not update the |
|
5414 |
* database. If the cursor is on a row in the rowset, the |
|
5415 |
* method {@link #updateRow} must be called to update the database. |
|
5416 |
* If the cursor is on the insert row, the method {@link #insertRow} |
|
5417 |
* must be called, which will insert the new row into both this rowset |
|
5418 |
* and the database. Both of these methods must be called before the |
|
5419 |
* cursor moves to another row. |
|
5420 |
* |
|
5421 |
* @param columnName a <code>String</code> object that must match the |
|
5422 |
* SQL name of a column in this rowset, ignoring case |
|
5423 |
* @param x the new column value |
|
5424 |
* @throws SQLException if (1) the given column name does not match the |
|
5425 |
* name of a column in this rowset, (2) the cursor is not on |
|
5426 |
* one of this rowset's rows or its insert row, or (3) this |
|
5427 |
* rowset is <code>ResultSet.CONCUR_READ_ONLY</code> |
|
5428 |
*/ |
|
5429 |
public void updateObject(String columnName, Object x) throws SQLException { |
|
5430 |
updateObject(getColIdxByName(columnName), x); |
|
5431 |
} |
|
5432 |
||
5433 |
/** |
|
5434 |
* Inserts the contents of this <code>CachedRowSetImpl</code> object's insert |
|
5435 |
* row into this rowset immediately following the current row. |
|
5436 |
* If the current row is the |
|
5437 |
* position after the last row or before the first row, the new row will |
|
5438 |
* be inserted at the end of the rowset. This method also notifies |
|
5439 |
* listeners registered with this rowset that the row has changed. |
|
5440 |
* <P> |
|
5441 |
* The cursor must be on the insert row when this method is called. |
|
5442 |
* |
|
5443 |
* @throws SQLException if (1) the cursor is not on the insert row, |
|
5444 |
* (2) one or more of the non-nullable columns in the insert |
|
5445 |
* row has not been given a value, or (3) this rowset is |
|
5446 |
* <code>ResultSet.CONCUR_READ_ONLY</code> |
|
5447 |
*/ |
|
5448 |
public void insertRow() throws SQLException { |
|
5449 |
int pos; |
|
5450 |
||
5451 |
if (onInsertRow == false || |
|
5452 |
insertRow.isCompleteRow(RowSetMD) == false) { |
|
5453 |
throw new SQLException(resBundle.handleGetObject("cachedrowsetimpl.failedins").toString()); |
|
5454 |
} |
|
5455 |
// Added the setting of parameters that are passed |
|
5456 |
// to setXXX methods after an empty CRS Object is |
|
5457 |
// created through RowSetMetaData object |
|
5458 |
Object [] toInsert = getParams(); |
|
5459 |
||
5460 |
for(int i = 0;i < toInsert.length; i++) { |
|
5461 |
insertRow.setColumnObject(i+1,toInsert[i]); |
|
5462 |
} |
|
5463 |
||
5464 |
Row insRow = new Row(RowSetMD.getColumnCount(), |
|
5465 |
insertRow.getOrigRow()); |
|
5466 |
insRow.setInserted(); |
|
5467 |
/* |
|
5468 |
* The new row is inserted into the RowSet |
|
5469 |
* immediately following the current row. |
|
5470 |
* |
|
5471 |
* If we are afterlast then the rows are |
|
5472 |
* inserted at the end. |
|
5473 |
*/ |
|
5474 |
if (currentRow >= numRows || currentRow < 0) { |
|
5475 |
pos = numRows; |
|
5476 |
} else { |
|
5477 |
pos = currentRow; |
|
5478 |
} |
|
5479 |
||
5480 |
rvh.add(pos, insRow); |
|
5481 |
++numRows; |
|
5482 |
// notify the listeners that the row changed. |
|
5483 |
notifyRowChanged(); |
|
5484 |
} |
|
5485 |
||
5486 |
/** |
|
5487 |
* Marks the current row of this <code>CachedRowSetImpl</code> object as |
|
5488 |
* updated and notifies listeners registered with this rowset that the |
|
5489 |
* row has changed. |
|
5490 |
* <P> |
|
5491 |
* This method cannot be called when the cursor is on the insert row, and |
|
5492 |
* it should be called before the cursor moves to another row. If it is |
|
5493 |
* called after the cursor moves to another row, this method has no effect, |
|
5494 |
* and the updates made before the cursor moved will be lost. |
|
5495 |
* |
|
5496 |
* @throws SQLException if the cursor is on the insert row or this |
|
5497 |
* rowset is <code>ResultSet.CONCUR_READ_ONLY</code> |
|
5498 |
*/ |
|
5499 |
public void updateRow() throws SQLException { |
|
5500 |
// make sure we aren't on the insert row |
|
5501 |
if (onInsertRow == true) { |
|
5502 |
throw new SQLException(resBundle.handleGetObject("cachedrowsetimpl.updateins").toString()); |
|
5503 |
} |
|
5504 |
||
5505 |
((Row)getCurrentRow()).setUpdated(); |
|
5506 |
||
5507 |
// notify the listeners that the row changed. |
|
5508 |
notifyRowChanged(); |
|
5509 |
} |
|
5510 |
||
5511 |
/** |
|
5512 |
* Deletes the current row from this <code>CachedRowSetImpl</code> object and |
|
5513 |
* notifies listeners registered with this rowset that a row has changed. |
|
5514 |
* This method cannot be called when the cursor is on the insert row. |
|
5515 |
* <P> |
|
5516 |
* This method marks the current row as deleted, but it does not delete |
|
5517 |
* the row from the underlying data source. The method |
|
5518 |
* <code>acceptChanges</code> must be called to delete the row in |
|
5519 |
* the data source. |
|
5520 |
* |
|
5521 |
* @throws SQLException if (1) this method is called when the cursor |
|
5522 |
* is on the insert row, before the first row, or after the |
|
5523 |
* last row or (2) this rowset is |
|
5524 |
* <code>ResultSet.CONCUR_READ_ONLY</code> |
|
5525 |
*/ |
|
5526 |
public void deleteRow() throws SQLException { |
|
5527 |
// make sure the cursor is on a valid row |
|
5528 |
checkCursor(); |
|
5529 |
||
5530 |
((Row)getCurrentRow()).setDeleted(); |
|
5531 |
++numDeleted; |
|
5532 |
||
5533 |
// notify the listeners that the row changed. |
|
5534 |
notifyRowChanged(); |
|
5535 |
} |
|
5536 |
||
5537 |
/** |
|
5538 |
* Sets the current row with its original value and marks the row as |
|
5539 |
* not updated, thus undoing any changes made to the row since the |
|
5540 |
* last call to the methods <code>updateRow</code> or <code>deleteRow</code>. |
|
5541 |
* This method should be called only when the cursor is on a row in |
|
5542 |
* this rowset. |
|
5543 |
* |
|
5544 |
* @throws SQLException if the cursor is on the insert row, before the |
|
5545 |
* first row, or after the last row |
|
5546 |
*/ |
|
5547 |
public void refreshRow() throws SQLException { |
|
5548 |
// make sure we are on a row |
|
5549 |
checkCursor(); |
|
5550 |
||
5551 |
// don't want this to happen... |
|
5552 |
if (onInsertRow == true) { |
|
5553 |
throw new SQLException(resBundle.handleGetObject("cachedrowsetimpl.invalidcp").toString()); |
|
5554 |
} |
|
5555 |
||
5556 |
Row currentRow = (Row)getCurrentRow(); |
|
5557 |
// just undo any changes made to this row. |
|
5558 |
currentRow.clearUpdated(); |
|
5559 |
||
5560 |
} |
|
5561 |
||
5562 |
/** |
|
5563 |
* Rolls back any updates made to the current row of this |
|
5564 |
* <code>CachedRowSetImpl</code> object and notifies listeners that |
|
5565 |
* a row has changed. To have an effect, this method |
|
5566 |
* must be called after an <code>updateXXX</code> method has been |
|
5567 |
* called and before the method <code>updateRow</code> has been called. |
|
5568 |
* If no updates have been made or the method <code>updateRow</code> |
|
5569 |
* has already been called, this method has no effect. |
|
5570 |
* |
|
5571 |
* @throws SQLException if the cursor is on the insert row, before the |
|
5572 |
* first row, or after the last row |
|
5573 |
*/ |
|
5574 |
public void cancelRowUpdates() throws SQLException { |
|
5575 |
// make sure we are on a row |
|
5576 |
checkCursor(); |
|
5577 |
||
5578 |
// don't want this to happen... |
|
5579 |
if (onInsertRow == true) { |
|
5580 |
throw new SQLException(resBundle.handleGetObject("cachedrowsetimpl.invalidcp").toString()); |
|
5581 |
} |
|
5582 |
||
5583 |
Row currentRow = (Row)getCurrentRow(); |
|
5584 |
if (currentRow.getUpdated() == true) { |
|
5585 |
currentRow.clearUpdated(); |
|
5586 |
notifyRowChanged(); |
|
5587 |
} |
|
5588 |
} |
|
5589 |
||
5590 |
/** |
|
5591 |
* Moves the cursor for this <code>CachedRowSetImpl</code> object |
|
5592 |
* to the insert row. The current row in the rowset is remembered |
|
5593 |
* while the cursor is on the insert row. |
|
5594 |
* <P> |
|
5595 |
* The insert row is a special row associated with an updatable |
|
5596 |
* rowset. It is essentially a buffer where a new row may |
|
5597 |
* be constructed by calling the appropriate <code>updateXXX</code> |
|
5598 |
* methods to assign a value to each column in the row. A complete |
|
5599 |
* row must be constructed; that is, every column that is not nullable |
|
5600 |
* must be assigned a value. In order for the new row to become part |
|
5601 |
* of this rowset, the method <code>insertRow</code> must be called |
|
5602 |
* before the cursor is moved back to the rowset. |
|
5603 |
* <P> |
|
5604 |
* Only certain methods may be invoked while the cursor is on the insert |
|
5605 |
* row; many methods throw an exception if they are called while the |
|
5606 |
* cursor is there. In addition to the <code>updateXXX</code> |
|
5607 |
* and <code>insertRow</code> methods, only the <code>getXXX</code> methods |
|
5608 |
* may be called when the cursor is on the insert row. A <code>getXXX</code> |
|
5609 |
* method should be called on a column only after an <code>updateXXX</code> |
|
5610 |
* method has been called on that column; otherwise, the value returned is |
|
5611 |
* undetermined. |
|
5612 |
* |
|
5613 |
* @throws SQLException if this <code>CachedRowSetImpl</code> object is |
|
5614 |
* <code>ResultSet.CONCUR_READ_ONLY</code> |
|
5615 |
*/ |
|
5616 |
public void moveToInsertRow() throws SQLException { |
|
5617 |
if (getConcurrency() == ResultSet.CONCUR_READ_ONLY) { |
|
5618 |
throw new SQLException(resBundle.handleGetObject("cachedrowsetimpl.movetoins").toString()); |
|
5619 |
} |
|
5620 |
if (insertRow == null) { |
|
5621 |
if (RowSetMD == null) |
|
5622 |
throw new SQLException(resBundle.handleGetObject("cachedrowsetimpl.movetoins1").toString()); |
|
5623 |
int numCols = RowSetMD.getColumnCount(); |
|
5624 |
if (numCols > 0) { |
|
5625 |
insertRow = new InsertRow(numCols); |
|
5626 |
} else { |
|
5627 |
throw new SQLException(resBundle.handleGetObject("cachedrowsetimpl.movetoins2").toString()); |
|
5628 |
} |
|
5629 |
} |
|
5630 |
onInsertRow = true; |
|
5631 |
// %%% setCurrentRow called in BaseRow |
|
5632 |
||
5633 |
currentRow = cursorPos; |
|
5634 |
cursorPos = -1; |
|
5635 |
||
5636 |
insertRow.initInsertRow(); |
|
5637 |
} |
|
5638 |
||
5639 |
/** |
|
5640 |
* Moves the cursor for this <code>CachedRowSetImpl</code> object to |
|
5641 |
* the current row. The current row is the row the cursor was on |
|
5642 |
* when the method <code>moveToInsertRow</code> was called. |
|
5643 |
* <P> |
|
5644 |
* Calling this method has no effect unless it is called while the |
|
5645 |
* cursor is on the insert row. |
|
5646 |
* |
|
5647 |
* @throws SQLException if an error occurs |
|
5648 |
*/ |
|
5649 |
public void moveToCurrentRow() throws SQLException { |
|
5650 |
if (onInsertRow == false) { |
|
5651 |
return; |
|
5652 |
} else { |
|
5653 |
cursorPos = currentRow; |
|
5654 |
onInsertRow = false; |
|
5655 |
} |
|
5656 |
} |
|
5657 |
||
5658 |
/** |
|
5659 |
* Returns <code>null</code>. |
|
5660 |
* |
|
5661 |
* @return <code>null</code> |
|
5662 |
* @throws SQLException if an error occurs |
|
5663 |
*/ |
|
5664 |
public Statement getStatement() throws SQLException { |
|
5665 |
return null; |
|
5666 |
} |
|
5667 |
||
5668 |
/** |
|
5669 |
* Retrieves the value of the designated column in this |
|
5670 |
* <code>CachedRowSetImpl</code> object as an <code>Object</code> in |
|
5671 |
* the Java programming language, using the given |
|
5672 |
* <code>java.util.Map</code> object to custom map the value if |
|
5673 |
* appropriate. |
|
5674 |
* |
|
5675 |
* @param columnIndex the first column is <code>1</code>, the second |
|
5676 |
* is <code>2</code>, and so on; must be <code>1</code> or larger |
|
5677 |
* and equal to or less than the number of columns in this rowset |
|
5678 |
* @param map a <code>java.util.Map</code> object showing the mapping |
|
5679 |
* from SQL type names to classes in the Java programming |
|
5680 |
* language |
|
5681 |
* @return an <code>Object</code> representing the SQL value |
|
5682 |
* @throws SQLException if the given column index is out of bounds or |
|
5683 |
* the cursor is not on one of this rowset's rows or its |
|
5684 |
* insert row |
|
5685 |
*/ |
|
5686 |
public Object getObject(int columnIndex, |
|
5687 |
java.util.Map<String,Class<?>> map) |
|
5688 |
throws SQLException |
|
5689 |
{ |
|
5690 |
Object value; |
|
5691 |
||
5692 |
// sanity check. |
|
5693 |
checkIndex(columnIndex); |
|
5694 |
// make sure the cursor is on a valid row |
|
5695 |
checkCursor(); |
|
5696 |
||
5697 |
setLastValueNull(false); |
|
5698 |
value = getCurrentRow().getColumnObject(columnIndex); |
|
5699 |
||
5700 |
// check for SQL NULL |
|
5701 |
if (value == null) { |
|
5702 |
setLastValueNull(true); |
|
5703 |
return null; |
|
5704 |
} |
|
5705 |
if (value instanceof Struct) { |
|
5706 |
Struct s = (Struct)value; |
|
5707 |
||
5708 |
// look up the class in the map |
|
11129
f9ad1aadf3fa
7116445: Miscellaneous warnings in the JDBC/RowSet classes
lancea
parents:
9537
diff
changeset
|
5709 |
Class<?> c = map.get(s.getSQLTypeName()); |
2 | 5710 |
if (c != null) { |
5711 |
// create new instance of the class |
|
5712 |
SQLData obj = null; |
|
5713 |
try { |
|
5714 |
obj = (SQLData)c.newInstance(); |
|
5715 |
} catch (java.lang.InstantiationException ex) { |
|
5716 |
throw new SQLException(MessageFormat.format(resBundle.handleGetObject("cachedrowsetimpl.unableins").toString(), |
|
5717 |
ex.getMessage())); |
|
5718 |
} catch (java.lang.IllegalAccessException ex) { |
|
5719 |
throw new SQLException(MessageFormat.format(resBundle.handleGetObject("cachedrowsetimpl.unableins").toString(), |
|
5720 |
ex.getMessage())); |
|
5721 |
} |
|
5722 |
// get the attributes from the struct |
|
5723 |
Object attribs[] = s.getAttributes(map); |
|
5724 |
// create the SQLInput "stream" |
|
5725 |
SQLInputImpl sqlInput = new SQLInputImpl(attribs, map); |
|
5726 |
// read the values... |
|
5727 |
obj.readSQL(sqlInput, s.getSQLTypeName()); |
|
5728 |
return (Object)obj; |
|
5729 |
} |
|
5730 |
} |
|
5731 |
return value; |
|
5732 |
} |
|
5733 |
||
5734 |
/** |
|
5735 |
* Retrieves the value of the designated column in this |
|
5736 |
* <code>CachedRowSetImpl</code> object as a <code>Ref</code> object |
|
5737 |
* in the Java programming language. |
|
5738 |
* |
|
5739 |
* @param columnIndex the first column is <code>1</code>, the second |
|
5740 |
* is <code>2</code>, and so on; must be <code>1</code> or larger |
|
5741 |
* and equal to or less than the number of columns in this rowset |
|
5742 |
* @return a <code>Ref</code> object representing an SQL<code> REF</code> value |
|
5743 |
* @throws SQLException if (1) the given column index is out of bounds, |
|
5744 |
* (2) the cursor is not on one of this rowset's rows or its |
|
5745 |
* insert row, or (3) the designated column does not store an |
|
5746 |
* SQL <code>REF</code> value |
|
5747 |
* @see #getRef(String) |
|
5748 |
*/ |
|
5749 |
public Ref getRef(int columnIndex) throws SQLException { |
|
5750 |
Ref value; |
|
5751 |
||
5752 |
// sanity check. |
|
5753 |
checkIndex(columnIndex); |
|
5754 |
// make sure the cursor is on a valid row |
|
5755 |
checkCursor(); |
|
5756 |
||
5757 |
if (RowSetMD.getColumnType(columnIndex) != java.sql.Types.REF) { |
|
5758 |
throw new SQLException(resBundle.handleGetObject("cachedrowsetimpl.dtypemismt").toString()); |
|
5759 |
} |
|
5760 |
||
5761 |
setLastValueNull(false); |
|
5762 |
value = (Ref)(getCurrentRow().getColumnObject(columnIndex)); |
|
5763 |
||
5764 |
// check for SQL NULL |
|
5765 |
if (value == null) { |
|
5766 |
setLastValueNull(true); |
|
5767 |
return null; |
|
5768 |
} |
|
5769 |
||
5770 |
return value; |
|
5771 |
} |
|
5772 |
||
5773 |
/** |
|
5774 |
* Retrieves the value of the designated column in this |
|
5775 |
* <code>CachedRowSetImpl</code> object as a <code>Blob</code> object |
|
5776 |
* in the Java programming language. |
|
5777 |
* |
|
5778 |
* @param columnIndex the first column is <code>1</code>, the second |
|
5779 |
* is <code>2</code>, and so on; must be <code>1</code> or larger |
|
5780 |
* and equal to or less than the number of columns in this rowset |
|
5781 |
* @return a <code>Blob</code> object representing an SQL <code>BLOB</code> value |
|
5782 |
* @throws SQLException if (1) the given column index is out of bounds, |
|
5783 |
* (2) the cursor is not on one of this rowset's rows or its |
|
5784 |
* insert row, or (3) the designated column does not store an |
|
5785 |
* SQL <code>BLOB</code> value |
|
5786 |
* @see #getBlob(String) |
|
5787 |
*/ |
|
5788 |
public Blob getBlob(int columnIndex) throws SQLException { |
|
5789 |
Blob value; |
|
5790 |
||
5791 |
// sanity check. |
|
5792 |
checkIndex(columnIndex); |
|
5793 |
// make sure the cursor is on a valid row |
|
5794 |
checkCursor(); |
|
5795 |
||
5796 |
if (RowSetMD.getColumnType(columnIndex) != java.sql.Types.BLOB) { |
|
5797 |
System.out.println(MessageFormat.format(resBundle.handleGetObject("cachedrowsetimpl.type").toString(), RowSetMD.getColumnType(columnIndex))); |
|
5798 |
throw new SQLException(resBundle.handleGetObject("cachedrowsetimpl.dtypemismt").toString()); |
|
5799 |
} |
|
5800 |
||
5801 |
setLastValueNull(false); |
|
5802 |
value = (Blob)(getCurrentRow().getColumnObject(columnIndex)); |
|
5803 |
||
5804 |
// check for SQL NULL |
|
5805 |
if (value == null) { |
|
5806 |
setLastValueNull(true); |
|
5807 |
return null; |
|
5808 |
} |
|
5809 |
||
5810 |
return value; |
|
5811 |
} |
|
5812 |
||
5813 |
/** |
|
5814 |
* Retrieves the value of the designated column in this |
|
5815 |
* <code>CachedRowSetImpl</code> object as a <code>Clob</code> object |
|
5816 |
* in the Java programming language. |
|
5817 |
* |
|
5818 |
* @param columnIndex the first column is <code>1</code>, the second |
|
5819 |
* is <code>2</code>, and so on; must be <code>1</code> or larger |
|
5820 |
* and equal to or less than the number of columns in this rowset |
|
5821 |
* @return a <code>Clob</code> object representing an SQL <code>CLOB</code> value |
|
5822 |
* @throws SQLException if (1) the given column index is out of bounds, |
|
5823 |
* (2) the cursor is not on one of this rowset's rows or its |
|
5824 |
* insert row, or (3) the designated column does not store an |
|
5825 |
* SQL <code>CLOB</code> value |
|
5826 |
* @see #getClob(String) |
|
5827 |
*/ |
|
5828 |
public Clob getClob(int columnIndex) throws SQLException { |
|
5829 |
Clob value; |
|
5830 |
||
5831 |
// sanity check. |
|
5832 |
checkIndex(columnIndex); |
|
5833 |
// make sure the cursor is on a valid row |
|
5834 |
checkCursor(); |
|
5835 |
||
5836 |
if (RowSetMD.getColumnType(columnIndex) != java.sql.Types.CLOB) { |
|
5837 |
System.out.println(MessageFormat.format(resBundle.handleGetObject("cachedrowsetimpl.type").toString(), RowSetMD.getColumnType(columnIndex))); |
|
5838 |
throw new SQLException(resBundle.handleGetObject("cachedrowsetimpl.dtypemismt").toString()); |
|
5839 |
} |
|
5840 |
||
5841 |
setLastValueNull(false); |
|
5842 |
value = (Clob)(getCurrentRow().getColumnObject(columnIndex)); |
|
5843 |
||
5844 |
// check for SQL NULL |
|
5845 |
if (value == null) { |
|
5846 |
setLastValueNull(true); |
|
5847 |
return null; |
|
5848 |
} |
|
5849 |
||
5850 |
return value; |
|
5851 |
} |
|
5852 |
||
5853 |
/** |
|
5854 |
* Retrieves the value of the designated column in this |
|
5855 |
* <code>CachedRowSetImpl</code> object as an <code>Array</code> object |
|
5856 |
* in the Java programming language. |
|
5857 |
* |
|
5858 |
* @param columnIndex the first column is <code>1</code>, the second |
|
5859 |
* is <code>2</code>, and so on; must be <code>1</code> or larger |
|
5860 |
* and equal to or less than the number of columns in this rowset |
|
5861 |
* @return an <code>Array</code> object representing an SQL |
|
5862 |
* <code>ARRAY</code> value |
|
5863 |
* @throws SQLException if (1) the given column index is out of bounds, |
|
5864 |
* (2) the cursor is not on one of this rowset's rows or its |
|
5865 |
* insert row, or (3) the designated column does not store an |
|
5866 |
* SQL <code>ARRAY</code> value |
|
5867 |
* @see #getArray(String) |
|
5868 |
*/ |
|
5869 |
public Array getArray(int columnIndex) throws SQLException { |
|
5870 |
java.sql.Array value; |
|
5871 |
||
5872 |
// sanity check. |
|
5873 |
checkIndex(columnIndex); |
|
5874 |
// make sure the cursor is on a valid row |
|
5875 |
checkCursor(); |
|
5876 |
||
5877 |
if (RowSetMD.getColumnType(columnIndex) != java.sql.Types.ARRAY) { |
|
5878 |
throw new SQLException(resBundle.handleGetObject("cachedrowsetimpl.dtypemismt").toString()); |
|
5879 |
} |
|
5880 |
||
5881 |
setLastValueNull(false); |
|
5882 |
value = (java.sql.Array)(getCurrentRow().getColumnObject(columnIndex)); |
|
5883 |
||
5884 |
// check for SQL NULL |
|
5885 |
if (value == null) { |
|
5886 |
setLastValueNull(true); |
|
5887 |
return null; |
|
5888 |
} |
|
5889 |
||
5890 |
return value; |
|
5891 |
} |
|
5892 |
||
5893 |
/** |
|
5894 |
* Retrieves the value of the designated column in this |
|
5895 |
* <code>CachedRowSetImpl</code> object as an <code>Object</code> in |
|
5896 |
* the Java programming language, using the given |
|
5897 |
* <code>java.util.Map</code> object to custom map the value if |
|
5898 |
* appropriate. |
|
5899 |
* |
|
5900 |
* @param columnName a <code>String</code> object that must match the |
|
5901 |
* SQL name of a column in this rowset, ignoring case |
|
5902 |
* @param map a <code>java.util.Map</code> object showing the mapping |
|
5903 |
* from SQL type names to classes in the Java programming |
|
5904 |
* language |
|
5905 |
* @return an <code>Object</code> representing the SQL value |
|
5906 |
* @throws SQLException if the given column name is not the name of |
|
5907 |
* a column in this rowset or the cursor is not on one of |
|
5908 |
* this rowset's rows or its insert row |
|
5909 |
*/ |
|
5910 |
public Object getObject(String columnName, |
|
5911 |
java.util.Map<String,Class<?>> map) |
|
5912 |
throws SQLException { |
|
5913 |
return getObject(getColIdxByName(columnName), map); |
|
5914 |
} |
|
5915 |
||
5916 |
/** |
|
5917 |
* Retrieves the value of the designated column in this |
|
5918 |
* <code>CachedRowSetImpl</code> object as a <code>Ref</code> object |
|
5919 |
* in the Java programming language. |
|
5920 |
* |
|
5921 |
* @param colName a <code>String</code> object that must match the |
|
5922 |
* SQL name of a column in this rowset, ignoring case |
|
5923 |
* @return a <code>Ref</code> object representing an SQL<code> REF</code> value |
|
5924 |
* @throws SQLException if (1) the given column name is not the name of |
|
5925 |
* a column in this rowset, (2) the cursor is not on one of |
|
5926 |
* this rowset's rows or its insert row, or (3) the column value |
|
5927 |
* is not an SQL <code>REF</code> value |
|
5928 |
* @see #getRef(int) |
|
5929 |
*/ |
|
5930 |
public Ref getRef(String colName) throws SQLException { |
|
5931 |
return getRef(getColIdxByName(colName)); |
|
5932 |
} |
|
5933 |
||
5934 |
/** |
|
5935 |
* Retrieves the value of the designated column in this |
|
5936 |
* <code>CachedRowSetImpl</code> object as a <code>Blob</code> object |
|
5937 |
* in the Java programming language. |
|
5938 |
* |
|
5939 |
* @param colName a <code>String</code> object that must match the |
|
5940 |
* SQL name of a column in this rowset, ignoring case |
|
5941 |
* @return a <code>Blob</code> object representing an SQL <code>BLOB</code> value |
|
5942 |
* @throws SQLException if (1) the given column name is not the name of |
|
5943 |
* a column in this rowset, (2) the cursor is not on one of |
|
5944 |
* this rowset's rows or its insert row, or (3) the designated |
|
5945 |
* column does not store an SQL <code>BLOB</code> value |
|
5946 |
* @see #getBlob(int) |
|
5947 |
*/ |
|
5948 |
public Blob getBlob(String colName) throws SQLException { |
|
5949 |
return getBlob(getColIdxByName(colName)); |
|
5950 |
} |
|
5951 |
||
5952 |
/** |
|
5953 |
* Retrieves the value of the designated column in this |
|
5954 |
* <code>CachedRowSetImpl</code> object as a <code>Clob</code> object |
|
5955 |
* in the Java programming language. |
|
5956 |
* |
|
5957 |
* @param colName a <code>String</code> object that must match the |
|
5958 |
* SQL name of a column in this rowset, ignoring case |
|
5959 |
* @return a <code>Clob</code> object representing an SQL |
|
5960 |
* <code>CLOB</code> value |
|
5961 |
* @throws SQLException if (1) the given column name is not the name of |
|
5962 |
* a column in this rowset, (2) the cursor is not on one of |
|
5963 |
* this rowset's rows or its insert row, or (3) the designated |
|
5964 |
* column does not store an SQL <code>CLOB</code> value |
|
5965 |
* @see #getClob(int) |
|
5966 |
*/ |
|
5967 |
public Clob getClob(String colName) throws SQLException { |
|
5968 |
return getClob(getColIdxByName(colName)); |
|
5969 |
} |
|
5970 |
||
5971 |
/** |
|
5972 |
* Retrieves the value of the designated column in this |
|
5973 |
* <code>CachedRowSetImpl</code> object as an <code>Array</code> object |
|
5974 |
* in the Java programming langugage. |
|
5975 |
* |
|
5976 |
* @param colName a <code>String</code> object that must match the |
|
5977 |
* SQL name of a column in this rowset, ignoring case |
|
5978 |
* @return an <code>Array</code> object representing an SQL |
|
5979 |
* <code>ARRAY</code> value |
|
5980 |
* @throws SQLException if (1) the given column name is not the name of |
|
5981 |
* a column in this rowset, (2) the cursor is not on one of |
|
5982 |
* this rowset's rows or its insert row, or (3) the designated |
|
5983 |
* column does not store an SQL <code>ARRAY</code> value |
|
5984 |
* @see #getArray(int) |
|
5985 |
*/ |
|
5986 |
public Array getArray(String colName) throws SQLException { |
|
5987 |
return getArray(getColIdxByName(colName)); |
|
5988 |
} |
|
5989 |
||
5990 |
/** |
|
5991 |
* Retrieves the value of the designated column in the current row |
|
5992 |
* of this <code>CachedRowSetImpl</code> object as a <code>java.sql.Date</code> |
|
5993 |
* object, using the given <code>Calendar</code> object to construct an |
|
5994 |
* appropriate millisecond value for the date. |
|
5995 |
* |
|
5996 |
* @param columnIndex the first column is <code>1</code>, the second |
|
5997 |
* is <code>2</code>, and so on; must be <code>1</code> or larger |
|
5998 |
* and equal to or less than the number of columns in the rowset |
|
5999 |
* @param cal the <code>java.util.Calendar</code> object to use in |
|
6000 |
* constructing the date |
|
6001 |
* @return the column value; if the value is SQL <code>NULL</code>, |
|
6002 |
* the result is <code>null</code> |
|
6003 |
* @throws SQLException if (1) the given column name is not the name of |
|
6004 |
* a column in this rowset, (2) the cursor is not on one of |
|
6005 |
* this rowset's rows or its insert row, or (3) the designated |
|
6006 |
* column does not store an SQL <code>DATE</code> or |
|
6007 |
* <code>TIMESTAMP</code> value |
|
6008 |
*/ |
|
6009 |
public java.sql.Date getDate(int columnIndex, Calendar cal) throws SQLException { |
|
6010 |
Object value; |
|
6011 |
||
6012 |
// sanity check. |
|
6013 |
checkIndex(columnIndex); |
|
6014 |
// make sure the cursor is on a valid row |
|
6015 |
checkCursor(); |
|
6016 |
||
6017 |
setLastValueNull(false); |
|
6018 |
value = getCurrentRow().getColumnObject(columnIndex); |
|
6019 |
||
6020 |
// check for SQL NULL |
|
6021 |
if (value == null) { |
|
6022 |
setLastValueNull(true); |
|
6023 |
return null; |
|
6024 |
} |
|
6025 |
||
6026 |
value = convertTemporal(value, |
|
6027 |
RowSetMD.getColumnType(columnIndex), |
|
6028 |
java.sql.Types.DATE); |
|
6029 |
||
6030 |
// create a default calendar |
|
6031 |
Calendar defaultCal = Calendar.getInstance(); |
|
6032 |
// set this Calendar to the time we have |
|
6033 |
defaultCal.setTime((java.util.Date)value); |
|
6034 |
||
6035 |
/* |
|
6036 |
* Now we can pull the pieces of the date out |
|
6037 |
* of the default calendar and put them into |
|
6038 |
* the user provided calendar |
|
6039 |
*/ |
|
6040 |
cal.set(Calendar.YEAR, defaultCal.get(Calendar.YEAR)); |
|
6041 |
cal.set(Calendar.MONTH, defaultCal.get(Calendar.MONTH)); |
|
6042 |
cal.set(Calendar.DAY_OF_MONTH, defaultCal.get(Calendar.DAY_OF_MONTH)); |
|
6043 |
||
6044 |
/* |
|
6045 |
* This looks a little odd but it is correct - |
|
6046 |
* Calendar.getTime() returns a Date... |
|
6047 |
*/ |
|
6048 |
return new java.sql.Date(cal.getTime().getTime()); |
|
6049 |
} |
|
6050 |
||
6051 |
/** |
|
6052 |
* Retrieves the value of the designated column in the current row |
|
6053 |
* of this <code>CachedRowSetImpl</code> object as a <code>java.sql.Date</code> |
|
6054 |
* object, using the given <code>Calendar</code> object to construct an |
|
6055 |
* appropriate millisecond value for the date. |
|
6056 |
* |
|
6057 |
* @param columnName a <code>String</code> object that must match the |
|
6058 |
* SQL name of a column in this rowset, ignoring case |
|
6059 |
* @param cal the <code>java.util.Calendar</code> object to use in |
|
6060 |
* constructing the date |
|
6061 |
* @return the column value; if the value is SQL <code>NULL</code>, |
|
6062 |
* the result is <code>null</code> |
|
6063 |
* @throws SQLException if (1) the given column name is not the name of |
|
6064 |
* a column in this rowset, (2) the cursor is not on one of |
|
6065 |
* this rowset's rows or its insert row, or (3) the designated |
|
6066 |
* column does not store an SQL <code>DATE</code> or |
|
6067 |
* <code>TIMESTAMP</code> value |
|
6068 |
*/ |
|
6069 |
public java.sql.Date getDate(String columnName, Calendar cal) throws SQLException { |
|
6070 |
return getDate(getColIdxByName(columnName), cal); |
|
6071 |
} |
|
6072 |
||
6073 |
/** |
|
6074 |
* Retrieves the value of the designated column in the current row |
|
6075 |
* of this <code>CachedRowSetImpl</code> object as a <code>java.sql.Time</code> |
|
6076 |
* object, using the given <code>Calendar</code> object to construct an |
|
6077 |
* appropriate millisecond value for the date. |
|
6078 |
* |
|
6079 |
* @param columnIndex the first column is <code>1</code>, the second |
|
6080 |
* is <code>2</code>, and so on; must be <code>1</code> or larger |
|
6081 |
* and equal to or less than the number of columns in the rowset |
|
6082 |
* @param cal the <code>java.util.Calendar</code> object to use in |
|
6083 |
* constructing the date |
|
6084 |
* @return the column value; if the value is SQL <code>NULL</code>, |
|
6085 |
* the result is <code>null</code> |
|
6086 |
* @throws SQLException if (1) the given column name is not the name of |
|
6087 |
* a column in this rowset, (2) the cursor is not on one of |
|
6088 |
* this rowset's rows or its insert row, or (3) the designated |
|
6089 |
* column does not store an SQL <code>TIME</code> or |
|
6090 |
* <code>TIMESTAMP</code> value |
|
6091 |
*/ |
|
6092 |
public java.sql.Time getTime(int columnIndex, Calendar cal) throws SQLException { |
|
6093 |
Object value; |
|
6094 |
||
6095 |
// sanity check. |
|
6096 |
checkIndex(columnIndex); |
|
6097 |
// make sure the cursor is on a valid row |
|
6098 |
checkCursor(); |
|
6099 |
||
6100 |
setLastValueNull(false); |
|
6101 |
value = getCurrentRow().getColumnObject(columnIndex); |
|
6102 |
||
6103 |
// check for SQL NULL |
|
6104 |
if (value == null) { |
|
6105 |
setLastValueNull(true); |
|
6106 |
return null; |
|
6107 |
} |
|
6108 |
||
6109 |
value = convertTemporal(value, |
|
6110 |
RowSetMD.getColumnType(columnIndex), |
|
6111 |
java.sql.Types.TIME); |
|
6112 |
||
6113 |
// create a default calendar |
|
6114 |
Calendar defaultCal = Calendar.getInstance(); |
|
6115 |
// set the time in the default calendar |
|
6116 |
defaultCal.setTime((java.util.Date)value); |
|
6117 |
||
6118 |
/* |
|
6119 |
* Now we can pull the pieces of the date out |
|
6120 |
* of the default calendar and put them into |
|
6121 |
* the user provided calendar |
|
6122 |
*/ |
|
6123 |
cal.set(Calendar.HOUR_OF_DAY, defaultCal.get(Calendar.HOUR_OF_DAY)); |
|
6124 |
cal.set(Calendar.MINUTE, defaultCal.get(Calendar.MINUTE)); |
|
6125 |
cal.set(Calendar.SECOND, defaultCal.get(Calendar.SECOND)); |
|
6126 |
||
6127 |
return new java.sql.Time(cal.getTime().getTime()); |
|
6128 |
} |
|
6129 |
||
6130 |
/** |
|
6131 |
* Retrieves the value of the designated column in the current row |
|
6132 |
* of this <code>CachedRowSetImpl</code> object as a <code>java.sql.Time</code> |
|
6133 |
* object, using the given <code>Calendar</code> object to construct an |
|
6134 |
* appropriate millisecond value for the date. |
|
6135 |
* |
|
6136 |
* @param columnName a <code>String</code> object that must match the |
|
6137 |
* SQL name of a column in this rowset, ignoring case |
|
6138 |
* @param cal the <code>java.util.Calendar</code> object to use in |
|
6139 |
* constructing the date |
|
6140 |
* @return the column value; if the value is SQL <code>NULL</code>, |
|
6141 |
* the result is <code>null</code> |
|
6142 |
* @throws SQLException if (1) the given column name is not the name of |
|
6143 |
* a column in this rowset, (2) the cursor is not on one of |
|
6144 |
* this rowset's rows or its insert row, or (3) the designated |
|
6145 |
* column does not store an SQL <code>TIME</code> or |
|
6146 |
* <code>TIMESTAMP</code> value |
|
6147 |
*/ |
|
6148 |
public java.sql.Time getTime(String columnName, Calendar cal) throws SQLException { |
|
6149 |
return getTime(getColIdxByName(columnName), cal); |
|
6150 |
} |
|
6151 |
||
6152 |
/** |
|
6153 |
* Retrieves the value of the designated column in the current row |
|
6154 |
* of this <code>CachedRowSetImpl</code> object as a <code>java.sql.Timestamp</code> |
|
6155 |
* object, using the given <code>Calendar</code> object to construct an |
|
6156 |
* appropriate millisecond value for the date. |
|
6157 |
* |
|
6158 |
* @param columnIndex the first column is <code>1</code>, the second |
|
6159 |
* is <code>2</code>, and so on; must be <code>1</code> or larger |
|
6160 |
* and equal to or less than the number of columns in the rowset |
|
6161 |
* @param cal the <code>java.util.Calendar</code> object to use in |
|
6162 |
* constructing the date |
|
6163 |
* @return the column value; if the value is SQL <code>NULL</code>, |
|
6164 |
* the result is <code>null</code> |
|
6165 |
* @throws SQLException if (1) the given column name is not the name of |
|
6166 |
* a column in this rowset, (2) the cursor is not on one of |
|
6167 |
* this rowset's rows or its insert row, or (3) the designated |
|
6168 |
* column does not store an SQL <code>TIME</code> or |
|
6169 |
* <code>TIMESTAMP</code> value |
|
6170 |
*/ |
|
6171 |
public java.sql.Timestamp getTimestamp(int columnIndex, Calendar cal) throws SQLException { |
|
6172 |
Object value; |
|
6173 |
||
6174 |
// sanity check. |
|
6175 |
checkIndex(columnIndex); |
|
6176 |
// make sure the cursor is on a valid row |
|
6177 |
checkCursor(); |
|
6178 |
||
6179 |
setLastValueNull(false); |
|
6180 |
value = getCurrentRow().getColumnObject(columnIndex); |
|
6181 |
||
6182 |
// check for SQL NULL |
|
6183 |
if (value == null) { |
|
6184 |
setLastValueNull(true); |
|
6185 |
return null; |
|
6186 |
} |
|
6187 |
||
6188 |
value = convertTemporal(value, |
|
6189 |
RowSetMD.getColumnType(columnIndex), |
|
6190 |
java.sql.Types.TIMESTAMP); |
|
6191 |
||
6192 |
// create a default calendar |
|
6193 |
Calendar defaultCal = Calendar.getInstance(); |
|
6194 |
// set the time in the default calendar |
|
6195 |
defaultCal.setTime((java.util.Date)value); |
|
6196 |
||
6197 |
/* |
|
6198 |
* Now we can pull the pieces of the date out |
|
6199 |
* of the default calendar and put them into |
|
6200 |
* the user provided calendar |
|
6201 |
*/ |
|
6202 |
cal.set(Calendar.YEAR, defaultCal.get(Calendar.YEAR)); |
|
6203 |
cal.set(Calendar.MONTH, defaultCal.get(Calendar.MONTH)); |
|
6204 |
cal.set(Calendar.DAY_OF_MONTH, defaultCal.get(Calendar.DAY_OF_MONTH)); |
|
6205 |
cal.set(Calendar.HOUR_OF_DAY, defaultCal.get(Calendar.HOUR_OF_DAY)); |
|
6206 |
cal.set(Calendar.MINUTE, defaultCal.get(Calendar.MINUTE)); |
|
6207 |
cal.set(Calendar.SECOND, defaultCal.get(Calendar.SECOND)); |
|
6208 |
||
6209 |
return new java.sql.Timestamp(cal.getTime().getTime()); |
|
6210 |
} |
|
6211 |
||
6212 |
/** |
|
6213 |
* Retrieves the value of the designated column in the current row |
|
6214 |
* of this <code>CachedRowSetImpl</code> object as a |
|
6215 |
* <code>java.sql.Timestamp</code> object, using the given |
|
6216 |
* <code>Calendar</code> object to construct an appropriate |
|
6217 |
* millisecond value for the date. |
|
6218 |
* |
|
6219 |
* @param columnName a <code>String</code> object that must match the |
|
6220 |
* SQL name of a column in this rowset, ignoring case |
|
6221 |
* @param cal the <code>java.util.Calendar</code> object to use in |
|
6222 |
* constructing the date |
|
6223 |
* @return the column value; if the value is SQL <code>NULL</code>, |
|
6224 |
* the result is <code>null</code> |
|
6225 |
* @throws SQLException if (1) the given column name is not the name of |
|
6226 |
* a column in this rowset, (2) the cursor is not on one of |
|
6227 |
* this rowset's rows or its insert row, or (3) the designated |
|
6228 |
* column does not store an SQL <code>DATE</code>, |
|
6229 |
* <code>TIME</code>, or <code>TIMESTAMP</code> value |
|
6230 |
*/ |
|
6231 |
public java.sql.Timestamp getTimestamp(String columnName, Calendar cal) throws SQLException { |
|
6232 |
return getTimestamp(getColIdxByName(columnName), cal); |
|
6233 |
} |
|
6234 |
||
6235 |
/* |
|
6236 |
* RowSetInternal Interface |
|
6237 |
*/ |
|
6238 |
||
6239 |
/** |
|
6240 |
* Retrieves the <code>Connection</code> object passed to this |
|
6241 |
* <code>CachedRowSetImpl</code> object. This connection may be |
|
6242 |
* used to populate this rowset with data or to write data back |
|
6243 |
* to its underlying data source. |
|
6244 |
* |
|
6245 |
* @return the <code>Connection</code> object passed to this rowset; |
|
6246 |
* may be <code>null</code> if there is no connection |
|
6247 |
* @throws SQLException if an error occurs |
|
6248 |
*/ |
|
6249 |
public Connection getConnection() throws SQLException{ |
|
6250 |
return conn; |
|
6251 |
} |
|
6252 |
||
6253 |
/** |
|
6254 |
* Sets the metadata for this <code>CachedRowSetImpl</code> object |
|
6255 |
* with the given <code>RowSetMetaData</code> object. |
|
6256 |
* |
|
6257 |
* @param md a <code>RowSetMetaData</code> object instance containing |
|
6258 |
* metadata about the columsn in the rowset |
|
6259 |
* @throws SQLException if invalid meta data is supplied to the |
|
6260 |
* rowset |
|
6261 |
*/ |
|
6262 |
public void setMetaData(RowSetMetaData md) throws SQLException { |
|
6263 |
RowSetMD =(RowSetMetaDataImpl) md; |
|
6264 |
} |
|
6265 |
||
6266 |
/** |
|
6267 |
* Returns a result set containing the original value of the rowset. The |
|
6268 |
* original value is the state of the <code>CachedRowSetImpl</code> after the |
|
6269 |
* last population or synchronization (whichever occured most recently) with |
|
6270 |
* the data source. |
|
6271 |
* <p> |
|
6272 |
* The cursor is positioned before the first row in the result set. |
|
6273 |
* Only rows contained in the result set returned by <code>getOriginal()</code> |
|
6274 |
* are said to have an original value. |
|
6275 |
* |
|
6276 |
* @return the original result set of the rowset |
|
6277 |
* @throws SQLException if an error occurs produce the |
|
6278 |
* <code>ResultSet</code> object |
|
6279 |
*/ |
|
6280 |
public ResultSet getOriginal() throws SQLException { |
|
6281 |
CachedRowSetImpl crs = new CachedRowSetImpl(); |
|
6282 |
crs.RowSetMD = RowSetMD; |
|
6283 |
crs.numRows = numRows; |
|
6284 |
crs.cursorPos = 0; |
|
6285 |
||
6286 |
// make sure we don't get someone playing with these |
|
6287 |
// %%% is this now necessary ??? |
|
6288 |
//crs.setReader(null); |
|
6289 |
//crs.setWriter(null); |
|
6290 |
int colCount = RowSetMD.getColumnCount(); |
|
6291 |
Row orig; |
|
6292 |
||
11129
f9ad1aadf3fa
7116445: Miscellaneous warnings in the JDBC/RowSet classes
lancea
parents:
9537
diff
changeset
|
6293 |
for (Iterator<?> i = rvh.iterator(); i.hasNext();) { |
2 | 6294 |
orig = new Row(colCount, ((Row)i.next()).getOrigRow()); |
6295 |
crs.rvh.add(orig); |
|
6296 |
} |
|
6297 |
return (ResultSet)crs; |
|
6298 |
} |
|
6299 |
||
6300 |
/** |
|
6301 |
* Returns a result set containing the original value of the current |
|
6302 |
* row only. |
|
6303 |
* The original value is the state of the <code>CachedRowSetImpl</code> after |
|
6304 |
* the last population or synchronization (whichever occured most recently) |
|
6305 |
* with the data source. |
|
6306 |
* |
|
6307 |
* @return the original result set of the row |
|
6308 |
* @throws SQLException if there is no current row |
|
6309 |
* @see #setOriginalRow |
|
6310 |
*/ |
|
6311 |
public ResultSet getOriginalRow() throws SQLException { |
|
6312 |
CachedRowSetImpl crs = new CachedRowSetImpl(); |
|
6313 |
crs.RowSetMD = RowSetMD; |
|
6314 |
crs.numRows = 1; |
|
6315 |
crs.cursorPos = 0; |
|
6530
bfb7b294dd14
6680198: UnmarshalException caused by incompatible serialVersionUID
lancea
parents:
5506
diff
changeset
|
6316 |
crs.setTypeMap(this.getTypeMap()); |
2 | 6317 |
|
6318 |
// make sure we don't get someone playing with these |
|
6319 |
// %%% is this now necessary ??? |
|
6320 |
//crs.setReader(null); |
|
6321 |
//crs.setWriter(null); |
|
6322 |
||
6323 |
Row orig = new Row(RowSetMD.getColumnCount(), |
|
6324 |
getCurrentRow().getOrigRow()); |
|
6325 |
||
6326 |
crs.rvh.add(orig); |
|
6327 |
||
6328 |
return (ResultSet)crs; |
|
6329 |
||
6330 |
} |
|
6331 |
||
6332 |
/** |
|
6333 |
* Marks the current row in this rowset as being an original row. |
|
6334 |
* |
|
6335 |
* @throws SQLException if there is no current row |
|
6336 |
* @see #getOriginalRow |
|
6337 |
*/ |
|
6338 |
public void setOriginalRow() throws SQLException { |
|
6339 |
if (onInsertRow == true) { |
|
6340 |
throw new SQLException(resBundle.handleGetObject("cachedrowsetimpl.invalidop").toString()); |
|
6341 |
} |
|
6342 |
||
6343 |
Row row = (Row)getCurrentRow(); |
|
6344 |
makeRowOriginal(row); |
|
6345 |
||
6346 |
// this can happen if deleted rows are being shown |
|
6347 |
if (row.getDeleted() == true) { |
|
6348 |
removeCurrentRow(); |
|
6349 |
} |
|
6350 |
} |
|
6351 |
||
6352 |
/** |
|
6353 |
* Makes the given row of this rowset the original row by clearing any |
|
6354 |
* settings that mark the row as having been inserted, deleted, or updated. |
|
6355 |
* This method is called internally by the methods |
|
6356 |
* <code>setOriginalRow</code> |
|
6357 |
* and <code>setOriginal</code>. |
|
6358 |
* |
|
6359 |
* @param row the row to be made the original row |
|
6360 |
*/ |
|
6361 |
private void makeRowOriginal(Row row) { |
|
6362 |
if (row.getInserted() == true) { |
|
6363 |
row.clearInserted(); |
|
6364 |
} |
|
6365 |
||
6366 |
if (row.getUpdated() == true) { |
|
6367 |
row.moveCurrentToOrig(); |
|
6368 |
} |
|
6369 |
} |
|
6370 |
||
6371 |
/** |
|
6372 |
* Marks all rows in this rowset as being original rows. Any updates |
|
6373 |
* made to the rows become the original values for the rowset. |
|
6374 |
* Calls to the method <code>setOriginal</code> connot be reversed. |
|
6375 |
* |
|
6376 |
* @throws SQLException if an error occurs |
|
6377 |
*/ |
|
6378 |
public void setOriginal() throws SQLException { |
|
11129
f9ad1aadf3fa
7116445: Miscellaneous warnings in the JDBC/RowSet classes
lancea
parents:
9537
diff
changeset
|
6379 |
for (Iterator<?> i = rvh.iterator(); i.hasNext();) { |
2 | 6380 |
Row row = (Row)i.next(); |
6381 |
makeRowOriginal(row); |
|
6382 |
// remove deleted rows from the collection. |
|
6383 |
if (row.getDeleted() == true) { |
|
6384 |
i.remove(); |
|
6385 |
--numRows; |
|
6386 |
} |
|
6387 |
} |
|
6388 |
numDeleted = 0; |
|
6389 |
||
6390 |
// notify any listeners that the rowset has changed |
|
6391 |
notifyRowSetChanged(); |
|
6392 |
} |
|
6393 |
||
6394 |
/** |
|
6395 |
* Returns an identifier for the object (table) that was used to create this |
|
6396 |
* rowset. |
|
6397 |
* |
|
6398 |
* @return a <code>String</code> object that identifies the table from |
|
6399 |
* which this <code>CachedRowSetImpl</code> object was derived |
|
6400 |
* @throws SQLException if an error occurs |
|
6401 |
*/ |
|
6402 |
public String getTableName() throws SQLException { |
|
6403 |
return tableName; |
|
6404 |
} |
|
6405 |
||
6406 |
/** |
|
6407 |
* Sets the identifier for the table from which this rowset was derived |
|
6408 |
* to the given table name. |
|
6409 |
* |
|
6410 |
* @param tabName a <code>String</code> object that identifies the |
|
6411 |
* table from which this <code>CachedRowSetImpl</code> object |
|
6412 |
* was derived |
|
6413 |
* @throws SQLException if an error occurs |
|
6414 |
*/ |
|
6415 |
public void setTableName(String tabName) throws SQLException { |
|
6416 |
if (tabName == null) |
|
6417 |
throw new SQLException(resBundle.handleGetObject("cachedrowsetimpl.tablename").toString()); |
|
6418 |
else |
|
6692
aef4e294026f
6988993: Address Findbugs warnings for the use of String Constructor
lancea
parents:
6664
diff
changeset
|
6419 |
tableName = tabName; |
2 | 6420 |
} |
6421 |
||
6422 |
/** |
|
6423 |
* Returns the columns that make a key to uniquely identify a |
|
6424 |
* row in this <code>CachedRowSetImpl</code> object. |
|
6425 |
* |
|
6426 |
* @return an array of column numbers that constitutes a primary |
|
6427 |
* key for this rowset. This array should be empty |
|
6428 |
* if no column is representitive of a primary key |
|
6429 |
* @throws SQLException if the rowset is empty or no columns |
|
6430 |
* are designated as primary keys |
|
6431 |
* @see #setKeyColumns |
|
6432 |
*/ |
|
6433 |
public int[] getKeyColumns() throws SQLException { |
|
11683
5e02efd89af6
7133815: address the findbug errors in CachedRowSetImpl, SerialStruct, BaseRow, SerialInputImpl, SerialOutputImpl
lancea
parents:
11129
diff
changeset
|
6434 |
int[]keyColumns = this.keyCols; |
5e02efd89af6
7133815: address the findbug errors in CachedRowSetImpl, SerialStruct, BaseRow, SerialInputImpl, SerialOutputImpl
lancea
parents:
11129
diff
changeset
|
6435 |
return (keyColumns == null) ? null : Arrays.copyOf(keyColumns, keyColumns.length); |
2 | 6436 |
} |
6437 |
||
6438 |
||
6439 |
/** |
|
6440 |
* Sets this <code>CachedRowSetImpl</code> object's |
|
6441 |
* <code>keyCols</code> field with the given array of column |
|
6442 |
* numbers, which forms a key for uniquely identifying a row |
|
6443 |
* in this rowset. |
|
6444 |
* |
|
6445 |
* @param keys an array of <code>int</code> indicating the |
|
6446 |
* columns that form a primary key for this |
|
6447 |
* <code>CachedRowSetImpl</code> object; every |
|
6448 |
* element in the array must be greater than |
|
6449 |
* <code>0</code> and less than or equal to the number |
|
6450 |
* of columns in this rowset |
|
6451 |
* @throws SQLException if any of the numbers in the |
|
6452 |
* given array is not valid for this rowset |
|
6453 |
* @see #getKeyColumns |
|
6454 |
*/ |
|
6455 |
public void setKeyColumns(int [] keys) throws SQLException { |
|
6456 |
int numCols = 0; |
|
6457 |
if (RowSetMD != null) { |
|
6458 |
numCols = RowSetMD.getColumnCount(); |
|
6459 |
if (keys.length > numCols) |
|
6460 |
throw new SQLException(resBundle.handleGetObject("cachedrowsetimpl.keycols").toString()); |
|
6461 |
} |
|
6462 |
keyCols = new int[keys.length]; |
|
6463 |
for (int i = 0; i < keys.length; i++) { |
|
6464 |
if (RowSetMD != null && (keys[i] <= 0 || |
|
6465 |
keys[i] > numCols)) { |
|
6466 |
throw new SQLException(resBundle.handleGetObject("cachedrowsetimpl.invalidcol").toString() + |
|
6467 |
keys[i]); |
|
6468 |
} |
|
6469 |
keyCols[i] = keys[i]; |
|
6470 |
} |
|
6471 |
} |
|
6472 |
||
6473 |
/** |
|
6474 |
* Sets the designated column in either the current row or the insert |
|
6475 |
* row of this <code>CachedRowSetImpl</code> object with the given |
|
6476 |
* <code>Ref</code> value. |
|
6477 |
* |
|
6478 |
* This method updates a column value in either the current row or |
|
6479 |
* the insert row of this rowset, but it does not update the |
|
6480 |
* database. If the cursor is on a row in the rowset, the |
|
6481 |
* method {@link #updateRow} must be called to update the database. |
|
6482 |
* If the cursor is on the insert row, the method {@link #insertRow} |
|
6483 |
* must be called, which will insert the new row into both this rowset |
|
6484 |
* and the database. Both of these methods must be called before the |
|
6485 |
* cursor moves to another row. |
|
6486 |
* |
|
6487 |
* @param columnIndex the first column is <code>1</code>, the second |
|
6488 |
* is <code>2</code>, and so on; must be <code>1</code> or larger |
|
6489 |
* and equal to or less than the number of columns in this rowset |
|
6490 |
* @param ref the new column <code>java.sql.Ref</code> value |
|
6491 |
* @throws SQLException if (1) the given column index is out of bounds, |
|
6492 |
* (2) the cursor is not on one of this rowset's rows or its |
|
6493 |
* insert row, or (3) this rowset is |
|
6494 |
* <code>ResultSet.CONCUR_READ_ONLY</code> |
|
6495 |
*/ |
|
6496 |
public void updateRef(int columnIndex, java.sql.Ref ref) throws SQLException { |
|
6497 |
// sanity check. |
|
6498 |
checkIndex(columnIndex); |
|
6499 |
// make sure the cursor is on a valid row |
|
6500 |
checkCursor(); |
|
6501 |
||
6502 |
// SerialClob will help in getting the byte array and storing it. |
|
6503 |
// We need to be checking DatabaseMetaData.locatorsUpdatorCopy() |
|
6504 |
// or through RowSetMetaData.locatorsUpdatorCopy() |
|
6505 |
getCurrentRow().setColumnObject(columnIndex, new SerialRef(ref)); |
|
6506 |
} |
|
6507 |
||
6508 |
/** |
|
6509 |
* Sets the designated column in either the current row or the insert |
|
6510 |
* row of this <code>CachedRowSetImpl</code> object with the given |
|
6511 |
* <code>double</code> value. |
|
6512 |
* |
|
6513 |
* This method updates a column value in either the current row or |
|
6514 |
* the insert row of this rowset, but it does not update the |
|
6515 |
* database. If the cursor is on a row in the rowset, the |
|
6516 |
* method {@link #updateRow} must be called to update the database. |
|
6517 |
* If the cursor is on the insert row, the method {@link #insertRow} |
|
6518 |
* must be called, which will insert the new row into both this rowset |
|
6519 |
* and the database. Both of these methods must be called before the |
|
6520 |
* cursor moves to another row. |
|
6521 |
* |
|
6522 |
* @param columnName a <code>String</code> object that must match the |
|
6523 |
* SQL name of a column in this rowset, ignoring case |
|
6524 |
* @param ref the new column <code>java.sql.Ref</code> value |
|
6525 |
* @throws SQLException if (1) the given column name does not match the |
|
6526 |
* name of a column in this rowset, (2) the cursor is not on |
|
6527 |
* one of this rowset's rows or its insert row, or (3) this |
|
6528 |
* rowset is <code>ResultSet.CONCUR_READ_ONLY</code> |
|
6529 |
*/ |
|
6530 |
public void updateRef(String columnName, java.sql.Ref ref) throws SQLException { |
|
6531 |
updateRef(getColIdxByName(columnName), ref); |
|
6532 |
} |
|
6533 |
||
6534 |
/** |
|
6535 |
* Sets the designated column in either the current row or the insert |
|
6536 |
* row of this <code>CachedRowSetImpl</code> object with the given |
|
6537 |
* <code>double</code> value. |
|
6538 |
* |
|
6539 |
* This method updates a column value in either the current row or |
|
6540 |
* the insert row of this rowset, but it does not update the |
|
6541 |
* database. If the cursor is on a row in the rowset, the |
|
6542 |
* method {@link #updateRow} must be called to update the database. |
|
6543 |
* If the cursor is on the insert row, the method {@link #insertRow} |
|
6544 |
* must be called, which will insert the new row into both this rowset |
|
6545 |
* and the database. Both of these methods must be called before the |
|
6546 |
* cursor moves to another row. |
|
6547 |
* |
|
6548 |
* @param columnIndex the first column is <code>1</code>, the second |
|
6549 |
* is <code>2</code>, and so on; must be <code>1</code> or larger |
|
6550 |
* and equal to or less than the number of columns in this rowset |
|
6551 |
* @param c the new column <code>Clob</code> value |
|
6552 |
* @throws SQLException if (1) the given column index is out of bounds, |
|
6553 |
* (2) the cursor is not on one of this rowset's rows or its |
|
6554 |
* insert row, or (3) this rowset is |
|
6555 |
* <code>ResultSet.CONCUR_READ_ONLY</code> |
|
6556 |
*/ |
|
6557 |
public void updateClob(int columnIndex, Clob c) throws SQLException { |
|
6558 |
// sanity check. |
|
6559 |
checkIndex(columnIndex); |
|
6560 |
// make sure the cursor is on a valid row |
|
6561 |
checkCursor(); |
|
6562 |
||
6563 |
// SerialClob will help in getting the byte array and storing it. |
|
6564 |
// We need to be checking DatabaseMetaData.locatorsUpdatorCopy() |
|
6565 |
// or through RowSetMetaData.locatorsUpdatorCopy() |
|
6566 |
||
6567 |
if(dbmslocatorsUpdateCopy){ |
|
6568 |
getCurrentRow().setColumnObject(columnIndex, new SerialClob(c)); |
|
6569 |
} |
|
6570 |
else{ |
|
6571 |
throw new SQLException(resBundle.handleGetObject("cachedrowsetimpl.opnotsupp").toString()); |
|
6572 |
} |
|
6573 |
} |
|
6574 |
||
6575 |
/** |
|
6576 |
* Sets the designated column in either the current row or the insert |
|
6577 |
* row of this <code>CachedRowSetImpl</code> object with the given |
|
6578 |
* <code>double</code> value. |
|
6579 |
* |
|
6580 |
* This method updates a column value in either the current row or |
|
6581 |
* the insert row of this rowset, but it does not update the |
|
6582 |
* database. If the cursor is on a row in the rowset, the |
|
6583 |
* method {@link #updateRow} must be called to update the database. |
|
6584 |
* If the cursor is on the insert row, the method {@link #insertRow} |
|
6585 |
* must be called, which will insert the new row into both this rowset |
|
6586 |
* and the database. Both of these methods must be called before the |
|
6587 |
* cursor moves to another row. |
|
6588 |
* |
|
6589 |
* @param columnName a <code>String</code> object that must match the |
|
6590 |
* SQL name of a column in this rowset, ignoring case |
|
6591 |
* @param c the new column <code>Clob</code> value |
|
6592 |
* @throws SQLException if (1) the given column name does not match the |
|
6593 |
* name of a column in this rowset, (2) the cursor is not on |
|
6594 |
* one of this rowset's rows or its insert row, or (3) this |
|
6595 |
* rowset is <code>ResultSet.CONCUR_READ_ONLY</code> |
|
6596 |
*/ |
|
6597 |
public void updateClob(String columnName, Clob c) throws SQLException { |
|
6598 |
updateClob(getColIdxByName(columnName), c); |
|
6599 |
} |
|
6600 |
||
6601 |
/** |
|
6602 |
* Sets the designated column in either the current row or the insert |
|
6603 |
* row of this <code>CachedRowSetImpl</code> object with the given |
|
6604 |
* <code>java.sql.Blob</code> value. |
|
6605 |
* |
|
6606 |
* This method updates a column value in either the current row or |
|
6607 |
* the insert row of this rowset, but it does not update the |
|
6608 |
* database. If the cursor is on a row in the rowset, the |
|
6609 |
* method {@link #updateRow} must be called to update the database. |
|
6610 |
* If the cursor is on the insert row, the method {@link #insertRow} |
|
6611 |
* must be called, which will insert the new row into both this rowset |
|
6612 |
* and the database. Both of these methods must be called before the |
|
6613 |
* cursor moves to another row. |
|
6614 |
* |
|
6615 |
* @param columnIndex the first column is <code>1</code>, the second |
|
6616 |
* is <code>2</code>, and so on; must be <code>1</code> or larger |
|
6617 |
* and equal to or less than the number of columns in this rowset |
|
6618 |
* @param b the new column <code>Blob</code> value |
|
6619 |
* @throws SQLException if (1) the given column index is out of bounds, |
|
6620 |
* (2) the cursor is not on one of this rowset's rows or its |
|
6621 |
* insert row, or (3) this rowset is |
|
6622 |
* <code>ResultSet.CONCUR_READ_ONLY</code> |
|
6623 |
*/ |
|
6624 |
public void updateBlob(int columnIndex, Blob b) throws SQLException { |
|
6625 |
// sanity check. |
|
6626 |
checkIndex(columnIndex); |
|
6627 |
// make sure the cursor is on a valid row |
|
6628 |
checkCursor(); |
|
6629 |
||
6630 |
// SerialBlob will help in getting the byte array and storing it. |
|
6631 |
// We need to be checking DatabaseMetaData.locatorsUpdatorCopy() |
|
6632 |
// or through RowSetMetaData.locatorsUpdatorCopy() |
|
6633 |
||
6634 |
if(dbmslocatorsUpdateCopy){ |
|
6635 |
getCurrentRow().setColumnObject(columnIndex, new SerialBlob(b)); |
|
6636 |
} |
|
6637 |
else{ |
|
6638 |
throw new SQLException(resBundle.handleGetObject("cachedrowsetimpl.opnotsupp").toString()); |
|
6639 |
} |
|
6640 |
} |
|
6641 |
||
6642 |
/** |
|
6643 |
* Sets the designated column in either the current row or the insert |
|
6644 |
* row of this <code>CachedRowSetImpl</code> object with the given |
|
6645 |
* <code>java.sql.Blob </code> value. |
|
6646 |
* |
|
6647 |
* This method updates a column value in either the current row or |
|
6648 |
* the insert row of this rowset, but it does not update the |
|
6649 |
* database. If the cursor is on a row in the rowset, the |
|
6650 |
* method {@link #updateRow} must be called to update the database. |
|
6651 |
* If the cursor is on the insert row, the method {@link #insertRow} |
|
6652 |
* must be called, which will insert the new row into both this rowset |
|
6653 |
* and the database. Both of these methods must be called before the |
|
6654 |
* cursor moves to another row. |
|
6655 |
* |
|
6656 |
* @param columnName a <code>String</code> object that must match the |
|
6657 |
* SQL name of a column in this rowset, ignoring case |
|
6658 |
* @param b the new column <code>Blob</code> value |
|
6659 |
* @throws SQLException if (1) the given column name does not match the |
|
6660 |
* name of a column in this rowset, (2) the cursor is not on |
|
6661 |
* one of this rowset's rows or its insert row, or (3) this |
|
6662 |
* rowset is <code>ResultSet.CONCUR_READ_ONLY</code> |
|
6663 |
*/ |
|
6664 |
public void updateBlob(String columnName, Blob b) throws SQLException { |
|
6665 |
updateBlob(getColIdxByName(columnName), b); |
|
6666 |
} |
|
6667 |
||
6668 |
/** |
|
6669 |
* Sets the designated column in either the current row or the insert |
|
6670 |
* row of this <code>CachedRowSetImpl</code> object with the given |
|
6671 |
* <code>java.sql.Array</code> values. |
|
6672 |
* |
|
6673 |
* This method updates a column value in either the current row or |
|
6674 |
* the insert row of this rowset, but it does not update the |
|
6675 |
* database. If the cursor is on a row in the rowset, the |
|
6676 |
* method {@link #updateRow} must be called to update the database. |
|
6677 |
* If the cursor is on the insert row, the method {@link #insertRow} |
|
6678 |
* must be called, which will insert the new row into both this rowset |
|
6679 |
* and the database. Both of these methods must be called before the |
|
6680 |
* cursor moves to another row. |
|
6681 |
* |
|
6682 |
* @param columnIndex the first column is <code>1</code>, the second |
|
6683 |
* is <code>2</code>, and so on; must be <code>1</code> or larger |
|
6684 |
* and equal to or less than the number of columns in this rowset |
|
6685 |
* @param a the new column <code>Array</code> value |
|
6686 |
* @throws SQLException if (1) the given column index is out of bounds, |
|
6687 |
* (2) the cursor is not on one of this rowset's rows or its |
|
6688 |
* insert row, or (3) this rowset is |
|
6689 |
* <code>ResultSet.CONCUR_READ_ONLY</code> |
|
6690 |
*/ |
|
6691 |
public void updateArray(int columnIndex, Array a) throws SQLException { |
|
6692 |
// sanity check. |
|
6693 |
checkIndex(columnIndex); |
|
6694 |
// make sure the cursor is on a valid row |
|
6695 |
checkCursor(); |
|
6696 |
||
6697 |
// SerialArray will help in getting the byte array and storing it. |
|
6698 |
// We need to be checking DatabaseMetaData.locatorsUpdatorCopy() |
|
6699 |
// or through RowSetMetaData.locatorsUpdatorCopy() |
|
6700 |
getCurrentRow().setColumnObject(columnIndex, new SerialArray(a)); |
|
6701 |
} |
|
6702 |
||
6703 |
/** |
|
6704 |
* Sets the designated column in either the current row or the insert |
|
6705 |
* row of this <code>CachedRowSetImpl</code> object with the given |
|
6706 |
* <code>java.sql.Array</code> value. |
|
6707 |
* |
|
6708 |
* This method updates a column value in either the current row or |
|
6709 |
* the insert row of this rowset, but it does not update the |
|
6710 |
* database. If the cursor is on a row in the rowset, the |
|
6711 |
* method {@link #updateRow} must be called to update the database. |
|
6712 |
* If the cursor is on the insert row, the method {@link #insertRow} |
|
6713 |
* must be called, which will insert the new row into both this rowset |
|
6714 |
* and the database. Both of these methods must be called before the |
|
6715 |
* cursor moves to another row. |
|
6716 |
* |
|
6717 |
* @param columnName a <code>String</code> object that must match the |
|
6718 |
* SQL name of a column in this rowset, ignoring case |
|
6719 |
* @param a the new column <code>Array</code> value |
|
6720 |
* @throws SQLException if (1) the given column name does not match the |
|
6721 |
* name of a column in this rowset, (2) the cursor is not on |
|
6722 |
* one of this rowset's rows or its insert row, or (3) this |
|
6723 |
* rowset is <code>ResultSet.CONCUR_READ_ONLY</code> |
|
6724 |
*/ |
|
6725 |
public void updateArray(String columnName, Array a) throws SQLException { |
|
6726 |
updateArray(getColIdxByName(columnName), a); |
|
6727 |
} |
|
6728 |
||
6729 |
||
6730 |
/** |
|
6731 |
* Retrieves the value of the designated column in this |
|
6732 |
* <code>CachedRowSetImpl</code> object as a <code>java.net.URL</code> object |
|
6733 |
* in the Java programming language. |
|
6734 |
* |
|
6735 |
* @return a java.net.URL object containing the resource reference described by |
|
6736 |
* the URL |
|
6737 |
* @throws SQLException if (1) the given column index is out of bounds, |
|
6738 |
* (2) the cursor is not on one of this rowset's rows or its |
|
6739 |
* insert row, or (3) the designated column does not store an |
|
6740 |
* SQL <code>DATALINK</code> value. |
|
6741 |
* @see #getURL(String) |
|
6742 |
*/ |
|
6743 |
public java.net.URL getURL(int columnIndex) throws SQLException { |
|
6744 |
//throw new SQLException("Operation not supported"); |
|
6745 |
||
6746 |
java.net.URL value; |
|
6747 |
||
6748 |
// sanity check. |
|
6749 |
checkIndex(columnIndex); |
|
6750 |
// make sure the cursor is on a valid row |
|
6751 |
checkCursor(); |
|
6752 |
||
6753 |
if (RowSetMD.getColumnType(columnIndex) != java.sql.Types.DATALINK) { |
|
6754 |
throw new SQLException(resBundle.handleGetObject("cachedrowsetimpl.dtypemismt").toString()); |
|
6755 |
} |
|
6756 |
||
6757 |
setLastValueNull(false); |
|
6758 |
value = (java.net.URL)(getCurrentRow().getColumnObject(columnIndex)); |
|
6759 |
||
6760 |
// check for SQL NULL |
|
6761 |
if (value == null) { |
|
6762 |
setLastValueNull(true); |
|
6763 |
return null; |
|
6764 |
} |
|
6765 |
||
6766 |
return value; |
|
6767 |
} |
|
6768 |
||
6769 |
/** |
|
6770 |
* Retrieves the value of the designated column in this |
|
6771 |
* <code>CachedRowSetImpl</code> object as a <code>java.net.URL</code> object |
|
6772 |
* in the Java programming language. |
|
6773 |
* |
|
6774 |
* @return a java.net.URL object containing the resource reference described by |
|
6775 |
* the URL |
|
6776 |
* @throws SQLException if (1) the given column name not the name of a column |
|
6777 |
* in this rowset, or |
|
6778 |
* (2) the cursor is not on one of this rowset's rows or its |
|
6779 |
* insert row, or (3) the designated column does not store an |
|
6780 |
* SQL <code>DATALINK</code> value. |
|
6781 |
* @see #getURL(int) |
|
6782 |
*/ |
|
6783 |
public java.net.URL getURL(String columnName) throws SQLException { |
|
6784 |
return getURL(getColIdxByName(columnName)); |
|
6785 |
||
6786 |
} |
|
6787 |
||
6788 |
/** |
|
6789 |
* The first warning reported by calls on this <code>CachedRowSetImpl</code> |
|
6790 |
* object is returned. Subsequent <code>CachedRowSetImpl</code> warnings will |
|
6791 |
* be chained to this <code>SQLWarning</code>. All <code>RowSetWarnings</code> |
|
6792 |
* warnings are generated in the disconnected environment and remain a |
|
6793 |
* seperate warning chain to that provided by the <code>getWarnings</code> |
|
6794 |
* method. |
|
6795 |
* |
|
6796 |
* <P>The warning chain is automatically cleared each time a new |
|
6797 |
* row is read. |
|
6798 |
* |
|
6799 |
* <P><B>Note:</B> This warning chain only covers warnings caused |
|
6800 |
* by <code>CachedRowSet</code> (and their child interface) |
|
6801 |
* methods. All <code>SQLWarnings</code> can be obtained using the |
|
6802 |
* <code>getWarnings</code> method which tracks warnings generated |
|
6803 |
* by the underlying JDBC driver. |
|
6804 |
* @return the first SQLWarning or null |
|
6805 |
* |
|
6806 |
*/ |
|
6807 |
public RowSetWarning getRowSetWarnings() { |
|
6808 |
try { |
|
6809 |
notifyCursorMoved(); |
|
6810 |
} catch (SQLException e) {} // mask exception |
|
6811 |
return rowsetWarning; |
|
6812 |
} |
|
6813 |
||
6814 |
||
6815 |
/** |
|
6816 |
* The function tries to isolate the tablename when only setCommand |
|
6817 |
* is set and not setTablename is called provided there is only one table |
|
6818 |
* name in the query else just leaves the setting of table name as such. |
|
6819 |
* If setTablename is set later it will over ride this table name |
|
6820 |
* value so retrieved. |
|
6821 |
* |
|
6822 |
* @return the tablename if only one table in query else return "" |
|
6823 |
*/ |
|
6824 |
private String buildTableName(String command) throws SQLException { |
|
6825 |
||
6826 |
// If we have a query from one table, |
|
6827 |
// we set the table name implicitly |
|
6828 |
// else user has to explicitly set the table name. |
|
6829 |
||
6830 |
int indexFrom, indexComma; |
|
6831 |
String strTablename =""; |
|
6832 |
command = command.trim(); |
|
6833 |
||
6834 |
// Query can be a select, insert or update |
|
6835 |
||
6836 |
if(command.toLowerCase().startsWith("select")) { |
|
6837 |
// look for "from" keyword, after that look for a |
|
6838 |
// comma after from. If comma is there don't set |
|
6839 |
// table name else isolate table name. |
|
6840 |
||
6841 |
indexFrom = command.toLowerCase().indexOf("from"); |
|
6842 |
indexComma = command.indexOf(",", indexFrom); |
|
6843 |
||
6844 |
if(indexComma == -1) { |
|
6845 |
// implies only one table |
|
6846 |
strTablename = (command.substring(indexFrom+"from".length(),command.length())).trim(); |
|
6847 |
||
6848 |
String tabName = strTablename; |
|
6849 |
||
6850 |
int idxWhere = tabName.toLowerCase().indexOf("where"); |
|
6851 |
||
6852 |
/** |
|
6853 |
* Adding the addtional check for conditions following the table name. |
|
6854 |
* If a condition is found truncate it. |
|
6855 |
**/ |
|
6856 |
||
6857 |
if(idxWhere != -1) |
|
6858 |
{ |
|
6859 |
tabName = tabName.substring(0,idxWhere).trim(); |
|
6860 |
} |
|
6861 |
||
6862 |
strTablename = tabName; |
|
6863 |
||
6864 |
} else { |
|
6865 |
//strTablename=""; |
|
6866 |
} |
|
6867 |
||
6868 |
} else if(command.toLowerCase().startsWith("insert")) { |
|
6869 |
//strTablename=""; |
|
6870 |
} else if(command.toLowerCase().startsWith("update")) { |
|
6871 |
//strTablename=""; |
|
6872 |
} |
|
6873 |
return strTablename; |
|
6874 |
} |
|
6875 |
||
6876 |
/** |
|
6877 |
* Commits all changes performed by the <code>acceptChanges()</code> |
|
6878 |
* methods |
|
6879 |
* |
|
6880 |
* @see java.sql.Connection#commit |
|
6881 |
*/ |
|
6882 |
public void commit() throws SQLException { |
|
6883 |
conn.commit(); |
|
6884 |
} |
|
6885 |
||
6886 |
/** |
|
6887 |
* Rolls back all changes performed by the <code>acceptChanges()</code> |
|
6888 |
* methods |
|
6889 |
* |
|
6890 |
* @see java.sql.Connection#rollback |
|
6891 |
*/ |
|
6892 |
public void rollback() throws SQLException { |
|
6893 |
conn.rollback(); |
|
6894 |
} |
|
6895 |
||
6896 |
/** |
|
6897 |
* Rolls back all changes performed by the <code>acceptChanges()</code> |
|
6898 |
* to the last <code>Savepoint</code> transaction marker. |
|
6899 |
* |
|
6900 |
* @see java.sql.Connection#rollback(Savepoint) |
|
6901 |
*/ |
|
6902 |
public void rollback(Savepoint s) throws SQLException { |
|
6903 |
conn.rollback(s); |
|
6904 |
} |
|
6905 |
||
6906 |
/** |
|
6907 |
* Unsets the designated parameter to the given int array. |
|
6908 |
* This was set using <code>setMatchColumn</code> |
|
6909 |
* as the column which will form the basis of the join. |
|
6910 |
* <P> |
|
6911 |
* The parameter value unset by this method should be same |
|
6912 |
* as was set. |
|
6913 |
* |
|
6914 |
* @param columnIdxes the index into this rowset |
|
6915 |
* object's internal representation of parameter values |
|
6916 |
* @throws SQLException if an error occurs or the |
|
6917 |
* parameter index is out of bounds or if the columnIdx is |
|
6918 |
* not the same as set using <code>setMatchColumn(int [])</code> |
|
6919 |
*/ |
|
6920 |
public void unsetMatchColumn(int[] columnIdxes) throws SQLException { |
|
6921 |
||
6922 |
int i_val; |
|
6923 |
for( int j= 0 ;j < columnIdxes.length; j++) { |
|
6924 |
i_val = (Integer.parseInt(iMatchColumns.get(j).toString())); |
|
6925 |
if(columnIdxes[j] != i_val) { |
|
6926 |
throw new SQLException(resBundle.handleGetObject("cachedrowsetimpl.matchcols").toString()); |
|
6927 |
} |
|
6928 |
} |
|
6929 |
||
6930 |
for( int i = 0;i < columnIdxes.length ;i++) { |
|
11129
f9ad1aadf3fa
7116445: Miscellaneous warnings in the JDBC/RowSet classes
lancea
parents:
9537
diff
changeset
|
6931 |
iMatchColumns.set(i, -1); |
2 | 6932 |
} |
6933 |
} |
|
6934 |
||
6935 |
/** |
|
6936 |
* Unsets the designated parameter to the given String array. |
|
6937 |
* This was set using <code>setMatchColumn</code> |
|
6938 |
* as the column which will form the basis of the join. |
|
6939 |
* <P> |
|
6940 |
* The parameter value unset by this method should be same |
|
6941 |
* as was set. |
|
6942 |
* |
|
6943 |
* @param columnIdxes the index into this rowset |
|
6944 |
* object's internal representation of parameter values |
|
6945 |
* @throws SQLException if an error occurs or the |
|
6946 |
* parameter index is out of bounds or if the columnName is |
|
6947 |
* not the same as set using <code>setMatchColumn(String [])</code> |
|
6948 |
*/ |
|
6949 |
public void unsetMatchColumn(String[] columnIdxes) throws SQLException { |
|
6950 |
||
6951 |
for(int j = 0 ;j < columnIdxes.length; j++) { |
|
6952 |
if( !columnIdxes[j].equals(strMatchColumns.get(j)) ){ |
|
6953 |
throw new SQLException(resBundle.handleGetObject("cachedrowsetimpl.matchcols").toString()); |
|
6954 |
} |
|
6955 |
} |
|
6956 |
||
6957 |
for(int i = 0 ; i < columnIdxes.length; i++) { |
|
6958 |
strMatchColumns.set(i,null); |
|
6959 |
} |
|
6960 |
} |
|
6961 |
||
6962 |
/** |
|
6963 |
* Retrieves the column name as <code>String</code> array |
|
6964 |
* that was set using <code>setMatchColumn(String [])</code> |
|
6965 |
* for this rowset. |
|
6966 |
* |
|
6967 |
* @return a <code>String</code> array object that contains the column names |
|
6968 |
* for the rowset which has this the match columns |
|
6969 |
* |
|
6970 |
* @throws SQLException if an error occurs or column name is not set |
|
6971 |
*/ |
|
6972 |
public String[] getMatchColumnNames() throws SQLException { |
|
6973 |
||
6974 |
String []str_temp = new String[strMatchColumns.size()]; |
|
6975 |
||
6976 |
if( strMatchColumns.get(0) == null) { |
|
6977 |
throw new SQLException(resBundle.handleGetObject("cachedrowsetimpl.setmatchcols").toString()); |
|
6978 |
} |
|
6979 |
||
6980 |
strMatchColumns.copyInto(str_temp); |
|
6981 |
return str_temp; |
|
6982 |
} |
|
6983 |
||
6984 |
/** |
|
6985 |
* Retrieves the column id as <code>int</code> array that was set using |
|
6986 |
* <code>setMatchColumn(int [])</code> for this rowset. |
|
6987 |
* |
|
6988 |
* @return a <code>int</code> array object that contains the column ids |
|
6989 |
* for the rowset which has this as the match columns. |
|
6990 |
* |
|
6991 |
* @throws SQLException if an error occurs or column index is not set |
|
6992 |
*/ |
|
6993 |
public int[] getMatchColumnIndexes() throws SQLException { |
|
6994 |
||
6995 |
Integer []int_temp = new Integer[iMatchColumns.size()]; |
|
6996 |
int [] i_temp = new int[iMatchColumns.size()]; |
|
6997 |
int i_val; |
|
6998 |
||
11129
f9ad1aadf3fa
7116445: Miscellaneous warnings in the JDBC/RowSet classes
lancea
parents:
9537
diff
changeset
|
6999 |
i_val = iMatchColumns.get(0); |
2 | 7000 |
|
7001 |
if( i_val == -1 ) { |
|
7002 |
throw new SQLException(resBundle.handleGetObject("cachedrowsetimpl.setmatchcols").toString()); |
|
7003 |
} |
|
7004 |
||
7005 |
||
7006 |
iMatchColumns.copyInto(int_temp); |
|
7007 |
||
7008 |
for(int i = 0; i < int_temp.length; i++) { |
|
7009 |
i_temp[i] = (int_temp[i]).intValue(); |
|
7010 |
} |
|
7011 |
||
7012 |
return i_temp; |
|
7013 |
} |
|
7014 |
||
7015 |
/** |
|
7016 |
* Sets the designated parameter to the given int array. |
|
7017 |
* This forms the basis of the join for the |
|
7018 |
* <code>JoinRowSet</code> as the column which will form the basis of the |
|
7019 |
* join. |
|
7020 |
* <P> |
|
7021 |
* The parameter value set by this method is stored internally and |
|
7022 |
* will be supplied as the appropriate parameter in this rowset's |
|
7023 |
* command when the method <code>getMatchColumnIndexes</code> is called. |
|
7024 |
* |
|
7025 |
* @param columnIdxes the indexes into this rowset |
|
7026 |
* object's internal representation of parameter values; the |
|
7027 |
* first parameter is 0, the second is 1, and so on; must be |
|
7028 |
* <code>0</code> or greater |
|
7029 |
* @throws SQLException if an error occurs or the |
|
7030 |
* parameter index is out of bounds |
|
7031 |
*/ |
|
7032 |
public void setMatchColumn(int[] columnIdxes) throws SQLException { |
|
7033 |
||
7034 |
for(int j = 0 ; j < columnIdxes.length; j++) { |
|
7035 |
if( columnIdxes[j] < 0 ) { |
|
7036 |
throw new SQLException(resBundle.handleGetObject("cachedrowsetimpl.matchcols1").toString()); |
|
7037 |
} |
|
7038 |
} |
|
7039 |
for(int i = 0 ;i < columnIdxes.length; i++) { |
|
11129
f9ad1aadf3fa
7116445: Miscellaneous warnings in the JDBC/RowSet classes
lancea
parents:
9537
diff
changeset
|
7040 |
iMatchColumns.add(i,columnIdxes[i]); |
2 | 7041 |
} |
7042 |
} |
|
7043 |
||
7044 |
/** |
|
7045 |
* Sets the designated parameter to the given String array. |
|
7046 |
* This forms the basis of the join for the |
|
7047 |
* <code>JoinRowSet</code> as the column which will form the basis of the |
|
7048 |
* join. |
|
7049 |
* <P> |
|
7050 |
* The parameter value set by this method is stored internally and |
|
7051 |
* will be supplied as the appropriate parameter in this rowset's |
|
7052 |
* command when the method <code>getMatchColumn</code> is called. |
|
7053 |
* |
|
7054 |
* @param columnNames the name of the column into this rowset |
|
7055 |
* object's internal representation of parameter values |
|
7056 |
* @throws SQLException if an error occurs or the |
|
7057 |
* parameter index is out of bounds |
|
7058 |
*/ |
|
7059 |
public void setMatchColumn(String[] columnNames) throws SQLException { |
|
7060 |
||
7061 |
for(int j = 0; j < columnNames.length; j++) { |
|
7062 |
if( columnNames[j] == null || columnNames[j].equals("")) { |
|
7063 |
throw new SQLException(resBundle.handleGetObject("cachedrowsetimpl.matchcols2").toString()); |
|
7064 |
} |
|
7065 |
} |
|
7066 |
for( int i = 0; i < columnNames.length; i++) { |
|
7067 |
strMatchColumns.add(i,columnNames[i]); |
|
7068 |
} |
|
7069 |
} |
|
7070 |
||
7071 |
||
7072 |
/** |
|
7073 |
* Sets the designated parameter to the given <code>int</code> |
|
7074 |
* object. This forms the basis of the join for the |
|
7075 |
* <code>JoinRowSet</code> as the column which will form the basis of the |
|
7076 |
* join. |
|
7077 |
* <P> |
|
7078 |
* The parameter value set by this method is stored internally and |
|
7079 |
* will be supplied as the appropriate parameter in this rowset's |
|
7080 |
* command when the method <code>getMatchColumn</code> is called. |
|
7081 |
* |
|
7082 |
* @param columnIdx the index into this rowset |
|
7083 |
* object's internal representation of parameter values; the |
|
7084 |
* first parameter is 0, the second is 1, and so on; must be |
|
7085 |
* <code>0</code> or greater |
|
7086 |
* @throws SQLException if an error occurs or the |
|
7087 |
* parameter index is out of bounds |
|
7088 |
*/ |
|
7089 |
public void setMatchColumn(int columnIdx) throws SQLException { |
|
7090 |
// validate, if col is ok to be set |
|
7091 |
if(columnIdx < 0) { |
|
7092 |
throw new SQLException(resBundle.handleGetObject("cachedrowsetimpl.matchcols1").toString()); |
|
7093 |
} else { |
|
7094 |
// set iMatchColumn |
|
11129
f9ad1aadf3fa
7116445: Miscellaneous warnings in the JDBC/RowSet classes
lancea
parents:
9537
diff
changeset
|
7095 |
iMatchColumns.set(0, columnIdx); |
2 | 7096 |
//strMatchColumn = null; |
7097 |
} |
|
7098 |
} |
|
7099 |
||
7100 |
/** |
|
7101 |
* Sets the designated parameter to the given <code>String</code> |
|
7102 |
* object. This forms the basis of the join for the |
|
7103 |
* <code>JoinRowSet</code> as the column which will form the basis of the |
|
7104 |
* join. |
|
7105 |
* <P> |
|
7106 |
* The parameter value set by this method is stored internally and |
|
7107 |
* will be supplied as the appropriate parameter in this rowset's |
|
7108 |
* command when the method <code>getMatchColumn</code> is called. |
|
7109 |
* |
|
7110 |
* @param columnName the name of the column into this rowset |
|
7111 |
* object's internal representation of parameter values |
|
7112 |
* @throws SQLException if an error occurs or the |
|
7113 |
* parameter index is out of bounds |
|
7114 |
*/ |
|
7115 |
public void setMatchColumn(String columnName) throws SQLException { |
|
7116 |
// validate, if col is ok to be set |
|
6697
39929804f9d4
6989139: Address JDBC Findbugs where Number type Constructor are used
lancea
parents:
6692
diff
changeset
|
7117 |
if(columnName == null || (columnName= columnName.trim()).equals("") ) { |
2 | 7118 |
throw new SQLException(resBundle.handleGetObject("cachedrowsetimpl.matchcols2").toString()); |
7119 |
} else { |
|
7120 |
// set strMatchColumn |
|
7121 |
strMatchColumns.set(0, columnName); |
|
7122 |
//iMatchColumn = -1; |
|
7123 |
} |
|
7124 |
} |
|
7125 |
||
7126 |
/** |
|
7127 |
* Unsets the designated parameter to the given <code>int</code> |
|
7128 |
* object. This was set using <code>setMatchColumn</code> |
|
7129 |
* as the column which will form the basis of the join. |
|
7130 |
* <P> |
|
7131 |
* The parameter value unset by this method should be same |
|
7132 |
* as was set. |
|
7133 |
* |
|
7134 |
* @param columnIdx the index into this rowset |
|
7135 |
* object's internal representation of parameter values |
|
7136 |
* @throws SQLException if an error occurs or the |
|
7137 |
* parameter index is out of bounds or if the columnIdx is |
|
7138 |
* not the same as set using <code>setMatchColumn(int)</code> |
|
7139 |
*/ |
|
7140 |
public void unsetMatchColumn(int columnIdx) throws SQLException { |
|
7141 |
// check if we are unsetting the SAME column |
|
6697
39929804f9d4
6989139: Address JDBC Findbugs where Number type Constructor are used
lancea
parents:
6692
diff
changeset
|
7142 |
if(! iMatchColumns.get(0).equals(Integer.valueOf(columnIdx) ) ) { |
2 | 7143 |
throw new SQLException(resBundle.handleGetObject("cachedrowsetimpl.unsetmatch").toString()); |
7144 |
} else if(strMatchColumns.get(0) != null) { |
|
7145 |
throw new SQLException(resBundle.handleGetObject("cachedrowsetimpl.unsetmatch1").toString()); |
|
7146 |
} else { |
|
7147 |
// that is, we are unsetting it. |
|
11129
f9ad1aadf3fa
7116445: Miscellaneous warnings in the JDBC/RowSet classes
lancea
parents:
9537
diff
changeset
|
7148 |
iMatchColumns.set(0, -1); |
2 | 7149 |
} |
7150 |
} |
|
7151 |
||
7152 |
/** |
|
7153 |
* Unsets the designated parameter to the given <code>String</code> |
|
7154 |
* object. This was set using <code>setMatchColumn</code> |
|
7155 |
* as the column which will form the basis of the join. |
|
7156 |
* <P> |
|
7157 |
* The parameter value unset by this method should be same |
|
7158 |
* as was set. |
|
7159 |
* |
|
7160 |
* @param columnName the index into this rowset |
|
7161 |
* object's internal representation of parameter values |
|
7162 |
* @throws SQLException if an error occurs or the |
|
7163 |
* parameter index is out of bounds or if the columnName is |
|
7164 |
* not the same as set using <code>setMatchColumn(String)</code> |
|
7165 |
*/ |
|
7166 |
public void unsetMatchColumn(String columnName) throws SQLException { |
|
7167 |
// check if we are unsetting the same column |
|
7168 |
columnName = columnName.trim(); |
|
7169 |
||
7170 |
if(!((strMatchColumns.get(0)).equals(columnName))) { |
|
7171 |
throw new SQLException(resBundle.handleGetObject("cachedrowsetimpl.unsetmatch").toString()); |
|
11129
f9ad1aadf3fa
7116445: Miscellaneous warnings in the JDBC/RowSet classes
lancea
parents:
9537
diff
changeset
|
7172 |
} else if(iMatchColumns.get(0) > 0) { |
2 | 7173 |
throw new SQLException(resBundle.handleGetObject("cachedrowsetimpl.unsetmatch2").toString()); |
7174 |
} else { |
|
7175 |
strMatchColumns.set(0, null); // that is, we are unsetting it. |
|
7176 |
} |
|
7177 |
} |
|
7178 |
||
7179 |
/** |
|
7180 |
* Notifies registered listeners that a RowSet object in the given RowSetEvent |
|
7181 |
* object has populated a number of additional rows. The <code>numRows</code> parameter |
|
7182 |
* ensures that this event will only be fired every <code>numRow</code>. |
|
7183 |
* <p> |
|
7184 |
* The source of the event can be retrieved with the method event.getSource. |
|
7185 |
* |
|
7186 |
* @param event a <code>RowSetEvent</code> object that contains the |
|
7187 |
* <code>RowSet</code> object that is the source of the events |
|
7188 |
* @param numRows when populating, the number of rows interval on which the |
|
7189 |
* <code>CachedRowSet</code> populated should fire; the default value |
|
7190 |
* is zero; cannot be less than <code>fetchSize</code> or zero |
|
7191 |
*/ |
|
7192 |
public void rowSetPopulated(RowSetEvent event, int numRows) throws SQLException { |
|
7193 |
||
7194 |
if( numRows < 0 || numRows < getFetchSize()) { |
|
7195 |
throw new SQLException(resBundle.handleGetObject("cachedrowsetimpl.numrows").toString()); |
|
7196 |
} |
|
7197 |
||
7198 |
if(size() % numRows == 0) { |
|
7199 |
RowSetEvent event_temp = new RowSetEvent(this); |
|
7200 |
event = event_temp; |
|
7201 |
notifyRowSetChanged(); |
|
7202 |
} |
|
7203 |
} |
|
7204 |
||
7205 |
/** |
|
7206 |
* Populates this <code>CachedRowSet</code> object with data from |
|
7207 |
* the given <code>ResultSet</code> object. While related to the <code>populate(ResultSet)</code> |
|
7208 |
* method, an additional parameter is provided to allow starting position within |
|
7209 |
* the <code>ResultSet</code> from where to populate the CachedRowSet |
|
7210 |
* instance. |
|
7211 |
* |
|
7212 |
* This method is an alternative to the method <code>execute</code> |
|
7213 |
* for filling the rowset with data. The method <code>populate</code> |
|
7214 |
* does not require that the properties needed by the method |
|
7215 |
* <code>execute</code>, such as the <code>command</code> property, |
|
7216 |
* be set. This is true because the method <code>populate</code> |
|
7217 |
* is given the <code>ResultSet</code> object from |
|
7218 |
* which to get data and thus does not need to use the properties |
|
7219 |
* required for setting up a connection and executing this |
|
7220 |
* <code>CachedRowSetImpl</code> object's command. |
|
7221 |
* <P> |
|
7222 |
* After populating this rowset with data, the method |
|
7223 |
* <code>populate</code> sets the rowset's metadata and |
|
7224 |
* then sends a <code>RowSetChangedEvent</code> object |
|
7225 |
* to all registered listeners prior to returning. |
|
7226 |
* |
|
7227 |
* @param data the <code>ResultSet</code> object containing the data |
|
7228 |
* to be read into this <code>CachedRowSetImpl</code> object |
|
7229 |
* @param start the integer specifing the position in the |
|
7230 |
* <code>ResultSet</code> object to popultate the |
|
7231 |
* <code>CachedRowSetImpl</code> object. |
|
7232 |
* @throws SQLException if an error occurs; or the max row setting is |
|
7233 |
* violated while populating the RowSet.Also id the start position |
|
7234 |
* is negative. |
|
7235 |
* @see #execute |
|
7236 |
*/ |
|
7237 |
public void populate(ResultSet data, int start) throws SQLException{ |
|
7238 |
||
7239 |
int rowsFetched; |
|
7240 |
Row currentRow; |
|
7241 |
int numCols; |
|
7242 |
int i; |
|
9257
53e6d7bc31b0
7035615: Address lint warnings for javax.sql.rowset & com.sun.rowset
lancea
parents:
6697
diff
changeset
|
7243 |
Map<String, Class<?>> map = getTypeMap(); |
2 | 7244 |
Object obj; |
7245 |
int mRows; |
|
7246 |
||
7247 |
cursorPos = 0; |
|
7248 |
if(populatecallcount == 0){ |
|
7249 |
if(start < 0){ |
|
7250 |
throw new SQLException(resBundle.handleGetObject("cachedrowsetimpl.startpos").toString()); |
|
7251 |
} |
|
7252 |
if(getMaxRows() == 0){ |
|
7253 |
data.absolute(start); |
|
7254 |
while(data.next()){ |
|
7255 |
totalRows++; |
|
7256 |
} |
|
7257 |
totalRows++; |
|
7258 |
} |
|
7259 |
startPos = start; |
|
7260 |
} |
|
7261 |
populatecallcount = populatecallcount +1; |
|
7262 |
resultSet = data; |
|
7263 |
if((endPos - startPos) >= getMaxRows() && (getMaxRows() > 0)){ |
|
7264 |
endPos = prevEndPos; |
|
7265 |
pagenotend = false; |
|
7266 |
return; |
|
7267 |
} |
|
7268 |
||
7269 |
if((maxRowsreached != getMaxRows() || maxRowsreached != totalRows) && pagenotend) { |
|
7270 |
startPrev = start - getPageSize(); |
|
7271 |
} |
|
7272 |
||
7273 |
if( pageSize == 0){ |
|
7274 |
prevEndPos = endPos; |
|
7275 |
endPos = start + getMaxRows() ; |
|
7276 |
} |
|
7277 |
else{ |
|
7278 |
prevEndPos = endPos; |
|
7279 |
endPos = start + getPageSize(); |
|
7280 |
} |
|
7281 |
||
7282 |
||
7283 |
if (start == 1){ |
|
7284 |
resultSet.beforeFirst(); |
|
7285 |
} |
|
7286 |
else { |
|
7287 |
resultSet.absolute(start -1); |
|
7288 |
} |
|
7289 |
if( pageSize == 0) { |
|
9257
53e6d7bc31b0
7035615: Address lint warnings for javax.sql.rowset & com.sun.rowset
lancea
parents:
6697
diff
changeset
|
7290 |
rvh = new Vector<Object>(getMaxRows()); |
2 | 7291 |
|
7292 |
} |
|
7293 |
else{ |
|
9257
53e6d7bc31b0
7035615: Address lint warnings for javax.sql.rowset & com.sun.rowset
lancea
parents:
6697
diff
changeset
|
7294 |
rvh = new Vector<Object>(getPageSize()); |
2 | 7295 |
} |
7296 |
||
7297 |
if (data == null) { |
|
7298 |
throw new SQLException(resBundle.handleGetObject("cachedrowsetimpl.populate").toString()); |
|
7299 |
} |
|
7300 |
||
7301 |
// get the meta data for this ResultSet |
|
7302 |
RSMD = data.getMetaData(); |
|
7303 |
||
7304 |
// set up the metadata |
|
7305 |
RowSetMD = new RowSetMetaDataImpl(); |
|
7306 |
initMetaData(RowSetMD, RSMD); |
|
7307 |
||
7308 |
// release the meta-data so that aren't tempted to use it. |
|
7309 |
RSMD = null; |
|
7310 |
numCols = RowSetMD.getColumnCount(); |
|
7311 |
mRows = this.getMaxRows(); |
|
7312 |
rowsFetched = 0; |
|
7313 |
currentRow = null; |
|
7314 |
||
7315 |
if(!data.next() && mRows == 0){ |
|
7316 |
endPos = prevEndPos; |
|
7317 |
pagenotend = false; |
|
7318 |
return; |
|
7319 |
} |
|
7320 |
||
7321 |
data.previous(); |
|
7322 |
||
7323 |
while ( data.next()) { |
|
7324 |
||
7325 |
currentRow = new Row(numCols); |
|
7326 |
if(pageSize == 0){ |
|
7327 |
if ( rowsFetched >= mRows && mRows > 0) { |
|
7328 |
rowsetWarning.setNextException(new SQLException("Populating rows " |
|
7329 |
+ "setting has exceeded max row setting")); |
|
7330 |
break; |
|
7331 |
} |
|
7332 |
} |
|
7333 |
else { |
|
7334 |
if ( (rowsFetched >= pageSize) ||( maxRowsreached >= mRows && mRows > 0)) { |
|
7335 |
rowsetWarning.setNextException(new SQLException("Populating rows " |
|
7336 |
+ "setting has exceeded max row setting")); |
|
7337 |
break; |
|
7338 |
} |
|
7339 |
} |
|
7340 |
||
7341 |
for ( i = 1; i <= numCols; i++) { |
|
7342 |
/* |
|
7343 |
* check if the user has set a map. If no map |
|
7344 |
* is set then use plain getObject. This lets |
|
7345 |
* us work with drivers that do not support |
|
7346 |
* getObject with a map in fairly sensible way |
|
7347 |
*/ |
|
7348 |
if (map == null) { |
|
7349 |
obj = data.getObject(i); |
|
7350 |
} else { |
|
7351 |
obj = data.getObject(i, map); |
|
7352 |
} |
|
7353 |
/* |
|
7354 |
* the following block checks for the various |
|
7355 |
* types that we have to serialize in order to |
|
7356 |
* store - right now only structs have been tested |
|
7357 |
*/ |
|
7358 |
if (obj instanceof Struct) { |
|
7359 |
obj = new SerialStruct((Struct)obj, map); |
|
7360 |
} else if (obj instanceof SQLData) { |
|
7361 |
obj = new SerialStruct((SQLData)obj, map); |
|
7362 |
} else if (obj instanceof Blob) { |
|
7363 |
obj = new SerialBlob((Blob)obj); |
|
7364 |
} else if (obj instanceof Clob) { |
|
7365 |
obj = new SerialClob((Clob)obj); |
|
7366 |
} else if (obj instanceof java.sql.Array) { |
|
7367 |
obj = new SerialArray((java.sql.Array)obj, map); |
|
7368 |
} |
|
7369 |
||
11129
f9ad1aadf3fa
7116445: Miscellaneous warnings in the JDBC/RowSet classes
lancea
parents:
9537
diff
changeset
|
7370 |
currentRow.initColumnObject(i, obj); |
2 | 7371 |
} |
7372 |
rowsFetched++; |
|
7373 |
maxRowsreached++; |
|
7374 |
rvh.add(currentRow); |
|
7375 |
} |
|
7376 |
numRows = rowsFetched ; |
|
7377 |
// Also rowsFetched should be equal to rvh.size() |
|
7378 |
// notify any listeners that the rowset has changed |
|
7379 |
notifyRowSetChanged(); |
|
7380 |
||
7381 |
} |
|
7382 |
||
7383 |
/** |
|
7384 |
* The nextPage gets the next page, that is a <code>CachedRowSetImpl</code> object |
|
7385 |
* containing the number of rows specified by page size. |
|
7386 |
* @return boolean value true indicating whether there are more pages to come and |
|
7387 |
* false indicating that this is the last page. |
|
7388 |
* @throws SQLException if an error occurs or this called before calling populate. |
|
7389 |
*/ |
|
7390 |
public boolean nextPage() throws SQLException { |
|
7391 |
||
7392 |
if (populatecallcount == 0){ |
|
7393 |
throw new SQLException(resBundle.handleGetObject("cachedrowsetimpl.nextpage").toString()); |
|
7394 |
} |
|
7395 |
// Fix for 6554186 |
|
7396 |
onFirstPage = false; |
|
7397 |
if(callWithCon){ |
|
7398 |
crsReader.setStartPosition(endPos); |
|
7399 |
crsReader.readData((RowSetInternal)this); |
|
7400 |
resultSet = null; |
|
7401 |
} |
|
7402 |
else { |
|
7403 |
populate(resultSet,endPos); |
|
7404 |
} |
|
7405 |
return pagenotend; |
|
7406 |
} |
|
7407 |
||
7408 |
/** |
|
7409 |
* This is the setter function for setting the size of the page, which specifies |
|
7410 |
* how many rows have to be retrived at a time. |
|
7411 |
* |
|
7412 |
* @param size which is the page size |
|
7413 |
* @throws SQLException if size is less than zero or greater than max rows. |
|
7414 |
*/ |
|
7415 |
public void setPageSize (int size) throws SQLException { |
|
7416 |
if (size < 0) { |
|
7417 |
throw new SQLException(resBundle.handleGetObject("cachedrowsetimpl.pagesize").toString()); |
|
7418 |
} |
|
7419 |
if (size > getMaxRows() && getMaxRows() != 0) { |
|
7420 |
throw new SQLException(resBundle.handleGetObject("cachedrowsetimpl.pagesize1").toString()); |
|
7421 |
} |
|
7422 |
pageSize = size; |
|
7423 |
} |
|
7424 |
||
7425 |
/** |
|
7426 |
* This is the getter function for the size of the page. |
|
7427 |
* |
|
7428 |
* @return an integer that is the page size. |
|
7429 |
*/ |
|
7430 |
public int getPageSize() { |
|
7431 |
return pageSize; |
|
7432 |
} |
|
7433 |
||
7434 |
||
7435 |
/** |
|
7436 |
* Retrieves the data present in the page prior to the page from where it is |
|
7437 |
* called. |
|
7438 |
* @return boolean value true if it retrieves the previous page, flase if it |
|
7439 |
* is on the first page. |
|
7440 |
* @throws SQLException if it is called before populate is called or ResultSet |
|
7441 |
* is of type <code>ResultSet.TYPE_FORWARD_ONLY</code> or if an error |
|
7442 |
* occurs. |
|
7443 |
*/ |
|
7444 |
public boolean previousPage() throws SQLException { |
|
7445 |
int pS; |
|
7446 |
int mR; |
|
7447 |
int rem; |
|
7448 |
||
7449 |
pS = getPageSize(); |
|
7450 |
mR = maxRowsreached; |
|
7451 |
||
7452 |
if (populatecallcount == 0){ |
|
7453 |
throw new SQLException(resBundle.handleGetObject("cachedrowsetimpl.nextpage").toString()); |
|
7454 |
} |
|
7455 |
||
7456 |
if( !callWithCon){ |
|
7457 |
if(resultSet.getType() == ResultSet.TYPE_FORWARD_ONLY){ |
|
7458 |
throw new SQLException (resBundle.handleGetObject("cachedrowsetimpl.fwdonly").toString()); |
|
7459 |
} |
|
7460 |
} |
|
7461 |
||
7462 |
pagenotend = true; |
|
7463 |
||
7464 |
if(startPrev < startPos ){ |
|
7465 |
onFirstPage = true; |
|
7466 |
return false; |
|
7467 |
} |
|
7468 |
||
7469 |
if(onFirstPage){ |
|
7470 |
return false; |
|
7471 |
} |
|
7472 |
||
7473 |
rem = mR % pS; |
|
7474 |
||
7475 |
if(rem == 0){ |
|
7476 |
maxRowsreached -= (2 * pS); |
|
7477 |
if(callWithCon){ |
|
7478 |
crsReader.setStartPosition(startPrev); |
|
7479 |
crsReader.readData((RowSetInternal)this); |
|
7480 |
resultSet = null; |
|
7481 |
} |
|
7482 |
else { |
|
7483 |
populate(resultSet,startPrev); |
|
7484 |
} |
|
7485 |
return true; |
|
7486 |
} |
|
7487 |
else |
|
7488 |
{ |
|
7489 |
maxRowsreached -= (pS + rem); |
|
7490 |
if(callWithCon){ |
|
7491 |
crsReader.setStartPosition(startPrev); |
|
7492 |
crsReader.readData((RowSetInternal)this); |
|
7493 |
resultSet = null; |
|
7494 |
} |
|
7495 |
else { |
|
7496 |
populate(resultSet,startPrev); |
|
7497 |
} |
|
7498 |
return true; |
|
7499 |
} |
|
7500 |
} |
|
7501 |
||
7502 |
/** |
|
7503 |
* Goes to the page number passed as the parameter |
|
7504 |
* @param page , the page loaded on a call to this function |
|
7505 |
* @return true if the page exists false otherwise |
|
7506 |
* @throws SQLException if an error occurs |
|
7507 |
*/ |
|
7508 |
/* |
|
7509 |
public boolean absolutePage(int page) throws SQLException{ |
|
7510 |
||
7511 |
boolean isAbs = true, retVal = true; |
|
7512 |
int counter; |
|
7513 |
||
7514 |
if( page <= 0 ){ |
|
7515 |
throw new SQLException("Absolute positoin is invalid"); |
|
7516 |
} |
|
7517 |
counter = 0; |
|
7518 |
||
7519 |
firstPage(); |
|
7520 |
counter++; |
|
7521 |
while((counter < page) && isAbs) { |
|
7522 |
isAbs = nextPage(); |
|
7523 |
counter ++; |
|
7524 |
} |
|
7525 |
||
7526 |
if( !isAbs && counter < page){ |
|
7527 |
retVal = false; |
|
7528 |
} |
|
7529 |
else if(counter == page){ |
|
7530 |
retVal = true; |
|
7531 |
} |
|
7532 |
||
7533 |
return retVal; |
|
7534 |
} |
|
7535 |
*/ |
|
7536 |
||
7537 |
||
7538 |
/** |
|
7539 |
* Goes to the page number passed as the parameter from the current page. |
|
7540 |
* The parameter can take postive or negative value accordingly. |
|
7541 |
* @param page , the page loaded on a call to this function |
|
7542 |
* @return true if the page exists false otherwise |
|
7543 |
* @throws SQLException if an error occurs |
|
7544 |
*/ |
|
7545 |
/* |
|
7546 |
public boolean relativePage(int page) throws SQLException { |
|
7547 |
||
7548 |
boolean isRel = true,retVal = true; |
|
7549 |
int counter; |
|
7550 |
||
7551 |
if(page > 0){ |
|
7552 |
counter = 0; |
|
7553 |
while((counter < page) && isRel){ |
|
7554 |
isRel = nextPage(); |
|
7555 |
counter++; |
|
7556 |
} |
|
7557 |
||
7558 |
if(!isRel && counter < page){ |
|
7559 |
retVal = false; |
|
7560 |
} |
|
7561 |
else if( counter == page){ |
|
7562 |
retVal = true; |
|
7563 |
} |
|
7564 |
return retVal; |
|
7565 |
} |
|
7566 |
else { |
|
7567 |
counter = page; |
|
7568 |
isRel = true; |
|
7569 |
while((counter < 0) && isRel){ |
|
7570 |
isRel = previousPage(); |
|
7571 |
counter++; |
|
7572 |
} |
|
7573 |
||
7574 |
if( !isRel && counter < 0){ |
|
7575 |
retVal = false; |
|
7576 |
} |
|
7577 |
else if(counter == 0){ |
|
7578 |
retVal = true; |
|
7579 |
} |
|
7580 |
return retVal; |
|
7581 |
} |
|
7582 |
} |
|
7583 |
*/ |
|
7584 |
||
7585 |
/** |
|
7586 |
* Retrieves the first page of data as specified by the page size. |
|
7587 |
* @return boolean value true if present on first page, false otherwise |
|
7588 |
* @throws SQLException if it called before populate or ResultSet is of |
|
7589 |
* type <code>ResultSet.TYPE_FORWARD_ONLY</code> or an error occurs |
|
7590 |
*/ |
|
7591 |
/* |
|
7592 |
public boolean firstPage() throws SQLException { |
|
7593 |
if (populatecallcount == 0){ |
|
7594 |
throw new SQLException("Populate the data before calling "); |
|
7595 |
} |
|
7596 |
if( !callWithCon){ |
|
7597 |
if(resultSet.getType() == ResultSet.TYPE_FORWARD_ONLY) { |
|
7598 |
throw new SQLException("Result of type forward only"); |
|
7599 |
} |
|
7600 |
} |
|
7601 |
endPos = 0; |
|
7602 |
maxRowsreached = 0; |
|
7603 |
pagenotend = true; |
|
7604 |
if(callWithCon){ |
|
7605 |
crsReader.setStartPosition(startPos); |
|
7606 |
crsReader.readData((RowSetInternal)this); |
|
7607 |
resultSet = null; |
|
7608 |
} |
|
7609 |
else { |
|
7610 |
populate(resultSet,startPos); |
|
7611 |
} |
|
7612 |
onFirstPage = true; |
|
7613 |
return onFirstPage; |
|
7614 |
} |
|
7615 |
*/ |
|
7616 |
||
7617 |
/** |
|
7618 |
* Retrives the last page of data as specified by the page size. |
|
7619 |
* @return boolean value tur if present on the last page, false otherwise |
|
7620 |
* @throws SQLException if called before populate or if an error occurs. |
|
7621 |
*/ |
|
7622 |
/* |
|
7623 |
public boolean lastPage() throws SQLException{ |
|
7624 |
int pS; |
|
7625 |
int mR; |
|
7626 |
int quo; |
|
7627 |
int rem; |
|
7628 |
||
7629 |
pS = getPageSize(); |
|
7630 |
mR = getMaxRows(); |
|
7631 |
||
7632 |
if(pS == 0){ |
|
7633 |
onLastPage = true; |
|
7634 |
return onLastPage; |
|
7635 |
} |
|
7636 |
||
7637 |
if(getMaxRows() == 0){ |
|
7638 |
mR = totalRows; |
|
7639 |
} |
|
7640 |
||
7641 |
if (populatecallcount == 0){ |
|
7642 |
throw new SQLException("Populate the data before calling "); |
|
7643 |
} |
|
7644 |
||
7645 |
onFirstPage = false; |
|
7646 |
||
7647 |
if((mR % pS) == 0){ |
|
7648 |
quo = mR / pS; |
|
7649 |
int start = startPos + (pS * (quo - 1)); |
|
7650 |
maxRowsreached = mR - pS; |
|
7651 |
if(callWithCon){ |
|
7652 |
crsReader.setStartPosition(start); |
|
7653 |
crsReader.readData((RowSetInternal)this); |
|
7654 |
resultSet = null; |
|
7655 |
} |
|
7656 |
else { |
|
7657 |
populate(resultSet,start); |
|
7658 |
} |
|
7659 |
onLastPage = true; |
|
7660 |
return onLastPage; |
|
7661 |
} |
|
7662 |
else { |
|
7663 |
quo = mR /pS; |
|
7664 |
rem = mR % pS; |
|
7665 |
int start = startPos + (pS * quo); |
|
7666 |
maxRowsreached = mR - (rem); |
|
7667 |
if(callWithCon){ |
|
7668 |
crsReader.setStartPosition(start); |
|
7669 |
crsReader.readData((RowSetInternal)this); |
|
7670 |
resultSet = null; |
|
7671 |
} |
|
7672 |
else { |
|
7673 |
populate(resultSet,start); |
|
7674 |
} |
|
7675 |
onLastPage = true; |
|
7676 |
return onLastPage; |
|
7677 |
} |
|
7678 |
} |
|
7679 |
*/ |
|
7680 |
||
7681 |
/** |
|
7682 |
* Sets the status for the row on which the cursor is positioned. The insertFlag is used |
|
7683 |
* to mention the toggle status for this row |
|
7684 |
* @param insertFlag if it is true - marks this row as inserted |
|
7685 |
* if it is false - marks it as not a newly inserted row |
|
7686 |
* @throws SQLException if an error occurs while doing this operation |
|
7687 |
*/ |
|
7688 |
public void setRowInserted(boolean insertFlag) throws SQLException { |
|
7689 |
||
7690 |
checkCursor(); |
|
7691 |
||
7692 |
if(onInsertRow == true) |
|
7693 |
throw new SQLException(resBundle.handleGetObject("cachedrowsetimpl.invalidop").toString()); |
|
7694 |
||
7695 |
if( insertFlag ) { |
|
7696 |
((Row)getCurrentRow()).setInserted(); |
|
7697 |
} else { |
|
7698 |
((Row)getCurrentRow()).clearInserted(); |
|
7699 |
} |
|
7700 |
} |
|
7701 |
||
7702 |
/** |
|
7703 |
* Retrieves the value of the designated <code>SQL XML</code> parameter as a |
|
7704 |
* <code>SQLXML</code> object in the Java programming language. |
|
7705 |
* @param columnIndex the first column is 1, the second is 2, ... |
|
7706 |
* @return a SQLXML object that maps an SQL XML value |
|
7707 |
* @throws SQLException if a database access error occurs |
|
7708 |
* @since 6.0 |
|
7709 |
*/ |
|
7710 |
public SQLXML getSQLXML(int columnIndex) throws SQLException { |
|
7711 |
throw new SQLFeatureNotSupportedException(resBundle.handleGetObject("cachedrowsetimpl.opnotysupp").toString()); |
|
7712 |
} |
|
7713 |
||
7714 |
/** |
|
7715 |
* Retrieves the value of the designated <code>SQL XML</code> parameter as a |
|
7716 |
* <code>SQLXML</code> object in the Java programming language. |
|
7717 |
* @param colName the name of the column from which to retrieve the value |
|
7718 |
* @return a SQLXML object that maps an SQL XML value |
|
7719 |
* @throws SQLException if a database access error occurs |
|
7720 |
*/ |
|
7721 |
public SQLXML getSQLXML(String colName) throws SQLException { |
|
7722 |
throw new SQLFeatureNotSupportedException(resBundle.handleGetObject("cachedrowsetimpl.opnotysupp").toString()); |
|
7723 |
} |
|
7724 |
||
7725 |
/** |
|
7726 |
* Retrieves the value of the designated column in the current row of this |
|
7727 |
* <code>ResultSet</code> object as a java.sql.RowId object in the Java |
|
7728 |
* programming language. |
|
7729 |
* |
|
7730 |
* @param columnIndex the first column is 1, the second 2, ... |
|
7731 |
* @return the column value if the value is a SQL <code>NULL</code> the |
|
7732 |
* value returned is <code>null</code> |
|
7733 |
* @throws SQLException if a database access error occurs |
|
7734 |
* @since 6.0 |
|
7735 |
*/ |
|
7736 |
public RowId getRowId(int columnIndex) throws SQLException { |
|
7737 |
throw new SQLFeatureNotSupportedException(resBundle.handleGetObject("cachedrowsetimpl.opnotysupp").toString()); |
|
7738 |
} |
|
7739 |
||
7740 |
/** |
|
7741 |
* Retrieves the value of the designated column in the current row of this |
|
7742 |
* <code>ResultSet</code> object as a java.sql.RowId object in the Java |
|
7743 |
* programming language. |
|
7744 |
* |
|
7745 |
* @param columnName the name of the column |
|
7746 |
* @return the column value if the value is a SQL <code>NULL</code> the |
|
7747 |
* value returned is <code>null</code> |
|
7748 |
* @throws SQLException if a database access error occurs |
|
7749 |
* @since 6.0 |
|
7750 |
*/ |
|
7751 |
public RowId getRowId(String columnName) throws SQLException { |
|
7752 |
throw new SQLFeatureNotSupportedException(resBundle.handleGetObject("cachedrowsetimpl.opnotysupp").toString()); |
|
7753 |
} |
|
7754 |
||
7755 |
/** |
|
7756 |
* Updates the designated column with a <code>RowId</code> value. The updater |
|
7757 |
* methods are used to update column values in the current row or the insert |
|
7758 |
* row. The updater methods do not update the underlying database; instead |
|
7759 |
* the <code>updateRow<code> or <code>insertRow</code> methods are called |
|
7760 |
* to update the database. |
|
7761 |
* |
|
7762 |
* @param columnIndex the first column is 1, the second 2, ... |
|
7763 |
* @param x the column value |
|
7764 |
* @throws SQLException if a database access occurs |
|
7765 |
* @since 6.0 |
|
7766 |
*/ |
|
7767 |
public void updateRowId(int columnIndex, RowId x) throws SQLException { |
|
7768 |
throw new SQLFeatureNotSupportedException(resBundle.handleGetObject("cachedrowsetimpl.opnotysupp").toString()); |
|
7769 |
} |
|
7770 |
||
7771 |
/** |
|
7772 |
* Updates the designated column with a <code>RowId</code> value. The updater |
|
7773 |
* methods are used to update column values in the current row or the insert |
|
7774 |
* row. The updater methods do not update the underlying database; instead |
|
7775 |
* the <code>updateRow<code> or <code>insertRow</code> methods are called |
|
7776 |
* to update the database. |
|
7777 |
* |
|
7778 |
* @param columnName the name of the column |
|
7779 |
* @param x the column value |
|
7780 |
* @throws SQLException if a database access occurs |
|
7781 |
* @since 6.0 |
|
7782 |
*/ |
|
7783 |
public void updateRowId(String columnName, RowId x) throws SQLException { |
|
7784 |
throw new SQLFeatureNotSupportedException(resBundle.handleGetObject("cachedrowsetimpl.opnotysupp").toString()); |
|
7785 |
} |
|
7786 |
||
7787 |
/** |
|
7788 |
* Retrieves the holdability of this ResultSet object |
|
7789 |
* @return either ResultSet.HOLD_CURSORS_OVER_COMMIT or ResultSet.CLOSE_CURSORS_AT_COMMIT |
|
7790 |
* @throws SQLException if a database error occurs |
|
7791 |
* @since 6.0 |
|
7792 |
*/ |
|
7793 |
public int getHoldability() throws SQLException { |
|
7794 |
throw new SQLFeatureNotSupportedException(resBundle.handleGetObject("cachedrowsetimpl.opnotysupp").toString()); |
|
7795 |
} |
|
7796 |
||
7797 |
/** |
|
7798 |
* Retrieves whether this ResultSet object has been closed. A ResultSet is closed if the |
|
7799 |
* method close has been called on it, or if it is automatically closed. |
|
7800 |
* @return true if this ResultSet object is closed; false if it is still open |
|
7801 |
* @throws SQLException if a database access error occurs |
|
7802 |
* @since 6.0 |
|
7803 |
*/ |
|
7804 |
public boolean isClosed() throws SQLException { |
|
7805 |
throw new SQLFeatureNotSupportedException(resBundle.handleGetObject("cachedrowsetimpl.opnotysupp").toString()); |
|
7806 |
} |
|
7807 |
||
7808 |
/** |
|
7809 |
* This method is used for updating columns that support National Character sets. |
|
7810 |
* It can be used for updating NCHAR,NVARCHAR and LONGNVARCHAR columns. |
|
7811 |
* @param columnIndex the first column is 1, the second 2, ... |
|
7812 |
* @param nString the value for the column to be updated |
|
7813 |
* @throws SQLException if a database access error occurs |
|
7814 |
* @since 6.0 |
|
7815 |
*/ |
|
7816 |
public void updateNString(int columnIndex, String nString) throws SQLException { |
|
7817 |
throw new SQLFeatureNotSupportedException(resBundle.handleGetObject("cachedrowsetimpl.opnotysupp").toString()); |
|
7818 |
} |
|
7819 |
||
7820 |
/** |
|
7821 |
* This method is used for updating columns that support National Character sets. |
|
7822 |
* It can be used for updating NCHAR,NVARCHAR and LONGNVARCHAR columns. |
|
7823 |
* @param columnName name of the Column |
|
7824 |
* @param nString the value for the column to be updated |
|
7825 |
* @throws SQLException if a database access error occurs |
|
7826 |
* @since 6.0 |
|
7827 |
*/ |
|
7828 |
public void updateNString(String columnName, String nString) throws SQLException { |
|
7829 |
throw new SQLFeatureNotSupportedException(resBundle.handleGetObject("cachedrowsetimpl.opnotysupp").toString()); |
|
7830 |
} |
|
7831 |
||
7832 |
||
7833 |
/*o |
|
7834 |
* This method is used for updating SQL <code>NCLOB</code> type that maps |
|
7835 |
* to <code>java.sql.Types.NCLOB</code> |
|
7836 |
* @param columnIndex the first column is 1, the second 2, ... |
|
7837 |
* @param nClob the value for the column to be updated |
|
7838 |
* @throws SQLException if a database access error occurs |
|
7839 |
* @since 6.0 |
|
7840 |
*/ |
|
7841 |
public void updateNClob(int columnIndex, NClob nClob) throws SQLException { |
|
7842 |
throw new SQLFeatureNotSupportedException(resBundle.handleGetObject("cachedrowsetimpl.opnotysupp").toString()); |
|
7843 |
} |
|
7844 |
||
7845 |
/** |
|
7846 |
* This method is used for updating SQL <code>NCLOB</code> type that maps |
|
7847 |
* to <code>java.sql.Types.NCLOB</code> |
|
7848 |
* @param columnName name of the column |
|
7849 |
* @param nClob the value for the column to be updated |
|
7850 |
* @throws SQLException if a database access error occurs |
|
7851 |
* @since 6.0 |
|
7852 |
*/ |
|
7853 |
public void updateNClob(String columnName, NClob nClob) throws SQLException { |
|
7854 |
throw new SQLFeatureNotSupportedException(resBundle.handleGetObject("cachedrowsetimpl.opnotysupp").toString()); |
|
7855 |
} |
|
7856 |
||
7857 |
/** |
|
7858 |
* Retrieves the value of the designated column in the current row |
|
7859 |
* of this <code>ResultSet</code> object as a <code>NClob</code> object |
|
7860 |
* in the Java programming language. |
|
7861 |
* |
|
7862 |
* @param i the first column is 1, the second is 2, ... |
|
7863 |
* @return a <code>NClob</code> object representing the SQL |
|
7864 |
* <code>NCLOB</code> value in the specified column |
|
7865 |
* @exception SQLException if a database access error occurs |
|
7866 |
* @since 6.0 |
|
7867 |
*/ |
|
7868 |
public NClob getNClob(int i) throws SQLException { |
|
7869 |
throw new SQLFeatureNotSupportedException(resBundle.handleGetObject("cachedrowsetimpl.opnotysupp").toString()); |
|
7870 |
} |
|
7871 |
||
7872 |
||
7873 |
/** |
|
7874 |
* Retrieves the value of the designated column in the current row |
|
7875 |
* of this <code>ResultSet</code> object as a <code>NClob</code> object |
|
7876 |
* in the Java programming language. |
|
7877 |
* |
|
7878 |
* @param colName the name of the column from which to retrieve the value |
|
7879 |
* @return a <code>NClob</code> object representing the SQL <code>NCLOB</code> |
|
7880 |
* value in the specified column |
|
7881 |
* @exception SQLException if a database access error occurs |
|
7882 |
* @since 6.0 |
|
7883 |
*/ |
|
7884 |
public NClob getNClob(String colName) throws SQLException { |
|
7885 |
throw new SQLFeatureNotSupportedException(resBundle.handleGetObject("cachedrowsetimpl.opnotysupp").toString()); |
|
7886 |
} |
|
7887 |
||
7888 |
public <T> T unwrap(java.lang.Class<T> iface) throws java.sql.SQLException { |
|
7889 |
return null; |
|
7890 |
} |
|
7891 |
||
7892 |
public boolean isWrapperFor(Class<?> interfaces) throws SQLException { |
|
7893 |
return false; |
|
7894 |
} |
|
7895 |
||
7896 |
||
7897 |
/** |
|
7898 |
* Sets the designated parameter to the given <code>java.sql.SQLXML</code> object. The driver converts this to an |
|
7899 |
* SQL <code>XML</code> value when it sends it to the database. |
|
7900 |
* @param parameterIndex index of the first parameter is 1, the second is 2, ... |
|
7901 |
* @param xmlObject a <code>SQLXML</code> object that maps an SQL <code>XML</code> value |
|
7902 |
* @throws SQLException if a database access error occurs |
|
7903 |
* @since 1.6 |
|
7904 |
*/ |
|
7905 |
public void setSQLXML(int parameterIndex, SQLXML xmlObject) throws SQLException { |
|
7906 |
throw new SQLFeatureNotSupportedException(resBundle.handleGetObject("cachedrowsetimpl.opnotysupp").toString()); |
|
7907 |
} |
|
7908 |
||
7909 |
/** |
|
7910 |
* Sets the designated parameter to the given <code>java.sql.SQLXML</code> object. The driver converts this to an |
|
7911 |
* <code>SQL XML</code> value when it sends it to the database. |
|
7912 |
* @param parameterName the name of the parameter |
|
7913 |
* @param xmlObject a <code>SQLXML</code> object that maps an <code>SQL XML</code> value |
|
7914 |
* @throws SQLException if a database access error occurs |
|
7915 |
* @since 1.6 |
|
7916 |
*/ |
|
7917 |
public void setSQLXML(String parameterName, SQLXML xmlObject) throws SQLException { |
|
7918 |
throw new SQLFeatureNotSupportedException(resBundle.handleGetObject("cachedrowsetimpl.opnotysupp").toString()); |
|
7919 |
} |
|
7920 |
||
7921 |
||
7922 |
/** |
|
7923 |
* Sets the designated parameter to the given <code>java.sql.RowId</code> object. The |
|
7924 |
* driver converts this to a SQL <code>ROWID</code> value when it sends it |
|
7925 |
* to the database |
|
7926 |
* |
|
7927 |
* @param parameterIndex the first parameter is 1, the second is 2, ... |
|
7928 |
* @param x the parameter value |
|
7929 |
* @throws SQLException if a database access error occurs |
|
7930 |
* |
|
7931 |
* @since 1.6 |
|
7932 |
*/ |
|
7933 |
public void setRowId(int parameterIndex, RowId x) throws SQLException { |
|
7934 |
throw new SQLFeatureNotSupportedException(resBundle.handleGetObject("cachedrowsetimpl.opnotysupp").toString()); |
|
7935 |
} |
|
7936 |
||
7937 |
||
7938 |
/** |
|
7939 |
* Sets the designated parameter to the given <code>java.sql.RowId</code> object. The |
|
7940 |
* driver converts this to a SQL <code>ROWID</code> when it sends it to the |
|
7941 |
* database. |
|
7942 |
* |
|
7943 |
* @param parameterName the name of the parameter |
|
7944 |
* @param x the parameter value |
|
7945 |
* @throws SQLException if a database access error occurs |
|
7946 |
* @since 1.6 |
|
7947 |
*/ |
|
7948 |
public void setRowId(String parameterName, RowId x) throws SQLException { |
|
7949 |
throw new SQLFeatureNotSupportedException(resBundle.handleGetObject("cachedrowsetimpl.opnotysupp").toString()); |
|
7950 |
} |
|
7951 |
||
7952 |
||
7953 |
/** |
|
7954 |
* Sets the designated parameter to a <code>Reader</code> object. The |
|
7955 |
* <code>Reader</code> reads the data till end-of-file is reached. The |
|
7956 |
* driver does the necessary conversion from Java character format to |
|
7957 |
* the national character set in the database. |
|
7958 |
||
7959 |
* <P><B>Note:</B> This stream object can either be a standard |
|
7960 |
* Java stream object or your own subclass that implements the |
|
7961 |
* standard interface. |
|
7962 |
* <P><B>Note:</B> Consult your JDBC driver documentation to determine if |
|
7963 |
* it might be more efficient to use a version of |
|
7964 |
* <code>setNCharacterStream</code> which takes a length parameter. |
|
7965 |
* |
|
7966 |
* @param parameterIndex of the first parameter is 1, the second is 2, ... |
|
7967 |
* @param value the parameter value |
|
7968 |
* @throws SQLException if the driver does not support national |
|
7969 |
* character sets; if the driver can detect that a data conversion |
|
7970 |
* error could occur ; if a database access error occurs; or |
|
7971 |
* this method is called on a closed <code>PreparedStatement</code> |
|
7972 |
* @throws SQLFeatureNotSupportedException if the JDBC driver does not support this method |
|
7973 |
* @since 1.6 |
|
7974 |
*/ |
|
7975 |
public void setNCharacterStream(int parameterIndex, Reader value) throws SQLException { |
|
7976 |
throw new SQLFeatureNotSupportedException(resBundle.handleGetObject("cachedrowsetimpl.featnotsupp").toString()); |
|
7977 |
} |
|
7978 |
||
7979 |
||
7980 |
/** |
|
7981 |
* Sets the designated parameter to a <code>java.sql.NClob</code> object. The object |
|
7982 |
* implements the <code>java.sql.NClob</code> interface. This <code>NClob</code> |
|
7983 |
* object maps to a SQL <code>NCLOB</code>. |
|
7984 |
* @param parameterName the name of the column to be set |
|
7985 |
* @param value the parameter value |
|
7986 |
* @throws SQLException if the driver does not support national |
|
7987 |
* character sets; if the driver can detect that a data conversion |
|
7988 |
* error could occur; or if a database access error occurs |
|
7989 |
* @since 1.6 |
|
7990 |
*/ |
|
7991 |
public void setNClob(String parameterName, NClob value) throws SQLException { |
|
7992 |
throw new SQLFeatureNotSupportedException(resBundle.handleGetObject("cachedrowsetimpl.opnotysupp").toString()); |
|
7993 |
} |
|
7994 |
||
7995 |
||
7996 |
/** |
|
7997 |
* Retrieves the value of the designated column in the current row |
|
7998 |
* of this <code>ResultSet</code> object as a |
|
7999 |
* <code>java.io.Reader</code> object. |
|
8000 |
* It is intended for use when |
|
8001 |
* accessing <code>NCHAR</code>,<code>NVARCHAR</code> |
|
8002 |
* and <code>LONGNVARCHAR</code> columns. |
|
8003 |
* |
|
8004 |
* @return a <code>java.io.Reader</code> object that contains the column |
|
8005 |
* value; if the value is SQL <code>NULL</code>, the value returned is |
|
8006 |
* <code>null</code> in the Java programming language. |
|
8007 |
* @param columnIndex the first column is 1, the second is 2, ... |
|
8008 |
* @exception SQLException if a database access error occurs |
|
8009 |
* @since 1.6 |
|
8010 |
*/ |
|
8011 |
public java.io.Reader getNCharacterStream(int columnIndex) throws SQLException { |
|
8012 |
throw new SQLFeatureNotSupportedException(resBundle.handleGetObject("cachedrowsetimpl.opnotysupp").toString()); |
|
8013 |
} |
|
8014 |
||
8015 |
||
8016 |
/** |
|
8017 |
* Retrieves the value of the designated column in the current row |
|
8018 |
* of this <code>ResultSet</code> object as a |
|
8019 |
* <code>java.io.Reader</code> object. |
|
8020 |
* It is intended for use when |
|
8021 |
* accessing <code>NCHAR</code>,<code>NVARCHAR</code> |
|
8022 |
* and <code>LONGNVARCHAR</code> columns. |
|
8023 |
* |
|
8024 |
* @param columnName the name of the column |
|
8025 |
* @return a <code>java.io.Reader</code> object that contains the column |
|
8026 |
* value; if the value is SQL <code>NULL</code>, the value returned is |
|
8027 |
* <code>null</code> in the Java programming language |
|
8028 |
* @exception SQLException if a database access error occurs |
|
8029 |
* @since 1.6 |
|
8030 |
*/ |
|
8031 |
public java.io.Reader getNCharacterStream(String columnName) throws SQLException { |
|
8032 |
throw new SQLFeatureNotSupportedException(resBundle.handleGetObject("cachedrowsetimpl.opnotysupp").toString()); |
|
8033 |
} |
|
8034 |
||
8035 |
||
8036 |
/** |
|
8037 |
* Updates the designated column with a <code>java.sql.SQLXML</code> value. |
|
8038 |
* The updater |
|
8039 |
* methods are used to update column values in the current row or the insert |
|
8040 |
* row. The updater methods do not update the underlying database; instead |
|
8041 |
* the <code>updateRow</code> or <code>insertRow</code> methods are called |
|
8042 |
* to update the database. |
|
8043 |
* @param columnIndex the first column is 1, the second 2, ... |
|
8044 |
* @param xmlObject the value for the column to be updated |
|
8045 |
* @throws SQLException if a database access error occurs |
|
8046 |
* @since 1.6 |
|
8047 |
*/ |
|
8048 |
public void updateSQLXML(int columnIndex, SQLXML xmlObject) throws SQLException { |
|
8049 |
throw new SQLFeatureNotSupportedException(resBundle.handleGetObject("cachedrowsetimpl.opnotysupp").toString()); |
|
8050 |
} |
|
8051 |
||
8052 |
/** |
|
8053 |
* Updates the designated column with a <code>java.sql.SQLXML</code> value. |
|
8054 |
* The updater |
|
8055 |
* methods are used to update column values in the current row or the insert |
|
8056 |
* row. The updater methods do not update the underlying database; instead |
|
8057 |
* the <code>updateRow</code> or <code>insertRow</code> methods are called |
|
8058 |
* to update the database. |
|
8059 |
* |
|
8060 |
* @param columnName the name of the column |
|
8061 |
* @param xmlObject the column value |
|
8062 |
* @throws SQLException if a database access occurs |
|
8063 |
* @since 1.6 |
|
8064 |
*/ |
|
8065 |
public void updateSQLXML(String columnName, SQLXML xmlObject) throws SQLException { |
|
8066 |
throw new SQLFeatureNotSupportedException(resBundle.handleGetObject("cachedrowsetimpl.opnotysupp").toString()); |
|
8067 |
} |
|
8068 |
||
8069 |
/** |
|
8070 |
* Retrieves the value of the designated column in the current row |
|
8071 |
* of this <code>ResultSet</code> object as |
|
8072 |
* a <code>String</code> in the Java programming language. |
|
8073 |
* It is intended for use when |
|
8074 |
* accessing <code>NCHAR</code>,<code>NVARCHAR</code> |
|
8075 |
* and <code>LONGNVARCHAR</code> columns. |
|
8076 |
* |
|
8077 |
* @param columnIndex the first column is 1, the second is 2, ... |
|
8078 |
* @return the column value; if the value is SQL <code>NULL</code>, the |
|
8079 |
* value returned is <code>null</code> |
|
8080 |
* @exception SQLException if a database access error occurs |
|
8081 |
* @since 1.6 |
|
8082 |
*/ |
|
8083 |
public String getNString(int columnIndex) throws SQLException { |
|
8084 |
throw new SQLFeatureNotSupportedException(resBundle.handleGetObject("cachedrowsetimpl.opnotysupp").toString()); |
|
8085 |
} |
|
8086 |
||
8087 |
/** |
|
8088 |
* Retrieves the value of the designated column in the current row |
|
8089 |
* of this <code>ResultSet</code> object as |
|
8090 |
* a <code>String</code> in the Java programming language. |
|
8091 |
* It is intended for use when |
|
8092 |
* accessing <code>NCHAR</code>,<code>NVARCHAR</code> |
|
8093 |
* and <code>LONGNVARCHAR</code> columns. |
|
8094 |
* |
|
8095 |
* @param columnName the SQL name of the column |
|
8096 |
* @return the column value; if the value is SQL <code>NULL</code>, the |
|
8097 |
* value returned is <code>null</code> |
|
8098 |
* @exception SQLException if a database access error occurs |
|
8099 |
* @since 1.6 |
|
8100 |
*/ |
|
8101 |
public String getNString(String columnName) throws SQLException { |
|
8102 |
throw new SQLFeatureNotSupportedException(resBundle.handleGetObject("cachedrowsetimpl.opnotysupp").toString()); |
|
8103 |
} |
|
8104 |
||
8105 |
/** |
|
8106 |
* Updates the designated column with a character stream value, which will |
|
8107 |
* have the specified number of bytes. The driver does the necessary conversion |
|
8108 |
* from Java character format to the national character set in the database. |
|
8109 |
* It is intended for use when updating NCHAR,NVARCHAR and LONGNVARCHAR columns. |
|
8110 |
* The updater methods are used to update column values in the current row or |
|
8111 |
* the insert row. The updater methods do not update the underlying database; |
|
8112 |
* instead the updateRow or insertRow methods are called to update the database. |
|
8113 |
* |
|
8114 |
* @param columnIndex - the first column is 1, the second is 2, ... |
|
8115 |
* @param x - the new column value |
|
8116 |
* @param length - the length of the stream |
|
8117 |
* @exception SQLException if a database access error occurs |
|
8118 |
* @since 1.6 |
|
8119 |
*/ |
|
8120 |
public void updateNCharacterStream(int columnIndex, |
|
8121 |
java.io.Reader x, |
|
8122 |
long length) |
|
8123 |
throws SQLException { |
|
8124 |
throw new SQLFeatureNotSupportedException(resBundle.handleGetObject("cachedrowsetimpl.opnotysupp").toString()); |
|
8125 |
} |
|
8126 |
||
8127 |
/** |
|
8128 |
* Updates the designated column with a character stream value, which will |
|
8129 |
* have the specified number of bytes. The driver does the necessary conversion |
|
8130 |
* from Java character format to the national character set in the database. |
|
8131 |
* It is intended for use when updating NCHAR,NVARCHAR and LONGNVARCHAR columns. |
|
8132 |
* The updater methods are used to update column values in the current row or |
|
8133 |
* the insert row. The updater methods do not update the underlying database; |
|
8134 |
* instead the updateRow or insertRow methods are called to update the database. |
|
8135 |
* |
|
8136 |
* @param columnName - name of the Column |
|
8137 |
* @param x - the new column value |
|
8138 |
* @param length - the length of the stream |
|
8139 |
* @exception SQLException if a database access error occurs |
|
8140 |
* @since 1.6 |
|
8141 |
*/ |
|
8142 |
public void updateNCharacterStream(String columnName, |
|
8143 |
java.io.Reader x, |
|
8144 |
long length) |
|
8145 |
throws SQLException { |
|
8146 |
throw new SQLFeatureNotSupportedException(resBundle.handleGetObject("cachedrowsetimpl.opnotysupp").toString()); |
|
8147 |
} |
|
8148 |
||
8149 |
/** |
|
8150 |
* Updates the designated column with a character stream value. The |
|
8151 |
* driver does the necessary conversion from Java character format to |
|
8152 |
* the national character set in the database. |
|
8153 |
* It is intended for use when |
|
8154 |
* updating <code>NCHAR</code>,<code>NVARCHAR</code> |
|
8155 |
* and <code>LONGNVARCHAR</code> columns. |
|
8156 |
* |
|
8157 |
* The updater methods are used to update column values in the |
|
8158 |
* current row or the insert row. The updater methods do not |
|
8159 |
* update the underlying database; instead the <code>updateRow</code> or |
|
8160 |
* <code>insertRow</code> methods are called to update the database. |
|
8161 |
* |
|
8162 |
* <P><B>Note:</B> Consult your JDBC driver documentation to determine if |
|
8163 |
* it might be more efficient to use a version of |
|
8164 |
* <code>updateNCharacterStream</code> which takes a length parameter. |
|
8165 |
* |
|
8166 |
* @param columnIndex the first column is 1, the second is 2, ... |
|
8167 |
* @param x the new column value |
|
8168 |
* @exception SQLException if a database access error occurs, |
|
8169 |
* the result set concurrency is <code>CONCUR_READ_ONLY</code> or this method is called on a closed result set |
|
8170 |
* @exception SQLFeatureNotSupportedException if the JDBC driver does not support |
|
8171 |
* this method |
|
8172 |
* @since 1.6 |
|
8173 |
*/ |
|
8174 |
public void updateNCharacterStream(int columnIndex, |
|
8175 |
java.io.Reader x) throws SQLException { |
|
8176 |
throw new SQLFeatureNotSupportedException(resBundle.handleGetObject("cachedrowsetimpl.featnotsupp").toString()); |
|
8177 |
} |
|
8178 |
||
8179 |
/** |
|
8180 |
* Updates the designated column with a character stream value. The |
|
8181 |
* driver does the necessary conversion from Java character format to |
|
8182 |
* the national character set in the database. |
|
8183 |
* It is intended for use when |
|
8184 |
* updating <code>NCHAR</code>,<code>NVARCHAR</code> |
|
8185 |
* and <code>LONGNVARCHAR</code> columns. |
|
8186 |
* |
|
8187 |
* The updater methods are used to update column values in the |
|
8188 |
* current row or the insert row. The updater methods do not |
|
8189 |
* update the underlying database; instead the <code>updateRow</code> or |
|
8190 |
* <code>insertRow</code> methods are called to update the database. |
|
8191 |
* |
|
8192 |
* <P><B>Note:</B> Consult your JDBC driver documentation to determine if |
|
8193 |
* it might be more efficient to use a version of |
|
8194 |
* <code>updateNCharacterStream</code> which takes a length parameter. |
|
8195 |
* |
|
8196 |
* @param columnLabel the label for the column specified with the SQL AS clause. If the SQL AS clause was not specified, then the la |
|
8197 |
bel is the name of the column |
|
8198 |
* @param reader the <code>java.io.Reader</code> object containing |
|
8199 |
* the new column value |
|
8200 |
* @exception SQLException if a database access error occurs, |
|
8201 |
* the result set concurrency is <code>CONCUR_READ_ONLY</code> or this method is called on a closed result set |
|
8202 |
* @exception SQLFeatureNotSupportedException if the JDBC driver does not support |
|
8203 |
* this method |
|
8204 |
* @since 1.6 |
|
8205 |
*/ |
|
8206 |
public void updateNCharacterStream(String columnLabel, |
|
8207 |
java.io.Reader reader) throws SQLException { |
|
8208 |
throw new SQLFeatureNotSupportedException(resBundle.handleGetObject("cachedrowsetimpl.featnotsupp").toString()); |
|
8209 |
} |
|
8210 |
||
8211 |
////////////////////////// |
|
8212 |
||
8213 |
/** |
|
8214 |
* Updates the designated column using the given input stream, which |
|
8215 |
* will have the specified number of bytes. |
|
8216 |
* When a very large ASCII value is input to a <code>LONGVARCHAR</code> |
|
8217 |
* parameter, it may be more practical to send it via a |
|
8218 |
* <code>java.io.InputStream</code>. Data will be read from the stream |
|
8219 |
* as needed until end-of-file is reached. The JDBC driver will |
|
8220 |
* do any necessary conversion from ASCII to the database char format. |
|
8221 |
* |
|
8222 |
* <P><B>Note:</B> This stream object can either be a standard |
|
8223 |
* Java stream object or your own subclass that implements the |
|
8224 |
* standard interface. |
|
8225 |
* <p> |
|
8226 |
* The updater methods are used to update column values in the |
|
8227 |
* current row or the insert row. The updater methods do not |
|
8228 |
* update the underlying database; instead the <code>updateRow</code> or |
|
8229 |
* <code>insertRow</code> methods are called to update the database. |
|
8230 |
* |
|
8231 |
* @param columnIndex the first column is 1, the second is 2, ... |
|
8232 |
* @param inputStream An object that contains the data to set the parameter |
|
8233 |
* value to. |
|
8234 |
* @param length the number of bytes in the parameter data. |
|
8235 |
* @exception SQLException if a database access error occurs, |
|
8236 |
* the result set concurrency is <code>CONCUR_READ_ONLY</code> |
|
8237 |
* or this method is called on a closed result set |
|
8238 |
* @exception SQLFeatureNotSupportedException if the JDBC driver does not support |
|
8239 |
* this method |
|
8240 |
* @since 1.6 |
|
8241 |
*/ |
|
8242 |
public void updateBlob(int columnIndex, InputStream inputStream, long length) throws SQLException{ |
|
8243 |
throw new SQLFeatureNotSupportedException(resBundle.handleGetObject("cachedrowsetimpl.featnotsupp").toString()); |
|
8244 |
} |
|
8245 |
||
8246 |
/** |
|
8247 |
* Updates the designated column using the given input stream, which |
|
8248 |
* will have the specified number of bytes. |
|
8249 |
* When a very large ASCII value is input to a <code>LONGVARCHAR</code> |
|
8250 |
* parameter, it may be more practical to send it via a |
|
8251 |
* <code>java.io.InputStream</code>. Data will be read from the stream |
|
8252 |
* as needed until end-of-file is reached. The JDBC driver will |
|
8253 |
* do any necessary conversion from ASCII to the database char format. |
|
8254 |
* |
|
8255 |
* <P><B>Note:</B> This stream object can either be a standard |
|
8256 |
* Java stream object or your own subclass that implements the |
|
8257 |
* standard interface. |
|
8258 |
* <p> |
|
8259 |
* The updater methods are used to update column values in the |
|
8260 |
* current row or the insert row. The updater methods do not |
|
8261 |
* update the underlying database; instead the <code>updateRow</code> or |
|
8262 |
* <code>insertRow</code> methods are called to update the database. |
|
8263 |
* |
|
8264 |
* @param columnLabel the label for the column specified with the SQL AS clause. If the SQL AS clause was not specified, then the label is the name of the column |
|
8265 |
* @param inputStream An object that contains the data to set the parameter |
|
8266 |
* value to. |
|
8267 |
* @param length the number of bytes in the parameter data. |
|
8268 |
* @exception SQLException if a database access error occurs, |
|
8269 |
* the result set concurrency is <code>CONCUR_READ_ONLY</code> |
|
8270 |
* or this method is called on a closed result set |
|
8271 |
* @exception SQLFeatureNotSupportedException if the JDBC driver does not support |
|
8272 |
* this method |
|
8273 |
* @since 1.6 |
|
8274 |
*/ |
|
8275 |
public void updateBlob(String columnLabel, InputStream inputStream, long length) throws SQLException { |
|
8276 |
throw new SQLFeatureNotSupportedException(resBundle.handleGetObject("cachedrowsetimpl.featnotsupp").toString()); |
|
8277 |
} |
|
8278 |
||
8279 |
/** |
|
8280 |
* Updates the designated column using the given input stream. |
|
8281 |
* When a very large ASCII value is input to a <code>LONGVARCHAR</code> |
|
8282 |
* parameter, it may be more practical to send it via a |
|
8283 |
* <code>java.io.InputStream</code>. Data will be read from the stream |
|
8284 |
* as needed until end-of-file is reached. The JDBC driver will |
|
8285 |
* do any necessary conversion from ASCII to the database char format. |
|
8286 |
* |
|
8287 |
* <P><B>Note:</B> This stream object can either be a standard |
|
8288 |
* Java stream object or your own subclass that implements the |
|
8289 |
* standard interface. |
|
8290 |
* |
|
8291 |
* <P><B>Note:</B> Consult your JDBC driver documentation to determine if |
|
8292 |
* it might be more efficient to use a version of |
|
8293 |
* <code>updateBlob</code> which takes a length parameter. |
|
8294 |
* <p> |
|
8295 |
* The updater methods are used to update column values in the |
|
8296 |
* current row or the insert row. The updater methods do not |
|
8297 |
* update the underlying database; instead the <code>updateRow</code> or |
|
8298 |
* <code>insertRow</code> methods are called to update the database. |
|
8299 |
* |
|
8300 |
* @param columnIndex the first column is 1, the second is 2, ... |
|
8301 |
* @param inputStream An object that contains the data to set the parameter |
|
8302 |
* value to. |
|
8303 |
* @exception SQLException if a database access error occurs, |
|
8304 |
* the result set concurrency is <code>CONCUR_READ_ONLY</code> |
|
8305 |
* or this method is called on a closed result set |
|
8306 |
* @exception SQLFeatureNotSupportedException if the JDBC driver does not support |
|
8307 |
* this method |
|
8308 |
* @since 1.6 |
|
8309 |
*/ |
|
8310 |
public void updateBlob(int columnIndex, InputStream inputStream) throws SQLException { |
|
8311 |
throw new SQLFeatureNotSupportedException(resBundle.handleGetObject("cachedrowsetimpl.featnotsupp").toString()); |
|
8312 |
} |
|
8313 |
||
8314 |
/** |
|
8315 |
* Updates the designated column using the given input stream. |
|
8316 |
* When a very large ASCII value is input to a <code>LONGVARCHAR</code> |
|
8317 |
* parameter, it may be more practical to send it via a |
|
8318 |
* <code>java.io.InputStream</code>. Data will be read from the stream |
|
8319 |
* as needed until end-of-file is reached. The JDBC driver will |
|
8320 |
* do any necessary conversion from ASCII to the database char format. |
|
8321 |
* |
|
8322 |
* <P><B>Note:</B> This stream object can either be a standard |
|
8323 |
* Java stream object or your own subclass that implements the |
|
8324 |
* standard interface. |
|
8325 |
* <P><B>Note:</B> Consult your JDBC driver documentation to determine if |
|
8326 |
* it might be more efficient to use a version of |
|
8327 |
* <code>updateBlob</code> which takes a length parameter. |
|
8328 |
* <p> |
|
8329 |
* The updater methods are used to update column values in the |
|
8330 |
* current row or the insert row. The updater methods do not |
|
8331 |
* update the underlying database; instead the <code>updateRow</code> or |
|
8332 |
* <code>insertRow</code> methods are called to update the database. |
|
8333 |
* |
|
8334 |
* @param columnLabel the label for the column specified with the SQL AS clause. If the SQL AS clause was not specified, then the la |
|
8335 |
bel is the name of the column |
|
8336 |
* @param inputStream An object that contains the data to set the parameter |
|
8337 |
* value to. |
|
8338 |
* @exception SQLException if a database access error occurs, |
|
8339 |
* the result set concurrency is <code>CONCUR_READ_ONLY</code> |
|
8340 |
* or this method is called on a closed result set |
|
8341 |
* @exception SQLFeatureNotSupportedException if the JDBC driver does not support |
|
8342 |
* this method |
|
8343 |
* @since 1.6 |
|
8344 |
*/ |
|
8345 |
public void updateBlob(String columnLabel, InputStream inputStream) throws SQLException { |
|
8346 |
throw new SQLFeatureNotSupportedException(resBundle.handleGetObject("cachedrowsetimpl.featnotsupp").toString()); |
|
8347 |
} |
|
8348 |
||
8349 |
/** |
|
8350 |
* Updates the designated column using the given <code>Reader</code> |
|
8351 |
* object, which is the given number of characters long. |
|
8352 |
* When a very large UNICODE value is input to a <code>LONGVARCHAR</code> |
|
8353 |
* parameter, it may be more practical to send it via a |
|
8354 |
* <code>java.io.Reader</code> object. The data will be read from the stream |
|
8355 |
* as needed until end-of-file is reached. The JDBC driver will |
|
8356 |
* do any necessary conversion from UNICODE to the database char format. |
|
8357 |
* |
|
8358 |
* <P><B>Note:</B> This stream object can either be a standard |
|
8359 |
* Java stream object or your own subclass that implements the |
|
8360 |
* standard interface. |
|
8361 |
* <p> |
|
8362 |
* The updater methods are used to update column values in the |
|
8363 |
* current row or the insert row. The updater methods do not |
|
8364 |
* update the underlying database; instead the <code>updateRow</code> or |
|
8365 |
* <code>insertRow</code> methods are called to update the database. |
|
8366 |
* |
|
8367 |
* @param columnIndex the first column is 1, the second is 2, ... |
|
8368 |
* @param reader An object that contains the data to set the parameter value to. |
|
8369 |
* @param length the number of characters in the parameter data. |
|
8370 |
* @exception SQLException if a database access error occurs, |
|
8371 |
* the result set concurrency is <code>CONCUR_READ_ONLY</code> |
|
8372 |
* or this method is called on a closed result set |
|
8373 |
* @exception SQLFeatureNotSupportedException if the JDBC driver does not support |
|
8374 |
* this method |
|
8375 |
* @since 1.6 |
|
8376 |
*/ |
|
8377 |
public void updateClob(int columnIndex, Reader reader, long length) throws SQLException { |
|
8378 |
throw new SQLFeatureNotSupportedException(resBundle.handleGetObject("cachedrowsetimpl.featnotsupp").toString()); |
|
8379 |
} |
|
8380 |
||
8381 |
/** |
|
8382 |
* Updates the designated column using the given <code>Reader</code> |
|
8383 |
* object, which is the given number of characters long. |
|
8384 |
* When a very large UNICODE value is input to a <code>LONGVARCHAR</code> |
|
8385 |
* parameter, it may be more practical to send it via a |
|
8386 |
* <code>java.io.Reader</code> object. The data will be read from the stream |
|
8387 |
* as needed until end-of-file is reached. The JDBC driver will |
|
8388 |
* do any necessary conversion from UNICODE to the database char format. |
|
8389 |
* |
|
8390 |
* <P><B>Note:</B> This stream object can either be a standard |
|
8391 |
* Java stream object or your own subclass that implements the |
|
8392 |
* standard interface. |
|
8393 |
* <p> |
|
8394 |
* The updater methods are used to update column values in the |
|
8395 |
* current row or the insert row. The updater methods do not |
|
8396 |
* update the underlying database; instead the <code>updateRow</code> or |
|
8397 |
* <code>insertRow</code> methods are called to update the database. |
|
8398 |
* |
|
8399 |
* @param columnLabel the label for the column specified with the SQL AS clause. If the SQL AS clause was not specified, then the label is the name of the column |
|
8400 |
* @param reader An object that contains the data to set the parameter value to. |
|
8401 |
* @param length the number of characters in the parameter data. |
|
8402 |
* @exception SQLException if a database access error occurs, |
|
8403 |
* the result set concurrency is <code>CONCUR_READ_ONLY</code> |
|
8404 |
* or this method is called on a closed result set |
|
8405 |
* @exception SQLFeatureNotSupportedException if the JDBC driver does not support |
|
8406 |
* this method |
|
8407 |
* @since 1.6 |
|
8408 |
*/ |
|
8409 |
public void updateClob(String columnLabel, Reader reader, long length) throws SQLException { |
|
8410 |
throw new SQLFeatureNotSupportedException(resBundle.handleGetObject("cachedrowsetimpl.featnotsupp").toString()); |
|
8411 |
} |
|
8412 |
||
8413 |
/** |
|
8414 |
* Updates the designated column using the given <code>Reader</code> |
|
8415 |
* object. |
|
8416 |
* When a very large UNICODE value is input to a <code>LONGVARCHAR</code> |
|
8417 |
* parameter, it may be more practical to send it via a |
|
8418 |
* <code>java.io.Reader</code> object. The data will be read from the stream |
|
8419 |
* as needed until end-of-file is reached. The JDBC driver will |
|
8420 |
* do any necessary conversion from UNICODE to the database char format. |
|
8421 |
* |
|
8422 |
* <P><B>Note:</B> This stream object can either be a standard |
|
8423 |
* Java stream object or your own subclass that implements the |
|
8424 |
* standard interface. |
|
8425 |
* <P><B>Note:</B> Consult your JDBC driver documentation to determine if |
|
8426 |
* it might be more efficient to use a version of |
|
8427 |
* <code>updateClob</code> which takes a length parameter. |
|
8428 |
* <p> |
|
8429 |
* The updater methods are used to update column values in the |
|
8430 |
* current row or the insert row. The updater methods do not |
|
8431 |
* update the underlying database; instead the <code>updateRow</code> or |
|
8432 |
* <code>insertRow</code> methods are called to update the database. |
|
8433 |
* |
|
8434 |
* @param columnIndex the first column is 1, the second is 2, ... |
|
8435 |
* @param reader An object that contains the data to set the parameter value to. |
|
8436 |
* @exception SQLException if a database access error occurs, |
|
8437 |
* the result set concurrency is <code>CONCUR_READ_ONLY</code> |
|
8438 |
* or this method is called on a closed result set |
|
8439 |
* @exception SQLFeatureNotSupportedException if the JDBC driver does not support |
|
8440 |
* this method |
|
8441 |
* @since 1.6 |
|
8442 |
*/ |
|
8443 |
public void updateClob(int columnIndex, Reader reader) throws SQLException { |
|
8444 |
throw new SQLFeatureNotSupportedException(resBundle.handleGetObject("cachedrowsetimpl.featnotsupp").toString()); |
|
8445 |
} |
|
8446 |
||
8447 |
/** |
|
8448 |
* Updates the designated column using the given <code>Reader</code> |
|
8449 |
* object. |
|
8450 |
* When a very large UNICODE value is input to a <code>LONGVARCHAR</code> |
|
8451 |
* parameter, it may be more practical to send it via a |
|
8452 |
* <code>java.io.Reader</code> object. The data will be read from the stream |
|
8453 |
* as needed until end-of-file is reached. The JDBC driver will |
|
8454 |
* do any necessary conversion from UNICODE to the database char format. |
|
8455 |
* |
|
8456 |
* <P><B>Note:</B> This stream object can either be a standard |
|
8457 |
* Java stream object or your own subclass that implements the |
|
8458 |
* standard interface. |
|
8459 |
* <P><B>Note:</B> Consult your JDBC driver documentation to determine if |
|
8460 |
* it might be more efficient to use a version of |
|
8461 |
* <code>updateClob</code> which takes a length parameter. |
|
8462 |
* <p> |
|
8463 |
* The updater methods are used to update column values in the |
|
8464 |
* current row or the insert row. The updater methods do not |
|
8465 |
* update the underlying database; instead the <code>updateRow</code> or |
|
8466 |
* <code>insertRow</code> methods are called to update the database. |
|
8467 |
* |
|
8468 |
* @param columnLabel the label for the column specified with the SQL AS clause. If the SQL AS clause was not specified, then the la |
|
8469 |
bel is the name of the column |
|
8470 |
* @param reader An object that contains the data to set the parameter value to. |
|
8471 |
* @exception SQLException if a database access error occurs, |
|
8472 |
* the result set concurrency is <code>CONCUR_READ_ONLY</code> |
|
8473 |
* or this method is called on a closed result set |
|
8474 |
* @exception SQLFeatureNotSupportedException if the JDBC driver does not support |
|
8475 |
* this method |
|
8476 |
* @since 1.6 |
|
8477 |
*/ |
|
8478 |
public void updateClob(String columnLabel, Reader reader) throws SQLException { |
|
8479 |
throw new SQLFeatureNotSupportedException(resBundle.handleGetObject("cachedrowsetimpl.featnotsupp").toString()); |
|
8480 |
} |
|
8481 |
||
8482 |
/** |
|
8483 |
* Updates the designated column using the given <code>Reader</code> |
|
8484 |
* object, which is the given number of characters long. |
|
8485 |
* When a very large UNICODE value is input to a <code>LONGVARCHAR</code> |
|
8486 |
* parameter, it may be more practical to send it via a |
|
8487 |
* <code>java.io.Reader</code> object. The data will be read from the stream |
|
8488 |
* as needed until end-of-file is reached. The JDBC driver will |
|
8489 |
* do any necessary conversion from UNICODE to the database char format. |
|
8490 |
* |
|
8491 |
* <P><B>Note:</B> This stream object can either be a standard |
|
8492 |
* Java stream object or your own subclass that implements the |
|
8493 |
* standard interface. |
|
8494 |
* <p> |
|
8495 |
* The updater methods are used to update column values in the |
|
8496 |
* current row or the insert row. The updater methods do not |
|
8497 |
* update the underlying database; instead the <code>updateRow</code> or |
|
8498 |
* <code>insertRow</code> methods are called to update the database. |
|
8499 |
* |
|
8500 |
* @param columnIndex the first column is 1, the second 2, ... |
|
8501 |
* @param reader An object that contains the data to set the parameter value to. |
|
8502 |
* @param length the number of characters in the parameter data. |
|
8503 |
* @throws SQLException if the driver does not support national |
|
8504 |
* character sets; if the driver can detect that a data conversion |
|
8505 |
* error could occur; this method is called on a closed result set, |
|
8506 |
* if a database access error occurs or |
|
8507 |
* the result set concurrency is <code>CONCUR_READ_ONLY</code> |
|
8508 |
* @exception SQLFeatureNotSupportedException if the JDBC driver does not support |
|
8509 |
* this method |
|
8510 |
* @since 1.6 |
|
8511 |
*/ |
|
8512 |
public void updateNClob(int columnIndex, Reader reader, long length) throws SQLException { |
|
8513 |
throw new SQLFeatureNotSupportedException(resBundle.handleGetObject("cachedrowsetimpl.featnotsupp").toString()); |
|
8514 |
} |
|
8515 |
||
8516 |
/** |
|
8517 |
* Updates the designated column using the given <code>Reader</code> |
|
8518 |
* object, which is the given number of characters long. |
|
8519 |
* When a very large UNICODE value is input to a <code>LONGVARCHAR</code> |
|
8520 |
* parameter, it may be more practical to send it via a |
|
8521 |
* <code>java.io.Reader</code> object. The data will be read from the stream |
|
8522 |
* as needed until end-of-file is reached. The JDBC driver will |
|
8523 |
* do any necessary conversion from UNICODE to the database char format. |
|
8524 |
* |
|
8525 |
* <P><B>Note:</B> This stream object can either be a standard |
|
8526 |
* Java stream object or your own subclass that implements the |
|
8527 |
* standard interface. |
|
8528 |
* <p> |
|
8529 |
* The updater methods are used to update column values in the |
|
8530 |
* current row or the insert row. The updater methods do not |
|
8531 |
* update the underlying database; instead the <code>updateRow</code> or |
|
8532 |
* <code>insertRow</code> methods are called to update the database. |
|
8533 |
* |
|
8534 |
* @param columnLabel the label for the column specified with the SQL AS clause. If the SQL AS clause was not specified, then the label is the name of the column |
|
8535 |
* @param reader An object that contains the data to set the parameter value to. |
|
8536 |
* @param length the number of characters in the parameter data. |
|
8537 |
* @throws SQLException if the driver does not support national |
|
8538 |
* character sets; if the driver can detect that a data conversion |
|
8539 |
* error could occur; this method is called on a closed result set; |
|
8540 |
* if a database access error occurs or |
|
8541 |
* the result set concurrency is <code>CONCUR_READ_ONLY</code> |
|
8542 |
* @exception SQLFeatureNotSupportedException if the JDBC driver does not support |
|
8543 |
* this method |
|
8544 |
* @since 1.6 |
|
8545 |
*/ |
|
8546 |
public void updateNClob(String columnLabel, Reader reader, long length) throws SQLException { |
|
8547 |
throw new SQLFeatureNotSupportedException(resBundle.handleGetObject("cachedrowsetimpl.featnotsupp").toString()); |
|
8548 |
} |
|
8549 |
||
8550 |
/** |
|
8551 |
* Updates the designated column using the given <code>Reader</code> |
|
8552 |
* object. |
|
8553 |
* When a very large UNICODE value is input to a <code>LONGVARCHAR</code> |
|
8554 |
* parameter, it may be more practical to send it via a |
|
8555 |
* <code>java.io.Reader</code> object. The data will be read from the stream |
|
8556 |
* as needed until end-of-file is reached. The JDBC driver will |
|
8557 |
* do any necessary conversion from UNICODE to the database char format. |
|
8558 |
* |
|
8559 |
* <P><B>Note:</B> This stream object can either be a standard |
|
8560 |
* Java stream object or your own subclass that implements the |
|
8561 |
* standard interface. |
|
8562 |
* <P><B>Note:</B> Consult your JDBC driver documentation to determine if |
|
8563 |
* it might be more efficient to use a version of |
|
8564 |
* <code>updateNClob</code> which takes a length parameter. |
|
8565 |
* <p> |
|
8566 |
* The updater methods are used to update column values in the |
|
8567 |
* current row or the insert row. The updater methods do not |
|
8568 |
* update the underlying database; instead the <code>updateRow</code> or |
|
8569 |
* <code>insertRow</code> methods are called to update the database. |
|
8570 |
* |
|
8571 |
* @param columnIndex the first column is 1, the second 2, ... |
|
8572 |
* @param reader An object that contains the data to set the parameter value to. |
|
8573 |
* @throws SQLException if the driver does not support national |
|
8574 |
* character sets; if the driver can detect that a data conversion |
|
8575 |
* error could occur; this method is called on a closed result set, |
|
8576 |
* if a database access error occurs or |
|
8577 |
* the result set concurrency is <code>CONCUR_READ_ONLY</code> |
|
8578 |
* @exception SQLFeatureNotSupportedException if the JDBC driver does not support |
|
8579 |
* this method |
|
8580 |
* @since 1.6 |
|
8581 |
*/ |
|
8582 |
public void updateNClob(int columnIndex, Reader reader) throws SQLException { |
|
8583 |
throw new SQLFeatureNotSupportedException(resBundle.handleGetObject("cachedrowsetimpl.featnotsupp").toString()); |
|
8584 |
} |
|
8585 |
||
8586 |
/** |
|
8587 |
* Updates the designated column using the given <code>Reader</code> |
|
8588 |
* object. |
|
8589 |
* When a very large UNICODE value is input to a <code>LONGVARCHAR</code> |
|
8590 |
* parameter, it may be more practical to send it via a |
|
8591 |
* <code>java.io.Reader</code> object. The data will be read from the stream |
|
8592 |
* as needed until end-of-file is reached. The JDBC driver will |
|
8593 |
* do any necessary conversion from UNICODE to the database char format. |
|
8594 |
* |
|
8595 |
* <P><B>Note:</B> This stream object can either be a standard |
|
8596 |
* Java stream object or your own subclass that implements the |
|
8597 |
* standard interface. |
|
8598 |
* <P><B>Note:</B> Consult your JDBC driver documentation to determine if |
|
8599 |
* it might be more efficient to use a version of |
|
8600 |
* <code>updateNClob</code> which takes a length parameter. |
|
8601 |
* <p> |
|
8602 |
* The updater methods are used to update column values in the |
|
8603 |
* current row or the insert row. The updater methods do not |
|
8604 |
* update the underlying database; instead the <code>updateRow</code> or |
|
8605 |
* <code>insertRow</code> methods are called to update the database. |
|
8606 |
* |
|
8607 |
* @param columnLabel the label for the column specified with the SQL AS clause. If the SQL AS clause was not specified, then the la |
|
8608 |
bel is the name of the column |
|
8609 |
* @param reader An object that contains the data to set the parameter value to. |
|
8610 |
* @throws SQLException if the driver does not support national |
|
8611 |
* character sets; if the driver can detect that a data conversion |
|
8612 |
* error could occur; this method is called on a closed result set; |
|
8613 |
* if a database access error occurs or |
|
8614 |
* the result set concurrency is <code>CONCUR_READ_ONLY</code> |
|
8615 |
* @exception SQLFeatureNotSupportedException if the JDBC driver does not support |
|
8616 |
* this method |
|
8617 |
* @since 1.6 |
|
8618 |
*/ |
|
8619 |
public void updateNClob(String columnLabel, Reader reader) throws SQLException { |
|
8620 |
throw new SQLFeatureNotSupportedException(resBundle.handleGetObject("cachedrowsetimpl.featnotsupp").toString()); |
|
8621 |
} |
|
8622 |
||
8623 |
/** |
|
8624 |
* Updates the designated column with an ascii stream value, which will have |
|
8625 |
* the specified number of bytes. |
|
8626 |
* The updater methods are used to update column values in the |
|
8627 |
* current row or the insert row. The updater methods do not |
|
8628 |
* update the underlying database; instead the <code>updateRow</code> or |
|
8629 |
* <code>insertRow</code> methods are called to update the database. |
|
8630 |
* |
|
8631 |
* @param columnIndex the first column is 1, the second is 2, ... |
|
8632 |
* @param x the new column value |
|
8633 |
* @param length the length of the stream |
|
8634 |
* @exception SQLException if a database access error occurs, |
|
8635 |
* the result set concurrency is <code>CONCUR_READ_ONLY</code> |
|
8636 |
* or this method is called on a closed result set |
|
8637 |
* @exception SQLFeatureNotSupportedException if the JDBC driver does not support |
|
8638 |
* this method |
|
8639 |
* @since 1.6 |
|
8640 |
*/ |
|
8641 |
public void updateAsciiStream(int columnIndex, |
|
8642 |
java.io.InputStream x, |
|
8643 |
long length) throws SQLException { |
|
8644 |
||
8645 |
} |
|
8646 |
||
8647 |
/** |
|
8648 |
* Updates the designated column with a binary stream value, which will have |
|
8649 |
* the specified number of bytes. |
|
8650 |
* The updater methods are used to update column values in the |
|
8651 |
* current row or the insert row. The updater methods do not |
|
8652 |
* update the underlying database; instead the <code>updateRow</code> or |
|
8653 |
* <code>insertRow</code> methods are called to update the database. |
|
8654 |
* |
|
8655 |
* @param columnIndex the first column is 1, the second is 2, ... |
|
8656 |
* @param x the new column value |
|
8657 |
* @param length the length of the stream |
|
8658 |
* @exception SQLException if a database access error occurs, |
|
8659 |
* the result set concurrency is <code>CONCUR_READ_ONLY</code> |
|
8660 |
* or this method is called on a closed result set |
|
8661 |
* @exception SQLFeatureNotSupportedException if the JDBC driver does not support |
|
8662 |
* this method |
|
8663 |
* @since 1.6 |
|
8664 |
*/ |
|
8665 |
public void updateBinaryStream(int columnIndex, |
|
8666 |
java.io.InputStream x, |
|
8667 |
long length) throws SQLException { |
|
8668 |
} |
|
8669 |
||
8670 |
/** |
|
8671 |
* Updates the designated column with a character stream value, which will have |
|
8672 |
* the specified number of bytes. |
|
8673 |
* The updater methods are used to update column values in the |
|
8674 |
* current row or the insert row. The updater methods do not |
|
8675 |
* update the underlying database; instead the <code>updateRow</code> or |
|
8676 |
* <code>insertRow</code> methods are called to update the database. |
|
8677 |
* |
|
8678 |
* @param columnIndex the first column is 1, the second is 2, ... |
|
8679 |
* @param x the new column value |
|
8680 |
* @param length the length of the stream |
|
8681 |
* @exception SQLException if a database access error occurs, |
|
8682 |
* the result set concurrency is <code>CONCUR_READ_ONLY</code> |
|
8683 |
* or this method is called on a closed result set |
|
8684 |
* @exception SQLFeatureNotSupportedException if the JDBC driver does not support |
|
8685 |
* this method |
|
8686 |
* @since 1.6 |
|
8687 |
*/ |
|
8688 |
public void updateCharacterStream(int columnIndex, |
|
8689 |
java.io.Reader x, |
|
8690 |
long length) throws SQLException { |
|
8691 |
throw new SQLFeatureNotSupportedException(resBundle.handleGetObject("cachedrowsetimpl.featnotsupp").toString()); |
|
8692 |
} |
|
8693 |
||
8694 |
/** |
|
8695 |
* Updates the designated column with a character stream value, which will have |
|
8696 |
* the specified number of bytes. |
|
8697 |
* The updater methods are used to update column values in the |
|
8698 |
* current row or the insert row. The updater methods do not |
|
8699 |
* update the underlying database; instead the <code>updateRow</code> or |
|
8700 |
* <code>insertRow</code> methods are called to update the database. |
|
8701 |
* |
|
8702 |
* @param columnLabel the label for the column specified with the SQL AS clause. If the SQL AS clause was not specified, then the la |
|
8703 |
bel is the name of the column |
|
8704 |
* @param reader the <code>java.io.Reader</code> object containing |
|
8705 |
* the new column value |
|
8706 |
* @param length the length of the stream |
|
8707 |
* @exception SQLException if a database access error occurs, |
|
8708 |
* the result set concurrency is <code>CONCUR_READ_ONLY</code> |
|
8709 |
* or this method is called on a closed result set |
|
8710 |
* @exception SQLFeatureNotSupportedException if the JDBC driver does not support |
|
8711 |
* this method |
|
8712 |
* @since 1.6 |
|
8713 |
*/ |
|
8714 |
public void updateCharacterStream(String columnLabel, |
|
8715 |
java.io.Reader reader, |
|
8716 |
long length) throws SQLException { |
|
8717 |
throw new SQLFeatureNotSupportedException(resBundle.handleGetObject("cachedrowsetimpl.featnotsupp").toString()); |
|
8718 |
} |
|
8719 |
/** |
|
8720 |
* Updates the designated column with an ascii stream value, which will have |
|
8721 |
* the specified number of bytes.. |
|
8722 |
* The updater methods are used to update column values in the |
|
8723 |
* current row or the insert row. The updater methods do not |
|
8724 |
* update the underlying database; instead the <code>updateRow</code> or |
|
8725 |
* <code>insertRow</code> methods are called to update the database. |
|
8726 |
* |
|
8727 |
* @param columnLabel the label for the column specified with the SQL AS clause. If the SQL AS clause was not specified, then the label is the name of the column |
|
8728 |
* @param x the new column value |
|
8729 |
* @param length the length of the stream |
|
8730 |
* @exception SQLException if a database access error occurs, |
|
8731 |
* the result set concurrency is <code>CONCUR_READ_ONLY</code> |
|
8732 |
* or this method is called on a closed result set |
|
8733 |
* @exception SQLFeatureNotSupportedException if the JDBC driver does not support |
|
8734 |
* this method |
|
8735 |
* @since 1.6 |
|
8736 |
*/ |
|
8737 |
public void updateAsciiStream(String columnLabel, |
|
8738 |
java.io.InputStream x, |
|
8739 |
long length) throws SQLException { |
|
8740 |
} |
|
8741 |
||
8742 |
/** |
|
8743 |
* Updates the designated column with a binary stream value, which will have |
|
8744 |
* the specified number of bytes. |
|
8745 |
* The updater methods are used to update column values in the |
|
8746 |
* current row or the insert row. The updater methods do not |
|
8747 |
* update the underlying database; instead the <code>updateRow</code> or |
|
8748 |
* <code>insertRow</code> methods are called to update the database. |
|
8749 |
* |
|
8750 |
* @param columnLabel the label for the column specified with the SQL AS clause. If the SQL AS clause was not specified, then the label is the name of the column |
|
8751 |
* @param x the new column value |
|
8752 |
* @param length the length of the stream |
|
8753 |
* @exception SQLException if a database access error occurs, |
|
8754 |
* the result set concurrency is <code>CONCUR_READ_ONLY</code> |
|
8755 |
* or this method is called on a closed result set |
|
8756 |
* @exception SQLFeatureNotSupportedException if the JDBC driver does not support |
|
8757 |
* this method |
|
8758 |
* @since 1.6 |
|
8759 |
*/ |
|
8760 |
public void updateBinaryStream(String columnLabel, |
|
8761 |
java.io.InputStream x, |
|
8762 |
long length) throws SQLException { |
|
8763 |
} |
|
8764 |
||
8765 |
/** |
|
8766 |
* Updates the designated column with a binary stream value. |
|
8767 |
* The updater methods are used to update column values in the |
|
8768 |
* current row or the insert row. The updater methods do not |
|
8769 |
* update the underlying database; instead the <code>updateRow</code> or |
|
8770 |
* <code>insertRow</code> methods are called to update the database. |
|
8771 |
* |
|
8772 |
* <P><B>Note:</B> Consult your JDBC driver documentation to determine if |
|
8773 |
* it might be more efficient to use a version of |
|
8774 |
* <code>updateBinaryStream</code> which takes a length parameter. |
|
8775 |
* |
|
8776 |
* @param columnIndex the first column is 1, the second is 2, ... |
|
8777 |
* @param x the new column value |
|
8778 |
* @exception SQLException if a database access error occurs, |
|
8779 |
* the result set concurrency is <code>CONCUR_READ_ONLY</code> |
|
8780 |
* or this method is called on a closed result set |
|
8781 |
* @exception SQLFeatureNotSupportedException if the JDBC driver does not support |
|
8782 |
* this method |
|
8783 |
* @since 1.6 |
|
8784 |
*/ |
|
8785 |
public void updateBinaryStream(int columnIndex, |
|
8786 |
java.io.InputStream x) throws SQLException { |
|
8787 |
throw new SQLFeatureNotSupportedException(resBundle.handleGetObject("cachedrowsetimpl.featnotsupp").toString()); |
|
8788 |
} |
|
8789 |
||
8790 |
||
8791 |
/** |
|
8792 |
* Updates the designated column with a binary stream value. |
|
8793 |
* The updater methods are used to update column values in the |
|
8794 |
* current row or the insert row. The updater methods do not |
|
8795 |
* update the underlying database; instead the <code>updateRow</code> or |
|
8796 |
* <code>insertRow</code> methods are called to update the database. |
|
8797 |
* |
|
8798 |
* <P><B>Note:</B> Consult your JDBC driver documentation to determine if |
|
8799 |
* it might be more efficient to use a version of |
|
8800 |
* <code>updateBinaryStream</code> which takes a length parameter. |
|
8801 |
* |
|
8802 |
* @param columnLabel the label for the column specified with the SQL AS clause. If the SQL AS clause was not specified, then the la |
|
8803 |
bel is the name of the column |
|
8804 |
* @param x the new column value |
|
8805 |
* @exception SQLException if a database access error occurs, |
|
8806 |
* the result set concurrency is <code>CONCUR_READ_ONLY</code> |
|
8807 |
* or this method is called on a closed result set |
|
8808 |
* @exception SQLFeatureNotSupportedException if the JDBC driver does not support |
|
8809 |
* this method |
|
8810 |
* @since 1.6 |
|
8811 |
*/ |
|
8812 |
public void updateBinaryStream(String columnLabel, |
|
8813 |
java.io.InputStream x) throws SQLException { |
|
8814 |
throw new SQLFeatureNotSupportedException(resBundle.handleGetObject("cachedrowsetimpl.featnotsupp").toString()); |
|
8815 |
} |
|
8816 |
||
8817 |
/** |
|
8818 |
* Updates the designated column with a character stream value. |
|
8819 |
* The updater methods are used to update column values in the |
|
8820 |
* current row or the insert row. The updater methods do not |
|
8821 |
* update the underlying database; instead the <code>updateRow</code> or |
|
8822 |
* <code>insertRow</code> methods are called to update the database. |
|
8823 |
* |
|
8824 |
* <P><B>Note:</B> Consult your JDBC driver documentation to determine if |
|
8825 |
* it might be more efficient to use a version of |
|
8826 |
* <code>updateCharacterStream</code> which takes a length parameter. |
|
8827 |
* |
|
8828 |
* @param columnIndex the first column is 1, the second is 2, ... |
|
8829 |
* @param x the new column value |
|
8830 |
* @exception SQLException if a database access error occurs, |
|
8831 |
* the result set concurrency is <code>CONCUR_READ_ONLY</code> |
|
8832 |
* or this method is called on a closed result set |
|
8833 |
* @exception SQLFeatureNotSupportedException if the JDBC driver does not support |
|
8834 |
* this method |
|
8835 |
* @since 1.6 |
|
8836 |
*/ |
|
8837 |
public void updateCharacterStream(int columnIndex, |
|
8838 |
java.io.Reader x) throws SQLException { |
|
8839 |
throw new SQLFeatureNotSupportedException(resBundle.handleGetObject("cachedrowsetimpl.featnotsupp").toString()); |
|
8840 |
} |
|
8841 |
||
8842 |
/** |
|
8843 |
* Updates the designated column with a character stream value. |
|
8844 |
* The updater methods are used to update column values in the |
|
8845 |
* current row or the insert row. The updater methods do not |
|
8846 |
* update the underlying database; instead the <code>updateRow</code> or |
|
8847 |
* <code>insertRow</code> methods are called to update the database. |
|
8848 |
* |
|
8849 |
* <P><B>Note:</B> Consult your JDBC driver documentation to determine if |
|
8850 |
* it might be more efficient to use a version of |
|
8851 |
* <code>updateCharacterStream</code> which takes a length parameter. |
|
8852 |
* |
|
8853 |
* @param columnLabel the label for the column specified with the SQL AS clause. If the SQL AS clause was not specified, then the la |
|
8854 |
bel is the name of the column |
|
8855 |
* @param reader the <code>java.io.Reader</code> object containing |
|
8856 |
* the new column value |
|
8857 |
* @exception SQLException if a database access error occurs, |
|
8858 |
* the result set concurrency is <code>CONCUR_READ_ONLY</code> |
|
8859 |
* or this method is called on a closed result set |
|
8860 |
* @exception SQLFeatureNotSupportedException if the JDBC driver does not support |
|
8861 |
* this method |
|
8862 |
* @since 1.6 |
|
8863 |
*/ |
|
8864 |
public void updateCharacterStream(String columnLabel, |
|
8865 |
java.io.Reader reader) throws SQLException { |
|
8866 |
throw new SQLFeatureNotSupportedException(resBundle.handleGetObject("cachedrowsetimpl.featnotsupp").toString()); |
|
8867 |
} |
|
8868 |
||
8869 |
/** |
|
8870 |
* Updates the designated column with an ascii stream value. |
|
8871 |
* The updater methods are used to update column values in the |
|
8872 |
* current row or the insert row. The updater methods do not |
|
8873 |
* update the underlying database; instead the <code>updateRow</code> or |
|
8874 |
* <code>insertRow</code> methods are called to update the database. |
|
8875 |
* |
|
8876 |
* <P><B>Note:</B> Consult your JDBC driver documentation to determine if |
|
8877 |
* it might be more efficient to use a version of |
|
8878 |
* <code>updateAsciiStream</code> which takes a length parameter. |
|
8879 |
* |
|
8880 |
* @param columnIndex the first column is 1, the second is 2, ... |
|
8881 |
* @param x the new column value |
|
8882 |
* @exception SQLException if a database access error occurs, |
|
8883 |
* the result set concurrency is <code>CONCUR_READ_ONLY</code> |
|
8884 |
* or this method is called on a closed result set |
|
8885 |
* @exception SQLFeatureNotSupportedException if the JDBC driver does not support |
|
8886 |
* this method |
|
8887 |
* @since 1.6 |
|
8888 |
*/ |
|
8889 |
public void updateAsciiStream(int columnIndex, |
|
8890 |
java.io.InputStream x) throws SQLException { |
|
8891 |
throw new SQLFeatureNotSupportedException(resBundle.handleGetObject("cachedrowsetimpl.featnotsupp").toString()); |
|
8892 |
} |
|
8893 |
||
8894 |
/** |
|
8895 |
* Updates the designated column with an ascii stream value. |
|
8896 |
* The updater methods are used to update column values in the |
|
8897 |
* current row or the insert row. The updater methods do not |
|
8898 |
* update the underlying database; instead the <code>updateRow</code> or |
|
8899 |
* <code>insertRow</code> methods are called to update the database. |
|
8900 |
* |
|
8901 |
* <P><B>Note:</B> Consult your JDBC driver documentation to determine if |
|
8902 |
* it might be more efficient to use a version of |
|
8903 |
* <code>updateAsciiStream</code> which takes a length parameter. |
|
8904 |
* |
|
8905 |
* @param columnLabel the label for the column specified with the SQL AS clause. If the SQL AS clause was not specified, then the la |
|
8906 |
bel is the name of the column |
|
8907 |
* @param x the new column value |
|
8908 |
* @exception SQLException if a database access error occurs, |
|
8909 |
* the result set concurrency is <code>CONCUR_READ_ONLY</code> |
|
8910 |
* or this method is called on a closed result set |
|
8911 |
* @exception SQLFeatureNotSupportedException if the JDBC driver does not support |
|
8912 |
* this method |
|
8913 |
* @since 1.6 |
|
8914 |
*/ |
|
8915 |
public void updateAsciiStream(String columnLabel, |
|
8916 |
java.io.InputStream x) throws SQLException { |
|
8917 |
||
8918 |
} |
|
8919 |
||
8920 |
/** |
|
8921 |
* Sets the designated parameter to the given <code>java.net.URL</code> value. |
|
8922 |
* The driver converts this to an SQL <code>DATALINK</code> value |
|
8923 |
* when it sends it to the database. |
|
8924 |
* |
|
8925 |
* @param parameterIndex the first parameter is 1, the second is 2, ... |
|
8926 |
* @param x the <code>java.net.URL</code> object to be set |
|
8927 |
* @exception SQLException if a database access error occurs or |
|
8928 |
* this method is called on a closed <code>PreparedStatement</code> |
|
8929 |
* @throws SQLFeatureNotSupportedException if the JDBC driver does not support this method |
|
8930 |
* @since 1.4 |
|
8931 |
*/ |
|
8932 |
public void setURL(int parameterIndex, java.net.URL x) throws SQLException{ |
|
8933 |
throw new SQLFeatureNotSupportedException(resBundle.handleGetObject("cachedrowsetimpl.featnotsupp").toString()); |
|
8934 |
} |
|
8935 |
||
8936 |
/** |
|
8937 |
* Sets the designated parameter to a <code>Reader</code> object. |
|
8938 |
* This method differs from the <code>setCharacterStream (int, Reader)</code> method |
|
8939 |
* because it informs the driver that the parameter value should be sent to |
|
8940 |
* the server as a <code>NCLOB</code>. When the <code>setCharacterStream</code> method is used, the |
|
8941 |
* driver may have to do extra work to determine whether the parameter |
|
8942 |
* data should be sent to the server as a <code>LONGNVARCHAR</code> or a <code>NCLOB</code> |
|
8943 |
* <P><B>Note:</B> Consult your JDBC driver documentation to determine if |
|
8944 |
* it might be more efficient to use a version of |
|
8945 |
* <code>setNClob</code> which takes a length parameter. |
|
8946 |
* |
|
8947 |
* @param parameterIndex index of the first parameter is 1, the second is 2, ... |
|
8948 |
* @param reader An object that contains the data to set the parameter value to. |
|
8949 |
* @throws SQLException if parameterIndex does not correspond to a parameter |
|
8950 |
* marker in the SQL statement; |
|
8951 |
* if the driver does not support national character sets; |
|
8952 |
* if the driver can detect that a data conversion |
|
8953 |
* error could occur; if a database access error occurs or |
|
8954 |
* this method is called on a closed <code>PreparedStatement</code> |
|
8955 |
* @throws SQLFeatureNotSupportedException if the JDBC driver does not support this method |
|
8956 |
* |
|
8957 |
* @since 1.6 |
|
8958 |
*/ |
|
8959 |
public void setNClob(int parameterIndex, Reader reader) |
|
8960 |
throws SQLException{ |
|
8961 |
throw new SQLFeatureNotSupportedException(resBundle.handleGetObject("cachedrowsetimpl.featnotsupp").toString()); |
|
8962 |
} |
|
8963 |
||
8964 |
/** |
|
8965 |
* Sets the designated parameter to a <code>Reader</code> object. The <code>reader</code> must contain the number |
|
8966 |
* of characters specified by length otherwise a <code>SQLException</code> will be |
|
8967 |
* generated when the <code>CallableStatement</code> is executed. |
|
8968 |
* This method differs from the <code>setCharacterStream (int, Reader, int)</code> method |
|
8969 |
* because it informs the driver that the parameter value should be sent to |
|
8970 |
* the server as a <code>NCLOB</code>. When the <code>setCharacterStream</code> method is used, the |
|
8971 |
* driver may have to do extra work to determine whether the parameter |
|
8972 |
* data should be send to the server as a <code>LONGNVARCHAR</code> or a <code>NCLOB</code> |
|
8973 |
* |
|
8974 |
* @param parameterName the name of the parameter to be set |
|
8975 |
* @param reader An object that contains the data to set the parameter value to. |
|
8976 |
* @param length the number of characters in the parameter data. |
|
8977 |
* @throws SQLException if parameterIndex does not correspond to a parameter |
|
8978 |
* marker in the SQL statement; if the length specified is less than zero; |
|
8979 |
* if the driver does not support national |
|
8980 |
* character sets; if the driver can detect that a data conversion |
|
8981 |
* error could occur; if a database access error occurs or |
|
8982 |
* this method is called on a closed <code>CallableStatement</code> |
|
8983 |
* @exception SQLFeatureNotSupportedException if the JDBC driver does not support |
|
8984 |
* this method |
|
8985 |
* @since 1.6 |
|
8986 |
*/ |
|
8987 |
public void setNClob(String parameterName, Reader reader, long length) |
|
8988 |
throws SQLException{ |
|
8989 |
throw new SQLFeatureNotSupportedException(resBundle.handleGetObject("cachedrowsetimpl.featnotsupp").toString()); |
|
8990 |
} |
|
8991 |
||
8992 |
||
8993 |
/** |
|
8994 |
* Sets the designated parameter to a <code>Reader</code> object. |
|
8995 |
* This method differs from the <code>setCharacterStream (int, Reader)</code> method |
|
8996 |
* because it informs the driver that the parameter value should be sent to |
|
8997 |
* the server as a <code>NCLOB</code>. When the <code>setCharacterStream</code> method is used, the |
|
8998 |
* driver may have to do extra work to determine whether the parameter |
|
8999 |
* data should be send to the server as a <code>LONGNVARCHAR</code> or a <code>NCLOB</code> |
|
9000 |
* <P><B>Note:</B> Consult your JDBC driver documentation to determine if |
|
9001 |
* it might be more efficient to use a version of |
|
9002 |
* <code>setNClob</code> which takes a length parameter. |
|
9003 |
* |
|
9004 |
* @param parameterName the name of the parameter |
|
9005 |
* @param reader An object that contains the data to set the parameter value to. |
|
9006 |
* @throws SQLException if the driver does not support national character sets; |
|
9007 |
* if the driver can detect that a data conversion |
|
9008 |
* error could occur; if a database access error occurs or |
|
9009 |
* this method is called on a closed <code>CallableStatement</code> |
|
9010 |
* @throws SQLFeatureNotSupportedException if the JDBC driver does not support this method |
|
9011 |
* |
|
9012 |
* @since 1.6 |
|
9013 |
*/ |
|
9014 |
public void setNClob(String parameterName, Reader reader) |
|
9015 |
throws SQLException{ |
|
9016 |
throw new SQLFeatureNotSupportedException(resBundle.handleGetObject("cachedrowsetimpl.featnotsupp").toString()); |
|
9017 |
} |
|
9018 |
||
9019 |
||
9020 |
/** |
|
9021 |
* Sets the designated parameter to a <code>Reader</code> object. The reader must contain the number |
|
9022 |
* of characters specified by length otherwise a <code>SQLException</code> will be |
|
9023 |
* generated when the <code>PreparedStatement</code> is executed. |
|
9024 |
* This method differs from the <code>setCharacterStream (int, Reader, int)</code> method |
|
9025 |
* because it informs the driver that the parameter value should be sent to |
|
9026 |
* the server as a <code>NCLOB</code>. When the <code>setCharacterStream</code> method is used, the |
|
9027 |
* driver may have to do extra work to determine whether the parameter |
|
9028 |
* data should be sent to the server as a <code>LONGNVARCHAR</code> or a <code>NCLOB</code> |
|
9029 |
* @param parameterIndex index of the first parameter is 1, the second is 2, ... |
|
9030 |
* @param reader An object that contains the data to set the parameter value to. |
|
9031 |
* @param length the number of characters in the parameter data. |
|
9032 |
* @throws SQLException if parameterIndex does not correspond to a parameter |
|
9033 |
* marker in the SQL statement; if the length specified is less than zero; |
|
9034 |
* if the driver does not support national character sets; |
|
9035 |
* if the driver can detect that a data conversion |
|
9036 |
* error could occur; if a database access error occurs or |
|
9037 |
* this method is called on a closed <code>PreparedStatement</code> |
|
9038 |
* @throws SQLFeatureNotSupportedException if the JDBC driver does not support this method |
|
9039 |
* |
|
9040 |
* @since 1.6 |
|
9041 |
*/ |
|
9042 |
public void setNClob(int parameterIndex, Reader reader, long length) |
|
9043 |
throws SQLException{ |
|
9044 |
throw new SQLFeatureNotSupportedException(resBundle.handleGetObject("cachedrowsetimpl.featnotsupp").toString()); |
|
9045 |
} |
|
9046 |
||
9047 |
||
9048 |
/** |
|
9049 |
* Sets the designated parameter to a <code>java.sql.NClob</code> object. The driver converts this to |
|
9050 |
a |
|
9051 |
* SQL <code>NCLOB</code> value when it sends it to the database. |
|
9052 |
* @param parameterIndex of the first parameter is 1, the second is 2, ... |
|
9053 |
* @param value the parameter value |
|
9054 |
* @throws SQLException if the driver does not support national |
|
9055 |
* character sets; if the driver can detect that a data conversion |
|
9056 |
* error could occur ; or if a database access error occurs |
|
9057 |
* @since 1.6 |
|
9058 |
*/ |
|
9059 |
public void setNClob(int parameterIndex, NClob value) throws SQLException{ |
|
9060 |
throw new SQLFeatureNotSupportedException(resBundle.handleGetObject("cachedrowsetimpl.featnotsupp").toString()); |
|
9061 |
} |
|
9062 |
||
9063 |
||
9064 |
/** |
|
9065 |
* Sets the designated paramter to the given <code>String</code> object. |
|
9066 |
* The driver converts this to a SQL <code>NCHAR</code> or |
|
9067 |
* <code>NVARCHAR</code> or <code>LONGNVARCHAR</code> value |
|
9068 |
* (depending on the argument's |
|
9069 |
* size relative to the driver's limits on <code>NVARCHAR</code> values) |
|
9070 |
* when it sends it to the database. |
|
9071 |
* |
|
9072 |
* @param parameterIndex of the first parameter is 1, the second is 2, ... |
|
9073 |
* @param value the parameter value |
|
9074 |
* @throws SQLException if the driver does not support national |
|
9075 |
* character sets; if the driver can detect that a data conversion |
|
9076 |
* error could occur ; or if a database access error occurs |
|
9077 |
* @since 1.6 |
|
9078 |
*/ |
|
9079 |
public void setNString(int parameterIndex, String value) throws SQLException{ |
|
9080 |
throw new SQLFeatureNotSupportedException(resBundle.handleGetObject("cachedrowsetimpl.featnotsupp").toString()); |
|
9081 |
} |
|
9082 |
||
9083 |
||
9084 |
/** |
|
9085 |
* Sets the designated paramter to the given <code>String</code> object. |
|
9086 |
* The driver converts this to a SQL <code>NCHAR</code> or |
|
9087 |
* <code>NVARCHAR</code> or <code>LONGNVARCHAR</code> |
|
9088 |
* @param parameterName the name of the column to be set |
|
9089 |
* @param value the parameter value |
|
9090 |
* @throws SQLException if the driver does not support national |
|
9091 |
* character sets; if the driver can detect that a data conversion |
|
9092 |
* error could occur; or if a database access error occurs |
|
9093 |
* @since 1.6 |
|
9094 |
*/ |
|
9095 |
public void setNString(String parameterName, String value) |
|
9096 |
throws SQLException{ |
|
9097 |
throw new SQLFeatureNotSupportedException(resBundle.handleGetObject("cachedrowsetimpl.featnotsupp").toString()); |
|
9098 |
} |
|
9099 |
||
9100 |
||
9101 |
/** |
|
9102 |
* Sets the designated parameter to a <code>Reader</code> object. The |
|
9103 |
* <code>Reader</code> reads the data till end-of-file is reached. The |
|
9104 |
* driver does the necessary conversion from Java character format to |
|
9105 |
* the national character set in the database. |
|
9106 |
* @param parameterIndex of the first parameter is 1, the second is 2, ... |
|
9107 |
* @param value the parameter value |
|
9108 |
* @param length the number of characters in the parameter data. |
|
9109 |
* @throws SQLException if the driver does not support national |
|
9110 |
* character sets; if the driver can detect that a data conversion |
|
9111 |
* error could occur ; or if a database access error occurs |
|
9112 |
* @since 1.6 |
|
9113 |
*/ |
|
9114 |
public void setNCharacterStream(int parameterIndex, Reader value, long length) throws SQLException{ |
|
9115 |
throw new SQLFeatureNotSupportedException(resBundle.handleGetObject("cachedrowsetimpl.featnotsupp").toString()); |
|
9116 |
} |
|
9117 |
||
9118 |
||
9119 |
/** |
|
9120 |
* Sets the designated parameter to a <code>Reader</code> object. The |
|
9121 |
* <code>Reader</code> reads the data till end-of-file is reached. The |
|
9122 |
* driver does the necessary conversion from Java character format to |
|
9123 |
* the national character set in the database. |
|
9124 |
* @param parameterName the name of the column to be set |
|
9125 |
* @param value the parameter value |
|
9126 |
* @param length the number of characters in the parameter data. |
|
9127 |
* @throws SQLException if the driver does not support national |
|
9128 |
* character sets; if the driver can detect that a data conversion |
|
9129 |
* error could occur; or if a database access error occurs |
|
9130 |
* @since 1.6 |
|
9131 |
*/ |
|
9132 |
public void setNCharacterStream(String parameterName, Reader value, long length) |
|
9133 |
throws SQLException{ |
|
9134 |
throw new SQLFeatureNotSupportedException(resBundle.handleGetObject("cachedrowsetimpl.featnotsupp").toString()); |
|
9135 |
} |
|
9136 |
||
9137 |
/** |
|
9138 |
* Sets the designated parameter to a <code>Reader</code> object. The |
|
9139 |
* <code>Reader</code> reads the data till end-of-file is reached. The |
|
9140 |
* driver does the necessary conversion from Java character format to |
|
9141 |
* the national character set in the database. |
|
9142 |
||
9143 |
* <P><B>Note:</B> This stream object can either be a standard |
|
9144 |
* Java stream object or your own subclass that implements the |
|
9145 |
* standard interface. |
|
9146 |
* <P><B>Note:</B> Consult your JDBC driver documentation to determine if |
|
9147 |
* it might be more efficient to use a version of |
|
9148 |
* <code>setNCharacterStream</code> which takes a length parameter. |
|
9149 |
* |
|
9150 |
* @param parameterName the name of the parameter |
|
9151 |
* @param value the parameter value |
|
9152 |
* @throws SQLException if the driver does not support national |
|
9153 |
* character sets; if the driver can detect that a data conversion |
|
9154 |
* error could occur ; if a database access error occurs; or |
|
9155 |
* this method is called on a closed <code>CallableStatement</code> |
|
9156 |
* @throws SQLFeatureNotSupportedException if the JDBC driver does not support this method |
|
9157 |
* @since 1.6 |
|
9158 |
*/ |
|
9159 |
public void setNCharacterStream(String parameterName, Reader value) throws SQLException{ |
|
9160 |
throw new SQLFeatureNotSupportedException(resBundle.handleGetObject("cachedrowsetimpl.featnotsupp").toString()); |
|
9161 |
} |
|
9162 |
||
9163 |
/** |
|
9164 |
* Sets the designated parameter to the given <code>java.sql.Timestamp</code> value, |
|
9165 |
* using the given <code>Calendar</code> object. The driver uses |
|
9166 |
* the <code>Calendar</code> object to construct an SQL <code>TIMESTAMP</code> value, |
|
9167 |
* which the driver then sends to the database. With a |
|
9168 |
* a <code>Calendar</code> object, the driver can calculate the timestamp |
|
9169 |
* taking into account a custom timezone. If no |
|
9170 |
* <code>Calendar</code> object is specified, the driver uses the default |
|
9171 |
* timezone, which is that of the virtual machine running the application. |
|
9172 |
* |
|
9173 |
* @param parameterName the name of the parameter |
|
9174 |
* @param x the parameter value |
|
9175 |
* @param cal the <code>Calendar</code> object the driver will use |
|
9176 |
* to construct the timestamp |
|
9177 |
* @exception SQLException if a database access error occurs or |
|
9178 |
* this method is called on a closed <code>CallableStatement</code> |
|
9179 |
* @exception SQLFeatureNotSupportedException if the JDBC driver does not support |
|
9180 |
* this method |
|
9181 |
* @see #getTimestamp |
|
9182 |
* @since 1.4 |
|
9183 |
*/ |
|
9184 |
public void setTimestamp(String parameterName, java.sql.Timestamp x, Calendar cal) |
|
9185 |
throws SQLException{ |
|
9186 |
throw new SQLFeatureNotSupportedException(resBundle.handleGetObject("cachedrowsetimpl.featnotsupp").toString()); |
|
9187 |
} |
|
9188 |
||
9189 |
/** |
|
9190 |
* Sets the designated parameter to a <code>Reader</code> object. The <code>reader</code> must contain the number |
|
9191 |
* of characters specified by length otherwise a <code>SQLException</code> will be |
|
9192 |
* generated when the <code>CallableStatement</code> is executed. |
|
9193 |
* This method differs from the <code>setCharacterStream (int, Reader, int)</code> method |
|
9194 |
* because it informs the driver that the parameter value should be sent to |
|
9195 |
* the server as a <code>CLOB</code>. When the <code>setCharacterStream</code> method is used, the |
|
9196 |
* driver may have to do extra work to determine whether the parameter |
|
9197 |
* data should be send to the server as a <code>LONGVARCHAR</code> or a <code>CLOB</code> |
|
9198 |
* @param parameterName the name of the parameter to be set |
|
9199 |
* @param reader An object that contains the data to set the parameter value to. |
|
9200 |
* @param length the number of characters in the parameter data. |
|
9201 |
* @throws SQLException if parameterIndex does not correspond to a parameter |
|
9202 |
* marker in the SQL statement; if the length specified is less than zero; |
|
9203 |
* a database access error occurs or |
|
9204 |
* this method is called on a closed <code>CallableStatement</code> |
|
9205 |
* @exception SQLFeatureNotSupportedException if the JDBC driver does not support |
|
9206 |
* this method |
|
9207 |
* |
|
9208 |
* @since 1.6 |
|
9209 |
*/ |
|
9210 |
public void setClob(String parameterName, Reader reader, long length) |
|
9211 |
throws SQLException{ |
|
9212 |
throw new SQLFeatureNotSupportedException(resBundle.handleGetObject("cachedrowsetimpl.featnotsupp").toString()); |
|
9213 |
} |
|
9214 |
||
9215 |
||
9216 |
/** |
|
9217 |
* Sets the designated parameter to the given <code>java.sql.Clob</code> object. |
|
9218 |
* The driver converts this to an SQL <code>CLOB</code> value when it |
|
9219 |
* sends it to the database. |
|
9220 |
* |
|
9221 |
* @param parameterName the name of the parameter |
|
9222 |
* @param x a <code>Clob</code> object that maps an SQL <code>CLOB</code> value |
|
9223 |
* @exception SQLException if a database access error occurs or |
|
9224 |
* this method is called on a closed <code>CallableStatement</code> |
|
9225 |
* @exception SQLFeatureNotSupportedException if the JDBC driver does not support |
|
9226 |
* this method |
|
9227 |
* @since 1.6 |
|
9228 |
*/ |
|
9229 |
public void setClob (String parameterName, Clob x) throws SQLException{ |
|
9230 |
throw new SQLFeatureNotSupportedException(resBundle.handleGetObject("cachedrowsetimpl.featnotsupp").toString()); |
|
9231 |
} |
|
9232 |
||
9233 |
||
9234 |
/** |
|
9235 |
* Sets the designated parameter to a <code>Reader</code> object. |
|
9236 |
* This method differs from the <code>setCharacterStream (int, Reader)</code> method |
|
9237 |
* because it informs the driver that the parameter value should be sent to |
|
9238 |
* the server as a <code>CLOB</code>. When the <code>setCharacterStream</code> method is used, the |
|
9239 |
* driver may have to do extra work to determine whether the parameter |
|
9240 |
* data should be send to the server as a <code>LONGVARCHAR</code> or a <code>CLOB</code> |
|
9241 |
* |
|
9242 |
* <P><B>Note:</B> Consult your JDBC driver documentation to determine if |
|
9243 |
* it might be more efficient to use a version of |
|
9244 |
* <code>setClob</code> which takes a length parameter. |
|
9245 |
* |
|
9246 |
* @param parameterName the name of the parameter |
|
9247 |
* @param reader An object that contains the data to set the parameter value to. |
|
9248 |
* @throws SQLException if a database access error occurs or this method is called on |
|
9249 |
* a closed <code>CallableStatement</code> |
|
9250 |
* |
|
9251 |
* @throws SQLFeatureNotSupportedException if the JDBC driver does not support this method |
|
9252 |
* @since 1.6 |
|
9253 |
*/ |
|
9254 |
public void setClob(String parameterName, Reader reader) |
|
9255 |
throws SQLException{ |
|
9256 |
throw new SQLFeatureNotSupportedException(resBundle.handleGetObject("cachedrowsetimpl.featnotsupp").toString()); |
|
9257 |
} |
|
9258 |
||
9259 |
||
9260 |
/** |
|
9261 |
* Sets the designated parameter to the given <code>java.sql.Date</code> value |
|
9262 |
* using the default time zone of the virtual machine that is running |
|
9263 |
* the application. |
|
9264 |
* The driver converts this |
|
9265 |
* to an SQL <code>DATE</code> value when it sends it to the database. |
|
9266 |
* |
|
9267 |
* @param parameterName the name of the parameter |
|
9268 |
* @param x the parameter value |
|
9269 |
* @exception SQLException if a database access error occurs or |
|
9270 |
* this method is called on a closed <code>CallableStatement</code> |
|
9271 |
* @exception SQLFeatureNotSupportedException if the JDBC driver does not support |
|
9272 |
* this method |
|
9273 |
* @see #getDate |
|
9274 |
* @since 1.4 |
|
9275 |
*/ |
|
9276 |
public void setDate(String parameterName, java.sql.Date x) |
|
9277 |
throws SQLException{ |
|
9278 |
throw new SQLFeatureNotSupportedException(resBundle.handleGetObject("cachedrowsetimpl.featnotsupp").toString()); |
|
9279 |
} |
|
9280 |
||
9281 |
||
9282 |
/** |
|
9283 |
* Sets the designated parameter to the given <code>java.sql.Date</code> value, |
|
9284 |
* using the given <code>Calendar</code> object. The driver uses |
|
9285 |
* the <code>Calendar</code> object to construct an SQL <code>DATE</code> value, |
|
9286 |
* which the driver then sends to the database. With a |
|
9287 |
* a <code>Calendar</code> object, the driver can calculate the date |
|
9288 |
* taking into account a custom timezone. If no |
|
9289 |
* <code>Calendar</code> object is specified, the driver uses the default |
|
9290 |
* timezone, which is that of the virtual machine running the application. |
|
9291 |
* |
|
9292 |
* @param parameterName the name of the parameter |
|
9293 |
* @param x the parameter value |
|
9294 |
* @param cal the <code>Calendar</code> object the driver will use |
|
9295 |
* to construct the date |
|
9296 |
* @exception SQLException if a database access error occurs or |
|
9297 |
* this method is called on a closed <code>CallableStatement</code> |
|
9298 |
* @exception SQLFeatureNotSupportedException if the JDBC driver does not support |
|
9299 |
* this method |
|
9300 |
* @see #getDate |
|
9301 |
* @since 1.4 |
|
9302 |
*/ |
|
9303 |
public void setDate(String parameterName, java.sql.Date x, Calendar cal) |
|
9304 |
throws SQLException{ |
|
9305 |
throw new SQLFeatureNotSupportedException(resBundle.handleGetObject("cachedrowsetimpl.featnotsupp").toString()); |
|
9306 |
} |
|
9307 |
||
9308 |
||
9309 |
/** |
|
9310 |
* Sets the designated parameter to the given <code>java.sql.Time</code> value. |
|
9311 |
* The driver converts this |
|
9312 |
* to an SQL <code>TIME</code> value when it sends it to the database. |
|
9313 |
* |
|
9314 |
* @param parameterName the name of the parameter |
|
9315 |
* @param x the parameter value |
|
9316 |
* @exception SQLException if a database access error occurs or |
|
9317 |
* this method is called on a closed <code>CallableStatement</code> |
|
9318 |
* @exception SQLFeatureNotSupportedException if the JDBC driver does not support |
|
9319 |
* this method |
|
9320 |
* @see #getTime |
|
9321 |
* @since 1.4 |
|
9322 |
*/ |
|
9323 |
public void setTime(String parameterName, java.sql.Time x) |
|
9324 |
throws SQLException{ |
|
9325 |
throw new SQLFeatureNotSupportedException(resBundle.handleGetObject("cachedrowsetimpl.featnotsupp").toString()); |
|
9326 |
} |
|
9327 |
||
9328 |
||
9329 |
/** |
|
9330 |
* Sets the designated parameter to the given <code>java.sql.Time</code> value, |
|
9331 |
* using the given <code>Calendar</code> object. The driver uses |
|
9332 |
* the <code>Calendar</code> object to construct an SQL <code>TIME</code> value, |
|
9333 |
* which the driver then sends to the database. With a |
|
9334 |
* a <code>Calendar</code> object, the driver can calculate the time |
|
9335 |
* taking into account a custom timezone. If no |
|
9336 |
* <code>Calendar</code> object is specified, the driver uses the default |
|
9337 |
* timezone, which is that of the virtual machine running the application. |
|
9338 |
* |
|
9339 |
* @param parameterName the name of the parameter |
|
9340 |
* @param x the parameter value |
|
9341 |
* @param cal the <code>Calendar</code> object the driver will use |
|
9342 |
* to construct the time |
|
9343 |
* @exception SQLException if a database access error occurs or |
|
9344 |
* this method is called on a closed <code>CallableStatement</code> |
|
9345 |
* @exception SQLFeatureNotSupportedException if the JDBC driver does not support |
|
9346 |
* this method |
|
9347 |
* @see #getTime |
|
9348 |
* @since 1.4 |
|
9349 |
*/ |
|
9350 |
public void setTime(String parameterName, java.sql.Time x, Calendar cal) |
|
9351 |
throws SQLException{ |
|
9352 |
throw new SQLFeatureNotSupportedException(resBundle.handleGetObject("cachedrowsetimpl.featnotsupp").toString()); |
|
9353 |
} |
|
9354 |
||
9355 |
/** |
|
9356 |
* Sets the designated parameter to a <code>Reader</code> object. |
|
9357 |
* This method differs from the <code>setCharacterStream (int, Reader)</code> method |
|
9358 |
* because it informs the driver that the parameter value should be sent to |
|
9359 |
* the server as a <code>CLOB</code>. When the <code>setCharacterStream</code> method is used, the |
|
9360 |
* driver may have to do extra work to determine whether the parameter |
|
9361 |
* data should be sent to the server as a <code>LONGVARCHAR</code> or a <code>CLOB</code> |
|
9362 |
* |
|
9363 |
* <P><B>Note:</B> Consult your JDBC driver documentation to determine if |
|
9364 |
* it might be more efficient to use a version of |
|
9365 |
* <code>setClob</code> which takes a length parameter. |
|
9366 |
* |
|
9367 |
* @param parameterIndex index of the first parameter is 1, the second is 2, ... |
|
9368 |
* @param reader An object that contains the data to set the parameter value to. |
|
9369 |
* @throws SQLException if a database access error occurs, this method is called on |
|
9370 |
* a closed <code>PreparedStatement</code>or if parameterIndex does not correspond to a parameter |
|
9371 |
* marker in the SQL statement |
|
9372 |
* |
|
9373 |
* @throws SQLFeatureNotSupportedException if the JDBC driver does not support this method |
|
9374 |
* @since 1.6 |
|
9375 |
*/ |
|
9376 |
public void setClob(int parameterIndex, Reader reader) |
|
9377 |
throws SQLException{ |
|
9378 |
throw new SQLFeatureNotSupportedException(resBundle.handleGetObject("cachedrowsetimpl.featnotsupp").toString()); |
|
9379 |
} |
|
9380 |
||
9381 |
/** |
|
9382 |
* Sets the designated parameter to a <code>Reader</code> object. The reader must contain the number |
|
9383 |
* of characters specified by length otherwise a <code>SQLException</code> will be |
|
9384 |
* generated when the <code>PreparedStatement</code> is executed. |
|
9385 |
*This method differs from the <code>setCharacterStream (int, Reader, int)</code> method |
|
9386 |
* because it informs the driver that the parameter value should be sent to |
|
9387 |
* the server as a <code>CLOB</code>. When the <code>setCharacterStream</code> method is used, the |
|
9388 |
* driver may have to do extra work to determine whether the parameter |
|
9389 |
* data should be sent to the server as a <code>LONGVARCHAR</code> or a <code>CLOB</code> |
|
9390 |
* @param parameterIndex index of the first parameter is 1, the second is 2, ... |
|
9391 |
* @param reader An object that contains the data to set the parameter value to. |
|
9392 |
* @param length the number of characters in the parameter data. |
|
9393 |
* @throws SQLException if a database access error occurs, this method is called on |
|
9394 |
* a closed <code>PreparedStatement</code>, if parameterIndex does not correspond to a parameter |
|
9395 |
* marker in the SQL statement, or if the length specified is less than zero. |
|
9396 |
* |
|
9397 |
* @throws SQLFeatureNotSupportedException if the JDBC driver does not support this method |
|
9398 |
* @since 1.6 |
|
9399 |
*/ |
|
9400 |
public void setClob(int parameterIndex, Reader reader, long length) |
|
9401 |
throws SQLException{ |
|
9402 |
throw new SQLFeatureNotSupportedException(resBundle.handleGetObject("cachedrowsetimpl.featnotsupp").toString()); |
|
9403 |
} |
|
9404 |
||
9405 |
||
9406 |
/** |
|
9407 |
* Sets the designated parameter to a <code>InputStream</code> object. The inputstream must contain the number |
|
9408 |
* of characters specified by length otherwise a <code>SQLException</code> will be |
|
9409 |
* generated when the <code>PreparedStatement</code> is executed. |
|
9410 |
* This method differs from the <code>setBinaryStream (int, InputStream, int)</code> |
|
9411 |
* method because it informs the driver that the parameter value should be |
|
9412 |
* sent to the server as a <code>BLOB</code>. When the <code>setBinaryStream</code> method is used, |
|
9413 |
* the driver may have to do extra work to determine whether the parameter |
|
9414 |
* data should be sent to the server as a <code>LONGVARBINARY</code> or a <code>BLOB</code> |
|
9415 |
* @param parameterIndex index of the first parameter is 1, |
|
9416 |
* the second is 2, ... |
|
9417 |
* @param inputStream An object that contains the data to set the parameter |
|
9418 |
* value to. |
|
9419 |
* @param length the number of bytes in the parameter data. |
|
9420 |
* @throws SQLException if a database access error occurs, |
|
9421 |
* this method is called on a closed <code>PreparedStatement</code>, |
|
9422 |
* if parameterIndex does not correspond |
|
9423 |
* to a parameter marker in the SQL statement, if the length specified |
|
9424 |
* is less than zero or if the number of bytes in the inputstream does not match |
|
9425 |
* the specfied length. |
|
9426 |
* @throws SQLFeatureNotSupportedException if the JDBC driver does not support this method |
|
9427 |
* |
|
9428 |
* @since 1.6 |
|
9429 |
*/ |
|
9430 |
public void setBlob(int parameterIndex, InputStream inputStream, long length) |
|
9431 |
throws SQLException{ |
|
9432 |
throw new SQLFeatureNotSupportedException(resBundle.handleGetObject("cachedrowsetimpl.featnotsupp").toString()); |
|
9433 |
} |
|
9434 |
||
9435 |
||
9436 |
/** |
|
9437 |
* Sets the designated parameter to a <code>InputStream</code> object. |
|
9438 |
* This method differs from the <code>setBinaryStream (int, InputStream)</code> |
|
9439 |
* method because it informs the driver that the parameter value should be |
|
9440 |
* sent to the server as a <code>BLOB</code>. When the <code>setBinaryStream</code> method is used, |
|
9441 |
* the driver may have to do extra work to determine whether the parameter |
|
9442 |
* data should be sent to the server as a <code>LONGVARBINARY</code> or a <code>BLOB</code> |
|
9443 |
* |
|
9444 |
* <P><B>Note:</B> Consult your JDBC driver documentation to determine if |
|
9445 |
* it might be more efficient to use a version of |
|
9446 |
* <code>setBlob</code> which takes a length parameter. |
|
9447 |
* |
|
9448 |
* @param parameterIndex index of the first parameter is 1, |
|
9449 |
* the second is 2, ... |
|
9450 |
* @param inputStream An object that contains the data to set the parameter |
|
9451 |
* value to. |
|
9452 |
* @throws SQLException if a database access error occurs, |
|
9453 |
* this method is called on a closed <code>PreparedStatement</code> or |
|
9454 |
* if parameterIndex does not correspond |
|
9455 |
* to a parameter marker in the SQL statement, |
|
9456 |
* @throws SQLFeatureNotSupportedException if the JDBC driver does not support this method |
|
9457 |
* |
|
9458 |
* @since 1.6 |
|
9459 |
*/ |
|
9460 |
public void setBlob(int parameterIndex, InputStream inputStream) |
|
9461 |
throws SQLException{ |
|
9462 |
throw new SQLFeatureNotSupportedException(resBundle.handleGetObject("cachedrowsetimpl.featnotsupp").toString()); |
|
9463 |
} |
|
9464 |
||
9465 |
||
9466 |
/** |
|
9467 |
* Sets the designated parameter to a <code>InputStream</code> object. The <code>inputstream</code> must contain the number |
|
9468 |
* of characters specified by length, otherwise a <code>SQLException</code> will be |
|
9469 |
* generated when the <code>CallableStatement</code> is executed. |
|
9470 |
* This method differs from the <code>setBinaryStream (int, InputStream, int)</code> |
|
9471 |
* method because it informs the driver that the parameter value should be |
|
9472 |
* sent to the server as a <code>BLOB</code>. When the <code>setBinaryStream</code> method is used, |
|
9473 |
* the driver may have to do extra work to determine whether the parameter |
|
9474 |
* data should be sent to the server as a <code>LONGVARBINARY</code> or a <code>BLOB</code> |
|
9475 |
* |
|
9476 |
* @param parameterName the name of the parameter to be set |
|
9477 |
* the second is 2, ... |
|
9478 |
* |
|
9479 |
* @param inputStream An object that contains the data to set the parameter |
|
9480 |
* value to. |
|
9481 |
* @param length the number of bytes in the parameter data. |
|
9482 |
* @throws SQLException if parameterIndex does not correspond |
|
9483 |
* to a parameter marker in the SQL statement, or if the length specified |
|
9484 |
* is less than zero; if the number of bytes in the inputstream does not match |
|
9485 |
* the specfied length; if a database access error occurs or |
|
9486 |
* this method is called on a closed <code>CallableStatement</code> |
|
9487 |
* @exception SQLFeatureNotSupportedException if the JDBC driver does not support |
|
9488 |
* this method |
|
9489 |
* |
|
9490 |
* @since 1.6 |
|
9491 |
*/ |
|
9492 |
public void setBlob(String parameterName, InputStream inputStream, long length) |
|
9493 |
throws SQLException{ |
|
9494 |
throw new SQLFeatureNotSupportedException(resBundle.handleGetObject("cachedrowsetimpl.featnotsupp").toString()); |
|
9495 |
} |
|
9496 |
||
9497 |
||
9498 |
/** |
|
9499 |
* Sets the designated parameter to the given <code>java.sql.Blob</code> object. |
|
9500 |
* The driver converts this to an SQL <code>BLOB</code> value when it |
|
9501 |
* sends it to the database. |
|
9502 |
* |
|
9503 |
* @param parameterName the name of the parameter |
|
9504 |
* @param x a <code>Blob</code> object that maps an SQL <code>BLOB</code> value |
|
9505 |
* @exception SQLException if a database access error occurs or |
|
9506 |
* this method is called on a closed <code>CallableStatement</code> |
|
9507 |
* @exception SQLFeatureNotSupportedException if the JDBC driver does not support |
|
9508 |
* this method |
|
9509 |
* @since 1.6 |
|
9510 |
*/ |
|
9511 |
public void setBlob (String parameterName, Blob x) throws SQLException{ |
|
9512 |
throw new SQLFeatureNotSupportedException(resBundle.handleGetObject("cachedrowsetimpl.featnotsupp").toString()); |
|
9513 |
} |
|
9514 |
||
9515 |
||
9516 |
/** |
|
9517 |
* Sets the designated parameter to a <code>InputStream</code> object. |
|
9518 |
* This method differs from the <code>setBinaryStream (int, InputStream)</code> |
|
9519 |
* method because it informs the driver that the parameter value should be |
|
9520 |
* sent to the server as a <code>BLOB</code>. When the <code>setBinaryStream</code> method is used, |
|
9521 |
* the driver may have to do extra work to determine whether the parameter |
|
9522 |
* data should be send to the server as a <code>LONGVARBINARY</code> or a <code>BLOB</code> |
|
9523 |
* |
|
9524 |
* <P><B>Note:</B> Consult your JDBC driver documentation to determine if |
|
9525 |
* it might be more efficient to use a version of |
|
9526 |
* <code>setBlob</code> which takes a length parameter. |
|
9527 |
* |
|
9528 |
* @param parameterName the name of the parameter |
|
9529 |
* @param inputStream An object that contains the data to set the parameter |
|
9530 |
* value to. |
|
9531 |
* @throws SQLException if a database access error occurs or |
|
9532 |
* this method is called on a closed <code>CallableStatement</code> |
|
9533 |
* @throws SQLFeatureNotSupportedException if the JDBC driver does not support this method |
|
9534 |
* |
|
9535 |
* @since 1.6 |
|
9536 |
*/ |
|
9537 |
public void setBlob(String parameterName, InputStream inputStream) |
|
9538 |
throws SQLException{ |
|
9539 |
throw new SQLFeatureNotSupportedException(resBundle.handleGetObject("cachedrowsetimpl.featnotsupp").toString()); |
|
9540 |
} |
|
9541 |
||
9542 |
/** |
|
9543 |
* Sets the value of the designated parameter with the given object. The second |
|
9544 |
* argument must be an object type; for integral values, the |
|
9545 |
* <code>java.lang</code> equivalent objects should be used. |
|
9546 |
* |
|
9547 |
* <p>The given Java object will be converted to the given targetSqlType |
|
9548 |
* before being sent to the database. |
|
9549 |
* |
|
9550 |
* If the object has a custom mapping (is of a class implementing the |
|
9551 |
* interface <code>SQLData</code>), |
|
9552 |
* the JDBC driver should call the method <code>SQLData.writeSQL</code> to write it |
|
9553 |
* to the SQL data stream. |
|
9554 |
* If, on the other hand, the object is of a class implementing |
|
9555 |
* <code>Ref</code>, <code>Blob</code>, <code>Clob</code>, <code>NClob</code>, |
|
9556 |
* <code>Struct</code>, <code>java.net.URL</code>, |
|
9557 |
* or <code>Array</code>, the driver should pass it to the database as a |
|
9558 |
* value of the corresponding SQL type. |
|
9559 |
* <P> |
|
9560 |
* Note that this method may be used to pass datatabase- |
|
9561 |
* specific abstract data types. |
|
9562 |
* |
|
9563 |
* @param parameterName the name of the parameter |
|
9564 |
* @param x the object containing the input parameter value |
|
9565 |
* @param targetSqlType the SQL type (as defined in java.sql.Types) to be |
|
9566 |
* sent to the database. The scale argument may further qualify this type. |
|
9567 |
* @param scale for java.sql.Types.DECIMAL or java.sql.Types.NUMERIC types, |
|
9568 |
* this is the number of digits after the decimal point. For all other |
|
9569 |
* types, this value will be ignored. |
|
9570 |
* @exception SQLException if a database access error occurs or |
|
9571 |
* this method is called on a closed <code>CallableStatement</code> |
|
9572 |
* @exception SQLFeatureNotSupportedException if <code>targetSqlType</code> is |
|
9573 |
* a <code>ARRAY</code>, <code>BLOB</code>, <code>CLOB</code>, |
|
9574 |
* <code>DATALINK</code>, <code>JAVA_OBJECT</code>, <code>NCHAR</code>, |
|
9575 |
* <code>NCLOB</code>, <code>NVARCHAR</code>, <code>LONGNVARCHAR</code>, |
|
9576 |
* <code>REF</code>, <code>ROWID</code>, <code>SQLXML</code> |
|
9577 |
* or <code>STRUCT</code> data type and the JDBC driver does not support |
|
9578 |
* this data type |
|
9579 |
* @see Types |
|
9580 |
* @see #getObject |
|
9581 |
* @since 1.4 |
|
9582 |
*/ |
|
9583 |
public void setObject(String parameterName, Object x, int targetSqlType, int scale) |
|
9584 |
throws SQLException{ |
|
9585 |
throw new SQLFeatureNotSupportedException(resBundle.handleGetObject("cachedrowsetimpl.featnotsupp").toString()); |
|
9586 |
} |
|
9587 |
||
9588 |
||
9589 |
||
9590 |
/** |
|
9591 |
* Sets the value of the designated parameter with the given object. |
|
9592 |
* This method is like the method <code>setObject</code> |
|
9593 |
* above, except that it assumes a scale of zero. |
|
9594 |
* |
|
9595 |
* @param parameterName the name of the parameter |
|
9596 |
* @param x the object containing the input parameter value |
|
9597 |
* @param targetSqlType the SQL type (as defined in java.sql.Types) to be |
|
9598 |
* sent to the database |
|
9599 |
* @exception SQLException if a database access error occurs or |
|
9600 |
* this method is called on a closed <code>CallableStatement</code> |
|
9601 |
* @exception SQLFeatureNotSupportedException if <code>targetSqlType</code> is |
|
9602 |
* a <code>ARRAY</code>, <code>BLOB</code>, <code>CLOB</code>, |
|
9603 |
* <code>DATALINK</code>, <code>JAVA_OBJECT</code>, <code>NCHAR</code>, |
|
9604 |
* <code>NCLOB</code>, <code>NVARCHAR</code>, <code>LONGNVARCHAR</code>, |
|
9605 |
* <code>REF</code>, <code>ROWID</code>, <code>SQLXML</code> |
|
9606 |
* or <code>STRUCT</code> data type and the JDBC driver does not support |
|
9607 |
* this data type |
|
9608 |
* @see #getObject |
|
9609 |
* @since 1.4 |
|
9610 |
*/ |
|
9611 |
public void setObject(String parameterName, Object x, int targetSqlType) |
|
9612 |
throws SQLException{ |
|
9613 |
throw new SQLFeatureNotSupportedException(resBundle.handleGetObject("cachedrowsetimpl.featnotsupp").toString()); |
|
9614 |
} |
|
9615 |
||
9616 |
||
9617 |
/** |
|
9618 |
* Sets the value of the designated parameter with the given object. |
|
9619 |
* The second parameter must be of type <code>Object</code>; therefore, the |
|
9620 |
* <code>java.lang</code> equivalent objects should be used for built-in types. |
|
9621 |
* |
|
9622 |
* <p>The JDBC specification specifies a standard mapping from |
|
9623 |
* Java <code>Object</code> types to SQL types. The given argument |
|
9624 |
* will be converted to the corresponding SQL type before being |
|
9625 |
* sent to the database. |
|
9626 |
* |
|
9627 |
* <p>Note that this method may be used to pass datatabase- |
|
9628 |
* specific abstract data types, by using a driver-specific Java |
|
9629 |
* type. |
|
9630 |
* |
|
9631 |
* If the object is of a class implementing the interface <code>SQLData</code>, |
|
9632 |
* the JDBC driver should call the method <code>SQLData.writeSQL</code> |
|
9633 |
* to write it to the SQL data stream. |
|
9634 |
* If, on the other hand, the object is of a class implementing |
|
9635 |
* <code>Ref</code>, <code>Blob</code>, <code>Clob</code>, <code>NClob</code>, |
|
9636 |
* <code>Struct</code>, <code>java.net.URL</code>, |
|
9637 |
* or <code>Array</code>, the driver should pass it to the database as a |
|
9638 |
* value of the corresponding SQL type. |
|
9639 |
* <P> |
|
9640 |
* This method throws an exception if there is an ambiguity, for example, if the |
|
9641 |
* object is of a class implementing more than one of the interfaces named above. |
|
9642 |
* |
|
9643 |
* @param parameterName the name of the parameter |
|
9644 |
* @param x the object containing the input parameter value |
|
9645 |
* @exception SQLException if a database access error occurs, |
|
9646 |
* this method is called on a closed <code>CallableStatement</code> or if the given |
|
9647 |
* <code>Object</code> parameter is ambiguous |
|
9648 |
* @exception SQLFeatureNotSupportedException if the JDBC driver does not support |
|
9649 |
* this method |
|
9650 |
* @see #getObject |
|
9651 |
* @since 1.4 |
|
9652 |
*/ |
|
9653 |
public void setObject(String parameterName, Object x) throws SQLException{ |
|
9654 |
throw new SQLFeatureNotSupportedException(resBundle.handleGetObject("cachedrowsetimpl.featnotsupp").toString()); |
|
9655 |
} |
|
9656 |
||
9657 |
/** |
|
9658 |
* Sets the designated parameter to the given input stream, which will have |
|
9659 |
* the specified number of bytes. |
|
9660 |
* When a very large ASCII value is input to a <code>LONGVARCHAR</code> |
|
9661 |
* parameter, it may be more practical to send it via a |
|
9662 |
* <code>java.io.InputStream</code>. Data will be read from the stream |
|
9663 |
* as needed until end-of-file is reached. The JDBC driver will |
|
9664 |
* do any necessary conversion from ASCII to the database char format. |
|
9665 |
* |
|
9666 |
* <P><B>Note:</B> This stream object can either be a standard |
|
9667 |
* Java stream object or your own subclass that implements the |
|
9668 |
* standard interface. |
|
9669 |
* |
|
9670 |
* @param parameterName the name of the parameter |
|
9671 |
* @param x the Java input stream that contains the ASCII parameter value |
|
9672 |
* @param length the number of bytes in the stream |
|
9673 |
* @exception SQLException if a database access error occurs or |
|
9674 |
* this method is called on a closed <code>CallableStatement</code> |
|
9675 |
* @exception SQLFeatureNotSupportedException if the JDBC driver does not support |
|
9676 |
* this method |
|
9677 |
* @since 1.4 |
|
9678 |
*/ |
|
9679 |
public void setAsciiStream(String parameterName, java.io.InputStream x, int length) |
|
9680 |
throws SQLException{ |
|
9681 |
throw new SQLFeatureNotSupportedException(resBundle.handleGetObject("cachedrowsetimpl.featnotsupp").toString()); |
|
9682 |
} |
|
9683 |
||
9684 |
||
9685 |
/** |
|
9686 |
* Sets the designated parameter to the given input stream, which will have |
|
9687 |
* the specified number of bytes. |
|
9688 |
* When a very large binary value is input to a <code>LONGVARBINARY</code> |
|
9689 |
* parameter, it may be more practical to send it via a |
|
9690 |
* <code>java.io.InputStream</code> object. The data will be read from the stream |
|
9691 |
* as needed until end-of-file is reached. |
|
9692 |
* |
|
9693 |
* <P><B>Note:</B> This stream object can either be a standard |
|
9694 |
* Java stream object or your own subclass that implements the |
|
9695 |
* standard interface. |
|
9696 |
* |
|
9697 |
* @param parameterName the name of the parameter |
|
9698 |
* @param x the java input stream which contains the binary parameter value |
|
9699 |
* @param length the number of bytes in the stream |
|
9700 |
* @exception SQLException if a database access error occurs or |
|
9701 |
* this method is called on a closed <code>CallableStatement</code> |
|
9702 |
* @exception SQLFeatureNotSupportedException if the JDBC driver does not support |
|
9703 |
* this method |
|
9704 |
* @since 1.4 |
|
9705 |
*/ |
|
9706 |
public void setBinaryStream(String parameterName, java.io.InputStream x, |
|
9707 |
int length) throws SQLException{ |
|
9708 |
throw new SQLFeatureNotSupportedException(resBundle.handleGetObject("cachedrowsetimpl.featnotsupp").toString()); |
|
9709 |
} |
|
9710 |
||
9711 |
||
9712 |
/** |
|
9713 |
* Sets the designated parameter to the given <code>Reader</code> |
|
9714 |
* object, which is the given number of characters long. |
|
9715 |
* When a very large UNICODE value is input to a <code>LONGVARCHAR</code> |
|
9716 |
* parameter, it may be more practical to send it via a |
|
9717 |
* <code>java.io.Reader</code> object. The data will be read from the stream |
|
9718 |
* as needed until end-of-file is reached. The JDBC driver will |
|
9719 |
* do any necessary conversion from UNICODE to the database char format. |
|
9720 |
* |
|
9721 |
* <P><B>Note:</B> This stream object can either be a standard |
|
9722 |
* Java stream object or your own subclass that implements the |
|
9723 |
* standard interface. |
|
9724 |
* |
|
9725 |
* @param parameterName the name of the parameter |
|
9726 |
* @param reader the <code>java.io.Reader</code> object that |
|
9727 |
* contains the UNICODE data used as the designated parameter |
|
9728 |
* @param length the number of characters in the stream |
|
9729 |
* @exception SQLException if a database access error occurs or |
|
9730 |
* this method is called on a closed <code>CallableStatement</code> |
|
9731 |
* @exception SQLFeatureNotSupportedException if the JDBC driver does not support |
|
9732 |
* this method |
|
9733 |
* @since 1.4 |
|
9734 |
*/ |
|
9735 |
public void setCharacterStream(String parameterName, |
|
9736 |
java.io.Reader reader, |
|
9737 |
int length) throws SQLException{ |
|
9738 |
throw new SQLFeatureNotSupportedException(resBundle.handleGetObject("cachedrowsetimpl.featnotsupp").toString()); |
|
9739 |
} |
|
9740 |
||
9741 |
||
9742 |
/** |
|
9743 |
* Sets the designated parameter to the given input stream. |
|
9744 |
* When a very large ASCII value is input to a <code>LONGVARCHAR</code> |
|
9745 |
* parameter, it may be more practical to send it via a |
|
9746 |
* <code>java.io.InputStream</code>. Data will be read from the stream |
|
9747 |
* as needed until end-of-file is reached. The JDBC driver will |
|
9748 |
* do any necessary conversion from ASCII to the database char format. |
|
9749 |
* |
|
9750 |
* <P><B>Note:</B> This stream object can either be a standard |
|
9751 |
* Java stream object or your own subclass that implements the |
|
9752 |
* standard interface. |
|
9753 |
* <P><B>Note:</B> Consult your JDBC driver documentation to determine if |
|
9754 |
* it might be more efficient to use a version of |
|
9755 |
* <code>setAsciiStream</code> which takes a length parameter. |
|
9756 |
* |
|
9757 |
* @param parameterName the name of the parameter |
|
9758 |
* @param x the Java input stream that contains the ASCII parameter value |
|
9759 |
* @exception SQLException if a database access error occurs or |
|
9760 |
* this method is called on a closed <code>CallableStatement</code> |
|
9761 |
* @throws SQLFeatureNotSupportedException if the JDBC driver does not support this method |
|
9762 |
* @since 1.6 |
|
9763 |
*/ |
|
9764 |
public void setAsciiStream(String parameterName, java.io.InputStream x) |
|
9765 |
throws SQLException{ |
|
9766 |
throw new SQLFeatureNotSupportedException(resBundle.handleGetObject("cachedrowsetimpl.featnotsupp").toString()); |
|
9767 |
} |
|
9768 |
||
9769 |
||
9770 |
/** |
|
9771 |
* Sets the designated parameter to the given input stream. |
|
9772 |
* When a very large binary value is input to a <code>LONGVARBINARY</code> |
|
9773 |
* parameter, it may be more practical to send it via a |
|
9774 |
* <code>java.io.InputStream</code> object. The data will be read from the |
|
9775 |
* stream as needed until end-of-file is reached. |
|
9776 |
* |
|
9777 |
* <P><B>Note:</B> This stream object can either be a standard |
|
9778 |
* Java stream object or your own subclass that implements the |
|
9779 |
* standard interface. |
|
9780 |
* <P><B>Note:</B> Consult your JDBC driver documentation to determine if |
|
9781 |
* it might be more efficient to use a version of |
|
9782 |
* <code>setBinaryStream</code> which takes a length parameter. |
|
9783 |
* |
|
9784 |
* @param parameterName the name of the parameter |
|
9785 |
* @param x the java input stream which contains the binary parameter value |
|
9786 |
* @exception SQLException if a database access error occurs or |
|
9787 |
* this method is called on a closed <code>CallableStatement</code> |
|
9788 |
* @throws SQLFeatureNotSupportedException if the JDBC driver does not support this method |
|
9789 |
* @since 1.6 |
|
9790 |
*/ |
|
9791 |
public void setBinaryStream(String parameterName, java.io.InputStream x) |
|
9792 |
throws SQLException{ |
|
9793 |
throw new SQLFeatureNotSupportedException(resBundle.handleGetObject("cachedrowsetimpl.featnotsupp").toString()); |
|
9794 |
} |
|
9795 |
||
9796 |
||
9797 |
||
9798 |
/** |
|
9799 |
* Sets the designated parameter to the given <code>Reader</code> |
|
9800 |
* object. |
|
9801 |
* When a very large UNICODE value is input to a <code>LONGVARCHAR</code> |
|
9802 |
* parameter, it may be more practical to send it via a |
|
9803 |
* <code>java.io.Reader</code> object. The data will be read from the stream |
|
9804 |
* as needed until end-of-file is reached. The JDBC driver will |
|
9805 |
* do any necessary conversion from UNICODE to the database char format. |
|
9806 |
* |
|
9807 |
* <P><B>Note:</B> This stream object can either be a standard |
|
9808 |
* Java stream object or your own subclass that implements the |
|
9809 |
* standard interface. |
|
9810 |
* <P><B>Note:</B> Consult your JDBC driver documentation to determine if |
|
9811 |
* it might be more efficient to use a version of |
|
9812 |
* <code>setCharacterStream</code> which takes a length parameter. |
|
9813 |
* |
|
9814 |
* @param parameterName the name of the parameter |
|
9815 |
* @param reader the <code>java.io.Reader</code> object that contains the |
|
9816 |
* Unicode data |
|
9817 |
* @exception SQLException if a database access error occurs or |
|
9818 |
* this method is called on a closed <code>CallableStatement</code> |
|
9819 |
* @throws SQLFeatureNotSupportedException if the JDBC driver does not support this method |
|
9820 |
* @since 1.6 |
|
9821 |
*/ |
|
9822 |
public void setCharacterStream(String parameterName, |
|
9823 |
java.io.Reader reader) throws SQLException{ |
|
9824 |
throw new SQLFeatureNotSupportedException(resBundle.handleGetObject("cachedrowsetimpl.featnotsupp").toString()); |
|
9825 |
} |
|
9826 |
||
9827 |
/** |
|
9828 |
* Sets the designated parameter to the given |
|
9829 |
* <code>java.math.BigDecimal</code> value. |
|
9830 |
* The driver converts this to an SQL <code>NUMERIC</code> value when |
|
9831 |
* it sends it to the database. |
|
9832 |
* |
|
9833 |
* @param parameterName the name of the parameter |
|
9834 |
* @param x the parameter value |
|
9835 |
* @exception SQLException if a database access error occurs or |
|
9836 |
* this method is called on a closed <code>CallableStatement</code> |
|
9837 |
* @exception SQLFeatureNotSupportedException if the JDBC driver does not support |
|
9838 |
* this method |
|
9839 |
* @see #getBigDecimal |
|
9840 |
* @since 1.4 |
|
9841 |
*/ |
|
9842 |
public void setBigDecimal(String parameterName, BigDecimal x) throws SQLException{ |
|
9843 |
throw new SQLFeatureNotSupportedException(resBundle.handleGetObject("cachedrowsetimpl.featnotsupp").toString()); |
|
9844 |
} |
|
9845 |
||
9846 |
||
9847 |
||
9848 |
/** |
|
9849 |
* Sets the designated parameter to the given Java <code>String</code> value. |
|
9850 |
* The driver converts this |
|
9851 |
* to an SQL <code>VARCHAR</code> or <code>LONGVARCHAR</code> value |
|
9852 |
* (depending on the argument's |
|
9853 |
* size relative to the driver's limits on <code>VARCHAR</code> values) |
|
9854 |
* when it sends it to the database. |
|
9855 |
* |
|
9856 |
* @param parameterName the name of the parameter |
|
9857 |
* @param x the parameter value |
|
9858 |
* @exception SQLException if a database access error occurs or |
|
9859 |
* this method is called on a closed <code>CallableStatement</code> |
|
9860 |
* @exception SQLFeatureNotSupportedException if the JDBC driver does not support |
|
9861 |
* this method |
|
9862 |
* @see #getString |
|
9863 |
* @since 1.4 |
|
9864 |
*/ |
|
9865 |
public void setString(String parameterName, String x) throws SQLException{ |
|
9866 |
throw new SQLFeatureNotSupportedException(resBundle.handleGetObject("cachedrowsetimpl.featnotsupp").toString()); |
|
9867 |
} |
|
9868 |
||
9869 |
||
9870 |
||
9871 |
/** |
|
9872 |
* Sets the designated parameter to the given Java array of bytes. |
|
9873 |
* The driver converts this to an SQL <code>VARBINARY</code> or |
|
9874 |
* <code>LONGVARBINARY</code> (depending on the argument's size relative |
|
9875 |
* to the driver's limits on <code>VARBINARY</code> values) when it sends |
|
9876 |
* it to the database. |
|
9877 |
* |
|
9878 |
* @param parameterName the name of the parameter |
|
9879 |
* @param x the parameter value |
|
9880 |
* @exception SQLException if a database access error occurs or |
|
9881 |
* this method is called on a closed <code>CallableStatement</code> |
|
9882 |
* @exception SQLFeatureNotSupportedException if the JDBC driver does not support |
|
9883 |
* this method |
|
9884 |
* @see #getBytes |
|
9885 |
* @since 1.4 |
|
9886 |
*/ |
|
9887 |
public void setBytes(String parameterName, byte x[]) throws SQLException{ |
|
9888 |
throw new SQLFeatureNotSupportedException(resBundle.handleGetObject("cachedrowsetimpl.featnotsupp").toString()); |
|
9889 |
} |
|
9890 |
||
9891 |
||
9892 |
||
9893 |
/** |
|
9894 |
* Sets the designated parameter to the given <code>java.sql.Timestamp</code> value. |
|
9895 |
* The driver |
|
9896 |
* converts this to an SQL <code>TIMESTAMP</code> value when it sends it to the |
|
9897 |
* database. |
|
9898 |
* |
|
9899 |
* @param parameterName the name of the parameter |
|
9900 |
* @param x the parameter value |
|
9901 |
* @exception SQLException if a database access error occurs or |
|
9902 |
* this method is called on a closed <code>CallableStatement</code> |
|
9903 |
* @exception SQLFeatureNotSupportedException if the JDBC driver does not support |
|
9904 |
* this method |
|
9905 |
* @see #getTimestamp |
|
9906 |
* @since 1.4 |
|
9907 |
*/ |
|
9908 |
public void setTimestamp(String parameterName, java.sql.Timestamp x) |
|
9909 |
throws SQLException{ |
|
9910 |
throw new SQLFeatureNotSupportedException(resBundle.handleGetObject("cachedrowsetimpl.featnotsupp").toString()); |
|
9911 |
} |
|
9912 |
||
9913 |
/** |
|
9914 |
* Sets the designated parameter to SQL <code>NULL</code>. |
|
9915 |
* |
|
9916 |
* <P><B>Note:</B> You must specify the parameter's SQL type. |
|
9917 |
* |
|
9918 |
* @param parameterName the name of the parameter |
|
9919 |
* @param sqlType the SQL type code defined in <code>java.sql.Types</code> |
|
9920 |
* @exception SQLException if a database access error occurs or |
|
9921 |
* this method is called on a closed <code>CallableStatement</code> |
|
9922 |
* @exception SQLFeatureNotSupportedException if the JDBC driver does not support |
|
9923 |
* this method |
|
9924 |
* @since 1.4 |
|
9925 |
*/ |
|
9926 |
public void setNull(String parameterName, int sqlType) throws SQLException { |
|
9927 |
throw new SQLFeatureNotSupportedException(resBundle.handleGetObject("cachedrowsetimpl.featnotsupp").toString()); |
|
9928 |
} |
|
9929 |
||
9930 |
||
9931 |
/** |
|
9932 |
* Sets the designated parameter to SQL <code>NULL</code>. |
|
9933 |
* This version of the method <code>setNull</code> should |
|
9934 |
* be used for user-defined types and REF type parameters. Examples |
|
9935 |
* of user-defined types include: STRUCT, DISTINCT, JAVA_OBJECT, and |
|
9936 |
* named array types. |
|
9937 |
* |
|
9938 |
* <P><B>Note:</B> To be portable, applications must give the |
|
9939 |
* SQL type code and the fully-qualified SQL type name when specifying |
|
9940 |
* a NULL user-defined or REF parameter. In the case of a user-defined type |
|
9941 |
* the name is the type name of the parameter itself. For a REF |
|
9942 |
* parameter, the name is the type name of the referenced type. If |
|
9943 |
* a JDBC driver does not need the type code or type name information, |
|
9944 |
* it may ignore it. |
|
9945 |
* |
|
9946 |
* Although it is intended for user-defined and Ref parameters, |
|
9947 |
* this method may be used to set a null parameter of any JDBC type. |
|
9948 |
* If the parameter does not have a user-defined or REF type, the given |
|
9949 |
* typeName is ignored. |
|
9950 |
* |
|
9951 |
* |
|
9952 |
* @param parameterName the name of the parameter |
|
9953 |
* @param sqlType a value from <code>java.sql.Types</code> |
|
9954 |
* @param typeName the fully-qualified name of an SQL user-defined type; |
|
9955 |
* ignored if the parameter is not a user-defined type or |
|
9956 |
* SQL <code>REF</code> value |
|
9957 |
* @exception SQLException if a database access error occurs or |
|
9958 |
* this method is called on a closed <code>CallableStatement</code> |
|
9959 |
* @exception SQLFeatureNotSupportedException if the JDBC driver does not support |
|
9960 |
* this method |
|
9961 |
* @since 1.4 |
|
9962 |
*/ |
|
9963 |
public void setNull (String parameterName, int sqlType, String typeName) |
|
9964 |
throws SQLException{ |
|
9965 |
throw new SQLFeatureNotSupportedException(resBundle.handleGetObject("cachedrowsetimpl.featnotsupp").toString()); |
|
9966 |
} |
|
9967 |
||
9968 |
||
9969 |
||
9970 |
/** |
|
9971 |
* Sets the designated parameter to the given Java <code>boolean</code> value. |
|
9972 |
* The driver converts this |
|
9973 |
* to an SQL <code>BIT</code> or <code>BOOLEAN</code> value when it sends it to the database. |
|
9974 |
* |
|
9975 |
* @param parameterName the name of the parameter |
|
9976 |
* @param x the parameter value |
|
9977 |
* @exception SQLException if a database access error occurs or |
|
9978 |
* this method is called on a closed <code>CallableStatement</code> |
|
9979 |
* @see #getBoolean |
|
9980 |
* @exception SQLFeatureNotSupportedException if the JDBC driver does not support |
|
9981 |
* this method |
|
9982 |
* @since 1.4 |
|
9983 |
*/ |
|
9984 |
public void setBoolean(String parameterName, boolean x) throws SQLException{ |
|
9985 |
throw new SQLFeatureNotSupportedException(resBundle.handleGetObject("cachedrowsetimpl.featnotsupp").toString()); |
|
9986 |
} |
|
9987 |
||
9988 |
||
9989 |
||
9990 |
/** |
|
9991 |
* Sets the designated parameter to the given Java <code>byte</code> value. |
|
9992 |
* The driver converts this |
|
9993 |
* to an SQL <code>TINYINT</code> value when it sends it to the database. |
|
9994 |
* |
|
9995 |
* @param parameterName the name of the parameter |
|
9996 |
* @param x the parameter value |
|
9997 |
* @exception SQLException if a database access error occurs or |
|
9998 |
* this method is called on a closed <code>CallableStatement</code> |
|
9999 |
* @exception SQLFeatureNotSupportedException if the JDBC driver does not support |
|
10000 |
* this method |
|
10001 |
* @see #getByte |
|
10002 |
* @since 1.4 |
|
10003 |
*/ |
|
10004 |
public void setByte(String parameterName, byte x) throws SQLException{ |
|
10005 |
throw new SQLFeatureNotSupportedException(resBundle.handleGetObject("cachedrowsetimpl.featnotsupp").toString()); |
|
10006 |
} |
|
10007 |
||
10008 |
||
10009 |
||
10010 |
/** |
|
10011 |
* Sets the designated parameter to the given Java <code>short</code> value. |
|
10012 |
* The driver converts this |
|
10013 |
* to an SQL <code>SMALLINT</code> value when it sends it to the database. |
|
10014 |
* |
|
10015 |
* @param parameterName the name of the parameter |
|
10016 |
* @param x the parameter value |
|
10017 |
* @exception SQLException if a database access error occurs or |
|
10018 |
* this method is called on a closed <code>CallableStatement</code> |
|
10019 |
* @exception SQLFeatureNotSupportedException if the JDBC driver does not support |
|
10020 |
* this method |
|
10021 |
* @see #getShort |
|
10022 |
* @since 1.4 |
|
10023 |
*/ |
|
10024 |
public void setShort(String parameterName, short x) throws SQLException{ |
|
10025 |
throw new SQLFeatureNotSupportedException(resBundle.handleGetObject("cachedrowsetimpl.featnotsupp").toString()); |
|
10026 |
} |
|
10027 |
||
10028 |
||
10029 |
/** |
|
10030 |
* Sets the designated parameter to the given Java <code>int</code> value. |
|
10031 |
* The driver converts this |
|
10032 |
* to an SQL <code>INTEGER</code> value when it sends it to the database. |
|
10033 |
* |
|
10034 |
* @param parameterName the name of the parameter |
|
10035 |
* @param x the parameter value |
|
10036 |
* @exception SQLException if a database access error occurs or |
|
10037 |
* this method is called on a closed <code>CallableStatement</code> |
|
10038 |
* @exception SQLFeatureNotSupportedException if the JDBC driver does not support |
|
10039 |
* this method |
|
10040 |
* @see #getInt |
|
10041 |
* @since 1.4 |
|
10042 |
*/ |
|
10043 |
public void setInt(String parameterName, int x) throws SQLException{ |
|
10044 |
throw new SQLFeatureNotSupportedException(resBundle.handleGetObject("cachedrowsetimpl.featnotsupp").toString()); |
|
10045 |
} |
|
10046 |
||
10047 |
||
10048 |
/** |
|
10049 |
* Sets the designated parameter to the given Java <code>long</code> value. |
|
10050 |
* The driver converts this |
|
10051 |
* to an SQL <code>BIGINT</code> value when it sends it to the database. |
|
10052 |
* |
|
10053 |
* @param parameterName the name of the parameter |
|
10054 |
* @param x the parameter value |
|
10055 |
* @exception SQLException if a database access error occurs or |
|
10056 |
* this method is called on a closed <code>CallableStatement</code> |
|
10057 |
* @exception SQLFeatureNotSupportedException if the JDBC driver does not support |
|
10058 |
* this method |
|
10059 |
* @see #getLong |
|
10060 |
* @since 1.4 |
|
10061 |
*/ |
|
10062 |
public void setLong(String parameterName, long x) throws SQLException{ |
|
10063 |
throw new SQLFeatureNotSupportedException(resBundle.handleGetObject("cachedrowsetimpl.featnotsupp").toString()); |
|
10064 |
} |
|
10065 |
||
10066 |
||
10067 |
/** |
|
10068 |
* Sets the designated parameter to the given Java <code>float</code> value. |
|
10069 |
* The driver converts this |
|
10070 |
* to an SQL <code>FLOAT</code> value when it sends it to the database. |
|
10071 |
* |
|
10072 |
* @param parameterName the name of the parameter |
|
10073 |
* @param x the parameter value |
|
10074 |
* @exception SQLException if a database access error occurs or |
|
10075 |
* this method is called on a closed <code>CallableStatement</code> |
|
10076 |
* @exception SQLFeatureNotSupportedException if the JDBC driver does not support |
|
10077 |
* this method |
|
10078 |
* @see #getFloat |
|
10079 |
* @since 1.4 |
|
10080 |
*/ |
|
10081 |
public void setFloat(String parameterName, float x) throws SQLException{ |
|
10082 |
throw new SQLFeatureNotSupportedException(resBundle.handleGetObject("cachedrowsetimpl.featnotsupp").toString()); |
|
10083 |
} |
|
10084 |
||
10085 |
||
10086 |
/** |
|
10087 |
* Sets the designated parameter to the given Java <code>double</code> value. |
|
10088 |
* The driver converts this |
|
10089 |
* to an SQL <code>DOUBLE</code> value when it sends it to the database. |
|
10090 |
* |
|
10091 |
* @param parameterName the name of the parameter |
|
10092 |
* @param x the parameter value |
|
10093 |
* @exception SQLException if a database access error occurs or |
|
10094 |
* this method is called on a closed <code>CallableStatement</code> |
|
10095 |
* @exception SQLFeatureNotSupportedException if the JDBC driver does not support |
|
10096 |
* this method |
|
10097 |
* @see #getDouble |
|
10098 |
* @since 1.4 |
|
10099 |
*/ |
|
10100 |
public void setDouble(String parameterName, double x) throws SQLException{ |
|
10101 |
throw new SQLFeatureNotSupportedException(resBundle.handleGetObject("cachedrowsetimpl.featnotsupp").toString()); |
|
10102 |
} |
|
10103 |
||
10104 |
/** |
|
10105 |
* This method re populates the resBundle |
|
10106 |
* during the deserialization process |
|
10107 |
* |
|
10108 |
*/ |
|
6530
bfb7b294dd14
6680198: UnmarshalException caused by incompatible serialVersionUID
lancea
parents:
5506
diff
changeset
|
10109 |
private void readObject(ObjectInputStream ois) throws IOException, ClassNotFoundException { |
2 | 10110 |
// Default state initialization happens here |
10111 |
ois.defaultReadObject(); |
|
10112 |
// Initialization of transient Res Bundle happens here . |
|
10113 |
try { |
|
10114 |
resBundle = JdbcRowSetResourceBundle.getJdbcRowSetResourceBundle(); |
|
10115 |
} catch(IOException ioe) { |
|
10116 |
throw new RuntimeException(ioe); |
|
10117 |
} |
|
10118 |
||
10119 |
} |
|
6530
bfb7b294dd14
6680198: UnmarshalException caused by incompatible serialVersionUID
lancea
parents:
5506
diff
changeset
|
10120 |
|
6540 | 10121 |
//------------------------- JDBC 4.1 ----------------------------------- |
10122 |
public <T> T getObject(int columnIndex, Class<T> type) throws SQLException { |
|
10123 |
throw new SQLFeatureNotSupportedException("Not supported yet."); |
|
10124 |
} |
|
10125 |
||
10126 |
public <T> T getObject(String columnLabel, Class<T> type) throws SQLException { |
|
10127 |
throw new SQLFeatureNotSupportedException("Not supported yet."); |
|
10128 |
} |
|
10129 |
||
6530
bfb7b294dd14
6680198: UnmarshalException caused by incompatible serialVersionUID
lancea
parents:
5506
diff
changeset
|
10130 |
static final long serialVersionUID =1884577171200622428L; |
2 | 10131 |
} |