comparison src/main/java/nl/cwi/monetdb/jdbc/MonetResultSet.java @ 172:60063c67f9e7 embedded

Merged with default
author Pedro Ferreira <pedro.ferreira@monetdbsolutions.com>
date Tue, 19 Sep 2017 13:49:34 +0200 (2017-09-19)
parents 92bac8379d06 7c9e386fe49a
children 89c285fc0a49
comparison
equal deleted inserted replaced
171:0f95fee3cf29 172:60063c67f9e7
10 10
11 import nl.cwi.monetdb.mcl.protocol.ProtocolException; 11 import nl.cwi.monetdb.mcl.protocol.ProtocolException;
12 import nl.cwi.monetdb.mcl.responses.AbstractDataBlockResponse; 12 import nl.cwi.monetdb.mcl.responses.AbstractDataBlockResponse;
13 import nl.cwi.monetdb.mcl.responses.ResultSetResponse; 13 import nl.cwi.monetdb.mcl.responses.ResultSetResponse;
14 14
15 import java.io.ByteArrayInputStream; 15 import java.io.*;
16 import java.io.InputStream;
17 import java.io.Reader;
18 import java.io.StringReader;
19 import java.lang.reflect.Constructor; 16 import java.lang.reflect.Constructor;
20 import java.lang.reflect.InvocationTargetException; 17 import java.lang.reflect.InvocationTargetException;
21 import java.math.BigDecimal; 18 import java.math.BigDecimal;
22 import java.net.MalformedURLException; 19 import java.net.MalformedURLException;
23 import java.net.URL; 20 import java.net.URL;
45 * result sets. 42 * result sets.
46 * 43 *
47 * @author Fabian Groffen, Martin van Dinther, Pedro Ferreira 44 * @author Fabian Groffen, Martin van Dinther, Pedro Ferreira
48 * @version 0.8 45 * @version 0.8
49 */ 46 */
50 public class MonetResultSet extends MonetWrapper implements ResultSet { 47 public class MonetResultSet extends MonetWrapper implements ResultSet, AutoCloseable {
51 48
52 /** The current position of the cursor for this ResultSet object */ 49 /** The current position of the cursor for this ResultSet object */
53 int curRow = 0; 50 int curRow = 0;
54 // a blank final is immutable once assigned in the constructor 51 // a blank final is immutable once assigned in the constructor
55 /** A Header to retrieve lines from */ 52 /** A Header to retrieve lines from */
78 /** 75 /**
79 * Main constructor backed by the given Header. 76 * Main constructor backed by the given Header.
80 * 77 *
81 * @param statement the statement which created this ResultSet 78 * @param statement the statement which created this ResultSet
82 * @param header a header containing the query, resultset type, etc. 79 * @param header a header containing the query, resultset type, etc.
83 * @throws SQLException is a protocol error occurs 80 * @throws IllegalArgumentException if called with null or invalid value for one of the arguments
84 */ 81 */
85 MonetResultSet(Statement statement, ResultSetResponse header) throws SQLException { 82 MonetResultSet(Statement statement, ResultSetResponse header) throws IllegalArgumentException {
86 if (statement == null) { 83 if (statement == null) {
87 throw new IllegalArgumentException("Statement may not be null!"); 84 throw new IllegalArgumentException("Statement may not be null!");
88 } 85 }
89 if (header == null) { 86 if (header == null) {
90 throw new IllegalArgumentException("ResultSetResponse may not be null!"); 87 throw new IllegalArgumentException("ResultSetResponse may not be null!");
109 * 106 *
110 * @param statement the statement which created this ResultSet 107 * @param statement the statement which created this ResultSet
111 * @param columns the column names 108 * @param columns the column names
112 * @param types the column types 109 * @param types the column types
113 * @param results the number of rows in the ResultSet 110 * @param results the number of rows in the ResultSet
114 * @throws IllegalArgumentException if communicating with monet failed 111 * @throws IllegalArgumentException if called with null or invalid value for one of the arguments
115 */ 112 */
116 MonetResultSet(Statement statement, String[] columns, String[] types, int[] JdbcSQLTypes, int results) 113 MonetResultSet(Statement statement, String[] columns, String[] types, int[] JdbcSQLTypes, int results)
117 throws IllegalArgumentException { 114 throws IllegalArgumentException {
118 if (statement == null) { 115 if (statement == null) {
119 throw new IllegalArgumentException("Statement may not be null!"); 116 throw new IllegalArgumentException("Statement may not be null!");
142 139
143 /** 140 /**
144 * Moves the cursor to the given row number in this ResultSet object. 141 * Moves the cursor to the given row number in this ResultSet object.
145 * 142 *
146 * If the row number is positive, the cursor moves to the given row number with respect to the beginning of the 143 * If the row number is positive, the cursor moves to the given row number with respect to the beginning of the
147 * result set. The first row is row 1, the second is row 2, and so on. 144 * result set. The first row is row 1, the second is row 2, and so on.
148 * 145 *
149 * If the given row number is negative, the cursor moves to an absolute row position with respect to the end of the 146 * If the given row number is negative, the cursor moves to an absolute row position with respect to the end of the
150 * result set. For example, calling the method absolute(-1) positions the cursor on the last row; calling the 147 * result set. For example, calling the method absolute(-1) positions the cursor on the last row; calling the
151 * method absolute(-2) moves the cursor to the next-to-last row, and so on. 148 * method absolute(-2) moves the cursor to the next-to-last row, and so on.
152 * 149 *
153 * An attempt to position the cursor beyond the first/last row in the result set leaves the cursor before the first 150 * An attempt to position the cursor beyond the first/last row in the result set leaves the cursor before the first
154 * row or after the last row. 151 * row or after the last row.
155 * Note: calling absolute(1) is the same as calling first(). Calling absolute(-1) is the same as calling last(). 152 * Note: calling absolute(1) is the same as calling first(). Calling absolute(-1) is the same as calling last().
156 * 153 *
157 * @param row the number of the row to which the cursor should move. A positive number indicates the row number 154 * @param row the number of the row to which the cursor should move. A positive number indicates the row number
158 * counting from the beginning of the result set; a negative number indicates the row number counting from 155 * counting from the beginning of the result set; a negative number indicates the row number counting from
159 * the end of the result set 156 * the end of the result set
172 if (row < 0) { 169 if (row < 0) {
173 // calculate the negatives... 170 // calculate the negatives...
174 row = tupleCount + row + 1; 171 row = tupleCount + row + 1;
175 } 172 }
176 // now place the row not farther than just before or after the result 173 // now place the row not farther than just before or after the result
177 if (row < 0) { 174 if (row < 0)
178 row = 0; // before first 175 row = 0; // before first
179 } else if (row > tupleCount + 1) { 176 else if (row > tupleCount + 1)
180 row = tupleCount + 1; // after last 177 row = tupleCount + 1; // after last
181 } 178
182 // store it
183 this.curRow = row; 179 this.curRow = row;
184 this.currentBlock = header.getDataBlockCorrespondingToLine(row - 1); 180 this.currentBlock = header.getDataBlockCorrespondingToLine(row - 1);
185 return this.curRow <= this.tupleCount; 181 return this.curRow <= this.tupleCount;
186 } 182 }
187 183
235 /** 231 /**
236 * Maps the given ResultSet column name to its ResultSet column index. Column names supplied to getter methods are 232 * Maps the given ResultSet column name to its ResultSet column index. Column names supplied to getter methods are
237 * case insensitive. If a select list contains the same column more than once, the first instance of the 233 * case insensitive. If a select list contains the same column more than once, the first instance of the
238 * column will be returned. 234 * column will be returned.
239 * 235 *
240 * @param columnName the name of the column 236 * @param columnLabel the name of the column
241 * @return the column index of the given column name 237 * @return the column index of the given column name
242 * @throws SQLException if the ResultSet object does not contain columnName 238 * @throws SQLException if the ResultSet object does not contain columnLabel
243 */ 239 */
244 @Override 240 @Override
245 public int findColumn(String columnName) throws SQLException { 241 public int findColumn(String columnLabel) throws SQLException {
246 if (columnName != null) { 242 if (columnLabel != null) {
247 final int array_size = columns.length; 243 final int array_size = columns.length;
248 for (int i = 0; i < array_size; i++) { 244 for (int i = 0; i < array_size; i++) {
249 if (columnName.equals(columns[i])) 245 if (columnLabel.equals(columns[i]))
250 return i + 1; 246 return i + 1;
251 } 247 }
252 /* if an exact match did not succeed try a case insensitive match */ 248 /* if an exact match did not succeed try a case insensitive match */
253 for (int i = 0; i < array_size; i++) { 249 for (int i = 0; i < array_size; i++) {
254 if (columnName.equalsIgnoreCase(columns[i])) 250 if (columnLabel.equalsIgnoreCase(columns[i]))
255 return i + 1; 251 return i + 1;
256 } 252 }
257 } 253 }
258 throw new SQLException("No such column name: " + columnName, "M1M05"); 254 throw new SQLException("No such column name: " + columnLabel, "M1M05");
259 } 255 }
260 256
261 /** 257 /**
262 * Moves the cursor to the first row in this ResultSet object. 258 * Moves the cursor to the first row in this ResultSet object.
263 * 259 *
273 public Array getArray(int columnIndex) throws SQLException { 269 public Array getArray(int columnIndex) throws SQLException {
274 throw newSQLFeatureNotSupportedException("getArray"); 270 throw newSQLFeatureNotSupportedException("getArray");
275 } 271 }
276 272
277 @Override 273 @Override
278 public Array getArray(String colName) throws SQLException { 274 public Array getArray(String columnLabel) throws SQLException {
279 throw newSQLFeatureNotSupportedException("getArray"); 275 throw newSQLFeatureNotSupportedException("getArray");
280 } 276 }
281 277
282 @Override 278 @Override
283 public InputStream getAsciiStream(int columnIndex) throws SQLException { 279 public InputStream getAsciiStream(int columnIndex) throws SQLException {
284 try { 280 try {
285 InputStream res = null; 281 InputStream res = null;
286 switch (JdbcSQLTypes[columnIndex - 1]) { 282 switch (JdbcSQLTypes[columnIndex - 1]) {
287 case Types.CLOB: 283 case Types.CLOB:
288 Clob cl = getClob(columnIndex); 284 Clob cl = getClob(columnIndex);
289 if(cl != null) { 285 if(cl != null) {
290 res = cl.getAsciiStream(); 286 res = cl.getAsciiStream();
291 } 287 }
292 break; 288 break;
293 case Types.BLOB: 289 case Types.BLOB:
294 case Types.LONGVARBINARY: 290 case Types.LONGVARBINARY:
295 case Types.CHAR: 291 case Types.CHAR:
296 case Types.VARCHAR: 292 case Types.VARCHAR:
297 case Types.LONGVARCHAR: 293 case Types.LONGVARCHAR:
298 byte[] bytes = getBytes(columnIndex); 294 byte[] bytes = getBytes(columnIndex);
299 if(bytes != null) { 295 if(bytes != null) {
300 res = new ByteArrayInputStream(getBytes(columnIndex)); 296 res = new ByteArrayInputStream(getBytes(columnIndex));
301 } 297 }
302 break; 298 break;
303 default: 299 default:
304 throw new SQLException("Conversion from " + types[columnIndex - 1] + 300 throw new SQLException("Conversion from " + types[columnIndex - 1] +
305 " to ascii stream not supported", "M1M05"); 301 " to ascii stream not supported", "M1M05");
306 } 302 }
307 return res; 303 return res;
308 } catch (ClassCastException ex) { 304 } catch (ClassCastException ex) {
309 throw new SQLException(ex.getMessage()); 305 throw new SQLException(ex.getMessage());
310 } catch (IndexOutOfBoundsException e) { 306 } catch (IndexOutOfBoundsException e) {
311 throw newSQLInvalidColumnIndexException(columnIndex); 307 throw newSQLInvalidColumnIndexException(columnIndex);
312 } 308 }
313 } 309 }
314 310
315 @Override 311 @Override
316 public InputStream getAsciiStream(String columnName) throws SQLException { 312 public InputStream getAsciiStream(String columnLabel) throws SQLException {
317 return getAsciiStream(findColumn(columnName)); 313 throw newSQLFeatureNotSupportedException("getAsciiStream");
318 } 314 }
319 315
320 @Override 316 @Override
321 @Deprecated 317 @Deprecated
322 public InputStream getUnicodeStream(int columnIndex) throws SQLException { 318 public InputStream getUnicodeStream(int columnIndex) throws SQLException {
323 throw newSQLFeatureNotSupportedException("getUnicodeStream"); 319 throw newSQLFeatureNotSupportedException("getUnicodeStream");
324 } 320 }
325 321
326 @Override 322 @Override
327 @Deprecated 323 @Deprecated
328 public InputStream getUnicodeStream(String columnName) throws SQLException { 324 public InputStream getUnicodeStream(String columnLabel) throws SQLException {
329 throw newSQLFeatureNotSupportedException("getUnicodeStream"); 325 throw newSQLFeatureNotSupportedException("getUnicodeStream");
330 } 326 }
331 327
332 /** 328 /**
333 * Retrieves the value of the designated column in the current row of this ResultSet object as a stream of 329 * Retrieves the value of the designated column in the current row of this ResultSet object as a stream of
334 * uninterpreted bytes. The value can then be read in chunks from the stream. This method is particularly suitable 330 * uninterpreted bytes. The value can then be read in chunks from the stream. This method is particularly suitable
335 * for retrieving large LONGVARBINARY values. 331 * for retrieving large LONGVARBINARY values.
336 * <br/><br/> 332 * <br/><br/>
337 * Note: All the data in the returned stream must be read prior to getting the value of any other column. The next 333 * Note: All the data in the returned stream must be read prior to getting the value of any other column. The next
338 * call to a getter method implicitly closes the stream. Also, a stream may return 0 when the method 334 * call to a getter method implicitly closes the stream. Also, a stream may return 0 when the method
339 * InputStream.available is called whether there is data available or not. 335 * InputStream.available is called whether there is data available or not.
340 * 336 *
341 * @param columnIndex the first column is 1, the second is 2, ... 337 * @param columnIndex the first column is 1, the second is 2, ...
342 * @return a Java input stream that delivers the database column value as a stream of uninterpreted bytes; if the 338 * @return a Java input stream that delivers the database column value as a stream of uninterpreted bytes; if the
343 * value is SQL NULL, the value returned is null 339 * value is SQL NULL, the value returned is null
344 * @throws SQLException if the columnIndex is not valid; if a database access error occurs or this method is called 340 * @throws SQLException if the columnIndex is not valid; if a database access error occurs or this method is called
345 * on a closed result set 341 * on a closed result set
346 */ 342 */
347 @Override 343 @Override
348 public InputStream getBinaryStream(int columnIndex) throws SQLException { 344 public InputStream getBinaryStream(int columnIndex) throws SQLException {
349 try { 345 try {
350 InputStream res = null; 346 InputStream res = null;
351 switch (JdbcSQLTypes[columnIndex - 1]) { 347 switch (JdbcSQLTypes[columnIndex - 1]) {
352 case Types.BLOB: 348 case Types.BLOB:
353 Blob cl = getBlob(columnIndex); 349 Blob cl = getBlob(columnIndex);
354 if(cl != null) { 350 if(cl != null) {
355 res = cl.getBinaryStream(); 351 res = cl.getBinaryStream();
356 } 352 }
357 break; 353 break;
358 case Types.LONGVARBINARY: 354 case Types.LONGVARBINARY:
359 byte[] bytes = getBytes(columnIndex); 355 byte[] bytes = getBytes(columnIndex);
360 if(bytes != null) { 356 if(bytes != null) {
361 res = new ByteArrayInputStream(getBytes(columnIndex)); 357 res = new ByteArrayInputStream(getBytes(columnIndex));
362 } 358 }
363 break; 359 break;
364 default: 360 default:
365 throw new SQLException("Conversion from " + types[columnIndex - 1] + 361 throw new SQLException("Conversion from " + types[columnIndex - 1] +
366 " to binary stream not supported", "M1M05"); 362 " to binary stream not supported", "M1M05");
367 } 363 }
368 return res; 364 return res;
369 } catch (ClassCastException ex) { 365 } catch (ClassCastException ex) {
370 throw new SQLException(ex.getMessage()); 366 throw new SQLException(ex.getMessage());
371 } catch (IndexOutOfBoundsException e) { 367 } catch (IndexOutOfBoundsException e) {
372 throw newSQLInvalidColumnIndexException(columnIndex); 368 throw newSQLInvalidColumnIndexException(columnIndex);
373 } 369 }
374 } 370 }
375 371
376 /** 372 /**
377 * Retrieves the value of the designated column in the current row of this ResultSet object as a stream of 373 * Retrieves the value of the designated column in the current row of this ResultSet object as a stream of
378 * uninterpreted bytes. The value can then be read in chunks from the stream. This method is particularly suitable 374 * uninterpreted bytes. The value can then be read in chunks from the stream. This method is particularly suitable
379 * for retrieving large LONGVARBINARY values. 375 * for retrieving large LONGVARBINARY values.
380 * <br/><br/> 376 * <br/><br/>
381 * Note: All the data in the returned stream must be read prior to getting the value of any other column. The next 377 * Note: All the data in the returned stream must be read prior to getting the value of any other column. The next
382 * call to a getter method implicitly closes the stream. Also, a stream may return 0 when the method available is 378 * call to a getter method implicitly closes the stream. Also, a stream may return 0 when the method available is
383 * called whether there is data available or not. 379 * called whether there is data available or not.
384 * 380 *
385 * @param columnName the label for the column specified with the SQL AS clause. If the SQL AS clause was not 381 * @param columnLabel the label for the column specified with he SQL AS clause. If the SQL AS clause was not
386 * specified, then the label is the name of the column 382 * specified, then the label is the name of the column
387 * @return a Java input stream that delivers the database column value as a stream of uninterpreted bytes; if the 383 * @return a Java input stream that delivers the database column value as a stream of uninterpreted bytes; if the
388 * value is SQL NULL, the result is null 384 * value is SQL NULL, the result is null
389 * @throws SQLException if the columnLabel is not valid; if a database access error occurs or this method is called 385 * @throws SQLException if the columnLabel is not valid; if a database access error occurs or this method is called
390 * on a closed result set 386 * on a closed result set
391 */ 387 */
392 @Override 388 @Override
393 public InputStream getBinaryStream(String columnName) throws SQLException { 389 public InputStream getBinaryStream(String columnLabel) throws SQLException {
394 return getBinaryStream(findColumn(columnName)); 390 return getBinaryStream(findColumn(columnLabel));
395 } 391 }
396 392
397 /** 393 /**
398 * Retrieves the value of the designated column in the current row of this ResultSet object as a java.io.Reader 394 * Retrieves the value of the designated column in the current row of this ResultSet object as a java.io.Reader
399 * object. 395 * object.
405 */ 401 */
406 @Override 402 @Override
407 public Reader getCharacterStream(int columnIndex) throws SQLException { 403 public Reader getCharacterStream(int columnIndex) throws SQLException {
408 try { 404 try {
409 String ss = currentBlock.getValueAsString(columnIndex - 1); 405 String ss = currentBlock.getValueAsString(columnIndex - 1);
410 return (ss == null) ? null : new StringReader(ss); 406 return (ss == null) ? null : new StringReader(ss);
411 } catch (ClassCastException ex) { 407 } catch (ClassCastException ex) {
412 throw new SQLException(ex.getMessage()); 408 throw new SQLException(ex.getMessage());
413 } catch (ProtocolException e) { 409 } catch (ProtocolException e) {
414 throw new SQLException(e); 410 throw new SQLException(e);
415 } catch (IndexOutOfBoundsException e) { 411 } catch (IndexOutOfBoundsException e) {
416 throw newSQLInvalidColumnIndexException(columnIndex); 412 throw newSQLInvalidColumnIndexException(columnIndex);
417 } 413 }
418 } 414 }
419 415
420 /** 416 /**
421 * Retrieves the value of the designated column in the current row of this ResultSet object as a java.io.Reader 417 * Retrieves the value of the designated column in the current row of this ResultSet object as a java.io.Reader
422 * object. 418 * object.
423 * 419 *
424 * @param columnName the name of the column 420 * @param columnLabel the name of the column
425 * @return a java.io.Reader object that contains the column value; if the value is SQL NULL, the value returned is 421 * @return a java.io.Reader object that contains the column value; if the value is SQL NULL, the value returned is
426 * null in the Java programming language. 422 * null in the Java programming language.
427 * @throws SQLException if a database access error occurs 423 * @throws SQLException if a database access error occurs
428 */ 424 */
429 @Override 425 @Override
430 public Reader getCharacterStream(String columnName) throws SQLException { 426 public Reader getCharacterStream(String columnLabel) throws SQLException {
431 return getCharacterStream(findColumn(columnName)); 427 return getCharacterStream(findColumn(columnLabel));
432 } 428 }
433 429
434 /** 430 /**
435 * Retrieves the value of the designated column in the current row of this ResultSet object as a java.io.Reader 431 * Retrieves the value of the designated column in the current row of this ResultSet object as a java.io.Reader
436 * object. It is intended for use when accessing NCHAR, NVARCHAR and LONGNVARCHAR columns. 432 * object. It is intended for use when accessing NCHAR, NVARCHAR and LONGNVARCHAR columns.
437 * 433 *
438 * @param columnIndex the first column is 1, the second is 2, ... 434 * @param columnIndex the first column is 1, the second is 2, ...
439 * @return a java.io.Reader object that contains the column value; if the value is SQL NULL, the value returned is 435 * @return a java.io.Reader object that contains the column value; if the value is SQL NULL, the value returned is
440 * null in the Java programming language. 436 * null in the Java programming language.
441 * @throws SQLException if a database access error occurs 437 * @throws SQLException if a database access error occurs
442 * @throws SQLFeatureNotSupportedException the JDBC driver does not support this method 438 * @throws SQLFeatureNotSupportedException the JDBC driver does not support this method
443 */ 439 */
444 @Override 440 @Override
445 public Reader getNCharacterStream(int columnIndex) throws SQLException { 441 public Reader getNCharacterStream(int columnIndex) throws SQLException {
446 throw newSQLFeatureNotSupportedException("getNCharacterStream"); 442 return getCharacterStream(columnIndex);
447 } 443 }
448 444
449 /** 445 /**
450 * Retrieves the value of the designated column in the current row of this ResultSet object as a java.io.Reader 446 * Retrieves the value of the designated column in the current row of this ResultSet object as a java.io.Reader
451 * object. It is intended for use when accessing NCHAR, NVARCHAR and LONGNVARCHAR columns. 447 * object. It is intended for use when accessing NCHAR, NVARCHAR and LONGNVARCHAR columns.
452 * 448 *
453 * @param columnName the name of the column 449 * @param columnLabel the name of the column
454 * @return a java.io.Reader object that contains the column value; if the value is SQL NULL, the value returned is 450 * @return a java.io.Reader object that contains the column value; if the value is SQL NULL, the value returned is
455 * null in the Java programming language. 451 * null in the Java programming language.
456 * @throws SQLException if a database access error occurs 452 * @throws SQLException if a database access error occurs
457 * @throws SQLFeatureNotSupportedException the JDBC driver does 453 * @throws SQLFeatureNotSupportedException the JDBC driver does
458 * not support this method 454 * not support this method
459 */ 455 */
460 @Override 456 @Override
461 public Reader getNCharacterStream(String columnName) throws SQLException { 457 public Reader getNCharacterStream(String columnLabel) throws SQLException {
462 throw newSQLFeatureNotSupportedException("getNCharacterStream"); 458 return getCharacterStream(findColumn(columnLabel));
463 } 459 }
464 460
465 /** 461 /**
466 * Retrieves the value of the designated column in the current row of this ResultSet object as a Blob object in 462 * Retrieves the value of the designated column in the current row of this ResultSet object as a Blob object in
467 * the Java programming language. 463 * the Java programming language.
475 try { 471 try {
476 return (MonetBlob) currentBlock.getObjectValue(columnIndex - 1); 472 return (MonetBlob) currentBlock.getObjectValue(columnIndex - 1);
477 } catch (ClassCastException ex) { 473 } catch (ClassCastException ex) {
478 throw new SQLException(ex.getMessage()); 474 throw new SQLException(ex.getMessage());
479 } catch (ProtocolException e) { 475 } catch (ProtocolException e) {
480 throw new SQLException(e); 476 throw new SQLException(e);
481 } catch (IndexOutOfBoundsException e) { 477 } catch (IndexOutOfBoundsException e) {
482 throw newSQLInvalidColumnIndexException(columnIndex); 478 throw newSQLInvalidColumnIndexException(columnIndex);
483 } 479 }
484 } 480 }
485 481
486 /** 482 /**
487 * Retrieves the value of the designated column in the current row of this ResultSet object as a Blob object in the 483 * Retrieves the value of the designated column in the current row of this ResultSet object as a Blob object in the
488 * Java programming language. 484 * Java programming language.
489 * 485 *
490 * @param colName the name of the column from which to retrieve the value 486 * @param columnLabel the name of the column from which to retrieve the value
491 * @return a Blob object representing the SQL BLOB value in the specified column 487 * @return a Blob object representing the SQL BLOB value in the specified column
492 * @throws SQLException if a database access error occurs 488 * @throws SQLException if a database access error occurs
493 */ 489 */
494 @Override 490 @Override
495 public Blob getBlob(String colName) throws SQLException { 491 public Blob getBlob(String columnLabel) throws SQLException {
496 return getBlob(findColumn(colName)); 492 return getBlob(findColumn(columnLabel));
497 } 493 }
498 494
499 /** 495 /**
500 * Retrieves the value of the designated column in the current row of this ResultSet object as a Clob object in the 496 * Retrieves the value of the designated column in the current row of this ResultSet object as a Clob object in the
501 * Java programming language. 497 * Java programming language.
509 try { 505 try {
510 return (MonetClob) currentBlock.getObjectValue(columnIndex - 1); 506 return (MonetClob) currentBlock.getObjectValue(columnIndex - 1);
511 } catch (ClassCastException ex) { 507 } catch (ClassCastException ex) {
512 throw new SQLException(ex.getMessage()); 508 throw new SQLException(ex.getMessage());
513 } catch (ProtocolException e) { 509 } catch (ProtocolException e) {
514 throw new SQLException(e); 510 throw new SQLException(e);
515 } catch (IndexOutOfBoundsException e) { 511 } catch (IndexOutOfBoundsException e) {
516 throw newSQLInvalidColumnIndexException(columnIndex); 512 throw newSQLInvalidColumnIndexException(columnIndex);
517 } 513 }
518 } 514 }
519 515
520 /** 516 /**
521 * Retrieves the value of the designated column in the current row of this ResultSet object as a Clob object in the 517 * Retrieves the value of the designated column in the current row of this ResultSet object as a Clob object in the
522 * Java programming language. 518 * Java programming language.
523 * 519 *
524 * @param colName the name of the column from which to retrieve the value 520 * @param columnLabel the name of the column from which to retrieve the value
525 * @return a Clob object representing the SQL CLOB value in the specified column 521 * @return a Clob object representing the SQL CLOB value in the specified column
526 * @throws SQLException if a database access error occurs 522 * @throws SQLException if a database access error occurs
527 */ 523 */
528 @Override 524 @Override
529 public Clob getClob(String colName) throws SQLException { 525 public Clob getClob(String columnLabel) throws SQLException {
530 return getClob(findColumn(colName)); 526 return getClob(findColumn(columnLabel));
531 } 527 }
532 528
533 /** 529 /**
534 * Retrieves the value of the designated column in the current row of this ResultSet object as a NClob object in the 530 * Retrieves the value of the designated column in the current row of this ResultSet object as a NClob object in the
535 * Java programming language. 531 * Java programming language.
536 * 532 *
537 * @param i the first column is 1, the second is 2, ... 533 * @param columnIndex the first column is 1, the second is 2, ...
538 * @return a NClob object representing the SQL NCLOB value in the specified column 534 * @return a NClob object representing the SQL NCLOB value in the specified column
539 * @throws SQLException if a database access error occurs 535 * @throws SQLException if a database access error occurs
540 * @throws SQLFeatureNotSupportedException the JDBC driver does not support this method 536 * @throws SQLFeatureNotSupportedException the JDBC driver does not support this method
541 */ 537 */
542 @Override 538 @Override
543 public NClob getNClob(int i) throws SQLException { 539 public NClob getNClob(int columnIndex) throws SQLException {
544 throw newSQLFeatureNotSupportedException("getNClob"); 540 throw newSQLFeatureNotSupportedException("getNClob");
545 } 541 }
546 542
547 /** 543 /**
548 * Retrieves the value of the designated column in the current row of this ResultSet object as a NClob object in the 544 * Retrieves the value of the designated column in the current row of this ResultSet object as a NClob object in the
549 * Java programming language. 545 * Java programming language.
550 * 546 *
551 * @param colName the name of the column from which to retrieve the value 547 * @param columnLabel the name of the column from which to retrieve the value
552 * @return a NClob object representing the SQL NCLOB value in the specified column 548 * @return a NClob object representing the SQL NCLOB value in the specified column
553 * @throws SQLException if a database access error occurs 549 * @throws SQLException if a database access error occurs
554 * @throws SQLFeatureNotSupportedException the JDBC driver does not support this method 550 * @throws SQLFeatureNotSupportedException the JDBC driver does not support this method
555 */ 551 */
556 @Override 552 @Override
557 public NClob getNClob(String colName) throws SQLException { 553 public NClob getNClob(String columnLabel) throws SQLException {
558 throw newSQLFeatureNotSupportedException("getNClob"); 554 throw newSQLFeatureNotSupportedException("getNClob");
559 } 555 }
560 556
561 /** 557 /**
562 * Retrieves the value of the designated column in the current row of this 558 * Retrieves the value of the designated column in the current row of this
599 case Types.VARCHAR: 595 case Types.VARCHAR:
600 case Types.LONGVARCHAR: 596 case Types.LONGVARCHAR:
601 case Types.CLOB: 597 case Types.CLOB:
602 case Types.BLOB: 598 case Types.BLOB:
603 case Types.LONGVARBINARY: 599 case Types.LONGVARBINARY:
604 String ss = currentBlock.getValueAsString(columnIndex - 1); 600 String ss = currentBlock.getValueAsString(columnIndex - 1);
605 return (ss == null) ? null : new BigDecimal(ss); 601 return (ss == null) ? null : new BigDecimal(ss);
606 default: //OTHERS, BLOB, LONGVARBINARY, TIME... 602 default: //OTHERS, BLOB, LONGVARBINARY, TIME...
607 throw new SQLException("Conversion from " + types[columnIndex - 1] + 603 throw new SQLException("Conversion from " + types[columnIndex - 1] +
608 " to boolean type not supported", "M1M05"); 604 " to boolean type not supported", "M1M05");
609 } 605 }
610 } catch (ClassCastException ex) { 606 } catch (ClassCastException ex) {
611 throw new SQLException(ex.getMessage()); 607 throw new SQLException(ex.getMessage());
612 } catch (ProtocolException e) { 608 } catch (ProtocolException e) {
613 throw new SQLException(e); 609 throw new SQLException(e);
614 } catch (IndexOutOfBoundsException e) { 610 } catch (IndexOutOfBoundsException e) {
615 throw newSQLInvalidColumnIndexException(columnIndex); 611 throw newSQLInvalidColumnIndexException(columnIndex);
616 } 612 }
617 } 613 }
618 614
619 /** 615 /**
644 640
645 /** 641 /**
646 * Retrieves the value of the designated column in the current row of this 642 * Retrieves the value of the designated column in the current row of this
647 * ResultSet object as a java.math.BigDecimal with full precision. 643 * ResultSet object as a java.math.BigDecimal with full precision.
648 * 644 *
649 * @param columnName the SQL name of the column 645 * @param columnLabel the SQL name of the column
650 * @return the column value (full precision); if the value is SQL NULL, 646 * @return the column value (full precision); if the value is SQL NULL,
651 * the value returned is null in the Java programming language. 647 * the value returned is null in the Java programming language.
652 * @throws SQLException if a database access error occurs 648 * @throws SQLException if a database access error occurs
653 */ 649 */
654 @Override 650 @Override
655 public BigDecimal getBigDecimal(String columnName) throws SQLException { 651 public BigDecimal getBigDecimal(String columnLabel) throws SQLException {
656 return getBigDecimal(findColumn(columnName)); 652 return getBigDecimal(findColumn(columnLabel));
657 } 653 }
658 654
659 /** 655 /**
660 * Retrieves the value of the designated column in the current row of this 656 * Retrieves the value of the designated column in the current row of this
661 * ResultSet object as a java.math.BigDecimal with full precision. 657 * ResultSet object as a java.math.BigDecimal with full precision.
662 * 658 *
663 * @param columnName the SQL name of the column 659 * @param columnLabel the SQL name of the column
664 * @param scale the number of digits to the right of the decimal point 660 * @param scale the number of digits to the right of the decimal point
665 * @return the column value (full precision); if the value is SQL NULL, 661 * @return the column value (full precision); if the value is SQL NULL,
666 * the value returned is null in the Java programming language. 662 * the value returned is null in the Java programming language.
667 * @throws SQLException if a database access error occurs 663 * @throws SQLException if a database access error occurs
668 */ 664 */
669 @Override 665 @Override
670 @Deprecated 666 @Deprecated
671 public BigDecimal getBigDecimal(String columnName, int scale) throws SQLException { 667 public BigDecimal getBigDecimal(String columnLabel, int scale) throws SQLException {
672 return getBigDecimal(findColumn(columnName), scale); 668 return getBigDecimal(findColumn(columnLabel), scale);
673 } 669 }
674 670
675 // See Sun JDBC Specification 3.0 Table B-6 671 // See Sun JDBC Specification 3.0 Table B-6
676 /** 672 /**
677 * Retrieves the value of the designated column in the current row of this ResultSet object as a boolean in the Java 673 * Retrieves the value of the designated column in the current row of this ResultSet object as a boolean in the Java
678 * programming language. 674 * programming language.
679 * 675 *
680 * @param columnIndex the first column is 1, the second is 2, ... 676 * @param columnIndex the first column is 1, the second is 2, ...
681 * @return the column value; if the value is SQL NULL, the value returned is false 677 * @return the column value; if the value is SQL NULL, the value returned is false
682 * @throws SQLException if there is no such column 678 * @throws SQLException if there is no such column
683 */ 679 */
705 float floa = currentBlock.getFloatValue(columnIndex - 1); 701 float floa = currentBlock.getFloatValue(columnIndex - 1);
706 return !currentBlock.isLastReadWasNull() && floa != 0.0f; 702 return !currentBlock.isLastReadWasNull() && floa != 0.0f;
707 case Types.DOUBLE: 703 case Types.DOUBLE:
708 double dou = currentBlock.getDoubleValue(columnIndex - 1); 704 double dou = currentBlock.getDoubleValue(columnIndex - 1);
709 return !currentBlock.isLastReadWasNull() && dou != 0.0d; 705 return !currentBlock.isLastReadWasNull() && dou != 0.0d;
710 case Types.CHAR: 706 case Types.CHAR:
711 case Types.VARCHAR: 707 case Types.VARCHAR:
712 case Types.LONGVARCHAR: 708 case Types.LONGVARCHAR:
713 case Types.CLOB: 709 case Types.CLOB:
714 case Types.BLOB: 710 case Types.BLOB:
715 case Types.LONGVARBINARY: 711 case Types.LONGVARBINARY:
716 String val = currentBlock.getValueAsString(columnIndex - 1); 712 String val = currentBlock.getValueAsString(columnIndex - 1);
717 return val != null && !"0".equals(val) && ("1".equals(val) || Boolean.parseBoolean(val)); 713 return val != null && !"0".equals(val) && ("1".equals(val) || Boolean.parseBoolean(val));
718 case Types.NUMERIC: 714 case Types.NUMERIC:
719 case Types.DECIMAL: 715 case Types.DECIMAL:
720 BigDecimal bigdec = (BigDecimal) currentBlock.getValueAsObject(columnIndex - 1); 716 BigDecimal bigdec = (BigDecimal) currentBlock.getValueAsObject(columnIndex - 1);
721 return bigdec != null && bigdec.compareTo(BigDecimal.ZERO) != 0; 717 return bigdec != null && bigdec.compareTo(BigDecimal.ZERO) != 0;
722 default: //OTHERS, BLOB, LONGVARBINARY, TIME... 718 default: //OTHERS, BLOB, LONGVARBINARY, TIME...
723 throw new SQLException("Conversion from " + types[columnIndex - 1] + 719 throw new SQLException("Conversion from " + types[columnIndex - 1] +
724 " to boolean type not supported", "M1M05"); 720 " to boolean type not supported", "M1M05");
725 } 721 }
726 } catch (ClassCastException ex) { 722 } catch (ClassCastException ex) {
727 throw new SQLException(ex.getMessage()); 723 throw new SQLException(ex.getMessage());
728 } catch (ProtocolException e) { 724 } catch (ProtocolException e) {
729 throw new SQLException(e); 725 throw new SQLException(e);
730 } catch (IndexOutOfBoundsException e) { 726 } catch (IndexOutOfBoundsException e) {
731 throw newSQLInvalidColumnIndexException(columnIndex); 727 throw newSQLInvalidColumnIndexException(columnIndex);
732 } 728 }
733 } 729 }
734 730
735 /** 731 /**
736 * Retrieves the value of the designated column in the current row of this ResultSet object as a boolean in the Java 732 * Retrieves the value of the designated column in the current row of this ResultSet object as a boolean in the Java
737 * programming language. 733 * programming language.
738 * 734 *
739 * @param columnName the SQL name of the column 735 * @param columnLabel the SQL name of the column
740 * @return the column value; if the value is SQL NULL, the value returned is false 736 * @return the column value; if the value is SQL NULL, the value returned is false
741 * @throws SQLException if the ResultSet object does not contain columnName 737 * @throws SQLException if the ResultSet object does not contain columnLabel
742 */ 738 */
743 @Override 739 @Override
744 public boolean getBoolean(String columnName) throws SQLException { 740 public boolean getBoolean(String columnLabel) throws SQLException {
745 return getBoolean(findColumn(columnName)); 741 return getBoolean(findColumn(columnLabel));
746 } 742 }
747 743
748 /** 744 /**
749 * Retrieves the value of the designated column in the current row of this ResultSet object as a byte in the Java 745 * Retrieves the value of the designated column in the current row of this ResultSet object as a byte in the Java
750 * programming language. 746 * programming language.
795 " to byte type not supported", "M1M05"); 791 " to byte type not supported", "M1M05");
796 } 792 }
797 } catch (ClassCastException ex) { 793 } catch (ClassCastException ex) {
798 throw new SQLException(ex.getMessage()); 794 throw new SQLException(ex.getMessage());
799 } catch (ProtocolException e) { 795 } catch (ProtocolException e) {
800 throw new SQLException(e); 796 throw new SQLException(e);
801 } catch (IndexOutOfBoundsException e) { 797 } catch (IndexOutOfBoundsException e) {
802 throw newSQLInvalidColumnIndexException(columnIndex); 798 throw newSQLInvalidColumnIndexException(columnIndex);
803 } 799 }
804 } 800 }
805 801
806 /** 802 /**
807 * Retrieves the value of the designated column in the current row of this 803 * Retrieves the value of the designated column in the current row of this
808 * ResultSet object as a byte in the Java programming language. 804 * ResultSet object as a byte in the Java programming language.
809 * 805 *
810 * @param columnName the SQL name of the column 806 * @param columnLabel the SQL name of the column
811 * @return the column value; if the value is SQL NULL, the value returned 807 * @return the column value; if the value is SQL NULL, the value returned
812 * is 0 808 * is 0
813 * @throws SQLException if a database access error occurs 809 * @throws SQLException if a database access error occurs
814 */ 810 */
815 @Override 811 @Override
816 public byte getByte(String columnName) throws SQLException { 812 public byte getByte(String columnLabel) throws SQLException {
817 return getByte(findColumn(columnName)); 813 return getByte(findColumn(columnLabel));
818 } 814 }
819 815
820 /** 816 /**
821 * Retrieves the value of the designated column in the current row of this 817 * Retrieves the value of the designated column in the current row of this
822 * ResultSet object as a byte array in the Java programming language. The 818 * ResultSet object as a byte array in the Java programming language. The
847 throw new SQLException("Cannot operate on " + types[columnIndex - 1] + " type", "M1M05"); 843 throw new SQLException("Cannot operate on " + types[columnIndex - 1] + " type", "M1M05");
848 } 844 }
849 } catch (ClassCastException ex) { 845 } catch (ClassCastException ex) {
850 throw new SQLException(ex.getMessage()); 846 throw new SQLException(ex.getMessage());
851 } catch (ProtocolException e) { 847 } catch (ProtocolException e) {
852 throw new SQLException(e); 848 throw new SQLException(e);
853 } catch (IndexOutOfBoundsException e) { 849 } catch (IndexOutOfBoundsException e) {
854 throw newSQLInvalidColumnIndexException(columnIndex); 850 throw newSQLInvalidColumnIndexException(columnIndex);
855 } 851 }
856 } 852 }
857 853
858 /** 854 /**
859 * Retrieves the value of the designated column in the current row of this ResultSet object as a byte array in the 855 * Retrieves the value of the designated column in the current row of this ResultSet object as a byte array in the
860 * Java programming language. The bytes represent the raw values returned by the driver. 856 * Java programming language. The bytes represent the raw values returned by the driver.
861 * 857 *
862 * @param columnName the SQL name of the column 858 * @param columnLabel the SQL name of the column
863 * @return the column value; if the value is SQL NULL, the value returned is null 859 * @return the column value; if the value is SQL NULL, the value returned is null
864 * @throws SQLException if a database access error occurs 860 * @throws SQLException if a database access error occurs
865 */ 861 */
866 @Override 862 @Override
867 public byte[] getBytes(String columnName) throws SQLException { 863 public byte[] getBytes(String columnLabel) throws SQLException {
868 return getBytes(findColumn(columnName)); 864 return getBytes(findColumn(columnLabel));
869 } 865 }
870 866
871 /** 867 /**
872 * Retrieves the concurrency mode of this ResultSet object. The concurrency used is determined by the Statement 868 * Retrieves the concurrency mode of this ResultSet object. The concurrency used is determined by the Statement
873 * object that created the result set. 869 * object that created the result set.
957 " to double type not supported", "M1M05"); 953 " to double type not supported", "M1M05");
958 } 954 }
959 } catch (ClassCastException ex) { 955 } catch (ClassCastException ex) {
960 throw new SQLException(ex.getMessage()); 956 throw new SQLException(ex.getMessage());
961 } catch (ProtocolException e) { 957 } catch (ProtocolException e) {
962 throw new SQLException(e); 958 throw new SQLException(e);
963 } catch (IndexOutOfBoundsException e) { 959 } catch (IndexOutOfBoundsException e) {
964 throw newSQLInvalidColumnIndexException(columnIndex); 960 throw newSQLInvalidColumnIndexException(columnIndex);
965 } 961 }
966 } 962 }
967 963
968 /** 964 /**
969 * Retrieves the value of the designated column in the current row of this 965 * Retrieves the value of the designated column in the current row of this
970 * ResultSet object as a double in the Java programming language. 966 * ResultSet object as a double in the Java programming language.
971 * 967 *
972 * @param columnName the SQL name of the column 968 * @param columnLabel the SQL name of the column
973 * @return the column value; if the value is SQL NULL, the value returned is 0 969 * @return the column value; if the value is SQL NULL, the value returned is 0
974 * @throws SQLException if the ResultSet object does not contain columnName 970 * @throws SQLException if the ResultSet object does not contain columnLabel
975 */ 971 */
976 @Override 972 @Override
977 public double getDouble(String columnName) throws SQLException { 973 public double getDouble(String columnLabel) throws SQLException {
978 return getDouble(findColumn(columnName)); 974 return getDouble(findColumn(columnLabel));
979 } 975 }
980 976
981 /** 977 /**
982 * Retrieves the holdability of this ResultSet object. 978 * Retrieves the holdability of this ResultSet object.
983 * 979 *
1107 " to float type not supported", "M1M05"); 1103 " to float type not supported", "M1M05");
1108 } 1104 }
1109 } catch (ClassCastException ex) { 1105 } catch (ClassCastException ex) {
1110 throw new SQLException(ex.getMessage()); 1106 throw new SQLException(ex.getMessage());
1111 } catch (ProtocolException e) { 1107 } catch (ProtocolException e) {
1112 throw new SQLException(e); 1108 throw new SQLException(e);
1113 } catch (IndexOutOfBoundsException e) { 1109 } catch (IndexOutOfBoundsException e) {
1114 throw newSQLInvalidColumnIndexException(columnIndex); 1110 throw newSQLInvalidColumnIndexException(columnIndex);
1115 } 1111 }
1116 } 1112 }
1117 1113
1118 /** 1114 /**
1119 * Retrieves the value of the designated column in the current row of this ResultSet object as a float in the Java 1115 * Retrieves the value of the designated column in the current row of this ResultSet object as a float in the Java
1120 * programming language. 1116 * programming language.
1121 * 1117 *
1122 * @param columnName the SQL name of the column 1118 * @param columnLabel the SQL name of the column
1123 * @return the column value; if the value is SQL NULL, the value returned is 0 1119 * @return the column value; if the value is SQL NULL, the value returned is 0
1124 * @throws SQLException if the ResultSet object does not contain columnName 1120 * @throws SQLException if the ResultSet object does not contain columnLabel
1125 */ 1121 */
1126 @Override 1122 @Override
1127 public float getFloat(String columnName) throws SQLException { 1123 public float getFloat(String columnLabel) throws SQLException {
1128 return getFloat(findColumn(columnName)); 1124 return getFloat(findColumn(columnLabel));
1129 } 1125 }
1130 1126
1131 /** 1127 /**
1132 * Retrieves the value of the designated column in the current row of this ResultSet object as an int in the 1128 * Retrieves the value of the designated column in the current row of this ResultSet object as an int in the
1133 * Java programming language. 1129 * Java programming language.
1178 " to integer type not supported", "M1M05"); 1174 " to integer type not supported", "M1M05");
1179 } 1175 }
1180 } catch (ClassCastException ex) { 1176 } catch (ClassCastException ex) {
1181 throw new SQLException(ex.getMessage()); 1177 throw new SQLException(ex.getMessage());
1182 } catch (ProtocolException e) { 1178 } catch (ProtocolException e) {
1183 throw new SQLException(e); 1179 throw new SQLException(e);
1184 } catch (IndexOutOfBoundsException e) { 1180 } catch (IndexOutOfBoundsException e) {
1185 throw newSQLInvalidColumnIndexException(columnIndex); 1181 throw newSQLInvalidColumnIndexException(columnIndex);
1186 } 1182 }
1187 } 1183 }
1188 1184
1189 /** 1185 /**
1190 * Retrieves the value of the designated column in the current row of this ResultSet object as an int in the 1186 * Retrieves the value of the designated column in the current row of this ResultSet object as an int in the
1191 * Java programming language. 1187 * Java programming language.
1192 * 1188 *
1193 * @param columnName the SQL name of the column 1189 * @param columnLabel the SQL name of the column
1194 * @return the column value; if the value is SQL NULL, the value returned is 0 1190 * @return the column value; if the value is SQL NULL, the value returned is 0
1195 * @throws SQLException if the ResultSet object does not contain columnName 1191 * @throws SQLException if the ResultSet object does not contain columnLabel
1196 */ 1192 */
1197 @Override 1193 @Override
1198 public int getInt(String columnName) throws SQLException { 1194 public int getInt(String columnLabel) throws SQLException {
1199 return getInt(findColumn(columnName)); 1195 return getInt(findColumn(columnLabel));
1200 } 1196 }
1201 1197
1202 /** 1198 /**
1203 * Retrieves the value of the designated column in the current row of this ResultSet object as a long in the Java 1199 * Retrieves the value of the designated column in the current row of this ResultSet object as a long in the Java
1204 * programming language. 1200 * programming language.
1249 " to long type not supported", "M1M05"); 1245 " to long type not supported", "M1M05");
1250 } 1246 }
1251 } catch (ClassCastException ex) { 1247 } catch (ClassCastException ex) {
1252 throw new SQLException(ex.getMessage()); 1248 throw new SQLException(ex.getMessage());
1253 } catch (ProtocolException e) { 1249 } catch (ProtocolException e) {
1254 throw new SQLException(e); 1250 throw new SQLException(e);
1255 } catch (IndexOutOfBoundsException e) { 1251 } catch (IndexOutOfBoundsException e) {
1256 throw newSQLInvalidColumnIndexException(columnIndex); 1252 throw newSQLInvalidColumnIndexException(columnIndex);
1257 } 1253 }
1258 } 1254 }
1259 1255
1260 /** 1256 /**
1261 * Retrieves the value of the designated column in the current row of this ResultSet object as a long in the Java 1257 * Retrieves the value of the designated column in the current row of this ResultSet object as a long in the Java
1262 * programming language. 1258 * programming language.
1263 * 1259 *
1264 * @param columnName the SQL name of the column 1260 * @param columnLabel the SQL name of the column
1265 * @return the column value; if the value is SQL NULL, the value returned is 0 1261 * @return the column value; if the value is SQL NULL, the value returned is 0
1266 * @throws SQLException if the ResultSet object does not contain columnName 1262 * @throws SQLException if the ResultSet object does not contain columnLabel
1267 */ 1263 */
1268 @Override 1264 @Override
1269 public long getLong(String columnName) throws SQLException { 1265 public long getLong(String columnLabel) throws SQLException {
1270 return getLong(findColumn(columnName)); 1266 return getLong(findColumn(columnLabel));
1271 } 1267 }
1272 1268
1273 /* helper for the anonymous class inside getMetaData */ 1269 /* helper for the anonymous class inside getMetaData */
1274 private abstract class rsmdw extends MonetWrapper implements ResultSetMetaData {} 1270 private abstract class rsmdw extends MonetWrapper implements ResultSetMetaData {}
1275 1271
1567 break; 1563 break;
1568 case Types.DATE: 1564 case Types.DATE:
1569 _precision[column] = 10; 1565 _precision[column] = 10;
1570 break; 1566 break;
1571 case Types.TIME: 1567 case Types.TIME:
1568 case 2013: //Types.TIME_WITH_TIMEZONE:
1572 _precision[column] = 8; 1569 _precision[column] = 8;
1573 break; 1570 break;
1574 case Types.TIMESTAMP: 1571 case Types.TIMESTAMP:
1572 case 2014: //Types.TIMESTAMP_WITH_TIMEZONE:
1575 _precision[column] = 19; 1573 _precision[column] = 19;
1576 break; 1574 break;
1577 default: 1575 default:
1578 _precision[column] = 30; 1576 _precision[column] = 30;
1579 break; 1577 break;
1830 case Types.BLOB: 1828 case Types.BLOB:
1831 return currentBlock.getValueAsObject(columnIndex - 1); 1829 return currentBlock.getValueAsObject(columnIndex - 1);
1832 case Types.DATE: 1830 case Types.DATE:
1833 return getDate(columnIndex); 1831 return getDate(columnIndex);
1834 case Types.TIME: 1832 case Types.TIME:
1833 case 2013: //Types.TIME_WITH_TIMEZONE:
1835 return getTime(columnIndex); 1834 return getTime(columnIndex);
1836 case Types.TIMESTAMP: 1835 case Types.TIMESTAMP:
1836 case 2014: //Types.TIMESTAMP_WITH_TIMEZONE:
1837 return getTimestamp(columnIndex); 1837 return getTimestamp(columnIndex);
1838 case Types.OTHER: { 1838 case Types.OTHER: {
1839 // The MonetDB types: inet, json, url and uuid are all mapped to Types.OTHER in MonetDriver.typeMap 1839 // The MonetDB types: inet, json, url and uuid are all mapped to Types.OTHER in MonetDriver.typeMap
1840 // For these MonetDB types (except json, see comments below) we try to create objects of the corresponding class. 1840 // For these MonetDB types (except json, see comments below) we try to create objects of the corresponding class.
1841 String MonetDBType = types[columnIndex - 1]; 1841 String MonetDBType = types[columnIndex - 1];
1887 return getObject(columnIndex, this.getStatement().getConnection().getTypeMap()); 1887 return getObject(columnIndex, this.getStatement().getConnection().getTypeMap());
1888 } 1888 }
1889 } catch (IndexOutOfBoundsException e) { 1889 } catch (IndexOutOfBoundsException e) {
1890 throw newSQLInvalidColumnIndexException(columnIndex); 1890 throw newSQLInvalidColumnIndexException(columnIndex);
1891 } catch (ProtocolException e) { 1891 } catch (ProtocolException e) {
1892 throw new SQLException(e); 1892 throw new SQLException(e);
1893 } 1893 }
1894 } 1894 }
1895 1895
1896 private boolean classImplementsSQLData(Class<?> cl) { 1896 private boolean classImplementsSQLData(Class<?> cl) {
1897 Class<?>[] cls = cl.getInterfaces(); 1897 Class<?>[] cls = cl.getInterfaces();
1898 for (Class<?> cl1 : cls) { 1898 for (Class<?> cl1 : cls) {
2158 * of the exception may provide a more detailed exception, for example, if a conversion error occurs 2158 * of the exception may provide a more detailed exception, for example, if a conversion error occurs
2159 */ 2159 */
2160 @Override 2160 @Override
2161 @SuppressWarnings("unchecked") 2161 @SuppressWarnings("unchecked")
2162 public <T> T getObject(int columnIndex, Class<T> type) throws SQLException { 2162 public <T> T getObject(int columnIndex, Class<T> type) throws SQLException {
2163 if (type == null)
2164 throw new SQLException("type is null", "M1M05");
2163 try { 2165 try {
2164 return (T) getObjectFromClass(columnIndex, type); 2166 return (T) getObjectFromClass(columnIndex, type);
2165 } catch (IndexOutOfBoundsException e) { 2167 } catch (IndexOutOfBoundsException e) {
2166 throw newSQLInvalidColumnIndexException(columnIndex); 2168 throw newSQLInvalidColumnIndexException(columnIndex);
2167 } 2169 }
2221 case Types.LONGVARBINARY: 2223 case Types.LONGVARBINARY:
2222 return byte[].class; 2224 return byte[].class;
2223 case Types.DATE: 2225 case Types.DATE:
2224 return Date.class; 2226 return Date.class;
2225 case Types.TIME: 2227 case Types.TIME:
2228 case 2013: //Types.TIME_WITH_TIMEZONE:
2226 return Time.class; 2229 return Time.class;
2227 case Types.TIMESTAMP: 2230 case Types.TIMESTAMP:
2231 case 2014: //Types.TIMESTAMP_WITH_TIMEZONE:
2228 return Timestamp.class; 2232 return Timestamp.class;
2229 case Types.CLOB: 2233 case Types.CLOB:
2230 return Clob.class; 2234 return Clob.class;
2231 case Types.BLOB: 2235 case Types.BLOB:
2232 return Blob.class; 2236 return Blob.class;
2245 * built-in types specified in the JDBC specification. If the value is an 2249 * built-in types specified in the JDBC specification. If the value is an
2246 * SQL NULL, the driver returns a Java null. 2250 * SQL NULL, the driver returns a Java null.
2247 * 2251 *
2248 * This method may also be used to read database-specific abstract data types. 2252 * This method may also be used to read database-specific abstract data types.
2249 * 2253 *
2250 * @param columnName the SQL name of the column 2254 * @param columnLabel the SQL name of the column
2251 * @return a java.lang.Object holding the column value 2255 * @return a java.lang.Object holding the column value
2252 * @throws SQLException if a database access error occurs 2256 * @throws SQLException if a database access error occurs
2253 */ 2257 */
2254 @Override 2258 @Override
2255 public Object getObject(String columnName) throws SQLException { 2259 public Object getObject(String columnLabel) throws SQLException {
2256 return getObject(findColumn(columnName)); 2260 return getObject(findColumn(columnLabel));
2257 } 2261 }
2258 2262
2259 /** 2263 /**
2260 * Retrieves the value of the designated column in the current row of this 2264 * Retrieves the value of the designated column in the current row of this
2261 * ResultSet object as an Object in the Java programming language. If the 2265 * ResultSet object as an Object in the Java programming language. If the
2262 * value is an SQL NULL, the driver returns a Java null. This method uses 2266 * value is an SQL NULL, the driver returns a Java null. This method uses
2263 * the specified Map object for custom mapping if appropriate. 2267 * the specified Map object for custom mapping if appropriate.
2264 * 2268 *
2265 * @param colName the name of the column from which to retrieve the value 2269 * @param columnLabel the name of the column from which to retrieve the value
2266 * @param map a java.util.Map object that contains the mapping from SQL 2270 * @param map a java.util.Map object that contains the mapping from SQL
2267 * type names to classes in the Java programming language 2271 * type names to classes in the Java programming language
2268 * @return an Object representing the SQL value in the specified column 2272 * @return an Object representing the SQL value in the specified column
2269 * @throws SQLException if a database access error occurs 2273 * @throws SQLException if a database access error occurs
2270 */ 2274 */
2271 @Override 2275 @Override
2272 public Object getObject(String colName, Map<String,Class<?>> map) throws SQLException { 2276 public Object getObject(String columnLabel, Map<String,Class<?>> map) throws SQLException {
2273 return getObject(findColumn(colName), map); 2277 return getObject(findColumn(columnLabel), map);
2274 } 2278 }
2275 2279
2276 @Override 2280 @Override
2277 public Ref getRef(int i) throws SQLException { 2281 public Ref getRef(int columnIndex) throws SQLException {
2278 throw newSQLFeatureNotSupportedException("getRef"); 2282 throw newSQLFeatureNotSupportedException("getRef");
2279 } 2283 }
2280 2284
2281 @Override 2285 @Override
2282 public Ref getRef(String colName) throws SQLException { 2286 public Ref getRef(String columnLabel) throws SQLException {
2283 throw newSQLFeatureNotSupportedException("getRef"); 2287 throw newSQLFeatureNotSupportedException("getRef");
2284 } 2288 }
2285 2289
2286 /** 2290 /**
2287 * Retrieves the current row number. The first row is number 1, the second number 2, and so on. 2291 * Retrieves the current row number. The first row is number 1, the second number 2, and so on.
2310 2314
2311 /** 2315 /**
2312 * Retrieves the value of the designated column in the current row of this ResultSet object as a java.sql.RowId 2316 * Retrieves the value of the designated column in the current row of this ResultSet object as a java.sql.RowId
2313 * object in the Java programming language. 2317 * object in the Java programming language.
2314 * 2318 *
2315 * @param columnName the SQL name of the column 2319 * @param columnLabel the SQL name of the column
2316 * @return the column value; if the value is SQL NULL, the value returned is null 2320 * @return the column value; if the value is SQL NULL, the value returned is null
2317 * @throws SQLException if the ResultSet object does not contain columnName 2321 * @throws SQLException if the ResultSet object does not contain columnLabel
2318 * @throws SQLFeatureNotSupportedException the JDBC driver does not support this method 2322 * @throws SQLFeatureNotSupportedException the JDBC driver does not support this method
2319 */ 2323 */
2320 @Override 2324 @Override
2321 public RowId getRowId(String columnName) throws SQLException { 2325 public RowId getRowId(String columnLabel) throws SQLException {
2322 throw newSQLFeatureNotSupportedException("getRowId"); 2326 throw newSQLFeatureNotSupportedException("getRowId");
2323 } 2327 }
2324 2328
2325 /** 2329 /**
2326 * Retrieves the value of the designated column in the current row of this ResultSet object as a short in the Java 2330 * Retrieves the value of the designated column in the current row of this ResultSet object as a short in the Java
2382 2386
2383 /** 2387 /**
2384 * Retrieves the value of the designated column in the current row of this ResultSet object as a short in the Java 2388 * Retrieves the value of the designated column in the current row of this ResultSet object as a short in the Java
2385 * programming language. 2389 * programming language.
2386 * 2390 *
2387 * @param columnName the SQL name of the column 2391 * @param columnLabel the SQL name of the column
2388 * @return the column value; if the value is SQL NULL, the value returned is 0 2392 * @return the column value; if the value is SQL NULL, the value returned is 0
2389 * @throws SQLException if the ResultSet object does not contain columnName 2393 * @throws SQLException if the ResultSet object does not contain columnLabel
2390 */ 2394 */
2391 @Override 2395 @Override
2392 public short getShort(String columnName) throws SQLException { 2396 public short getShort(String columnLabel) throws SQLException {
2393 return getShort(findColumn(columnName)); 2397 return getShort(findColumn(columnLabel));
2394 } 2398 }
2395 2399
2396 /** 2400 /**
2397 * Retrieves the Statement object that produced this ResultSet object. If the result set was generated some other 2401 * Retrieves the Statement object that produced this ResultSet object. If the result set was generated some other
2398 * way, such as by a DatabaseMetaData method, this method returns null. 2402 * way, such as by a DatabaseMetaData method, this method returns null.
2428 2432
2429 /** 2433 /**
2430 * Retrieves the value of the designated column in the current row of this 2434 * Retrieves the value of the designated column in the current row of this
2431 * ResultSet object as a String in the Java programming language. 2435 * ResultSet object as a String in the Java programming language.
2432 * 2436 *
2433 * @param columnName the SQL name of the column 2437 * @param columnLabel the SQL name of the column
2434 * @return the column value; if the value is SQL NULL, the value returned is null 2438 * @return the column value; if the value is SQL NULL, the value returned is null
2435 * @throws SQLException if the ResultSet object does not contain columnName 2439 * @throws SQLException if the ResultSet object does not contain columnLabel
2436 */ 2440 */
2437 @Override 2441 @Override
2438 public String getString(String columnName) throws SQLException { 2442 public String getString(String columnLabel) throws SQLException {
2439 return getString(findColumn(columnName)); 2443 return getString(findColumn(columnLabel));
2440 } 2444 }
2441 2445
2442 /** 2446 /**
2443 * Retrieves the value of the designated column in the current row 2447 * Retrieves the value of the designated column in the current row
2444 * of this ResultSet object as a String in the Java programming 2448 * of this ResultSet object as a String in the Java programming
2459 * Retrieves the value of the designated column in the current row 2463 * Retrieves the value of the designated column in the current row
2460 * of this ResultSet object as a String in the Java programming 2464 * of this ResultSet object as a String in the Java programming
2461 * language. It is intended for use when accessing NCHAR,NVARCHAR 2465 * language. It is intended for use when accessing NCHAR,NVARCHAR
2462 * and LONGNVARCHAR columns. 2466 * and LONGNVARCHAR columns.
2463 * 2467 *
2464 * @param columnName the SQL name of the column 2468 * @param columnLabel the SQL name of the column
2465 * @return the column value; if the value is SQL NULL, the value returned is null 2469 * @return the column value; if the value is SQL NULL, the value returned is null
2466 * @throws SQLException if the ResultSet object does not contain columnName 2470 * @throws SQLException if the ResultSet object does not contain columnLabel
2467 * @throws SQLFeatureNotSupportedException the JDBC driver does not support this method 2471 * @throws SQLFeatureNotSupportedException the JDBC driver does not support this method
2468 */ 2472 */
2469 @Override 2473 @Override
2470 public String getNString(String columnName) throws SQLException { 2474 public String getNString(String columnLabel) throws SQLException {
2471 return getNString(findColumn(columnName)); 2475 return getString(findColumn(columnLabel));
2472 } 2476 }
2473 2477
2474 /** 2478 /**
2475 * Retrieves the value of the designated column in the current row of this ResultSet as a java.sql.SQLXML object 2479 * Retrieves the value of the designated column in the current row of this ResultSet as a java.sql.SQLXML object
2476 * in the Java programming language. 2480 * in the Java programming language.
2477 * 2481 *
2478 * @param i the first column is 1, the second is 2, ... 2482 * @param columnIndex the first column is 1, the second is 2, ...
2479 * @return a SQLXML object that maps an SQL XML value 2483 * @return a SQLXML object that maps an SQL XML value
2480 * @throws SQLException if a database access error occurs 2484 * @throws SQLException if a database access error occurs
2481 * @throws SQLFeatureNotSupportedException the JDBC driver does not support this method 2485 * @throws SQLFeatureNotSupportedException the JDBC driver does not support this method
2482 */ 2486 */
2483 @Override 2487 @Override
2484 public SQLXML getSQLXML(int i) throws SQLException { 2488 public SQLXML getSQLXML(int columnIndex) throws SQLException {
2485 throw newSQLFeatureNotSupportedException("getSQLXML"); 2489 throw newSQLFeatureNotSupportedException("getSQLXML");
2486 } 2490 }
2487 2491
2488 /** 2492 /**
2489 * Retrieves the value of the designated column in the current row of this ResultSet as a java.sql.SQLXML object 2493 * Retrieves the value of the designated column in the current row of this ResultSet as a java.sql.SQLXML object
2490 * in the Java programming language. 2494 * in the Java programming language.
2491 * 2495 *
2492 * @param colName the label for the column specified with the SQL AS clause. If the SQL AS clause was not specified, 2496 * @param columnLabel the label for the column specified with the SQL AS clause. If the SQL AS clause was not
2493 * then the label is the name of the column 2497 * specified, then the label is the name of the column
2494 * @return a SQLXML object that maps an SQL XML value 2498 * @return a SQLXML object that maps an SQL XML value
2495 * @throws SQLException if a database access error occurs 2499 * @throws SQLException if a database access error occurs
2496 * @throws SQLFeatureNotSupportedException the JDBC driver does not support this method 2500 * @throws SQLFeatureNotSupportedException the JDBC driver does not support this method
2497 */ 2501 */
2498 @Override 2502 @Override
2499 public SQLXML getSQLXML(String colName) throws SQLException { 2503 public SQLXML getSQLXML(String columnLabel) throws SQLException {
2500 throw newSQLFeatureNotSupportedException("getSQLXML"); 2504 throw newSQLFeatureNotSupportedException("getSQLXML");
2501 } 2505 }
2502 2506
2503 /** 2507 /**
2504 * Retrieves the value of the designated column in the current row of this 2508 * Retrieves the value of the designated column in the current row of this
2529 */ 2533 */
2530 @Override 2534 @Override
2531 public Date getDate(int columnIndex, Calendar cal) throws SQLException { 2535 public Date getDate(int columnIndex, Calendar cal) throws SQLException {
2532 try { 2536 try {
2533 Calendar res; 2537 Calendar res;
2534 long millis; 2538 long millis;
2535 switch (JdbcSQLTypes[columnIndex - 1]) { 2539 switch (JdbcSQLTypes[columnIndex - 1]) {
2536 case Types.DATE: 2540 case Types.DATE:
2537 case Types.TIME: 2541 case Types.TIME:
2538 case Types.TIMESTAMP: 2542 case Types.TIMESTAMP:
2539 res = (Calendar) currentBlock.getValueAsObject(columnIndex - 1); 2543 res = (Calendar) currentBlock.getValueAsObject(columnIndex - 1);
2540 if(res == null) { 2544 if(res == null) {
2541 return null; 2545 return null;
2542 } 2546 }
2543 millis = res.getTimeInMillis() - res.getTimeZone().getRawOffset() + cal.getTimeZone().getRawOffset(); 2547 millis = res.getTimeInMillis() - res.getTimeZone().getRawOffset() + cal.getTimeZone().getRawOffset();
2544 break; 2548 break;
2545 case 2013: //Types.TIME_WITH_TIMEZONE: 2549 case 2013: //Types.TIME_WITH_TIMEZONE:
2546 case 2014: //Types.TIMESTAMP_WITH_TIMEZONE: 2550 case 2014: //Types.TIMESTAMP_WITH_TIMEZONE:
2547 res = (Calendar) currentBlock.getValueAsObject(columnIndex - 1); 2551 res = (Calendar) currentBlock.getValueAsObject(columnIndex - 1);
2548 if(res == null) { 2552 if(res == null) {
2549 return null; 2553 return null;
2550 } 2554 }
2551 millis = res.getTimeInMillis(); 2555 millis = res.getTimeInMillis();
2552 break; 2556 break;
2553 case Types.CHAR: 2557 case Types.CHAR:
2554 case Types.VARCHAR: 2558 case Types.VARCHAR:
2555 case Types.LONGVARCHAR: 2559 case Types.LONGVARCHAR:
2556 case Types.CLOB: 2560 case Types.CLOB:
2557 case Types.BLOB: 2561 case Types.BLOB:
2558 case Types.LONGVARBINARY: 2562 case Types.LONGVARBINARY:
2559 res = currentBlock.getDateValueFromString(this, columnIndex - 1, Types.DATE); 2563 res = currentBlock.getDateValueFromString(this, columnIndex - 1, Types.DATE);
2560 if(res == null) { 2564 if(res == null) {
2561 return null; 2565 return null;
2562 } 2566 }
2563 millis = res.getTimeInMillis() - res.getTimeZone().getRawOffset() + cal.getTimeZone().getRawOffset(); 2567 millis = res.getTimeInMillis() - res.getTimeZone().getRawOffset() + cal.getTimeZone().getRawOffset();
2564 break; 2568 break;
2565 default: 2569 default:
2566 this.addWarning("unsupported data type", "01M03"); 2570 this.addWarning("unsupported data type", "01M03");
2567 cal.clear(); 2571 cal.clear();
2568 millis = 0; 2572 millis = 0;
2569 } 2573 }
2570 return new Date(millis); 2574 return new Date(millis);
2571 } catch (ClassCastException ex) { 2575 } catch (ClassCastException ex) {
2572 throw new SQLException(ex.getMessage()); 2576 throw new SQLException(ex.getMessage());
2573 } catch (ProtocolException e) { 2577 } catch (ProtocolException e) {
2574 throw new SQLException(e); 2578 throw new SQLException(e);
2575 } catch (IndexOutOfBoundsException e) { 2579 } catch (IndexOutOfBoundsException e) {
2576 throw newSQLInvalidColumnIndexException(columnIndex); 2580 throw newSQLInvalidColumnIndexException(columnIndex);
2580 /** 2584 /**
2581 * Retrieves the value of the designated column in the current row of this 2585 * Retrieves the value of the designated column in the current row of this
2582 * ResultSet object as a java.sql.Date object in the Java programming 2586 * ResultSet object as a java.sql.Date object in the Java programming
2583 * language. 2587 * language.
2584 * 2588 *
2585 * @param columnName the SQL name of the column from which to retrieve the value 2589 * @param columnLabel the SQL name of the column from which to retrieve the value
2586 * @return the column value; if the value is SQL NULL, the value returned is null 2590 * @return the column value; if the value is SQL NULL, the value returned is null
2587 * @throws SQLException if a database access error occurs 2591 * @throws SQLException if a database access error occurs
2588 */ 2592 */
2589 @Override 2593 @Override
2590 public Date getDate(String columnName) throws SQLException { 2594 public Date getDate(String columnLabel) throws SQLException {
2591 return getDate(findColumn(columnName), Calendar.getInstance()); 2595 return getDate(findColumn(columnLabel), Calendar.getInstance());
2592 } 2596 }
2593 2597
2594 /** 2598 /**
2595 * Retrieves the value of the designated column in the current row of this 2599 * Retrieves the value of the designated column in the current row of this
2596 * ResultSet object as a java.sql.Date object in the Java programming 2600 * ResultSet object as a java.sql.Date object in the Java programming
2597 * language. This method uses the given calendar to construct an appropriate 2601 * language. This method uses the given calendar to construct an appropriate
2598 * millisecond value for the date if the underlying database does not store 2602 * millisecond value for the date if the underlying database does not store
2599 * timezone information. 2603 * timezone information.
2600 * 2604 *
2601 * @param columnName the SQL name of the column from which to retrieve the value 2605 * @param columnLabel the SQL name of the column from which to retrieve the value
2602 * @param cal the java.util.Calendar object to use in constructing the date 2606 * @param cal the java.util.Calendar object to use in constructing the date
2603 * @return the column value; if the value is SQL NULL, the value returned is null 2607 * @return the column value; if the value is SQL NULL, the value returned is null
2604 * @throws SQLException if a database access error occurs 2608 * @throws SQLException if a database access error occurs
2605 */ 2609 */
2606 @Override 2610 @Override
2607 public Date getDate(String columnName, Calendar cal) throws SQLException { 2611 public Date getDate(String columnLabel, Calendar cal) throws SQLException {
2608 return getDate(findColumn(columnName), cal); 2612 return getDate(findColumn(columnLabel), cal);
2609 } 2613 }
2610 2614
2611 /** 2615 /**
2612 * Retrieves the value of the designated column in the current row of this ResultSet object as a java.sql.Time 2616 * Retrieves the value of the designated column in the current row of this ResultSet object as a java.sql.Time
2613 * object in the Java programming language. 2617 * object in the Java programming language.
2616 * @return the column value; if the value is SQL NULL, the value returned is null 2620 * @return the column value; if the value is SQL NULL, the value returned is null
2617 * @throws SQLException if a database access error occurs 2621 * @throws SQLException if a database access error occurs
2618 */ 2622 */
2619 @Override 2623 @Override
2620 public Time getTime(int columnIndex) throws SQLException { 2624 public Time getTime(int columnIndex) throws SQLException {
2621 return getTime(columnIndex, Calendar.getInstance()); 2625 return getTime(columnIndex, null);
2622 } 2626 }
2623 2627
2624 /** 2628 /**
2625 * Retrieves the value of the designated column in the current row of 2629 * Retrieves the value of the designated column in the current row of
2626 * this ResultSet object as a java.sql.Time object in the Java programming 2630 * this ResultSet object as a java.sql.Time object in the Java programming
2628 * millisecond value for the time if the underlying database does not store 2632 * millisecond value for the time if the underlying database does not store
2629 * timezone information. 2633 * timezone information.
2630 * 2634 *
2631 * @param columnIndex the first column is 1, the second is 2, ... 2635 * @param columnIndex the first column is 1, the second is 2, ...
2632 * @param cal the java.util.Calendar object to use in constructing the timestamp 2636 * @param cal the java.util.Calendar object to use in constructing the timestamp
2633 * @return the column value as a java.sql.Timestamp object; if the value is SQL NULL, the value returned is null in 2637 * @return the column value as a java.sql.Time object; if the value is SQL NULL, the value returned is null in the
2634 * the Java programming language 2638 * Java programming language
2635 * @throws SQLException if a database access error occurs 2639 * @throws SQLException if a database access error occurs
2636 */ 2640 */
2637 @Override 2641 @Override
2638 public Time getTime(int columnIndex, Calendar cal) throws SQLException { 2642 public Time getTime(int columnIndex, Calendar cal) throws SQLException {
2639 try { 2643 try {
2640 Calendar res; 2644 Calendar res;
2641 long millis; 2645 long millis;
2642 switch (JdbcSQLTypes[columnIndex - 1]) { 2646 switch (JdbcSQLTypes[columnIndex - 1]) {
2643 case Types.DATE: 2647 case Types.DATE:
2644 case Types.TIME: 2648 case Types.TIME:
2645 case Types.TIMESTAMP: 2649 case Types.TIMESTAMP:
2646 res = (Calendar) currentBlock.getValueAsObject(columnIndex - 1); 2650 res = (Calendar) currentBlock.getValueAsObject(columnIndex - 1);
2647 if(res == null) { 2651 if(res == null) {
2648 return null; 2652 return null;
2649 } 2653 }
2650 millis = res.getTimeInMillis() - res.getTimeZone().getRawOffset() + cal.getTimeZone().getRawOffset(); 2654 millis = res.getTimeInMillis() - res.getTimeZone().getRawOffset() + cal.getTimeZone().getRawOffset();
2651 break; 2655 break;
2652 case 2013: //Types.TIME_WITH_TIMEZONE: 2656 case 2013: //Types.TIME_WITH_TIMEZONE:
2653 case 2014: //Types.TIMESTAMP_WITH_TIMEZONE: 2657 case 2014: //Types.TIMESTAMP_WITH_TIMEZONE:
2654 res = (Calendar) currentBlock.getValueAsObject(columnIndex - 1); 2658 res = (Calendar) currentBlock.getValueAsObject(columnIndex - 1);
2655 if(res == null) { 2659 if(res == null) {
2656 return null; 2660 return null;
2657 } 2661 }
2658 millis = res.getTimeInMillis(); 2662 millis = res.getTimeInMillis();
2659 break; 2663 break;
2660 case Types.CHAR: 2664 case Types.CHAR:
2661 case Types.VARCHAR: 2665 case Types.VARCHAR:
2662 case Types.LONGVARCHAR: 2666 case Types.LONGVARCHAR:
2663 case Types.CLOB: 2667 case Types.CLOB:
2664 case Types.BLOB: 2668 case Types.BLOB:
2665 case Types.LONGVARBINARY: 2669 case Types.LONGVARBINARY:
2666 res = currentBlock.getDateValueFromString(this, columnIndex - 1, Types.TIME); 2670 res = currentBlock.getDateValueFromString(this, columnIndex - 1, Types.TIME);
2667 if(res == null) { 2671 if(res == null) {
2668 return null; 2672 return null;
2669 } 2673 }
2670 millis = res.getTimeInMillis() - res.getTimeZone().getRawOffset() + cal.getTimeZone().getRawOffset(); 2674 millis = res.getTimeInMillis() - res.getTimeZone().getRawOffset() + cal.getTimeZone().getRawOffset();
2671 break; 2675 break;
2672 default: 2676 default:
2673 this.addWarning("unsupported data type", "01M03"); 2677 this.addWarning("unsupported data type", "01M03");
2674 cal.clear(); 2678 cal.clear();
2675 millis = 0; 2679 millis = 0;
2676 } 2680 }
2677 return new Time(millis); 2681 return new Time(millis);
2678 } catch (ClassCastException ex) { 2682 } catch (ClassCastException ex) {
2679 throw new SQLException(ex.getMessage()); 2683 throw new SQLException(ex.getMessage());
2680 } catch (ProtocolException e) { 2684 } catch (ProtocolException e) {
2681 throw new SQLException(e); 2685 throw new SQLException(e);
2682 } catch (IndexOutOfBoundsException e) { 2686 } catch (IndexOutOfBoundsException e) {
2683 throw newSQLInvalidColumnIndexException(columnIndex); 2687 throw newSQLInvalidColumnIndexException(columnIndex);
2684 } 2688 }
2685 } 2689 }
2686 2690
2687 /** 2691 /**
2688 * Retrieves the value of the designated column in the current row of this ResultSet object as a java.sql.Time 2692 * Retrieves the value of the designated column in the current row of this ResultSet object as a java.sql.Time
2689 * object in the Java programming language. 2693 * object in the Java programming language.
2690 * 2694 *
2691 * @param columnName the SQL name of the column 2695 * @param columnLabel the SQL name of the column
2692 * @return the column value; if the value is SQL NULL, the value returned is null 2696 * @return the column value; if the value is SQL NULL, the value returned is null
2693 * @throws SQLException if a database access error occurs 2697 * @throws SQLException if a database access error occurs
2694 */ 2698 */
2695 @Override 2699 @Override
2696 public Time getTime(String columnName) throws SQLException { 2700 public Time getTime(String columnLabel) throws SQLException {
2697 return getTime(findColumn(columnName), Calendar.getInstance()); 2701 return getTime(findColumn(columnLabel), null);
2698 } 2702 }
2699 2703
2700 /** 2704 /**
2701 * Retrieves the value of the designated column in the current row of 2705 * Retrieves the value of the designated column in the current row of
2702 * this ResultSet object as a java.sql.Time object in the Java programming 2706 * this ResultSet object as a java.sql.Time object in the Java programming
2703 * language. This method uses the given calendar to construct an appropriate 2707 * language. This method uses the given calendar to construct an appropriate
2704 * millisecond value for the time if the underlying database does not store 2708 * millisecond value for the time if the underlying database does not store
2705 * timezone information. 2709 * timezone information.
2706 * 2710 *
2707 * @param columnName the SQL name of the column 2711 * @param columnLabel the SQL name of the column
2708 * @param cal the java.util.Calendar object to use in constructing the timestamp 2712 * @param cal the java.util.Calendar object to use in constructing the timestamp
2709 * @return the column value as a java.sql.Timestamp object; if the value is SQL NULL, the value returned is null 2713 * @return the column value as a java.sql.Time object; if the value is SQL NULL, the value returned is null in the
2710 * in the Java programming language 2714 * Java programming language
2711 * @throws SQLException if a database access error occurs 2715 * @throws SQLException if a database access error occurs
2712 */ 2716 */
2713 @Override 2717 @Override
2714 public Time getTime(String columnName, Calendar cal) throws SQLException { 2718 public Time getTime(String columnLabel, Calendar cal) throws SQLException {
2715 return getTime(findColumn(columnName), cal); 2719 return getTime(findColumn(columnLabel), cal);
2716 } 2720 }
2717 2721
2718 /** 2722 /**
2719 * Retrieves the value of the designated column in the current row of this ResultSet object as a java.sql.Timestamp 2723 * Retrieves the value of the designated column in the current row of this ResultSet object as a java.sql.Timestamp
2720 * object in the Java programming language. 2724 * object in the Java programming language.
2723 * @return the column value; if the value is SQL NULL, the value returned is null 2727 * @return the column value; if the value is SQL NULL, the value returned is null
2724 * @throws SQLException if a database access error occurs 2728 * @throws SQLException if a database access error occurs
2725 */ 2729 */
2726 @Override 2730 @Override
2727 public Timestamp getTimestamp(int columnIndex) throws SQLException { 2731 public Timestamp getTimestamp(int columnIndex) throws SQLException {
2728 return getTimestamp(columnIndex, Calendar.getInstance()); 2732 return getTimestamp(columnIndex, null);
2729 } 2733 }
2730 2734
2731 /** 2735 /**
2732 * Retrieves the value of the designated column in the current row of this 2736 * Retrieves the value of the designated column in the current row of this
2733 * ResultSet object as a java.sql.Timestamp object in the Java programming 2737 * ResultSet object as a java.sql.Timestamp object in the Java programming
2741 * in the Java programming language 2745 * in the Java programming language
2742 * @throws SQLException if a database access error occurs 2746 * @throws SQLException if a database access error occurs
2743 */ 2747 */
2744 @Override 2748 @Override
2745 public Timestamp getTimestamp(int columnIndex, Calendar cal) throws SQLException { 2749 public Timestamp getTimestamp(int columnIndex, Calendar cal) throws SQLException {
2746 try { 2750 try {
2747 Calendar res; 2751 Calendar res;
2748 long millis; 2752 long millis;
2749 int nanos = 0; 2753 int nanos = 0;
2750 switch (JdbcSQLTypes[columnIndex - 1]) { 2754 switch (JdbcSQLTypes[columnIndex - 1]) {
2751 case Types.DATE: 2755 case Types.DATE:
2752 case Types.TIME: 2756 case Types.TIME:
2753 res = (Calendar) currentBlock.getValueAsObject(columnIndex - 1); 2757 res = (Calendar) currentBlock.getValueAsObject(columnIndex - 1);
2754 if(res == null) { 2758 if(res == null) {
2755 return null; 2759 return null;
2756 } 2760 }
2757 millis = res.getTimeInMillis() - res.getTimeZone().getRawOffset() + cal.getTimeZone().getRawOffset(); 2761 millis = res.getTimeInMillis() - res.getTimeZone().getRawOffset() + cal.getTimeZone().getRawOffset();
2758 break; 2762 break;
2759 case 2013: //Types.TIME_WITH_TIMEZONE: 2763 case 2013: //Types.TIME_WITH_TIMEZONE:
2760 res = (Calendar) currentBlock.getValueAsObject(columnIndex - 1); 2764 res = (Calendar) currentBlock.getValueAsObject(columnIndex - 1);
2761 if(res == null) { 2765 if(res == null) {
2762 return null; 2766 return null;
2763 } 2767 }
2764 millis = res.getTimeInMillis(); 2768 millis = res.getTimeInMillis();
2765 break; 2769 break;
2766 case Types.TIMESTAMP: 2770 case Types.TIMESTAMP:
2767 res = (Calendar) currentBlock.getValueAsObject(columnIndex - 1); 2771 res = (Calendar) currentBlock.getValueAsObject(columnIndex - 1);
2768 if(res == null) { 2772 if(res == null) {
2769 return null; 2773 return null;
2770 } 2774 }
2777 return null; 2781 return null;
2778 } 2782 }
2779 nanos = currentBlock.getLastNanos(); 2783 nanos = currentBlock.getLastNanos();
2780 millis = res.getTimeInMillis(); 2784 millis = res.getTimeInMillis();
2781 break; 2785 break;
2782 case Types.CHAR: 2786 case Types.CHAR:
2783 case Types.VARCHAR: 2787 case Types.VARCHAR:
2784 case Types.LONGVARCHAR: 2788 case Types.LONGVARCHAR:
2785 case Types.CLOB: 2789 case Types.CLOB:
2786 case Types.BLOB: 2790 case Types.BLOB:
2787 case Types.LONGVARBINARY: 2791 case Types.LONGVARBINARY:
2788 res = currentBlock.getDateValueFromString(this, columnIndex - 1, Types.TIMESTAMP); 2792 res = currentBlock.getDateValueFromString(this, columnIndex - 1, Types.TIMESTAMP);
2789 if(res == null) { 2793 if(res == null) {
2790 return null; 2794 return null;
2791 } 2795 }
2792 millis = res.getTimeInMillis() - res.getTimeZone().getRawOffset() + cal.getTimeZone().getRawOffset(); 2796 millis = res.getTimeInMillis() - res.getTimeZone().getRawOffset() + cal.getTimeZone().getRawOffset();
2793 break; 2797 break;
2794 default: 2798 default:
2795 this.addWarning("unsupported data type", "01M03"); 2799 this.addWarning("unsupported data type", "01M03");
2796 cal.clear(); 2800 cal.clear();
2797 millis = 0; 2801 millis = 0;
2798 } 2802 }
2799 Timestamp result = new Timestamp(millis); 2803 Timestamp result = new Timestamp(millis);
2800 result.setNanos(nanos); 2804 result.setNanos(nanos);
2801 return result; 2805 return result;
2802 } catch (ClassCastException ex) { 2806 } catch (ClassCastException ex) {
2803 throw new SQLException(ex.getMessage()); 2807 throw new SQLException(ex.getMessage());
2804 } catch (ProtocolException e) { 2808 } catch (ProtocolException e) {
2805 throw new SQLException(e); 2809 throw new SQLException(e);
2806 } catch (IndexOutOfBoundsException e) { 2810 } catch (IndexOutOfBoundsException e) {
2807 throw newSQLInvalidColumnIndexException(columnIndex); 2811 throw newSQLInvalidColumnIndexException(columnIndex);
2808 } 2812 }
2809 } 2813 }
2810 2814
2811 /** 2815 /**
2812 * Retrieves the value of the designated column in the current row of this ResultSet object as a java.sql.Timestamp 2816 * Retrieves the value of the designated column in the current row of this ResultSet object as a java.sql.Timestamp
2813 * object in the Java programming language. 2817 * object in the Java programming language.
2814 * 2818 *
2815 * @param columnName the SQL name of the column 2819 * @param columnLabel the SQL name of the column
2816 * @return the column value; if the value is SQL NULL, the value returned is null 2820 * @return the column value; if the value is SQL NULL, the value returned is null
2817 * @throws SQLException if a database access error occurs 2821 * @throws SQLException if a database access error occurs
2818 */ 2822 */
2819 @Override 2823 @Override
2820 public Timestamp getTimestamp(String columnName) throws SQLException { 2824 public Timestamp getTimestamp(String columnLabel) throws SQLException {
2821 return getTimestamp(findColumn(columnName), Calendar.getInstance()); 2825 return getTimestamp(findColumn(columnLabel), null);
2822 } 2826 }
2823 2827
2824 /** 2828 /**
2825 * Retrieves the value of the designated column in the current row of this 2829 * Retrieves the value of the designated column in the current row of this
2826 * ResultSet object as a java.sql.Timestamp object in the Java programming 2830 * ResultSet object as a java.sql.Timestamp object in the Java programming
2827 * language. This method uses the given calendar to construct an appropriate 2831 * language. This method uses the given calendar to construct an appropriate
2828 * millisecond value for the timestamp if the underlying database does not 2832 * millisecond value for the timestamp if the underlying database does not
2829 * store timezone information. 2833 * store timezone information.
2830 * 2834 *
2831 * @param columnName the SQL name of the column 2835 * @param columnLabel the SQL name of the column
2832 * @param cal the java.util.Calendar object to use in constructing the timestamp 2836 * @param cal the java.util.Calendar object to use in constructing the timestamp
2833 * @return the column value as a java.sql.Timestamp object; if the value is 2837 * @return the column value as a java.sql.Timestamp object; if the value is
2834 * SQL NULL, the value returned is null in the Java programming language 2838 * SQL NULL, the value returned is null in the Java programming language
2835 * @throws SQLException if a database access error occurs 2839 * @throws SQLException if a database access error occurs
2836 */ 2840 */
2837 @Override 2841 @Override
2838 public Timestamp getTimestamp(String columnName, Calendar cal) throws SQLException { 2842 public Timestamp getTimestamp(String columnLabel, Calendar cal) throws SQLException {
2839 return getTimestamp(findColumn(columnName), cal); 2843 return getTimestamp(findColumn(columnLabel), cal);
2840 } 2844 }
2841 2845
2842 /** 2846 /**
2843 * Retrieves the type of this ResultSet object. The type is determined by 2847 * Retrieves the type of this ResultSet object. The type is determined by
2844 * the Statement object that created the result set. 2848 * the Statement object that created the result set.
2890 2894
2891 /** 2895 /**
2892 * Retrieves the value of the designated column in the current row of this ResultSet object as a java.net.URL object 2896 * Retrieves the value of the designated column in the current row of this ResultSet object as a java.net.URL object
2893 * in the Java programming language. 2897 * in the Java programming language.
2894 * 2898 *
2895 * @param columnName the SQL name of the column 2899 * @param columnLabel the SQL name of the column
2896 * @return the column value as a java.net.URL object; if the value is SQL NULL, the value returned is null in the 2900 * @return the column value as a java.net.URL object; if the value is SQL NULL, the value returned is null in the
2897 * Java programming language 2901 * Java programming language
2898 * @throws SQLException if a database access error occurs, or if a URL is malformed 2902 * @throws SQLException if a database access error occurs, or if a URL is malformed
2899 */ 2903 */
2900 @Override 2904 @Override
2901 public URL getURL(String columnName) throws SQLException { 2905 public URL getURL(String columnLabel) throws SQLException {
2902 return getURL(findColumn(columnName)); 2906 return getURL(findColumn(columnLabel));
2903 } 2907 }
2904 2908
2905 /** 2909 /**
2906 * Retrieves the first warning reported by calls on this ResultSet object. 2910 * Retrieves the first warning reported by calls on this ResultSet object.
2907 * If there is more than one warning, subsequent warnings will be chained to 2911 * If there is more than one warning, subsequent warnings will be chained to
3085 * Retrieves whether the current row has been updated. 3089 * Retrieves whether the current row has been updated.
3086 * The value returned depends on whether or not the result set can detect updates. 3090 * The value returned depends on whether or not the result set can detect updates.
3087 * 3091 *
3088 * Note: Support for the rowUpdated method is optional with a result set concurrency of CONCUR_READ_ONLY 3092 * Note: Support for the rowUpdated method is optional with a result set concurrency of CONCUR_READ_ONLY
3089 * 3093 *
3090 * Returns: true if the current row is detected to have been visibly updated by the owner or another; false otherwise 3094 * Returns: true if the current row is detected to have been visibly updated by the owner or another;false otherwise
3091 * 3095 *
3092 * Throws: 3096 * Throws:
3093 * SQLException - if a database access error occurs or this method is called on a closed result set 3097 * SQLException - if a database access error occurs or this method is called on a closed result set
3094 * SQLFeatureNotSupportedException - if the JDBC driver does not support this method 3098 * SQLFeatureNotSupportedException - if the JDBC driver does not support this method
3095 * Since: 1.2 3099 * Since: 1.2
3098 @Override 3102 @Override
3099 public boolean rowUpdated() throws SQLException { 3103 public boolean rowUpdated() throws SQLException {
3100 return false; 3104 return false;
3101 } 3105 }
3102 3106
3103 /** 3107 /**
3104 * Adds a warning to the pile of warnings this ResultSet object has. If 3108 * Adds a warning to the pile of warnings this ResultSet object has. If
3105 * there were no warnings (or clearWarnings was called) this warning will 3109 * there were no warnings (or clearWarnings was called) this warning will
3106 * be the first, otherwise this warning will get appended to the current 3110 * be the first, otherwise this warning will get appended to the current
3107 * warning. 3111 * warning.
3108 * 3112 *
3109 * @param reason the warning message 3113 * @param reason the warning message
3110 */ 3114 */
3111 public void addWarning(String reason, String sqlstate) { 3115 public void addWarning(String reason, String sqlstate) {
3112 if (warnings == null) { 3116 if (warnings == null) {
3113 warnings = new SQLWarning(reason, sqlstate); 3117 warnings = new SQLWarning(reason, sqlstate);
3114 } else { 3118 } else {
3115 warnings.setNextWarning(new SQLWarning(reason, sqlstate)); 3119 warnings.setNextWarning(new SQLWarning(reason, sqlstate));
3116 } 3120 }
3117 } 3121 }
3118 3122
3119 /* the next methods are all related to updateable result sets, which we currently do not support */ 3123 /* the next methods are all related to updateable result sets, which we currently do not support */
3120 @Override 3124 @Override
3121 public void cancelRowUpdates() throws SQLException { 3125 public void cancelRowUpdates() throws SQLException {
3122 throw newSQLFeatureNotSupportedException("cancelRowUpdates"); 3126 throw newSQLFeatureNotSupportedException("cancelRowUpdates");
3151 public void updateArray(int columnIndex, Array x) throws SQLException { 3155 public void updateArray(int columnIndex, Array x) throws SQLException {
3152 throw newSQLFeatureNotSupportedException("updateArray"); 3156 throw newSQLFeatureNotSupportedException("updateArray");
3153 } 3157 }
3154 3158
3155 @Override 3159 @Override
3156 public void updateArray(String columnName, Array x) throws SQLException { 3160 public void updateArray(String columnLabel, Array x) throws SQLException {
3157 throw newSQLFeatureNotSupportedException("updateArray"); 3161 throw newSQLFeatureNotSupportedException("updateArray");
3158 } 3162 }
3159 3163
3160 @Override 3164 @Override
3161 public void updateAsciiStream(int columnIndex, InputStream xh) throws SQLException { 3165 public void updateAsciiStream(int columnIndex, InputStream xh) throws SQLException {
3171 public void updateAsciiStream(int columnIndex, InputStream x, long length) throws SQLException { 3175 public void updateAsciiStream(int columnIndex, InputStream x, long length) throws SQLException {
3172 throw newSQLFeatureNotSupportedException("updateAsciiStream"); 3176 throw newSQLFeatureNotSupportedException("updateAsciiStream");
3173 } 3177 }
3174 3178
3175 @Override 3179 @Override
3176 public void updateAsciiStream(String columnName, InputStream x) throws SQLException { 3180 public void updateAsciiStream(String columnLabel, InputStream x) throws SQLException {
3177 throw newSQLFeatureNotSupportedException("updateAsciiStream"); 3181 throw newSQLFeatureNotSupportedException("updateAsciiStream");
3178 } 3182 }
3179 3183
3180 @Override 3184 @Override
3181 public void updateAsciiStream(String columnName, InputStream x, int length) throws SQLException { 3185 public void updateAsciiStream(String columnLabel, InputStream x, int length) throws SQLException {
3182 throw newSQLFeatureNotSupportedException("updateAsciiStream"); 3186 throw newSQLFeatureNotSupportedException("updateAsciiStream");
3183 } 3187 }
3184 3188
3185 @Override 3189 @Override
3186 public void updateAsciiStream(String columnName, InputStream x, long length) throws SQLException { 3190 public void updateAsciiStream(String columnLabel, InputStream x, long length) throws SQLException {
3187 throw newSQLFeatureNotSupportedException("updateAsciiStream"); 3191 throw newSQLFeatureNotSupportedException("updateAsciiStream");
3188 } 3192 }
3189 3193
3190 @Override 3194 @Override
3191 public void updateBigDecimal(int columnIndex, BigDecimal x) throws SQLException { 3195 public void updateBigDecimal(int columnIndex, BigDecimal x) throws SQLException {
3192 throw newSQLFeatureNotSupportedException("updateBigDecimal"); 3196 throw newSQLFeatureNotSupportedException("updateBigDecimal");
3193 } 3197 }
3194 3198
3195 @Override 3199 @Override
3196 public void updateBigDecimal(String columnName, BigDecimal x) throws SQLException { 3200 public void updateBigDecimal(String columnLabel, BigDecimal x) throws SQLException {
3197 throw newSQLFeatureNotSupportedException("updateBigDecimal"); 3201 throw newSQLFeatureNotSupportedException("updateBigDecimal");
3198 } 3202 }
3199 3203
3200 @Override 3204 @Override
3201 public void updateBinaryStream(int columnIndex, InputStream x) throws SQLException { 3205 public void updateBinaryStream(int columnIndex, InputStream x) throws SQLException {
3211 public void updateBinaryStream(int columnIndex, InputStream x, long length) throws SQLException { 3215 public void updateBinaryStream(int columnIndex, InputStream x, long length) throws SQLException {
3212 throw newSQLFeatureNotSupportedException("updateBinaryStream"); 3216 throw newSQLFeatureNotSupportedException("updateBinaryStream");
3213 } 3217 }
3214 3218
3215 @Override 3219 @Override
3216 public void updateBinaryStream(String columnName, InputStream x) throws SQLException { 3220 public void updateBinaryStream(String columnLabel, InputStream x) throws SQLException {
3217 throw newSQLFeatureNotSupportedException("updateBinaryStream"); 3221 throw newSQLFeatureNotSupportedException("updateBinaryStream");
3218 } 3222 }
3219 3223
3220 @Override 3224 @Override
3221 public void updateBinaryStream(String columnName, InputStream x, int length) throws SQLException { 3225 public void updateBinaryStream(String columnLabel, InputStream x, int length) throws SQLException {
3222 throw newSQLFeatureNotSupportedException("updateBinaryStream"); 3226 throw newSQLFeatureNotSupportedException("updateBinaryStream");
3223 } 3227 }
3224 3228
3225 @Override 3229 @Override
3226 public void updateBinaryStream(String columnName, InputStream x, long length) throws SQLException { 3230 public void updateBinaryStream(String columnLabel, InputStream x, long length) throws SQLException {
3227 throw newSQLFeatureNotSupportedException("updateBinaryStream"); 3231 throw newSQLFeatureNotSupportedException("updateBinaryStream");
3228 } 3232 }
3229 3233
3230 @Override 3234 @Override
3231 public void updateBlob(int columnIndex, Blob x) throws SQLException { 3235 public void updateBlob(int columnIndex, Blob x) throws SQLException {
3241 public void updateBlob(int columnIndex, InputStream s, long length) throws SQLException { 3245 public void updateBlob(int columnIndex, InputStream s, long length) throws SQLException {
3242 throw newSQLFeatureNotSupportedException("updateBlob"); 3246 throw newSQLFeatureNotSupportedException("updateBlob");
3243 } 3247 }
3244 3248
3245 @Override 3249 @Override
3246 public void updateBlob(String columnName, Blob x) throws SQLException { 3250 public void updateBlob(String columnLabel, Blob x) throws SQLException {
3247 throw newSQLFeatureNotSupportedException("updateBlob"); 3251 throw newSQLFeatureNotSupportedException("updateBlob");
3248 } 3252 }
3249 3253
3250 @Override 3254 @Override
3251 public void updateBlob(String columnName, InputStream s) throws SQLException { 3255 public void updateBlob(String columnLabel, InputStream s) throws SQLException {
3252 throw newSQLFeatureNotSupportedException("updateBlob"); 3256 throw newSQLFeatureNotSupportedException("updateBlob");
3253 } 3257 }
3254 3258
3255 @Override 3259 @Override
3256 public void updateBlob(String columnName, InputStream s, long length) throws SQLException { 3260 public void updateBlob(String columnLabel, InputStream s, long length) throws SQLException {
3257 throw newSQLFeatureNotSupportedException("updateBlob"); 3261 throw newSQLFeatureNotSupportedException("updateBlob");
3258 } 3262 }
3259 3263
3260 @Override 3264 @Override
3261 public void updateBoolean(int columnIndex, boolean x) throws SQLException { 3265 public void updateBoolean(int columnIndex, boolean x) throws SQLException {
3262 throw newSQLFeatureNotSupportedException("updateBoolean"); 3266 throw newSQLFeatureNotSupportedException("updateBoolean");
3263 } 3267 }
3264 3268
3265 @Override 3269 @Override
3266 public void updateBoolean(String columnName, boolean x) throws SQLException { 3270 public void updateBoolean(String columnLabel, boolean x) throws SQLException {
3267 throw newSQLFeatureNotSupportedException("updateBoolean"); 3271 throw newSQLFeatureNotSupportedException("updateBoolean");
3268 } 3272 }
3269 3273
3270 @Override 3274 @Override
3271 public void updateByte(int columnIndex, byte x) throws SQLException { 3275 public void updateByte(int columnIndex, byte x) throws SQLException {
3272 throw newSQLFeatureNotSupportedException("updateByte"); 3276 throw newSQLFeatureNotSupportedException("updateByte");
3273 } 3277 }
3274 3278
3275 @Override 3279 @Override
3276 public void updateByte(String columnName, byte x) throws SQLException { 3280 public void updateByte(String columnLabel, byte x) throws SQLException {
3277 throw newSQLFeatureNotSupportedException("updateByte"); 3281 throw newSQLFeatureNotSupportedException("updateByte");
3278 } 3282 }
3279 3283
3280 @Override 3284 @Override
3281 public void updateBytes(int columnIndex, byte[] x) throws SQLException { 3285 public void updateBytes(int columnIndex, byte[] x) throws SQLException {
3282 throw newSQLFeatureNotSupportedException("updateBytes"); 3286 throw newSQLFeatureNotSupportedException("updateBytes");
3283 } 3287 }
3284 3288
3285 @Override 3289 @Override
3286 public void updateBytes(String columnName, byte[] x) throws SQLException { 3290 public void updateBytes(String columnLabel, byte[] x) throws SQLException {
3287 throw newSQLFeatureNotSupportedException("updateBytes"); 3291 throw newSQLFeatureNotSupportedException("updateBytes");
3288 } 3292 }
3289 3293
3290 @Override 3294 @Override
3291 public void updateCharacterStream(int columnIndex, Reader x) throws SQLException { 3295 public void updateCharacterStream(int columnIndex, Reader x) throws SQLException {
3301 public void updateCharacterStream(int columnIndex, Reader x, long length) throws SQLException { 3305 public void updateCharacterStream(int columnIndex, Reader x, long length) throws SQLException {
3302 throw newSQLFeatureNotSupportedException("updateCharacterStream"); 3306 throw newSQLFeatureNotSupportedException("updateCharacterStream");
3303 } 3307 }
3304 3308
3305 @Override 3309 @Override
3306 public void updateCharacterStream(String columnName, Reader reader) throws SQLException { 3310 public void updateCharacterStream(String columnLabel, Reader reader) throws SQLException {
3307 throw newSQLFeatureNotSupportedException("updateCharacterStream"); 3311 throw newSQLFeatureNotSupportedException("updateCharacterStream");
3308 } 3312 }
3309 3313
3310 @Override 3314 @Override
3311 public void updateCharacterStream(String columnName, Reader reader, int length) throws SQLException { 3315 public void updateCharacterStream(String columnLabel, Reader reader, int length) throws SQLException {
3312 throw newSQLFeatureNotSupportedException("updateCharacterStream"); 3316 throw newSQLFeatureNotSupportedException("updateCharacterStream");
3313 } 3317 }
3314 3318
3315 @Override 3319 @Override
3316 public void updateCharacterStream(String columnName, Reader reader, long length) throws SQLException { 3320 public void updateCharacterStream(String columnLabel, Reader reader, long length) throws SQLException {
3317 throw newSQLFeatureNotSupportedException("updateCharacterStream"); 3321 throw newSQLFeatureNotSupportedException("updateCharacterStream");
3318 } 3322 }
3319 3323
3320 @Override 3324 @Override
3321 public void updateNCharacterStream(int columnIndex, Reader x) throws SQLException { 3325 public void updateNCharacterStream(int columnIndex, Reader x) throws SQLException {
3326 public void updateNCharacterStream(int columnIndex, Reader x, long length) throws SQLException { 3330 public void updateNCharacterStream(int columnIndex, Reader x, long length) throws SQLException {
3327 throw newSQLFeatureNotSupportedException("updateNCharacterStream"); 3331 throw newSQLFeatureNotSupportedException("updateNCharacterStream");
3328 } 3332 }
3329 3333
3330 @Override 3334 @Override
3331 public void updateNCharacterStream(String columnName, Reader reader) throws SQLException { 3335 public void updateNCharacterStream(String columnLabel, Reader reader) throws SQLException {
3332 throw newSQLFeatureNotSupportedException("updateNCharacterStream"); 3336 throw newSQLFeatureNotSupportedException("updateNCharacterStream");
3333 } 3337 }
3334 3338
3335 @Override 3339 @Override
3336 public void updateNCharacterStream(String columnName, Reader reader, long length) throws SQLException { 3340 public void updateNCharacterStream(String columnLabel, Reader reader, long length) throws SQLException {
3337 throw newSQLFeatureNotSupportedException("updateNCharacterStream"); 3341 throw newSQLFeatureNotSupportedException("updateNCharacterStream");
3338 } 3342 }
3339 3343
3340 @Override 3344 @Override
3341 public void updateClob(int columnIndex, Clob x) throws SQLException { 3345 public void updateClob(int columnIndex, Clob x) throws SQLException {
3351 public void updateClob(int columnIndex, Reader r, long length) throws SQLException { 3355 public void updateClob(int columnIndex, Reader r, long length) throws SQLException {
3352 throw newSQLFeatureNotSupportedException("updateClob"); 3356 throw newSQLFeatureNotSupportedException("updateClob");
3353 } 3357 }
3354 3358
3355 @Override 3359 @Override
3356 public void updateClob(String columnName, Clob x) throws SQLException { 3360 public void updateClob(String columnLabel, Clob x) throws SQLException {
3357 throw newSQLFeatureNotSupportedException("updateClob"); 3361 throw newSQLFeatureNotSupportedException("updateClob");
3358 } 3362 }
3359 3363
3360 @Override 3364 @Override
3361 public void updateClob(String columnName, Reader r) throws SQLException { 3365 public void updateClob(String columnLabel, Reader r) throws SQLException {
3362 throw newSQLFeatureNotSupportedException("updateClob"); 3366 throw newSQLFeatureNotSupportedException("updateClob");
3363 } 3367 }
3364 3368
3365 @Override 3369 @Override
3366 public void updateClob(String columnName, Reader r, long length) throws SQLException { 3370 public void updateClob(String columnLabel, Reader r, long length) throws SQLException {
3367 throw newSQLFeatureNotSupportedException("updateClob"); 3371 throw newSQLFeatureNotSupportedException("updateClob");
3368 } 3372 }
3369 3373
3370 @Override 3374 @Override
3371 public void updateNClob(int columnIndex, NClob x) throws SQLException { 3375 public void updateNClob(int columnIndex, NClob x) throws SQLException {
3381 public void updateNClob(int columnIndex, Reader r, long length) throws SQLException { 3385 public void updateNClob(int columnIndex, Reader r, long length) throws SQLException {
3382 throw newSQLFeatureNotSupportedException("updateNClob"); 3386 throw newSQLFeatureNotSupportedException("updateNClob");
3383 } 3387 }
3384 3388
3385 @Override 3389 @Override
3386 public void updateNClob(String columnName, NClob x) throws SQLException { 3390 public void updateNClob(String columnLabel, NClob x) throws SQLException {
3387 throw newSQLFeatureNotSupportedException("updateNClob"); 3391 throw newSQLFeatureNotSupportedException("updateNClob");
3388 } 3392 }
3389 3393
3390 @Override 3394 @Override
3391 public void updateNClob(String columnName, Reader r) throws SQLException { 3395 public void updateNClob(String columnLabel, Reader r) throws SQLException {
3392 throw newSQLFeatureNotSupportedException("updateNClob"); 3396 throw newSQLFeatureNotSupportedException("updateNClob");
3393 } 3397 }
3394 3398
3395 @Override 3399 @Override
3396 public void updateNClob(String columnName, Reader r, long length) throws SQLException { 3400 public void updateNClob(String columnLabel, Reader r, long length) throws SQLException {
3397 throw newSQLFeatureNotSupportedException("updateNClob"); 3401 throw newSQLFeatureNotSupportedException("updateNClob");
3398 } 3402 }
3399 3403
3400 @Override 3404 @Override
3401 public void updateDate(int columnIndex, java.sql.Date x) throws SQLException { 3405 public void updateDate(int columnIndex, java.sql.Date x) throws SQLException {
3402 throw newSQLFeatureNotSupportedException("updateDate"); 3406 throw newSQLFeatureNotSupportedException("updateDate");
3403 } 3407 }
3404 3408
3405 @Override 3409 @Override
3406 public void updateDate(String columnName, java.sql.Date x) throws SQLException { 3410 public void updateDate(String columnLabel, java.sql.Date x) throws SQLException {
3407 throw newSQLFeatureNotSupportedException("updateDate"); 3411 throw newSQLFeatureNotSupportedException("updateDate");
3408 } 3412 }
3409 3413
3410 @Override 3414 @Override
3411 public void updateDouble(int columnIndex, double x) throws SQLException { 3415 public void updateDouble(int columnIndex, double x) throws SQLException {
3412 throw newSQLFeatureNotSupportedException("updateDouble"); 3416 throw newSQLFeatureNotSupportedException("updateDouble");
3413 } 3417 }
3414 3418
3415 @Override 3419 @Override
3416 public void updateDouble(String columnName, double x) throws SQLException { 3420 public void updateDouble(String columnLabel, double x) throws SQLException {
3417 throw newSQLFeatureNotSupportedException("updateDouble"); 3421 throw newSQLFeatureNotSupportedException("updateDouble");
3418 } 3422 }
3419 3423
3420 @Override 3424 @Override
3421 public void updateFloat(int columnIndex, float x) throws SQLException { 3425 public void updateFloat(int columnIndex, float x) throws SQLException {
3422 throw newSQLFeatureNotSupportedException("updateFloat"); 3426 throw newSQLFeatureNotSupportedException("updateFloat");
3423 } 3427 }
3424 3428
3425 @Override 3429 @Override
3426 public void updateFloat(String columnName, float x) throws SQLException { 3430 public void updateFloat(String columnLabel, float x) throws SQLException {
3427 throw newSQLFeatureNotSupportedException("updateFloat"); 3431 throw newSQLFeatureNotSupportedException("updateFloat");
3428 } 3432 }
3429 3433
3430 @Override 3434 @Override
3431 public void updateInt(int columnIndex, int x) throws SQLException { 3435 public void updateInt(int columnIndex, int x) throws SQLException {
3432 throw newSQLFeatureNotSupportedException("updateInt"); 3436 throw newSQLFeatureNotSupportedException("updateInt");
3433 } 3437 }
3434 3438
3435 @Override 3439 @Override
3436 public void updateInt(String columnName, int x) throws SQLException { 3440 public void updateInt(String columnLabel, int x) throws SQLException {
3437 throw newSQLFeatureNotSupportedException("updateInt"); 3441 throw newSQLFeatureNotSupportedException("updateInt");
3438 } 3442 }
3439 3443
3440 @Override 3444 @Override
3441 public void updateLong(int columnIndex, long x) throws SQLException { 3445 public void updateLong(int columnIndex, long x) throws SQLException {
3442 throw newSQLFeatureNotSupportedException("updateLong"); 3446 throw newSQLFeatureNotSupportedException("updateLong");
3443 } 3447 }
3444 3448
3445 @Override 3449 @Override
3446 public void updateLong(String columnName, long x) throws SQLException { 3450 public void updateLong(String columnLabel, long x) throws SQLException {
3447 throw newSQLFeatureNotSupportedException("updateLong"); 3451 throw newSQLFeatureNotSupportedException("updateLong");
3448 } 3452 }
3449 3453
3450 @Override 3454 @Override
3451 public void updateNull(int columnIndex) throws SQLException { 3455 public void updateNull(int columnIndex) throws SQLException {
3452 throw newSQLFeatureNotSupportedException("updateNull"); 3456 throw newSQLFeatureNotSupportedException("updateNull");
3453 } 3457 }
3454 3458
3455 @Override 3459 @Override
3456 public void updateNull(String columnName) throws SQLException { 3460 public void updateNull(String columnLabel) throws SQLException {
3457 throw newSQLFeatureNotSupportedException("updateNull"); 3461 throw newSQLFeatureNotSupportedException("updateNull");
3458 } 3462 }
3459 3463
3460 @Override 3464 @Override
3461 public void updateObject(int columnIndex, Object x) throws SQLException { 3465 public void updateObject(int columnIndex, Object x) throws SQLException {
3466 public void updateObject(int columnIndex, Object x, int scale) throws SQLException { 3470 public void updateObject(int columnIndex, Object x, int scale) throws SQLException {
3467 throw newSQLFeatureNotSupportedException("updateObject"); 3471 throw newSQLFeatureNotSupportedException("updateObject");
3468 } 3472 }
3469 3473
3470 @Override 3474 @Override
3471 public void updateObject(String columnName, Object x) throws SQLException { 3475 public void updateObject(String columnLabel, Object x) throws SQLException {
3472 throw newSQLFeatureNotSupportedException("updateObject"); 3476 throw newSQLFeatureNotSupportedException("updateObject");
3473 } 3477 }
3474 3478
3475 @Override 3479 @Override
3476 public void updateObject(String columnName, Object x, int scale) throws SQLException { 3480 public void updateObject(String columnLabel, Object x, int scale) throws SQLException {
3477 throw newSQLFeatureNotSupportedException("updateObject"); 3481 throw newSQLFeatureNotSupportedException("updateObject");
3478 } 3482 }
3479 3483
3480 @Override 3484 @Override
3481 public void updateRef(int columnIndex, Ref x) throws SQLException { 3485 public void updateRef(int columnIndex, Ref x) throws SQLException {
3482 throw newSQLFeatureNotSupportedException("updateRef"); 3486 throw newSQLFeatureNotSupportedException("updateRef");
3483 } 3487 }
3484 3488
3485 @Override 3489 @Override
3486 public void updateRef(String columnName, Ref x) throws SQLException { 3490 public void updateRef(String columnLabel, Ref x) throws SQLException {
3487 throw newSQLFeatureNotSupportedException("updateRef"); 3491 throw newSQLFeatureNotSupportedException("updateRef");
3488 } 3492 }
3489 3493
3490 @Override 3494 @Override
3491 public void updateRow() throws SQLException { 3495 public void updateRow() throws SQLException {
3506 public void updateShort(int columnIndex, short x) throws SQLException { 3510 public void updateShort(int columnIndex, short x) throws SQLException {
3507 throw newSQLFeatureNotSupportedException("updateShort"); 3511 throw newSQLFeatureNotSupportedException("updateShort");
3508 } 3512 }
3509 3513
3510 @Override 3514 @Override
3511 public void updateShort(String columnName, short x) throws SQLException { 3515 public void updateShort(String columnLabel, short x) throws SQLException {
3512 throw newSQLFeatureNotSupportedException("updateShort"); 3516 throw newSQLFeatureNotSupportedException("updateShort");
3513 } 3517 }
3514 3518
3515 @Override 3519 @Override
3516 public void updateString(int columnIndex, String x) throws SQLException { 3520 public void updateString(int columnIndex, String x) throws SQLException {
3517 throw newSQLFeatureNotSupportedException("updateString"); 3521 throw newSQLFeatureNotSupportedException("updateString");
3518 } 3522 }
3519 3523
3520 @Override 3524 @Override
3521 public void updateString(String columnName, String x) throws SQLException { 3525 public void updateString(String columnLabel, String x) throws SQLException {
3522 throw newSQLFeatureNotSupportedException("updateString"); 3526 throw newSQLFeatureNotSupportedException("updateString");
3523 } 3527 }
3524 3528
3525 @Override 3529 @Override
3526 public void updateNString(int columnIndex, String x) throws SQLException { 3530 public void updateNString(int columnIndex, String x) throws SQLException {
3527 throw newSQLFeatureNotSupportedException("updateNString"); 3531 throw newSQLFeatureNotSupportedException("updateNString");
3528 } 3532 }
3529 3533
3530 @Override 3534 @Override
3531 public void updateNString(String columnName, String x) throws SQLException { 3535 public void updateNString(String columnLabel, String x) throws SQLException {
3532 throw newSQLFeatureNotSupportedException("updateNString"); 3536 throw newSQLFeatureNotSupportedException("updateNString");
3533 } 3537 }
3534 3538
3535 @Override 3539 @Override
3536 public void updateSQLXML(String columnName, SQLXML x) throws SQLException { 3540 public void updateSQLXML(String columnLabel, SQLXML x) throws SQLException {
3537 throw newSQLFeatureNotSupportedException("updateSQLXML"); 3541 throw newSQLFeatureNotSupportedException("updateSQLXML");
3538 } 3542 }
3539 3543
3540 @Override 3544 @Override
3541 public void updateSQLXML(int columnIndex, SQLXML x) throws SQLException { 3545 public void updateSQLXML(int columnIndex, SQLXML x) throws SQLException {
3546 public void updateTime(int columnIndex, Time x) throws SQLException { 3550 public void updateTime(int columnIndex, Time x) throws SQLException {
3547 throw newSQLFeatureNotSupportedException("updateTime"); 3551 throw newSQLFeatureNotSupportedException("updateTime");
3548 } 3552 }
3549 3553
3550 @Override 3554 @Override
3551 public void updateTime(String columnName, Time x) throws SQLException { 3555 public void updateTime(String columnLabel, Time x) throws SQLException {
3552 throw newSQLFeatureNotSupportedException("updateTime"); 3556 throw newSQLFeatureNotSupportedException("updateTime");
3553 } 3557 }
3554 3558
3555 @Override 3559 @Override
3556 public void updateTimestamp(int columnIndex, Timestamp x) throws SQLException { 3560 public void updateTimestamp(int columnIndex, Timestamp x) throws SQLException {
3557 throw newSQLFeatureNotSupportedException("updateTimestamp"); 3561 throw newSQLFeatureNotSupportedException("updateTimestamp");
3558 } 3562 }
3559 3563
3560 @Override 3564 @Override
3561 public void updateTimestamp(String columnName, Timestamp x) throws SQLException { 3565 public void updateTimestamp(String columnLabel, Timestamp x) throws SQLException {
3562 throw newSQLFeatureNotSupportedException("updateTimestamp"); 3566 throw newSQLFeatureNotSupportedException("updateTimestamp");
3563 } 3567 }
3564 3568
3565 // Chapter 14.2.3.3 Sun JDBC 3.0 Specification 3569 // Chapter 14.2.3.3 Sun JDBC 3.0 Specification
3566 /** 3570 /**
3578 3582
3579 //== end methods of interface ResultSet 3583 //== end methods of interface ResultSet
3580 3584
3581 /** 3585 /**
3582 * Small helper method that formats the "Invalid Column Index number ..." message 3586 * Small helper method that formats the "Invalid Column Index number ..." message
3583 * and creates a new SQLException object whose SQLState is set to "M1M05". 3587 * and creates a new SQLDataException object whose SQLState is set to "22010": invalid indicator parameter value.
3584 * 3588 *
3585 * @param colIdx the column index number 3589 * @param colIdx the column index number
3586 * @return a new created SQLException object with SQLState M1M05 3590 * @return a new created SQLDataException object with SQLState 22010
3587 */ 3591 */
3588 static SQLException newSQLInvalidColumnIndexException(int colIdx) { 3592 static SQLDataException newSQLInvalidColumnIndexException(int colIdx) {
3589 return new SQLException("Invalid Column Index number: " + colIdx, "M1M05"); 3593 return new SQLDataException("Invalid Column Index number: " + colIdx, "22010");
3590 } 3594 }
3591 3595
3592 /** 3596 /**
3593 * Small helper method that formats the "Method ... not implemented" message 3597 * Small helper method that formats the "Method ... not implemented" message
3594 * and creates a new SQLFeatureNotSupportedException object 3598 * and creates a new SQLFeatureNotSupportedException object whose SQLState is set to "0A000": feature not supported.
3595 * whose SQLState is set to "0A000".
3596 * 3599 *
3597 * @param name the method name 3600 * @param name the method name
3598 * @return a new created SQLFeatureNotSupportedException object with SQLState 0A000 3601 * @return a new created SQLFeatureNotSupportedException object with SQLState 0A000
3599 */ 3602 */
3600 private static SQLFeatureNotSupportedException newSQLFeatureNotSupportedException(String name) { 3603 private static SQLFeatureNotSupportedException newSQLFeatureNotSupportedException(String name) {