annotate src/main/java/org/monetdb/jdbc/MonetResultSet.java @ 943:ff075ed5ce81

Spell check.
author Sjoerd Mullender <sjoerd@acm.org>
date Thu, 09 Jan 2025 10:56:14 +0100 (3 months ago)
parents d416e9b6b3d0
children 32f246853ec4
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1 /*
833
e890195256ac Update copyright for the new year, move to MonetDB Foundation, add SPDX.
Sjoerd Mullender <sjoerd@acm.org>
parents: 832
diff changeset
2 * SPDX-License-Identifier: MPL-2.0
e890195256ac Update copyright for the new year, move to MonetDB Foundation, add SPDX.
Sjoerd Mullender <sjoerd@acm.org>
parents: 832
diff changeset
3 *
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
4 * This Source Code Form is subject to the terms of the Mozilla Public
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
5 * License, v. 2.0. If a copy of the MPL was not distributed with this
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
6 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
7 *
937
d416e9b6b3d0 Update Copyright year.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 890
diff changeset
8 * Copyright 2024, 2025 MonetDB Foundation;
833
e890195256ac Update copyright for the new year, move to MonetDB Foundation, add SPDX.
Sjoerd Mullender <sjoerd@acm.org>
parents: 832
diff changeset
9 * Copyright August 2008 - 2023 MonetDB B.V.;
e890195256ac Update copyright for the new year, move to MonetDB Foundation, add SPDX.
Sjoerd Mullender <sjoerd@acm.org>
parents: 832
diff changeset
10 * Copyright 1997 - July 2008 CWI.
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
11 */
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
12
391
f523727db392 Moved Java classes from packages starting with nl.cwi.monetdb.* to package org.monetdb.*
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 384
diff changeset
13 package org.monetdb.jdbc;
f523727db392 Moved Java classes from packages starting with nl.cwi.monetdb.* to package org.monetdb.*
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 384
diff changeset
14
f523727db392 Moved Java classes from packages starting with nl.cwi.monetdb.* to package org.monetdb.*
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 384
diff changeset
15 import org.monetdb.mcl.parser.MCLParseException;
f523727db392 Moved Java classes from packages starting with nl.cwi.monetdb.* to package org.monetdb.*
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 384
diff changeset
16 import org.monetdb.mcl.parser.TupleLineParser;
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
17 import java.io.InputStream;
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
18 import java.io.Reader;
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
19 import java.math.BigDecimal;
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
20 import java.net.URL;
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
21 import java.sql.Array;
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
22 import java.sql.Blob;
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
23 import java.sql.Clob;
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
24 import java.sql.Connection;
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
25 import java.sql.DatabaseMetaData;
773
2bd1983f1c11 Reduce code by importing java.sql.Date; and remove prefix java.sql. where no longer needed.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 769
diff changeset
26 import java.sql.Date;
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
27 import java.sql.NClob;
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
28 import java.sql.Ref;
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
29 import java.sql.ResultSet;
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
30 import java.sql.ResultSetMetaData;
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
31 import java.sql.RowId;
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
32 import java.sql.SQLData;
144
d6abd1ffffbb Use SQLNonTransientConnectionException instead of SQLException where applicable (SQLState starts with 08)
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 143
diff changeset
33 import java.sql.SQLDataException;
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
34 import java.sql.SQLException;
266
eefa7f625673 Resolve javadoc errors:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 262
diff changeset
35 import java.sql.SQLFeatureNotSupportedException;
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
36 import java.sql.SQLInput;
376
ffdc7b0e102d Updated JDBC driver to comply with JDBC 4.2 interface now we compile for Java 8. This includes:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 350
diff changeset
37 import java.sql.SQLType; // new as of Java 1.8
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
38 import java.sql.SQLWarning;
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
39 import java.sql.SQLXML;
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
40 import java.sql.Statement;
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
41 import java.sql.Time;
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
42 import java.sql.Timestamp;
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
43 import java.sql.Types;
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
44 import java.text.SimpleDateFormat;
832
7eb05cbf67dc In ResultSet.getObject(column, Class<T> type) and ResultSet.getObject(column, Map<String,Class<?>>) methods added support to return objects for classes: java.time.LocalDate, java.time.LocalDateTime.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 820
diff changeset
45 import java.time.LocalDate;
7eb05cbf67dc In ResultSet.getObject(column, Class<T> type) and ResultSet.getObject(column, Map<String,Class<?>>) methods added support to return objects for classes: java.time.LocalDate, java.time.LocalDateTime.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 820
diff changeset
46 import java.time.LocalDateTime;
7eb05cbf67dc In ResultSet.getObject(column, Class<T> type) and ResultSet.getObject(column, Map<String,Class<?>>) methods added support to return objects for classes: java.time.LocalDate, java.time.LocalDateTime.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 820
diff changeset
47 import java.time.LocalTime;
820
4c35009cd59c In ResultSet.getObject() method added support for retrieving
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 774
diff changeset
48 import java.time.OffsetDateTime;
4c35009cd59c In ResultSet.getObject() method added support for retrieving
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 774
diff changeset
49 import java.time.OffsetTime;
832
7eb05cbf67dc In ResultSet.getObject(column, Class<T> type) and ResultSet.getObject(column, Map<String,Class<?>>) methods added support to return objects for classes: java.time.LocalDate, java.time.LocalDateTime.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 820
diff changeset
50 import java.time.format.DateTimeFormatter;
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
51 import java.util.Calendar;
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
52 import java.util.Map;
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
53 import java.util.TimeZone;
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
54
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
55 /**
451
3dfcd06fd8ba Correcting typos in documentation text. Also improved the readability of the generated javadoc documents.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 425
diff changeset
56 *<pre>
3dfcd06fd8ba Correcting typos in documentation text. Also improved the readability of the generated javadoc documents.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 425
diff changeset
57 * A {@link ResultSet} suitable for the MonetDB database.
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
58 *
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
59 * A table of data representing a database result set, which is usually
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
60 * generated by executing a statement that queries the database.
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
61 *
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
62 * A ResultSet object maintains a cursor pointing to its current row of data.
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
63 * Initially the cursor is positioned before the first row. The next method
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
64 * moves the cursor to the next row, and because it returns false when there
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
65 * are no more rows in the ResultSet object, it can be used in a while loop to
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
66 * iterate through the result set.
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
67 *
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
68 * The current state of this ResultSet is that it supports positioning in the
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
69 * result set, absolute and relative. A slight performance difference between
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
70 * FORWARD_ONLY or result sets scrollable in both directions can be noticed as
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
71 * for FORWARD_ONLY result sets the memory usage will be likely lower for large
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
72 * result sets.
451
3dfcd06fd8ba Correcting typos in documentation text. Also improved the readability of the generated javadoc documents.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 425
diff changeset
73 *</pre>
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
74 *
376
ffdc7b0e102d Updated JDBC driver to comply with JDBC 4.2 interface now we compile for Java 8. This includes:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 350
diff changeset
75 * @author Fabian Groffen
ffdc7b0e102d Updated JDBC driver to comply with JDBC 4.2 interface now we compile for Java 8. This includes:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 350
diff changeset
76 * @author Martin van Dinther
416
b3c876a0d61f Improved performance of ResultSetMetaData methods getSchemaName(), getTableName(), getPrecision(), getScale(), isNullable() and isAutoIncrement().
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 415
diff changeset
77 * @version 1.0
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
78 */
164
7c9e386fe49a As of Java 1.7 implementations of JDBC interfaces Connection, Statement, PreparedStatement,
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 152
diff changeset
79 public class MonetResultSet
7c9e386fe49a As of Java 1.7 implementations of JDBC interfaces Connection, Statement, PreparedStatement,
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 152
diff changeset
80 extends MonetWrapper
7c9e386fe49a As of Java 1.7 implementations of JDBC interfaces Connection, Statement, PreparedStatement,
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 152
diff changeset
81 implements ResultSet, AutoCloseable
7c9e386fe49a As of Java 1.7 implementations of JDBC interfaces Connection, Statement, PreparedStatement,
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 152
diff changeset
82 {
292
b127164342c4 Introduce default general behavior settings DEF_... for MonetResultSets and use them
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 286
diff changeset
83 static final int DEF_RESULTSETTYPE = ResultSet.TYPE_FORWARD_ONLY;
b127164342c4 Introduce default general behavior settings DEF_... for MonetResultSets and use them
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 286
diff changeset
84 static final int DEF_FETCHDIRECTION = ResultSet.FETCH_FORWARD;
b127164342c4 Introduce default general behavior settings DEF_... for MonetResultSets and use them
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 286
diff changeset
85 static final int DEF_CONCURRENCY = ResultSet.CONCUR_READ_ONLY;
b127164342c4 Introduce default general behavior settings DEF_... for MonetResultSets and use them
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 286
diff changeset
86 static final int DEF_HOLDABILITY = ResultSet.HOLD_CURSORS_OVER_COMMIT;
b127164342c4 Introduce default general behavior settings DEF_... for MonetResultSets and use them
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 286
diff changeset
87
187
daa1a4c70879 For MonetresultSet class: added method checkNotClosed() and invocation for all methods which should test it.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 180
diff changeset
88 /** The parental Statement object */
daa1a4c70879 For MonetresultSet class: added method checkNotClosed() and invocation for all methods which should test it.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 180
diff changeset
89 private final Statement statement;
daa1a4c70879 For MonetresultSet class: added method checkNotClosed() and invocation for all methods which should test it.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 180
diff changeset
90 /** A Header to retrieve lines from. Note: it will be null in case of a MonetVirtualResultSet ! */
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
91 private final MonetConnection.ResultSetResponse header;
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
92 /** The names of the columns in this ResultSet */
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
93 private final String[] columns;
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
94 /** The MonetDB types of the columns in this ResultSet */
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
95 private final String[] types;
713
c3c424a90a42 Improve implementation of ResultSet.getMetaData().
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 709
diff changeset
96 /** The JDBC SQL types of the columns in this ResultSet.
c3c424a90a42 Improve implementation of ResultSet.getMetaData().
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 709
diff changeset
97 * The content will be derived once from the MonetDB String[] types */
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
98 private final int[] JdbcSQLTypes;
187
daa1a4c70879 For MonetresultSet class: added method checkNotClosed() and invocation for all methods which should test it.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 180
diff changeset
99
713
c3c424a90a42 Improve implementation of ResultSet.getMetaData().
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 709
diff changeset
100 /** A cache to reduce the number of ResultSetMetaData objects created by getMetaData() to maximum 1 per ResultSet */
c3c424a90a42 Improve implementation of ResultSet.getMetaData().
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 709
diff changeset
101 private ResultSetMetaData rsmd;
c3c424a90a42 Improve implementation of ResultSet.getMetaData().
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 709
diff changeset
102
187
daa1a4c70879 For MonetresultSet class: added method checkNotClosed() and invocation for all methods which should test it.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 180
diff changeset
103 // the following have protected access modifier for the MonetVirtualResultSet subclass
daa1a4c70879 For MonetresultSet class: added method checkNotClosed() and invocation for all methods which should test it.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 180
diff changeset
104 // they are accessed from MonetVirtualResultSet.absolute()
daa1a4c70879 For MonetresultSet class: added method checkNotClosed() and invocation for all methods which should test it.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 180
diff changeset
105 /** The current line of the buffer split in columns */
daa1a4c70879 For MonetresultSet class: added method checkNotClosed() and invocation for all methods which should test it.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 180
diff changeset
106 protected final TupleLineParser tlp;
296
c5efd6e661e5 Add "final" keyword to classes, method arguments and local variables where possible.`
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 292
diff changeset
107 /** The number of rows in this ResultSet */
377
8a813f5cef1b Extend StartOfHeaderParser with method getNextAsLong() and change type of tuplecount to long.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 376
diff changeset
108 protected final long tupleCount;
187
daa1a4c70879 For MonetresultSet class: added method checkNotClosed() and invocation for all methods which should test it.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 180
diff changeset
109 /** The current position of the cursor for this ResultSet object */
414
1e278695fe54 Small improvements: adding some final keywords, removing unnecesary initialisations, improve comments.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 406
diff changeset
110 protected int curRow;
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
111
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
112 /** The type of this ResultSet (forward or scrollable) */
292
b127164342c4 Introduce default general behavior settings DEF_... for MonetResultSets and use them
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 286
diff changeset
113 private int type = DEF_RESULTSETTYPE;
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
114 /** The concurrency of this ResultSet (currently only read-only) */
292
b127164342c4 Introduce default general behavior settings DEF_... for MonetResultSets and use them
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 286
diff changeset
115 private int concurrency = DEF_CONCURRENCY;
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
116 /** The warnings for this ResultSet object */
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
117 private SQLWarning warnings;
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
118 /** whether the last read field (via some getXyz() method) was NULL */
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
119 private boolean lastReadWasNull = true;
330
98ae44c5fd56 Updated oand improved MonetResultSet constructors. They do not throw SQLException or IOException.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 329
diff changeset
120 /** to store the fetchsize set. */
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
121 private int fetchSize;
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
122
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
123 /**
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
124 * Main constructor backed by the given Header.
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
125 *
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
126 * @param statement the statement which created this ResultSet
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
127 * @param header a header containing the query, resultset type, etc.
143
dcf7879d4862 Optimised ResulSet methods getDate(column), getTime(column) and getTimestamp(column)
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 139
diff changeset
128 * @throws IllegalArgumentException if called with null or invalid value for one of the arguments
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
129 */
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
130 MonetResultSet(
296
c5efd6e661e5 Add "final" keyword to classes, method arguments and local variables where possible.`
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 292
diff changeset
131 final Statement statement,
c5efd6e661e5 Add "final" keyword to classes, method arguments and local variables where possible.`
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 292
diff changeset
132 final MonetConnection.ResultSetResponse header)
330
98ae44c5fd56 Updated oand improved MonetResultSet constructors. They do not throw SQLException or IOException.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 329
diff changeset
133 throws IllegalArgumentException
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
134 {
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
135 if (statement == null) {
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
136 throw new IllegalArgumentException("Statement may not be null!");
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
137 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
138 if (header == null) {
330
98ae44c5fd56 Updated oand improved MonetResultSet constructors. They do not throw SQLException or IOException.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 329
diff changeset
139 throw new IllegalArgumentException("Header may not be null!");
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
140 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
141 this.statement = statement;
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
142 this.header = header;
330
98ae44c5fd56 Updated oand improved MonetResultSet constructors. They do not throw SQLException or IOException.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 329
diff changeset
143 type = header.getRSType();
98ae44c5fd56 Updated oand improved MonetResultSet constructors. They do not throw SQLException or IOException.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 329
diff changeset
144 concurrency = header.getRSConcur();
98ae44c5fd56 Updated oand improved MonetResultSet constructors. They do not throw SQLException or IOException.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 329
diff changeset
145 /* the fetchSize used for this result set is the header's cacheSize */
98ae44c5fd56 Updated oand improved MonetResultSet constructors. They do not throw SQLException or IOException.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 329
diff changeset
146 fetchSize = header.getCacheSize();
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
147 columns = header.getNames();
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
148 types = header.getTypes();
330
98ae44c5fd56 Updated oand improved MonetResultSet constructors. They do not throw SQLException or IOException.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 329
diff changeset
149 if (columns == null || types == null) {
98ae44c5fd56 Updated oand improved MonetResultSet constructors. They do not throw SQLException or IOException.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 329
diff changeset
150 throw new IllegalArgumentException("Missing Header metadata");
98ae44c5fd56 Updated oand improved MonetResultSet constructors. They do not throw SQLException or IOException.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 329
diff changeset
151 }
98ae44c5fd56 Updated oand improved MonetResultSet constructors. They do not throw SQLException or IOException.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 329
diff changeset
152 if (columns.length != types.length) {
98ae44c5fd56 Updated oand improved MonetResultSet constructors. They do not throw SQLException or IOException.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 329
diff changeset
153 throw new IllegalArgumentException("Inconsistent Header metadata");
98ae44c5fd56 Updated oand improved MonetResultSet constructors. They do not throw SQLException or IOException.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 329
diff changeset
154 }
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
155 tupleCount = header.tuplecount;
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
156
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
157 // create result array
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
158 tlp = new TupleLineParser(columns.length);
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
159
330
98ae44c5fd56 Updated oand improved MonetResultSet constructors. They do not throw SQLException or IOException.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 329
diff changeset
160 // for efficiency derive the JDBC SQL type codes from the types[] names once
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
161 JdbcSQLTypes = new int[types.length];
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
162 populateJdbcSQLtypesArray();
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
163 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
164
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
165 /**
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
166 * Constructor used by MonetVirtualResultSet.
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
167 * DO NOT USE THIS CONSTRUCTOR IF YOU ARE NOT EXTENDING THIS OBJECT!
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
168 *
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
169 * @param statement the statement which created this ResultSet
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
170 * @param columns the column names
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
171 * @param types the column types
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
172 * @param results the number of rows in the ResultSet
143
dcf7879d4862 Optimised ResulSet methods getDate(column), getTime(column) and getTimestamp(column)
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 139
diff changeset
173 * @throws IllegalArgumentException if called with null or invalid value for one of the arguments
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
174 */
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
175 MonetResultSet(
296
c5efd6e661e5 Add "final" keyword to classes, method arguments and local variables where possible.`
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 292
diff changeset
176 final Statement statement,
c5efd6e661e5 Add "final" keyword to classes, method arguments and local variables where possible.`
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 292
diff changeset
177 final String[] columns,
c5efd6e661e5 Add "final" keyword to classes, method arguments and local variables where possible.`
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 292
diff changeset
178 final String[] types,
c5efd6e661e5 Add "final" keyword to classes, method arguments and local variables where possible.`
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 292
diff changeset
179 final int results)
c5efd6e661e5 Add "final" keyword to classes, method arguments and local variables where possible.`
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 292
diff changeset
180 throws IllegalArgumentException
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
181 {
296
c5efd6e661e5 Add "final" keyword to classes, method arguments and local variables where possible.`
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 292
diff changeset
182 if (statement == null || columns == null || types == null) {
c5efd6e661e5 Add "final" keyword to classes, method arguments and local variables where possible.`
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 292
diff changeset
183 throw new IllegalArgumentException("One of the given arguments is null");
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
184 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
185 if (columns.length != types.length) {
296
c5efd6e661e5 Add "final" keyword to classes, method arguments and local variables where possible.`
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 292
diff changeset
186 throw new IllegalArgumentException("Given arrays are not the same size");
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
187 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
188 if (results < 0) {
296
c5efd6e661e5 Add "final" keyword to classes, method arguments and local variables where possible.`
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 292
diff changeset
189 throw new IllegalArgumentException("Negative rowcount not allowed");
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
190 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
191
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
192 this.statement = statement;
330
98ae44c5fd56 Updated oand improved MonetResultSet constructors. They do not throw SQLException or IOException.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 329
diff changeset
193 header = null;
98ae44c5fd56 Updated oand improved MonetResultSet constructors. They do not throw SQLException or IOException.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 329
diff changeset
194 fetchSize = 0;
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
195
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
196 this.columns = columns;
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
197 this.types = types;
330
98ae44c5fd56 Updated oand improved MonetResultSet constructors. They do not throw SQLException or IOException.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 329
diff changeset
198 tupleCount = results;
98ae44c5fd56 Updated oand improved MonetResultSet constructors. They do not throw SQLException or IOException.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 329
diff changeset
199
98ae44c5fd56 Updated oand improved MonetResultSet constructors. They do not throw SQLException or IOException.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 329
diff changeset
200 tlp = new TupleLineParser(columns.length);
98ae44c5fd56 Updated oand improved MonetResultSet constructors. They do not throw SQLException or IOException.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 329
diff changeset
201
98ae44c5fd56 Updated oand improved MonetResultSet constructors. They do not throw SQLException or IOException.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 329
diff changeset
202 // for efficiency derive the JDBC SQL type codes from the types[] names once
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
203 JdbcSQLTypes = new int[types.length];
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
204 populateJdbcSQLtypesArray();
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
205 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
206
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
207 /**
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
208 * Internal utility method to fill the JdbcSQLTypes array with derivable values.
180
fdf4c888d5b7 Small code and layout improvements
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 175
diff changeset
209 * By doing it once (in the constructor) we can avoid doing this in many getXyz()
fdf4c888d5b7 Small code and layout improvements
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 175
diff changeset
210 * methods again and again thereby improving getXyz() method performance.
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
211 */
296
c5efd6e661e5 Add "final" keyword to classes, method arguments and local variables where possible.`
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 292
diff changeset
212 private final void populateJdbcSQLtypesArray() {
175
8700d9ef2ace Added possibility via a connection property to let the JDBC driver
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 164
diff changeset
213 MonetConnection connection = null;
8700d9ef2ace Added possibility via a connection property to let the JDBC driver
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 164
diff changeset
214 try {
296
c5efd6e661e5 Add "final" keyword to classes, method arguments and local variables where possible.`
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 292
diff changeset
215 connection = (MonetConnection) statement.getConnection();
175
8700d9ef2ace Added possibility via a connection property to let the JDBC driver
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 164
diff changeset
216 } catch (SQLException se) { /* ignore it */ }
8700d9ef2ace Added possibility via a connection property to let the JDBC driver
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 164
diff changeset
217
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
218 for (int i = 0; i < types.length; i++) {
223
e8139dbe3883 Rename internal method MonetDriver.getJavaType() into MonetDriver.getJdbcSQLType()
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 200
diff changeset
219 int javaSQLtype = MonetDriver.getJdbcSQLType(types[i]);
175
8700d9ef2ace Added possibility via a connection property to let the JDBC driver
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 164
diff changeset
220 if (javaSQLtype == Types.CLOB) {
8700d9ef2ace Added possibility via a connection property to let the JDBC driver
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 164
diff changeset
221 if (connection != null && connection.mapClobAsVarChar())
180
fdf4c888d5b7 Small code and layout improvements
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 175
diff changeset
222 javaSQLtype = Types.VARCHAR;
175
8700d9ef2ace Added possibility via a connection property to let the JDBC driver
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 164
diff changeset
223 } else
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
224 if (javaSQLtype == Types.BLOB) {
175
8700d9ef2ace Added possibility via a connection property to let the JDBC driver
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 164
diff changeset
225 if (connection != null && connection.mapBlobAsVarBinary())
180
fdf4c888d5b7 Small code and layout improvements
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 175
diff changeset
226 javaSQLtype = Types.VARBINARY;
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
227 }
180
fdf4c888d5b7 Small code and layout improvements
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 175
diff changeset
228 JdbcSQLTypes[i] = javaSQLtype;
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
229 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
230 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
231
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
232
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
233 //== methods of interface ResultSet
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
234
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
235 // Chapter 14.2.2 Sun JDBC 3.0 Specification
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
236 /**
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
237 * Moves the cursor to the given row number in this ResultSet object.
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
238 *
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
239 * If the row number is positive, the cursor moves to the given row number
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
240 * with respect to the beginning of the result set. The first row is row 1,
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
241 * the second is row 2, and so on.
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
242 *
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
243 * If the given row number is negative, the cursor moves to an absolute row
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
244 * position with respect to the end of the result set. For example, calling
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
245 * the method absolute(-1) positions the cursor on the last row; calling the
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
246 * method absolute(-2) moves the cursor to the next-to-last row, and so on.
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
247 *
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
248 * An attempt to position the cursor beyond the first/last row in the result
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
249 * set leaves the cursor before the first row or after the last row.
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
250 * Note: calling absolute(1) is the same as calling first(). Calling
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
251 * absolute(-1) is the same as calling last().
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
252 *
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
253 * @param row the number of the row to which the cursor should move. A
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
254 * positive number indicates the row number counting from the
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
255 * beginning of the result set; a negative number indicates the row
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
256 * number counting from the end of the result set
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
257 * @return true if the cursor is on the result set; false otherwise
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
258 * @throws SQLException if a database access error occurs, or the result set
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
259 * type is TYPE_FORWARD_ONLY
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
260 */
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
261 @Override
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
262 public boolean absolute(int row) throws SQLException {
187
daa1a4c70879 For MonetresultSet class: added method checkNotClosed() and invocation for all methods which should test it.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 180
diff changeset
263 checkNotClosed();
137
688cd5675466 Improved robustness of ResultSet methods:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 90
diff changeset
264 if (row != curRow + 1 && type == TYPE_FORWARD_ONLY)
418
6558ab0d2547 Remove double space from msg.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 416
diff changeset
265 throw new SQLException("(Absolute) positioning not allowed on forward only result sets!", "M1M05");
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
266
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
267 // first calculate what the JDBC row is
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
268 if (row < 0) {
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
269 // calculate the negatives...
377
8a813f5cef1b Extend StartOfHeaderParser with method getNextAsLong() and change type of tuplecount to long.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 376
diff changeset
270 row = (int) tupleCount + row + 1;
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
271 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
272 // now place the row not farther than just before or after the result
137
688cd5675466 Improved robustness of ResultSet methods:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 90
diff changeset
273 if (row < 0)
688cd5675466 Improved robustness of ResultSet methods:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 90
diff changeset
274 row = 0; // before first
688cd5675466 Improved robustness of ResultSet methods:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 90
diff changeset
275 else if (row > tupleCount + 1)
377
8a813f5cef1b Extend StartOfHeaderParser with method getNextAsLong() and change type of tuplecount to long.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 376
diff changeset
276 row = (int) tupleCount + 1; // after last
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
277
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
278 // store it
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
279 curRow = row;
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
280
480
849af4b76b28 Optimise code by reducing local variables which are used only once, replacing complex string concatenation by using StringBuilder, replacing some ternairy operators.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 471
diff changeset
281 if (header == null)
849af4b76b28 Optimise code by reducing local variables which are used only once, replacing complex string concatenation by using StringBuilder, replacing some ternairy operators.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 471
diff changeset
282 return false;
849af4b76b28 Optimise code by reducing local variables which are used only once, replacing complex string concatenation by using StringBuilder, replacing some ternairy operators.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 471
diff changeset
283
849af4b76b28 Optimise code by reducing local variables which are used only once, replacing complex string concatenation by using StringBuilder, replacing some ternairy operators.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 471
diff changeset
284 final String tmpLine = header.getLine(row - 1);
137
688cd5675466 Improved robustness of ResultSet methods:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 90
diff changeset
285 if (tmpLine == null)
688cd5675466 Improved robustness of ResultSet methods:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 90
diff changeset
286 return false;
187
daa1a4c70879 For MonetresultSet class: added method checkNotClosed() and invocation for all methods which should test it.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 180
diff changeset
287
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
288 try {
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
289 tlp.parse(tmpLine);
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
290 } catch (MCLParseException e) {
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
291 throw new SQLException(e.getMessage(), "M0M10");
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
292 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
293
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
294 return true;
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
295 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
296
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
297 /**
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
298 * Moves the cursor to the end of this ResultSet object, just after the last
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
299 * row. This method has no effect if the result set contains no rows.
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
300 *
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
301 * @throws SQLException if a database access error occurs or the result set
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
302 * type is TYPE_FORWARD_ONLY
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
303 */
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
304 @Override
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
305 public void afterLast() throws SQLException {
377
8a813f5cef1b Extend StartOfHeaderParser with method getNextAsLong() and change type of tuplecount to long.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 376
diff changeset
306 absolute((int)tupleCount + 1);
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
307 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
308
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
309 /**
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
310 * Moves the cursor to the front of this ResultSet object, just before the
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
311 * first row. This method has no effect if the result set contains no rows.
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
312 *
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
313 * @throws SQLException if a database access error occurs or the result set
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
314 * type is TYPE_FORWARD_ONLY
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
315 */
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
316 @Override
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
317 public void beforeFirst() throws SQLException {
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
318 absolute(0);
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
319 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
320
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
321 /**
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
322 * Clears all warnings reported for this ResultSet object. After a call to
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
323 * this method, the method getWarnings returns null until a new warning is
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
324 * reported for this ResultSet object.
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
325 */
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
326 @Override
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
327 public void clearWarnings() {
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
328 warnings = null;
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
329 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
330
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
331 /**
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
332 * Releases this ResultSet object's database (and JDBC) resources
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
333 * immediately instead of waiting for this to happen when it is
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
334 * automatically closed.
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
335 */
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
336 @Override
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
337 public void close() {
623
1c3cdf0667d7 Do more cleanup in the close() methods such as calling clearWarnings(), clearParameters(), clearBatch() and dereferencing cached objects.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 610
diff changeset
338 clearWarnings();
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
339 if (header != null && !header.isClosed()) {
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
340 header.close();
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
341 }
713
c3c424a90a42 Improve implementation of ResultSet.getMetaData().
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 709
diff changeset
342 rsmd = null;
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
343 if (statement instanceof MonetStatement)
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
344 ((MonetStatement)statement).closeIfCompletion();
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
345 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
346
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
347 // Chapter 14.2.3 from Sun JDBC 3.0 specification
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
348 /**
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
349 * Maps the given ResultSet column name to its ResultSet column index.
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
350 * Column names supplied to getter methods are case insensitive. If a select
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
351 * list contains the same column more than once, the first instance of the
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
352 * column will be returned.
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
353 *
151
3d5ea891bb74 Update implementation to match the JDBC spec so use
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 145
diff changeset
354 * @param columnLabel the name of the column
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
355 * @return the column index of the given column name
187
daa1a4c70879 For MonetresultSet class: added method checkNotClosed() and invocation for all methods which should test it.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 180
diff changeset
356 * @throws SQLException if the ResultSet object does not contain a column labeled columnLabel,
daa1a4c70879 For MonetresultSet class: added method checkNotClosed() and invocation for all methods which should test it.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 180
diff changeset
357 * a database access error occurs or this method is called on a closed result set
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
358 */
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
359 @Override
296
c5efd6e661e5 Add "final" keyword to classes, method arguments and local variables where possible.`
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 292
diff changeset
360 public int findColumn(final String columnLabel) throws SQLException {
187
daa1a4c70879 For MonetresultSet class: added method checkNotClosed() and invocation for all methods which should test it.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 180
diff changeset
361 checkNotClosed();
151
3d5ea891bb74 Update implementation to match the JDBC spec so use
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 145
diff changeset
362 if (columnLabel != null) {
10
4ef332ad8ec0 For efficiency fetch columns.length only once in a local variable.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 9
diff changeset
363 final int array_size = columns.length;
4ef332ad8ec0 For efficiency fetch columns.length only once in a local variable.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 9
diff changeset
364 for (int i = 0; i < array_size; i++) {
151
3d5ea891bb74 Update implementation to match the JDBC spec so use
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 145
diff changeset
365 if (columnLabel.equals(columns[i]))
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
366 return i + 1;
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
367 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
368 /* if an exact match did not succeed try a case insensitive match */
10
4ef332ad8ec0 For efficiency fetch columns.length only once in a local variable.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 9
diff changeset
369 for (int i = 0; i < array_size; i++) {
151
3d5ea891bb74 Update implementation to match the JDBC spec so use
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 145
diff changeset
370 if (columnLabel.equalsIgnoreCase(columns[i]))
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
371 return i + 1;
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
372 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
373 }
151
3d5ea891bb74 Update implementation to match the JDBC spec so use
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 145
diff changeset
374 throw new SQLException("No such column name: " + columnLabel, "M1M05");
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
375 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
376
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
377 /**
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
378 * Moves the cursor to the first row in this ResultSet object.
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
379 *
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
380 * @return true if the cursor is on a valid row; false if there are no rows
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
381 * in the result set
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
382 * @throws SQLException - if a database access error occurs or the result
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
383 * set type is TYPE_FORWARD_ONLY
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
384 */
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
385 @Override
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
386 public boolean first() throws SQLException {
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
387 return absolute(1);
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
388 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
389
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
390 @Override
296
c5efd6e661e5 Add "final" keyword to classes, method arguments and local variables where possible.`
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 292
diff changeset
391 public Array getArray(final int columnIndex) throws SQLException {
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
392 throw newSQLFeatureNotSupportedException("getArray");
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
393 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
394 @Override
296
c5efd6e661e5 Add "final" keyword to classes, method arguments and local variables where possible.`
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 292
diff changeset
395 public Array getArray(final String columnLabel) throws SQLException {
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
396 throw newSQLFeatureNotSupportedException("getArray");
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
397 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
398
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
399 /* Mapi doesn't allow something for streams at the moment, thus all not implemented for now */
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
400 @Override
296
c5efd6e661e5 Add "final" keyword to classes, method arguments and local variables where possible.`
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 292
diff changeset
401 public InputStream getAsciiStream(final int columnIndex) throws SQLException {
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
402 throw newSQLFeatureNotSupportedException("getAsciiStream");
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
403 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
404 @Override
296
c5efd6e661e5 Add "final" keyword to classes, method arguments and local variables where possible.`
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 292
diff changeset
405 public InputStream getAsciiStream(final String columnLabel) throws SQLException {
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
406 throw newSQLFeatureNotSupportedException("getAsciiStream");
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
407 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
408
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
409 @Override
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
410 @Deprecated
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
411 public InputStream getUnicodeStream(int columnIndex) throws SQLException {
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
412 throw newSQLFeatureNotSupportedException("getUnicodeStream");
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
413 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
414 @Override
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
415 @Deprecated
151
3d5ea891bb74 Update implementation to match the JDBC spec so use
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 145
diff changeset
416 public InputStream getUnicodeStream(String columnLabel) throws SQLException {
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
417 throw newSQLFeatureNotSupportedException("getUnicodeStream");
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
418 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
419
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
420 /**
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
421 * Retrieves the value of the designated column in the current row
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
422 * of this ResultSet object as a stream of uninterpreted bytes. The
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
423 * value can then be read in chunks from the stream. This method is
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
424 * particularly suitable for retrieving large LONGVARBINARY values.
194
1296dbcc4958 Resolved javadoc many errors and warnings, such as:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 187
diff changeset
425 *
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
426 * Note: All the data in the returned stream must be read prior to
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
427 * getting the value of any other column. The next call to a getter
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
428 * method implicitly closes the stream. Also, a stream may return 0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
429 * when the method InputStream.available is called whether there is
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
430 * data available or not.
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
431 *
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
432 * @param columnIndex the first column is 1, the second is 2, ...
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
433 * @return a Java input stream that delivers the database column
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
434 * value as a stream of uninterpreted bytes; if the value is SQL
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
435 * NULL, the value returned is null
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
436 * @throws SQLException if the columnIndex is not valid; if a
187
daa1a4c70879 For MonetresultSet class: added method checkNotClosed() and invocation for all methods which should test it.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 180
diff changeset
437 * database access error occurs or this method is called on a closed result set
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
438 */
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
439 @Override
296
c5efd6e661e5 Add "final" keyword to classes, method arguments and local variables where possible.`
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 292
diff changeset
440 public InputStream getBinaryStream(final int columnIndex) throws SQLException {
187
daa1a4c70879 For MonetresultSet class: added method checkNotClosed() and invocation for all methods which should test it.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 180
diff changeset
441 checkNotClosed();
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
442 try {
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
443 switch (JdbcSQLTypes[columnIndex - 1]) {
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
444 case Types.BLOB:
296
c5efd6e661e5 Add "final" keyword to classes, method arguments and local variables where possible.`
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 292
diff changeset
445 final Blob blob = getBlob(columnIndex);
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
446 if (blob == null)
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
447 return null;
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
448 return blob.getBinaryStream();
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
449 case Types.BINARY:
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
450 case Types.VARBINARY:
735
3dd0d43014e8 Disable checks for Types.LONGVARCHAR and Types.LONGVARBINARY as MonetDB server does not support these data types, and no mappings exists to these JDBC Types and thus these cases will never be reached in JDBC Driver.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 725
diff changeset
451 /* case Types.LONGVARBINARY: // MonetDB doesn't use type LONGVARBINARY */
296
c5efd6e661e5 Add "final" keyword to classes, method arguments and local variables where possible.`
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 292
diff changeset
452 final byte[] bte = getBytes(columnIndex);
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
453 if (bte == null)
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
454 return null;
296
c5efd6e661e5 Add "final" keyword to classes, method arguments and local variables where possible.`
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 292
diff changeset
455 return new java.io.ByteArrayInputStream(bte);
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
456 }
480
849af4b76b28 Optimise code by reducing local variables which are used only once, replacing complex string concatenation by using StringBuilder, replacing some ternairy operators.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 471
diff changeset
457 throw new SQLException("Cannot operate on type: " + types[columnIndex - 1], "M1M05");
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
458 } catch (IndexOutOfBoundsException e) {
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
459 throw newSQLInvalidColumnIndexException(columnIndex);
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
460 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
461 }
391
f523727db392 Moved Java classes from packages starting with nl.cwi.monetdb.* to package org.monetdb.*
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 384
diff changeset
462
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
463 /**
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
464 * Retrieves the value of the designated column in the current row
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
465 * of this ResultSet object as a stream of uninterpreted bytes. The
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
466 * value can then be read in chunks from the stream. This method is
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
467 * particularly suitable for retrieving large LONGVARBINARY values.
194
1296dbcc4958 Resolved javadoc many errors and warnings, such as:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 187
diff changeset
468 *
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
469 * Note: All the data in the returned stream must be read prior to
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
470 * getting the value of any other column. The next call to a getter
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
471 * method implicitly closes the stream. Also, a stream may return 0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
472 * when the method available is called whether there is data
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
473 * available or not.
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
474 *
151
3d5ea891bb74 Update implementation to match the JDBC spec so use
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 145
diff changeset
475 * @param columnLabel the label for the column specified with
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
476 * the SQL AS clause. If the SQL AS clause was not specified, then
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
477 * the label is the name of the column
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
478 * @return a Java input stream that delivers the database column
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
479 * value as a stream of uninterpreted bytes; if the value is SQL
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
480 * NULL, the result is null
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
481 * @throws SQLException if the columnLabel is not valid; if a
187
daa1a4c70879 For MonetresultSet class: added method checkNotClosed() and invocation for all methods which should test it.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 180
diff changeset
482 * database access error occurs or this method is called on a closed result set
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
483 */
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
484 @Override
296
c5efd6e661e5 Add "final" keyword to classes, method arguments and local variables where possible.`
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 292
diff changeset
485 public InputStream getBinaryStream(final String columnLabel) throws SQLException {
151
3d5ea891bb74 Update implementation to match the JDBC spec so use
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 145
diff changeset
486 return getBinaryStream(findColumn(columnLabel));
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
487 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
488
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
489 /**
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
490 * Retrieves the value of the designated column in the current row
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
491 * of this ResultSet object as a java.io.Reader object.
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
492 *
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
493 * @param columnIndex the first column is 1, the second is 2, ...
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
494 * @return a java.io.Reader object that contains the column value;
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
495 * if the value is SQL NULL, the value returned is null in
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
496 * the Java programming language.
187
daa1a4c70879 For MonetresultSet class: added method checkNotClosed() and invocation for all methods which should test it.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 180
diff changeset
497 * @throws SQLException if a database access error occurs or this method is called on a closed result set
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
498 */
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
499 @Override
296
c5efd6e661e5 Add "final" keyword to classes, method arguments and local variables where possible.`
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 292
diff changeset
500 public Reader getCharacterStream(final int columnIndex) throws SQLException {
187
daa1a4c70879 For MonetresultSet class: added method checkNotClosed() and invocation for all methods which should test it.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 180
diff changeset
501 checkNotClosed();
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
502 try {
296
c5efd6e661e5 Add "final" keyword to classes, method arguments and local variables where possible.`
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 292
diff changeset
503 final String val = tlp.values[columnIndex - 1];
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
504 if (val == null) {
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
505 lastReadWasNull = true;
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
506 return null;
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
507 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
508 lastReadWasNull = false;
296
c5efd6e661e5 Add "final" keyword to classes, method arguments and local variables where possible.`
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 292
diff changeset
509 return new java.io.StringReader(val);
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
510 } catch (IndexOutOfBoundsException e) {
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
511 throw newSQLInvalidColumnIndexException(columnIndex);
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
512 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
513 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
514
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
515 /**
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
516 * Retrieves the value of the designated column in the current row
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
517 * of this ResultSet object as a java.io.Reader object.
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
518 *
151
3d5ea891bb74 Update implementation to match the JDBC spec so use
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 145
diff changeset
519 * @param columnLabel the name of the column
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
520 * @return a java.io.Reader object that contains the column value;
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
521 * if the value is SQL NULL, the value returned is null in
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
522 * the Java programming language.
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
523 * @throws SQLException if a database access error occurs
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
524 */
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
525 @Override
296
c5efd6e661e5 Add "final" keyword to classes, method arguments and local variables where possible.`
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 292
diff changeset
526 public Reader getCharacterStream(final String columnLabel) throws SQLException {
151
3d5ea891bb74 Update implementation to match the JDBC spec so use
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 145
diff changeset
527 return getCharacterStream(findColumn(columnLabel));
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
528 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
529
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
530 /**
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
531 * Retrieves the value of the designated column in the current row
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
532 * of this ResultSet object as a java.io.Reader object. It is
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
533 * intended for use when accessing NCHAR,NVARCHAR and LONGNVARCHAR
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
534 * columns.
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
535 *
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
536 * @param columnIndex the first column is 1, the second is 2, ...
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
537 * @return a java.io.Reader object that contains the column value;
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
538 * if the value is SQL NULL, the value returned is null in
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
539 * the Java programming language.
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
540 * @throws SQLException if a database access error occurs
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
541 */
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
542 @Override
296
c5efd6e661e5 Add "final" keyword to classes, method arguments and local variables where possible.`
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 292
diff changeset
543 public Reader getNCharacterStream(final int columnIndex) throws SQLException {
152
352b54ff0436 Implemented ResultSet method getNCharacterStream()
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 151
diff changeset
544 return getCharacterStream(columnIndex);
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
545 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
546
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
547 /**
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
548 * Retrieves the value of the designated column in the current row
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
549 * of this ResultSet object as a java.io.Reader object. It is
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
550 * intended for use when accessing NCHAR,NVARCHAR and LONGNVARCHAR
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
551 * columns.
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
552 *
151
3d5ea891bb74 Update implementation to match the JDBC spec so use
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 145
diff changeset
553 * @param columnLabel the name of the column
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
554 * @return a java.io.Reader object that contains the column value;
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
555 * if the value is SQL NULL, the value returned is null in
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
556 * the Java programming language.
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
557 * @throws SQLException if a database access error occurs
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
558 */
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
559 @Override
296
c5efd6e661e5 Add "final" keyword to classes, method arguments and local variables where possible.`
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 292
diff changeset
560 public Reader getNCharacterStream(final String columnLabel) throws SQLException {
152
352b54ff0436 Implemented ResultSet method getNCharacterStream()
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 151
diff changeset
561 return getCharacterStream(findColumn(columnLabel));
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
562 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
563
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
564 /**
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
565 * Retrieves the value of the designated column in the current row
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
566 * of this ResultSet object as a Blob object in the Java programming
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
567 * language.
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
568 *
151
3d5ea891bb74 Update implementation to match the JDBC spec so use
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 145
diff changeset
569 * @param columnIndex the first column is 1, the second is 2, ...
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
570 * @return a Blob object representing the SQL BLOB value in the
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
571 * specified column
187
daa1a4c70879 For MonetresultSet class: added method checkNotClosed() and invocation for all methods which should test it.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 180
diff changeset
572 * @throws SQLException if a database access error occurs or this method is called on a closed result set
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
573 */
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
574 @Override
296
c5efd6e661e5 Add "final" keyword to classes, method arguments and local variables where possible.`
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 292
diff changeset
575 public Blob getBlob(final int columnIndex) throws SQLException {
187
daa1a4c70879 For MonetresultSet class: added method checkNotClosed() and invocation for all methods which should test it.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 180
diff changeset
576 checkNotClosed();
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
577 try {
296
c5efd6e661e5 Add "final" keyword to classes, method arguments and local variables where possible.`
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 292
diff changeset
578 final String val = tlp.values[columnIndex - 1];
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
579 if (val == null) {
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
580 lastReadWasNull = true;
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
581 return null;
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
582 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
583 lastReadWasNull = false;
329
05c7989eae91 Removed duplicate code for converting a string of hex characters into a byte array, done both in MonetBlob.create() and in MonetResultSet.getBytes().
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 296
diff changeset
584 return new MonetBlob(val);
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
585 } catch (IndexOutOfBoundsException e) {
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
586 throw newSQLInvalidColumnIndexException(columnIndex);
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
587 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
588 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
589
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
590 /**
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
591 * Retrieves the value of the designated column in the current row
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
592 * of this ResultSet object as a Blob object in the Java programming
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
593 * language.
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
594 *
151
3d5ea891bb74 Update implementation to match the JDBC spec so use
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 145
diff changeset
595 * @param columnLabel the name of the column from which to retrieve
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
596 * the value
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
597 * @return a Blob object representing the SQL BLOB value in the
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
598 * specified column
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
599 * @throws SQLException if a database access error occurs
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
600 */
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
601 @Override
296
c5efd6e661e5 Add "final" keyword to classes, method arguments and local variables where possible.`
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 292
diff changeset
602 public Blob getBlob(final String columnLabel) throws SQLException {
151
3d5ea891bb74 Update implementation to match the JDBC spec so use
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 145
diff changeset
603 return getBlob(findColumn(columnLabel));
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
604 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
605
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
606 /**
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
607 * Retrieves the value of the designated column in the current row
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
608 * of this ResultSet object as a Clob object in the
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
609 * Java programming language.
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
610 *
151
3d5ea891bb74 Update implementation to match the JDBC spec so use
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 145
diff changeset
611 * @param columnIndex the first column is 1, the second is 2, ...
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
612 * @return a Clob object representing the SQL CLOB value in the
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
613 * specified column
187
daa1a4c70879 For MonetresultSet class: added method checkNotClosed() and invocation for all methods which should test it.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 180
diff changeset
614 * @throws SQLException if a database access error occurs or this method is called on a closed result set
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
615 */
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
616 @Override
296
c5efd6e661e5 Add "final" keyword to classes, method arguments and local variables where possible.`
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 292
diff changeset
617 public Clob getClob(final int columnIndex) throws SQLException {
187
daa1a4c70879 For MonetresultSet class: added method checkNotClosed() and invocation for all methods which should test it.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 180
diff changeset
618 checkNotClosed();
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
619 try {
296
c5efd6e661e5 Add "final" keyword to classes, method arguments and local variables where possible.`
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 292
diff changeset
620 final String val = tlp.values[columnIndex - 1];
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
621 if (val == null) {
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
622 lastReadWasNull = true;
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
623 return null;
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
624 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
625 lastReadWasNull = false;
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
626 return new MonetClob(val);
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
627 } catch (IndexOutOfBoundsException e) {
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
628 throw newSQLInvalidColumnIndexException(columnIndex);
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
629 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
630 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
631
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
632 /**
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
633 * Retrieves the value of the designated column in the current row
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
634 * of this ResultSet object as a Clob object in the
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
635 * Java programming language.
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
636 *
151
3d5ea891bb74 Update implementation to match the JDBC spec so use
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 145
diff changeset
637 * @param columnLabel the name of the column from which to retrieve
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
638 * the value
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
639 * @return a Clob object representing the SQL CLOB value in the
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
640 * specified column
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
641 * @throws SQLException if a database access error occurs
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
642 */
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
643 @Override
296
c5efd6e661e5 Add "final" keyword to classes, method arguments and local variables where possible.`
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 292
diff changeset
644 public Clob getClob(final String columnLabel) throws SQLException {
151
3d5ea891bb74 Update implementation to match the JDBC spec so use
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 145
diff changeset
645 return getClob(findColumn(columnLabel));
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
646 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
647
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
648 /**
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
649 * Retrieves the value of the designated column in the current row
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
650 * of this ResultSet object as a NClob object in the
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
651 * Java programming language.
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
652 *
151
3d5ea891bb74 Update implementation to match the JDBC spec so use
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 145
diff changeset
653 * @param columnIndex the first column is 1, the second is 2, ...
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
654 * @return a NClob object representing the SQL NCLOB value in the
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
655 * specified column
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
656 * @throws SQLException if a database access error occurs
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
657 * @throws SQLFeatureNotSupportedException the JDBC driver does
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
658 * not support this method
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
659 */
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
660 @Override
296
c5efd6e661e5 Add "final" keyword to classes, method arguments and local variables where possible.`
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 292
diff changeset
661 public NClob getNClob(final int columnIndex) throws SQLException {
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
662 throw newSQLFeatureNotSupportedException("getNClob");
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
663 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
664
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
665 /**
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
666 * Retrieves the value of the designated column in the current row
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
667 * of this ResultSet object as a NClob object in the
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
668 * Java programming language.
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
669 *
151
3d5ea891bb74 Update implementation to match the JDBC spec so use
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 145
diff changeset
670 * @param columnLabel the name of the column from which to retrieve
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
671 * the value
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
672 * @return a NClob object representing the SQL NCLOB value in the
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
673 * specified column
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
674 * @throws SQLException if a database access error occurs
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
675 * @throws SQLFeatureNotSupportedException the JDBC driver does
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
676 * not support this method
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
677 */
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
678 @Override
296
c5efd6e661e5 Add "final" keyword to classes, method arguments and local variables where possible.`
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 292
diff changeset
679 public NClob getNClob(final String columnLabel) throws SQLException {
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
680 throw newSQLFeatureNotSupportedException("getNClob");
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
681 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
682
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
683 /**
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
684 * Retrieves the value of the designated column in the current row of this
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
685 * ResultSet object as a java.math.BigDecimal with full precision.
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
686 *
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
687 * @param columnIndex the first column is 1, the second is 2, ...
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
688 * @return the column value (full precision); if the value is SQL NULL,
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
689 * the value returned is null in the Java programming language.
187
daa1a4c70879 For MonetresultSet class: added method checkNotClosed() and invocation for all methods which should test it.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 180
diff changeset
690 * @throws SQLException if a database access error occurs or this method is called on a closed result set
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
691 */
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
692 @Override
296
c5efd6e661e5 Add "final" keyword to classes, method arguments and local variables where possible.`
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 292
diff changeset
693 public BigDecimal getBigDecimal(final int columnIndex) throws SQLException {
187
daa1a4c70879 For MonetresultSet class: added method checkNotClosed() and invocation for all methods which should test it.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 180
diff changeset
694 checkNotClosed();
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
695 try {
296
c5efd6e661e5 Add "final" keyword to classes, method arguments and local variables where possible.`
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 292
diff changeset
696 final String val = tlp.values[columnIndex - 1];
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
697 if (val == null) {
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
698 lastReadWasNull = true;
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
699 return null;
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
700 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
701 lastReadWasNull = false;
9
c37a76cc1e6e Corrected ResultSet methods: getByte(), getBigDecimal(), getShort(), getInt(), getLong(), getFloat() and getDouble()
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 8
diff changeset
702 return new BigDecimal(val);
c37a76cc1e6e Corrected ResultSet methods: getByte(), getBigDecimal(), getShort(), getInt(), getLong(), getFloat() and getDouble()
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 8
diff changeset
703 } catch (NumberFormatException e) {
c37a76cc1e6e Corrected ResultSet methods: getByte(), getBigDecimal(), getShort(), getInt(), getLong(), getFloat() and getDouble()
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 8
diff changeset
704 throw newSQLNumberFormatException(e);
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
705 } catch (IndexOutOfBoundsException e) {
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
706 throw newSQLInvalidColumnIndexException(columnIndex);
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
707 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
708 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
709
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
710 /**
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
711 * Retrieves the value of the designated column in the current row of this
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
712 * ResultSet object as a java.math.BigDecimal with full precision.
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
713 *
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
714 * @param columnIndex the first column is 1, the second is 2, ...
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
715 * @param scale the number of digits to the right of the decimal point
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
716 * @return the column value (full precision); if the value is SQL NULL,
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
717 * the value returned is null in the Java programming language.
187
daa1a4c70879 For MonetresultSet class: added method checkNotClosed() and invocation for all methods which should test it.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 180
diff changeset
718 * @throws SQLException if a database access error occurs or this method is called on a closed result set
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
719 */
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
720 @Override
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
721 @Deprecated
296
c5efd6e661e5 Add "final" keyword to classes, method arguments and local variables where possible.`
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 292
diff changeset
722 public BigDecimal getBigDecimal(final int columnIndex, final int scale)
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
723 throws SQLException
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
724 {
187
daa1a4c70879 For MonetresultSet class: added method checkNotClosed() and invocation for all methods which should test it.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 180
diff changeset
725 checkNotClosed();
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
726 try {
296
c5efd6e661e5 Add "final" keyword to classes, method arguments and local variables where possible.`
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 292
diff changeset
727 final String val = tlp.values[columnIndex - 1];
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
728 if (val == null) {
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
729 lastReadWasNull = true;
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
730 return null;
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
731 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
732 lastReadWasNull = false;
296
c5efd6e661e5 Add "final" keyword to classes, method arguments and local variables where possible.`
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 292
diff changeset
733 return (new BigDecimal(val)).setScale(scale);
9
c37a76cc1e6e Corrected ResultSet methods: getByte(), getBigDecimal(), getShort(), getInt(), getLong(), getFloat() and getDouble()
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 8
diff changeset
734 } catch (NumberFormatException e) {
c37a76cc1e6e Corrected ResultSet methods: getByte(), getBigDecimal(), getShort(), getInt(), getLong(), getFloat() and getDouble()
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 8
diff changeset
735 throw newSQLNumberFormatException(e);
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
736 } catch (IndexOutOfBoundsException e) {
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
737 throw newSQLInvalidColumnIndexException(columnIndex);
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
738 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
739 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
740
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
741 /**
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
742 * Retrieves the value of the designated column in the current row of this
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
743 * ResultSet object as a java.math.BigDecimal with full precision.
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
744 *
151
3d5ea891bb74 Update implementation to match the JDBC spec so use
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 145
diff changeset
745 * @param columnLabel the SQL name of the column
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
746 * @return the column value (full precision); if the value is SQL NULL,
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
747 * the value returned is null in the Java programming language.
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
748 * @throws SQLException if a database access error occurs
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
749 */
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
750 @Override
296
c5efd6e661e5 Add "final" keyword to classes, method arguments and local variables where possible.`
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 292
diff changeset
751 public BigDecimal getBigDecimal(final String columnLabel) throws SQLException {
151
3d5ea891bb74 Update implementation to match the JDBC spec so use
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 145
diff changeset
752 return getBigDecimal(findColumn(columnLabel));
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
753 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
754
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
755 /**
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
756 * Retrieves the value of the designated column in the current row of this
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
757 * ResultSet object as a java.math.BigDecimal with full precision.
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
758 *
151
3d5ea891bb74 Update implementation to match the JDBC spec so use
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 145
diff changeset
759 * @param columnLabel the SQL name of the column
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
760 * @param scale the number of digits to the right of the decimal point
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
761 * @return the column value (full precision); if the value is SQL NULL,
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
762 * the value returned is null in the Java programming language.
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
763 * @throws SQLException if a database access error occurs
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
764 */
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
765 @Override
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
766 @Deprecated
296
c5efd6e661e5 Add "final" keyword to classes, method arguments and local variables where possible.`
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 292
diff changeset
767 public BigDecimal getBigDecimal(final String columnLabel, final int scale)
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
768 throws SQLException
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
769 {
151
3d5ea891bb74 Update implementation to match the JDBC spec so use
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 145
diff changeset
770 return getBigDecimal(findColumn(columnLabel), scale);
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
771 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
772
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
773 // See Sun JDBC Specification 3.0 Table B-6
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
774 /**
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
775 * Retrieves the value of the designated column in the current row of this
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
776 * ResultSet object as a boolean in the Java programming language.
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
777 *
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
778 * @param columnIndex the first column is 1, the second is 2, ...
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
779 * @return the column value; if the value is SQL NULL, the value returned
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
780 * is false
187
daa1a4c70879 For MonetresultSet class: added method checkNotClosed() and invocation for all methods which should test it.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 180
diff changeset
781 * @throws SQLException if the columnIndex is not valid; if a database access error occurs
daa1a4c70879 For MonetresultSet class: added method checkNotClosed() and invocation for all methods which should test it.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 180
diff changeset
782 * or this method is called on a closed result set
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
783 */
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
784 @Override
296
c5efd6e661e5 Add "final" keyword to classes, method arguments and local variables where possible.`
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 292
diff changeset
785 public boolean getBoolean(final int columnIndex) throws SQLException {
187
daa1a4c70879 For MonetresultSet class: added method checkNotClosed() and invocation for all methods which should test it.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 180
diff changeset
786 checkNotClosed();
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
787 try {
296
c5efd6e661e5 Add "final" keyword to classes, method arguments and local variables where possible.`
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 292
diff changeset
788 final String val = tlp.values[columnIndex - 1];
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
789 if (val == null) {
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
790 lastReadWasNull = true;
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
791 return false; // if the value is SQL NULL, the value returned is false
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
792 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
793 lastReadWasNull = false;
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
794
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
795 // match common cases first
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
796 if ("false".equalsIgnoreCase(val) || "0".equals(val))
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
797 return false;
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
798 if ("true".equalsIgnoreCase(val) || "1".equals(val))
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
799 return true;
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
800
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
801 // match type specific values
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
802 switch (JdbcSQLTypes[columnIndex - 1]) {
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
803 case Types.BOOLEAN:
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
804 case Types.CHAR:
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
805 case Types.VARCHAR:
735
3dd0d43014e8 Disable checks for Types.LONGVARCHAR and Types.LONGVARBINARY as MonetDB server does not support these data types, and no mappings exists to these JDBC Types and thus these cases will never be reached in JDBC Driver.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 725
diff changeset
806 /* case Types.LONGVARCHAR: // MonetDB doesn't use type LONGVARCHAR */
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
807 case Types.CLOB:
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
808 // check if string value equals "true" (case insensitive) or not
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
809 return Boolean.parseBoolean(val);
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
810 case Types.TINYINT:
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
811 case Types.SMALLINT:
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
812 case Types.INTEGER:
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
813 if (getInt(columnIndex) == 0) {
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
814 return false;
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
815 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
816 return true;
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
817 case Types.BIGINT:
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
818 if (getLong(columnIndex) == 0L) {
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
819 return false;
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
820 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
821 return true;
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
822 case Types.DOUBLE:
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
823 case Types.FLOAT:
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
824 case Types.REAL:
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
825 if (getDouble(columnIndex) == 0.0) {
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
826 return false;
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
827 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
828 return true;
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
829 case Types.DECIMAL:
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
830 case Types.NUMERIC:
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
831 if (getBigDecimal(columnIndex).compareTo(BigDecimal.ZERO) == 0) {
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
832 return false;
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
833 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
834 return true;
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
835 default:
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
836 throw new SQLException("Conversion from " + types[columnIndex - 1] + " to boolean type not supported", "M1M05");
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
837 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
838 } catch (IndexOutOfBoundsException e) {
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
839 throw newSQLInvalidColumnIndexException(columnIndex);
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
840 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
841 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
842
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
843 /**
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
844 * Retrieves the value of the designated column in the current row of this
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
845 * ResultSet object as a boolean in the Java programming language.
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
846 *
151
3d5ea891bb74 Update implementation to match the JDBC spec so use
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 145
diff changeset
847 * @param columnLabel the SQL name of the column
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
848 * @return the column value; if the value is SQL NULL, the value returned
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
849 * is false
151
3d5ea891bb74 Update implementation to match the JDBC spec so use
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 145
diff changeset
850 * @throws SQLException if the ResultSet object does not contain columnLabel
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
851 */
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
852 @Override
296
c5efd6e661e5 Add "final" keyword to classes, method arguments and local variables where possible.`
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 292
diff changeset
853 public boolean getBoolean(final String columnLabel) throws SQLException {
151
3d5ea891bb74 Update implementation to match the JDBC spec so use
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 145
diff changeset
854 return getBoolean(findColumn(columnLabel));
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
855 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
856
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
857 /**
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
858 * Retrieves the value of the designated column in the current row of this
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
859 * ResultSet object as a byte in the Java programming language.
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
860 *
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
861 * @param columnIndex the first column is 1, the second is 2, ...
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
862 * @return the column value; if the value is SQL NULL, the value returned
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
863 * is 0
187
daa1a4c70879 For MonetresultSet class: added method checkNotClosed() and invocation for all methods which should test it.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 180
diff changeset
864 * @throws SQLException if a database access error occurs or this method is called on a closed result set
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
865 */
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
866 @Override
296
c5efd6e661e5 Add "final" keyword to classes, method arguments and local variables where possible.`
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 292
diff changeset
867 public byte getByte(final int columnIndex) throws SQLException {
187
daa1a4c70879 For MonetresultSet class: added method checkNotClosed() and invocation for all methods which should test it.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 180
diff changeset
868 checkNotClosed();
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
869 try {
296
c5efd6e661e5 Add "final" keyword to classes, method arguments and local variables where possible.`
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 292
diff changeset
870 final String val = tlp.values[columnIndex - 1];
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
871 if (val == null) {
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
872 lastReadWasNull = true;
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
873 return (byte) 0;
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
874 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
875 lastReadWasNull = false;
9
c37a76cc1e6e Corrected ResultSet methods: getByte(), getBigDecimal(), getShort(), getInt(), getLong(), getFloat() and getDouble()
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 8
diff changeset
876 return Byte.parseByte(val);
c37a76cc1e6e Corrected ResultSet methods: getByte(), getBigDecimal(), getShort(), getInt(), getLong(), getFloat() and getDouble()
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 8
diff changeset
877 } catch (NumberFormatException e) {
c37a76cc1e6e Corrected ResultSet methods: getByte(), getBigDecimal(), getShort(), getInt(), getLong(), getFloat() and getDouble()
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 8
diff changeset
878 throw newSQLNumberFormatException(e);
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
879 } catch (IndexOutOfBoundsException e) {
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
880 throw newSQLInvalidColumnIndexException(columnIndex);
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
881 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
882 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
883
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
884 /**
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
885 * Retrieves the value of the designated column in the current row of this
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
886 * ResultSet object as a byte in the Java programming language.
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
887 *
151
3d5ea891bb74 Update implementation to match the JDBC spec so use
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 145
diff changeset
888 * @param columnLabel the SQL name of the column
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
889 * @return the column value; if the value is SQL NULL, the value returned
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
890 * is 0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
891 * @throws SQLException if a database access error occurs
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
892 */
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
893 @Override
296
c5efd6e661e5 Add "final" keyword to classes, method arguments and local variables where possible.`
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 292
diff changeset
894 public byte getByte(final String columnLabel) throws SQLException {
151
3d5ea891bb74 Update implementation to match the JDBC spec so use
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 145
diff changeset
895 return getByte(findColumn(columnLabel));
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
896 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
897
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
898 /**
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
899 * Retrieves the value of the designated column in the current row of this
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
900 * ResultSet object as a byte array in the Java programming language. The
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
901 * bytes represent the raw values returned by the driver.
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
902 *
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
903 * @param columnIndex the first column is 1, the second is 2, ...
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
904 * @return the column value; if the value is SQL NULL, the value returned
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
905 * is null
187
daa1a4c70879 For MonetresultSet class: added method checkNotClosed() and invocation for all methods which should test it.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 180
diff changeset
906 * @throws SQLException if a database access error occurs or this method is called on a closed result set
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
907 */
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
908 @Override
296
c5efd6e661e5 Add "final" keyword to classes, method arguments and local variables where possible.`
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 292
diff changeset
909 public byte[] getBytes(final int columnIndex) throws SQLException {
187
daa1a4c70879 For MonetresultSet class: added method checkNotClosed() and invocation for all methods which should test it.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 180
diff changeset
910 checkNotClosed();
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
911 try {
296
c5efd6e661e5 Add "final" keyword to classes, method arguments and local variables where possible.`
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 292
diff changeset
912 final String val = tlp.values[columnIndex - 1];
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
913 if (val == null) {
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
914 lastReadWasNull = true;
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
915 return null;
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
916 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
917 lastReadWasNull = false;
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
918
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
919 // According to Table B-6, getBytes() only operates on BINARY types
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
920 switch (JdbcSQLTypes[columnIndex - 1]) {
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
921 case Types.BLOB:
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
922 case Types.BINARY:
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
923 case Types.VARBINARY:
735
3dd0d43014e8 Disable checks for Types.LONGVARCHAR and Types.LONGVARBINARY as MonetDB server does not support these data types, and no mappings exists to these JDBC Types and thus these cases will never be reached in JDBC Driver.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 725
diff changeset
924 /* case Types.LONGVARBINARY: // MonetDB doesn't use type LONGVARBINARY */
329
05c7989eae91 Removed duplicate code for converting a string of hex characters into a byte array, done both in MonetBlob.create() and in MonetResultSet.getBytes().
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 296
diff changeset
925 return MonetBlob.hexStrToByteArray(val);
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
926 default:
480
849af4b76b28 Optimise code by reducing local variables which are used only once, replacing complex string concatenation by using StringBuilder, replacing some ternairy operators.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 471
diff changeset
927 throw new SQLException("Cannot operate on type: " + types[columnIndex - 1], "M1M05");
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
928 }
20
dbb8e7c2dbbf Added missing catch (NumberFormatException e) to getBytes(col)
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 12
diff changeset
929 } catch (NumberFormatException e) {
dbb8e7c2dbbf Added missing catch (NumberFormatException e) to getBytes(col)
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 12
diff changeset
930 throw newSQLNumberFormatException(e);
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
931 } catch (IndexOutOfBoundsException e) {
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
932 throw newSQLInvalidColumnIndexException(columnIndex);
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
933 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
934 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
935
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
936 /**
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
937 * Retrieves the value of the designated column in the current row of this
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
938 * ResultSet object as a byte array in the Java programming language. The
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
939 * bytes represent the raw values returned by the driver.
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
940 *
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
941 * NOTE: Since the mapi protocol is ASCII-based, this method only returns
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
942 * Java byte representations of Strings, which is nothing more than
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
943 * an encoding into a sequence of bytes using the platform's default
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
944 * charset.
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
945 *
151
3d5ea891bb74 Update implementation to match the JDBC spec so use
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 145
diff changeset
946 * @param columnLabel the SQL name of the column
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
947 * @return the column value; if the value is SQL NULL, the value returned
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
948 * is null
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
949 * @throws SQLException if a database access error occurs
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
950 */
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
951 @Override
296
c5efd6e661e5 Add "final" keyword to classes, method arguments and local variables where possible.`
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 292
diff changeset
952 public byte[] getBytes(final String columnLabel) throws SQLException {
151
3d5ea891bb74 Update implementation to match the JDBC spec so use
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 145
diff changeset
953 return getBytes(findColumn(columnLabel));
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
954 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
955
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
956 /**
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
957 * Retrieves the concurrency mode of this ResultSet object. The concurrency
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
958 * used is determined by the Statement object that created the result set.
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
959 *
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
960 * NOTE: MonetDB only supports read-only result sets, and will always return
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
961 * ResultSet.CONCUR_READ_ONLY
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
962 *
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
963 * @return the concurrency type, either ResultSet.CONCUR_READ_ONLY or
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
964 * ResultSet.CONCUR_UPDATABLE
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
965 */
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
966 @Override
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
967 public int getConcurrency() {
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
968 return concurrency;
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
969 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
970
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
971 /**
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
972 * Retrieves the name of the SQL cursor used by this ResultSet object.
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
973 * In SQL, a result table is retrieved through a cursor that is named.
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
974 * For MonetDB this is the header.id returned in a resultset header. The
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
975 * current row of a result set can be updated or deleted using a positioned
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
976 * update/delete statement that references the cursor name. To insure that
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
977 * the cursor has the proper isolation level to support update, the
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
978 * cursor's SELECT statement should be of the form SELECT FOR UPDATE. If
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
979 * FOR UPDATE is omitted, the positioned updates may fail.
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
980 *
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
981 * The JDBC API supports this SQL feature by providing the name of the SQL
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
982 * cursor used by a ResultSet object. The current row of a ResultSet object
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
983 * is also the current row of this SQL cursor.
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
984 *
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
985 * Note: If positioned update is not supported, a SQLException is thrown.
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
986 * MonetDB currently doesn't support updates, so the SQLException is
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
987 * thrown for now.
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
988 *
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
989 * @return the SQL name for this ResultSet object's cursor
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
990 * @throws SQLException if a database access error occurs
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
991 */
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
992 @Override
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
993 public String getCursorName() throws SQLException {
471
e14e81b8044e Improved performance of ResultSetMetaData methods getPrecision(), getScale(), isNullable() and isAutoIncrement().
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 451
diff changeset
994 throw new SQLException("Positioned updates not supported for this cursor ("
480
849af4b76b28 Optimise code by reducing local variables which are used only once, replacing complex string concatenation by using StringBuilder, replacing some ternairy operators.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 471
diff changeset
995 + (header != null ? header.id + ")" : ")"), "0AM21");
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
996 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
997
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
998 /**
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
999 * Retrieves the value of the designated column in the current row of this
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1000 * ResultSet object as a double in the Java programming language.
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1001 *
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1002 * @param columnIndex the first column is 1, the second is 2, ...
187
daa1a4c70879 For MonetresultSet class: added method checkNotClosed() and invocation for all methods which should test it.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 180
diff changeset
1003 * @return the column value; if the value is SQL NULL, the value returned is 0
daa1a4c70879 For MonetresultSet class: added method checkNotClosed() and invocation for all methods which should test it.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 180
diff changeset
1004 * @throws SQLException if there is no such column or this method is called on a closed result set
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1005 */
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1006 @Override
296
c5efd6e661e5 Add "final" keyword to classes, method arguments and local variables where possible.`
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 292
diff changeset
1007 public double getDouble(final int columnIndex) throws SQLException {
187
daa1a4c70879 For MonetresultSet class: added method checkNotClosed() and invocation for all methods which should test it.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 180
diff changeset
1008 checkNotClosed();
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1009 try {
296
c5efd6e661e5 Add "final" keyword to classes, method arguments and local variables where possible.`
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 292
diff changeset
1010 final String val = tlp.values[columnIndex - 1];
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1011 if (val == null) {
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1012 lastReadWasNull = true;
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1013 return 0;
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1014 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1015 lastReadWasNull = false;
9
c37a76cc1e6e Corrected ResultSet methods: getByte(), getBigDecimal(), getShort(), getInt(), getLong(), getFloat() and getDouble()
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 8
diff changeset
1016 return Double.parseDouble(val);
c37a76cc1e6e Corrected ResultSet methods: getByte(), getBigDecimal(), getShort(), getInt(), getLong(), getFloat() and getDouble()
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 8
diff changeset
1017 } catch (NumberFormatException e) {
c37a76cc1e6e Corrected ResultSet methods: getByte(), getBigDecimal(), getShort(), getInt(), getLong(), getFloat() and getDouble()
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 8
diff changeset
1018 throw newSQLNumberFormatException(e);
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1019 } catch (IndexOutOfBoundsException e) {
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1020 throw newSQLInvalidColumnIndexException(columnIndex);
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1021 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1022 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1023
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1024 /**
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1025 * Retrieves the value of the designated column in the current row of this
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1026 * ResultSet object as a double in the Java programming language.
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1027 *
151
3d5ea891bb74 Update implementation to match the JDBC spec so use
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 145
diff changeset
1028 * @param columnLabel the SQL name of the column
187
daa1a4c70879 For MonetresultSet class: added method checkNotClosed() and invocation for all methods which should test it.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 180
diff changeset
1029 * @return the column value; if the value is SQL NULL, the value returned is 0
151
3d5ea891bb74 Update implementation to match the JDBC spec so use
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 145
diff changeset
1030 * @throws SQLException if the ResultSet object does not contain columnLabel
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1031 */
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1032 @Override
296
c5efd6e661e5 Add "final" keyword to classes, method arguments and local variables where possible.`
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 292
diff changeset
1033 public double getDouble(final String columnLabel) throws SQLException {
151
3d5ea891bb74 Update implementation to match the JDBC spec so use
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 145
diff changeset
1034 return getDouble(findColumn(columnLabel));
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1035 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1036
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1037 /**
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1038 * Retrieves the holdability of this ResultSet object.
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1039 *
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1040 * @return either ResultSet.HOLD_CURSORS_OVER_COMMIT or
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1041 * ResultSet.CLOSE_CURSORS_AT_COMMIT
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1042 * @throws SQLException if a database access error occurs
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1043 */
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1044 @Override
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1045 public int getHoldability() throws SQLException {
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1046 return getStatement().getConnection().getHoldability();
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1047 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1048
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1049 /**
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1050 * Retrieves the fetch direction for this ResultSet object.
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1051 *
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1052 * @return the current fetch direction for this ResultSet object
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1053 */
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1054 @Override
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1055 public int getFetchDirection() {
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1056 return ResultSet.FETCH_FORWARD;
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1057 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1058
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1059 /**
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1060 * Gives a hint as to the direction in which the rows in this ResultSet
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1061 * object will be processed. The initial value is determined by the
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1062 * Statement object that produced this ResultSet object.
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1063 * The fetch direction may be changed at any time.
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1064 *
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1065 * @param direction - an int specifying the suggested fetch direction;
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1066 * one of ResultSet.FETCH_FORWARD, ResultSet.FETCH_REVERSE, or ResultSet.FETCH_UNKNOWN
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1067 */
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1068 @Override
296
c5efd6e661e5 Add "final" keyword to classes, method arguments and local variables where possible.`
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 292
diff changeset
1069 public void setFetchDirection(final int direction) throws SQLException {
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1070 switch (direction) {
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1071 case ResultSet.FETCH_FORWARD:
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1072 break;
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1073 case ResultSet.FETCH_REVERSE:
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1074 case ResultSet.FETCH_UNKNOWN:
480
849af4b76b28 Optimise code by reducing local variables which are used only once, replacing complex string concatenation by using StringBuilder, replacing some ternairy operators.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 471
diff changeset
1075 throw new SQLException("Not supported direction: " + direction, "0A000");
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1076 default:
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1077 throw new SQLException("Illegal direction: " + direction, "M1M05");
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1078 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1079 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1080
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1081 /**
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1082 * Retrieves the fetch size for this ResultSet object.
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1083 *
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1084 * @return the current fetch size for this ResultSet object
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1085 * @throws SQLException if a database access error occurs
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1086 */
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1087 @Override
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1088 public int getFetchSize() throws SQLException {
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1089 return fetchSize;
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1090 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1091
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1092 /**
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1093 * Gives the JDBC driver a hint as to the number of rows that should be
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1094 * fetched from the database when more rows are needed. In MonetDB, this is
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1095 * actually a no-op, because even before a MonetResultSet object is
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1096 * created, the fetch size is already determined in the
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1097 * MonetConnection.ResultSetResponse passed to its constructor. Since all
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1098 * data blocks for this whole result set are already allocated in
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1099 * MonetConnection.ResultSetResponse, it is too complicated and error-prone
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1100 * to still change the fetchSize here. If one really needs to overwrite
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1101 * the default fetchSize, please use MonetStatement.setFetchSize() instead.
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1102 *
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1103 * @param rows the number of rows to fetch
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1104 * @throws SQLException if the condition 0 &lt;= rows is not satisfied
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1105 */
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1106 @Override
296
c5efd6e661e5 Add "final" keyword to classes, method arguments and local variables where possible.`
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 292
diff changeset
1107 public void setFetchSize(final int rows) throws SQLException {
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1108 if (rows >= 0) {
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1109 fetchSize = rows;
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1110 } else {
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1111 throw new SQLException("Illegal fetch size value: " + rows, "M1M05");
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1112 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1113 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1114
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1115 /**
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1116 * Retrieves the value of the designated column in the current row of this
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1117 * ResultSet object as a float in the Java programming language.
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1118 *
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1119 * @param columnIndex the first column is 1, the second is 2, ...
187
daa1a4c70879 For MonetresultSet class: added method checkNotClosed() and invocation for all methods which should test it.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 180
diff changeset
1120 * @return the column value; if the value is SQL NULL, the value returned is 0
daa1a4c70879 For MonetresultSet class: added method checkNotClosed() and invocation for all methods which should test it.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 180
diff changeset
1121 * @throws SQLException if there is no such column or this method is called on a closed result set
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1122 */
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1123 @Override
296
c5efd6e661e5 Add "final" keyword to classes, method arguments and local variables where possible.`
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 292
diff changeset
1124 public float getFloat(final int columnIndex) throws SQLException {
187
daa1a4c70879 For MonetresultSet class: added method checkNotClosed() and invocation for all methods which should test it.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 180
diff changeset
1125 checkNotClosed();
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1126 try {
296
c5efd6e661e5 Add "final" keyword to classes, method arguments and local variables where possible.`
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 292
diff changeset
1127 final String val = tlp.values[columnIndex - 1];
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1128 if (val == null) {
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1129 lastReadWasNull = true;
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1130 return 0;
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1131 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1132 lastReadWasNull = false;
9
c37a76cc1e6e Corrected ResultSet methods: getByte(), getBigDecimal(), getShort(), getInt(), getLong(), getFloat() and getDouble()
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 8
diff changeset
1133 return Float.parseFloat(val);
c37a76cc1e6e Corrected ResultSet methods: getByte(), getBigDecimal(), getShort(), getInt(), getLong(), getFloat() and getDouble()
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 8
diff changeset
1134 } catch (NumberFormatException e) {
c37a76cc1e6e Corrected ResultSet methods: getByte(), getBigDecimal(), getShort(), getInt(), getLong(), getFloat() and getDouble()
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 8
diff changeset
1135 throw newSQLNumberFormatException(e);
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1136 } catch (IndexOutOfBoundsException e) {
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1137 throw newSQLInvalidColumnIndexException(columnIndex);
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1138 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1139 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1140
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1141 /**
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1142 * Retrieves the value of the designated column in the current row of this
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1143 * ResultSet object as a float in the Java programming language.
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1144 *
151
3d5ea891bb74 Update implementation to match the JDBC spec so use
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 145
diff changeset
1145 * @param columnLabel the SQL name of the column
11
01b9672e9308 Improved speed of ResultSet.getLong().
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 10
diff changeset
1146 * @return the column value; if the value is SQL NULL, the value returned is 0
151
3d5ea891bb74 Update implementation to match the JDBC spec so use
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 145
diff changeset
1147 * @throws SQLException if the ResultSet object does not contain columnLabel
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1148 */
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1149 @Override
296
c5efd6e661e5 Add "final" keyword to classes, method arguments and local variables where possible.`
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 292
diff changeset
1150 public float getFloat(final String columnLabel) throws SQLException {
151
3d5ea891bb74 Update implementation to match the JDBC spec so use
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 145
diff changeset
1151 return getFloat(findColumn(columnLabel));
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1152 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1153
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1154 /**
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1155 * Retrieves the value of the designated column in the current row of this
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1156 * ResultSet object as an int in the Java programming language.
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1157 *
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1158 * @param columnIndex the first column is 1, the second is 2, ...
11
01b9672e9308 Improved speed of ResultSet.getLong().
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 10
diff changeset
1159 * @return the column value; if the value is SQL NULL, the value returned is 0
187
daa1a4c70879 For MonetresultSet class: added method checkNotClosed() and invocation for all methods which should test it.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 180
diff changeset
1160 * @throws SQLException if there is no such column or this method is called on a closed result set
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1161 */
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1162 @Override
296
c5efd6e661e5 Add "final" keyword to classes, method arguments and local variables where possible.`
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 292
diff changeset
1163 public int getInt(final int columnIndex) throws SQLException {
187
daa1a4c70879 For MonetresultSet class: added method checkNotClosed() and invocation for all methods which should test it.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 180
diff changeset
1164 checkNotClosed();
11
01b9672e9308 Improved speed of ResultSet.getLong().
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 10
diff changeset
1165 String val = "";
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1166 try {
11
01b9672e9308 Improved speed of ResultSet.getLong().
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 10
diff changeset
1167 val = tlp.values[columnIndex - 1];
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1168 if (val == null) {
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1169 lastReadWasNull = true;
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1170 return 0;
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1171 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1172 lastReadWasNull = false;
9
c37a76cc1e6e Corrected ResultSet methods: getByte(), getBigDecimal(), getShort(), getInt(), getLong(), getFloat() and getDouble()
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 8
diff changeset
1173 return Integer.parseInt(val);
c37a76cc1e6e Corrected ResultSet methods: getByte(), getBigDecimal(), getShort(), getInt(), getLong(), getFloat() and getDouble()
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 8
diff changeset
1174 } catch (NumberFormatException e) {
11
01b9672e9308 Improved speed of ResultSet.getLong().
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 10
diff changeset
1175 // The oid datatype values (as string) have a @0 suffix in the string value.
943
ff075ed5ce81 Spell check.
Sjoerd Mullender <sjoerd@acm.org>
parents: 937
diff changeset
1176 // To allow successful parsing and conversion to int, we need to remove the suffix first
11
01b9672e9308 Improved speed of ResultSet.getLong().
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 10
diff changeset
1177 if ("oid".equals(types[columnIndex - 1])) {
296
c5efd6e661e5 Add "final" keyword to classes, method arguments and local variables where possible.`
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 292
diff changeset
1178 if (val.endsWith("@0")) {
11
01b9672e9308 Improved speed of ResultSet.getLong().
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 10
diff changeset
1179 try {
296
c5efd6e661e5 Add "final" keyword to classes, method arguments and local variables where possible.`
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 292
diff changeset
1180 return Integer.parseInt(val.substring(0, val.length()-2));
11
01b9672e9308 Improved speed of ResultSet.getLong().
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 10
diff changeset
1181 } catch (NumberFormatException nfe) {
01b9672e9308 Improved speed of ResultSet.getLong().
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 10
diff changeset
1182 throw newSQLNumberFormatException(nfe);
01b9672e9308 Improved speed of ResultSet.getLong().
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 10
diff changeset
1183 }
01b9672e9308 Improved speed of ResultSet.getLong().
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 10
diff changeset
1184 }
01b9672e9308 Improved speed of ResultSet.getLong().
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 10
diff changeset
1185 }
9
c37a76cc1e6e Corrected ResultSet methods: getByte(), getBigDecimal(), getShort(), getInt(), getLong(), getFloat() and getDouble()
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 8
diff changeset
1186 throw newSQLNumberFormatException(e);
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1187 } catch (IndexOutOfBoundsException e) {
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1188 throw newSQLInvalidColumnIndexException(columnIndex);
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1189 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1190 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1191
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1192 /**
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1193 * Retrieves the value of the designated column in the current row of this
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1194 * ResultSet object as an int in the Java programming language.
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1195 *
151
3d5ea891bb74 Update implementation to match the JDBC spec so use
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 145
diff changeset
1196 * @param columnLabel the SQL name of the column
11
01b9672e9308 Improved speed of ResultSet.getLong().
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 10
diff changeset
1197 * @return the column value; if the value is SQL NULL, the value returned is 0
151
3d5ea891bb74 Update implementation to match the JDBC spec so use
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 145
diff changeset
1198 * @throws SQLException if the ResultSet object does not contain columnLabel
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1199 */
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1200 @Override
296
c5efd6e661e5 Add "final" keyword to classes, method arguments and local variables where possible.`
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 292
diff changeset
1201 public int getInt(final String columnLabel) throws SQLException {
151
3d5ea891bb74 Update implementation to match the JDBC spec so use
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 145
diff changeset
1202 return getInt(findColumn(columnLabel));
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1203 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1204
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1205 /**
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1206 * Retrieves the value of the designated column in the current row of this
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1207 * ResultSet object as a long in the Java programming language.
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1208 *
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1209 * @param columnIndex the first column is 1, the second is 2, ...
11
01b9672e9308 Improved speed of ResultSet.getLong().
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 10
diff changeset
1210 * @return the column value; if the value is SQL NULL, the value returned is 0
187
daa1a4c70879 For MonetresultSet class: added method checkNotClosed() and invocation for all methods which should test it.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 180
diff changeset
1211 * @throws SQLException if there is no such column or this method is called on a closed result set
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1212 */
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1213 @Override
296
c5efd6e661e5 Add "final" keyword to classes, method arguments and local variables where possible.`
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 292
diff changeset
1214 public long getLong(final int columnIndex) throws SQLException {
187
daa1a4c70879 For MonetresultSet class: added method checkNotClosed() and invocation for all methods which should test it.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 180
diff changeset
1215 checkNotClosed();
11
01b9672e9308 Improved speed of ResultSet.getLong().
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 10
diff changeset
1216 String val = "";
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1217 try {
11
01b9672e9308 Improved speed of ResultSet.getLong().
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 10
diff changeset
1218 val = tlp.values[columnIndex - 1];
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1219 if (val == null) {
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1220 lastReadWasNull = true;
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1221 return 0;
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1222 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1223 lastReadWasNull = false;
11
01b9672e9308 Improved speed of ResultSet.getLong().
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 10
diff changeset
1224 return Long.parseLong(val);
01b9672e9308 Improved speed of ResultSet.getLong().
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 10
diff changeset
1225 } catch (NumberFormatException e) {
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1226 // The oid datatype values (as string) have a @0 suffix in the string value.
943
ff075ed5ce81 Spell check.
Sjoerd Mullender <sjoerd@acm.org>
parents: 937
diff changeset
1227 // To allow successful parsing and conversion to long, we need to remove the suffix first
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1228 if ("oid".equals(types[columnIndex - 1])) {
296
c5efd6e661e5 Add "final" keyword to classes, method arguments and local variables where possible.`
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 292
diff changeset
1229 if (val.endsWith("@0")) {
11
01b9672e9308 Improved speed of ResultSet.getLong().
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 10
diff changeset
1230 try {
296
c5efd6e661e5 Add "final" keyword to classes, method arguments and local variables where possible.`
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 292
diff changeset
1231 return Long.parseLong(val.substring(0, val.length()-2));
11
01b9672e9308 Improved speed of ResultSet.getLong().
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 10
diff changeset
1232 } catch (NumberFormatException nfe) {
01b9672e9308 Improved speed of ResultSet.getLong().
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 10
diff changeset
1233 throw newSQLNumberFormatException(nfe);
01b9672e9308 Improved speed of ResultSet.getLong().
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 10
diff changeset
1234 }
01b9672e9308 Improved speed of ResultSet.getLong().
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 10
diff changeset
1235 }
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1236 }
9
c37a76cc1e6e Corrected ResultSet methods: getByte(), getBigDecimal(), getShort(), getInt(), getLong(), getFloat() and getDouble()
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 8
diff changeset
1237 throw newSQLNumberFormatException(e);
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1238 } catch (IndexOutOfBoundsException e) {
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1239 throw newSQLInvalidColumnIndexException(columnIndex);
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1240 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1241 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1242
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1243 /**
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1244 * Retrieves the value of the designated column in the current row of this
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1245 * ResultSet object as a long in the Java programming language.
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1246 *
151
3d5ea891bb74 Update implementation to match the JDBC spec so use
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 145
diff changeset
1247 * @param columnLabel the SQL name of the column
187
daa1a4c70879 For MonetresultSet class: added method checkNotClosed() and invocation for all methods which should test it.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 180
diff changeset
1248 * @return the column value; if the value is SQL NULL, the value returned is 0
151
3d5ea891bb74 Update implementation to match the JDBC spec so use
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 145
diff changeset
1249 * @throws SQLException if the ResultSet object does not contain columnLabel
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1250 */
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1251 @Override
296
c5efd6e661e5 Add "final" keyword to classes, method arguments and local variables where possible.`
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 292
diff changeset
1252 public long getLong(final String columnLabel) throws SQLException {
151
3d5ea891bb74 Update implementation to match the JDBC spec so use
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 145
diff changeset
1253 return getLong(findColumn(columnLabel));
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1254 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1255
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1256 /**
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1257 * Retrieves the number, types and properties of this ResultSet object's
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1258 * columns.
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1259 *
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1260 * @return the description of this ResultSet object's columns
725
224d73363dc9 Fixed issue when you create a new Statement, call getGeneratedKeys().getMetaData().
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 716
diff changeset
1261 * @throws SQLException if a database access error occurs or this method is called on a closed result set
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1262 */
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1263 @Override
286
d430f8adbf1b Add keyword "final" to those variables which do not change after first assigment.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 266
diff changeset
1264 public ResultSetMetaData getMetaData() throws SQLException {
713
c3c424a90a42 Improve implementation of ResultSet.getMetaData().
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 709
diff changeset
1265 if (rsmd == null) {
716
aeb268156580 Updated Copyright year.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 714
diff changeset
1266 // first use, construct it once and reuse it for all next calls
725
224d73363dc9 Fixed issue when you create a new Statement, call getGeneratedKeys().getMetaData().
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 716
diff changeset
1267 if (header != null) {
224d73363dc9 Fixed issue when you create a new Statement, call getGeneratedKeys().getMetaData().
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 716
diff changeset
1268 rsmd = new MonetResultSetMetaData((MonetConnection) getStatement().getConnection(), header);
224d73363dc9 Fixed issue when you create a new Statement, call getGeneratedKeys().getMetaData().
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 716
diff changeset
1269 } else {
224d73363dc9 Fixed issue when you create a new Statement, call getGeneratedKeys().getMetaData().
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 716
diff changeset
1270 // this will be a MonetVirtualResultSet object, see MonetStatement.getGeneratedKeys()
224d73363dc9 Fixed issue when you create a new Statement, call getGeneratedKeys().getMetaData().
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 716
diff changeset
1271 // create arrays for storing the result columns meta data to pass to the constructor
224d73363dc9 Fixed issue when you create a new Statement, call getGeneratedKeys().getMetaData().
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 716
diff changeset
1272 final int array_size = 1;
224d73363dc9 Fixed issue when you create a new Statement, call getGeneratedKeys().getMetaData().
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 716
diff changeset
1273 final String[] schemas = new String[array_size];
224d73363dc9 Fixed issue when you create a new Statement, call getGeneratedKeys().getMetaData().
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 716
diff changeset
1274 final String[] tables = new String[array_size];
224d73363dc9 Fixed issue when you create a new Statement, call getGeneratedKeys().getMetaData().
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 716
diff changeset
1275 final String[] columns = new String[array_size];
224d73363dc9 Fixed issue when you create a new Statement, call getGeneratedKeys().getMetaData().
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 716
diff changeset
1276 final String[] types = new String[array_size];
224d73363dc9 Fixed issue when you create a new Statement, call getGeneratedKeys().getMetaData().
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 716
diff changeset
1277 final int[] jdbcTypes = new int[array_size];
224d73363dc9 Fixed issue when you create a new Statement, call getGeneratedKeys().getMetaData().
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 716
diff changeset
1278 final int[] lengths = new int[array_size];
224d73363dc9 Fixed issue when you create a new Statement, call getGeneratedKeys().getMetaData().
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 716
diff changeset
1279 final int[] precisions = new int[array_size];
224d73363dc9 Fixed issue when you create a new Statement, call getGeneratedKeys().getMetaData().
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 716
diff changeset
1280 final int[] scales = new int[array_size];
224d73363dc9 Fixed issue when you create a new Statement, call getGeneratedKeys().getMetaData().
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 716
diff changeset
1281 // fill the arrays with the getGeneratedKeys() resultset columns metadata. It only has 1 column.
224d73363dc9 Fixed issue when you create a new Statement, call getGeneratedKeys().getMetaData().
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 716
diff changeset
1282 schemas[0] = null;
224d73363dc9 Fixed issue when you create a new Statement, call getGeneratedKeys().getMetaData().
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 716
diff changeset
1283 tables[0] = null;
224d73363dc9 Fixed issue when you create a new Statement, call getGeneratedKeys().getMetaData().
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 716
diff changeset
1284 columns[0] = "GENERATED_KEY";
224d73363dc9 Fixed issue when you create a new Statement, call getGeneratedKeys().getMetaData().
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 716
diff changeset
1285 types[0] = "bigint";
224d73363dc9 Fixed issue when you create a new Statement, call getGeneratedKeys().getMetaData().
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 716
diff changeset
1286 jdbcTypes[0] = Types.BIGINT;
224d73363dc9 Fixed issue when you create a new Statement, call getGeneratedKeys().getMetaData().
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 716
diff changeset
1287 lengths[0] = 20;
224d73363dc9 Fixed issue when you create a new Statement, call getGeneratedKeys().getMetaData().
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 716
diff changeset
1288 precisions[0] = 19;
224d73363dc9 Fixed issue when you create a new Statement, call getGeneratedKeys().getMetaData().
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 716
diff changeset
1289 scales[0] = 0;
224d73363dc9 Fixed issue when you create a new Statement, call getGeneratedKeys().getMetaData().
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 716
diff changeset
1290 rsmd = new MonetResultSetMetaData((MonetConnection) getStatement().getConnection(), 1,
224d73363dc9 Fixed issue when you create a new Statement, call getGeneratedKeys().getMetaData().
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 716
diff changeset
1291 schemas, tables, columns, types, jdbcTypes, lengths, precisions, scales);
224d73363dc9 Fixed issue when you create a new Statement, call getGeneratedKeys().getMetaData().
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 716
diff changeset
1292 }
713
c3c424a90a42 Improve implementation of ResultSet.getMetaData().
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 709
diff changeset
1293 }
c3c424a90a42 Improve implementation of ResultSet.getMetaData().
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 709
diff changeset
1294 return rsmd;
c3c424a90a42 Improve implementation of ResultSet.getMetaData().
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 709
diff changeset
1295 }
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1296
713
c3c424a90a42 Improve implementation of ResultSet.getMetaData().
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 709
diff changeset
1297 /**
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1298 * Gets the value of the designated column in the current row of this
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1299 * ResultSet object as an Object in the Java programming language.
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1300 *
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1301 * This method will return the value of the given column as a Java object.
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1302 * The type of the Java object will be the default Java object type
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1303 * corresponding to the column's SQL type, following the mapping for
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1304 * built-in types specified in the JDBC specification. If the value is
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1305 * an SQL NULL, the driver returns a Java null.
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1306 *
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1307 * This method may also be used to read database-specific abstract data
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1308 * types. In the JDBC 2.0 API, the behavior of method getObject is extended
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1309 * to materialize data of SQL user-defined types. When a column contains a
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1310 * structured or distinct value, the behavior of this method is as if it
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1311 * were a call to: getObject(columnIndex, this.getStatement().getConnection().getTypeMap()).
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1312 *
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1313 * @param columnIndex the first column is 1, the second is 2, ...
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1314 * @return a java.lang.Object holding the column value or null
187
daa1a4c70879 For MonetresultSet class: added method checkNotClosed() and invocation for all methods which should test it.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 180
diff changeset
1315 * @throws SQLException if a database access error occurs or this method is called on a closed result set
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1316 */
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1317 @Override
296
c5efd6e661e5 Add "final" keyword to classes, method arguments and local variables where possible.`
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 292
diff changeset
1318 public Object getObject(final int columnIndex) throws SQLException {
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1319 // Many generic JDBC programs use getObject(colnr) to retrieve value objects from a resultset
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1320 // For speed the implementation should be as fast as possible, so avoid method calls (by inlining code) where possible
187
daa1a4c70879 For MonetresultSet class: added method checkNotClosed() and invocation for all methods which should test it.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 180
diff changeset
1321 checkNotClosed();
daa1a4c70879 For MonetresultSet class: added method checkNotClosed() and invocation for all methods which should test it.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 180
diff changeset
1322
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1323 final int JdbcType;
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1324 final String val;
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1325 try {
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1326 val = tlp.values[columnIndex - 1];
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1327 if (val == null) {
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1328 lastReadWasNull = true;
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1329 return null;
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1330 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1331 lastReadWasNull = false;
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1332 JdbcType = JdbcSQLTypes[columnIndex - 1];
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1333 } catch (IndexOutOfBoundsException e) {
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1334 throw newSQLInvalidColumnIndexException(columnIndex);
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1335 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1336
773
2bd1983f1c11 Reduce code by importing java.sql.Date; and remove prefix java.sql. where no longer needed.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 769
diff changeset
1337 switch (JdbcType) {
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1338 case Types.TINYINT:
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1339 case Types.SMALLINT:
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1340 try {
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1341 return Short.valueOf(val);
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1342 } catch (NumberFormatException e) {
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1343 return val;
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1344 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1345 case Types.INTEGER:
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1346 try {
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1347 return Integer.valueOf(val);
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1348 } catch (NumberFormatException e) {
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1349 return val;
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1350 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1351 case Types.BIGINT:
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1352 try {
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1353 return Long.valueOf(val);
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1354 } catch (NumberFormatException e) {
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1355 return val;
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1356 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1357 case Types.DOUBLE:
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1358 case Types.FLOAT:
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1359 try {
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1360 return Double.valueOf(val);
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1361 } catch (NumberFormatException e) {
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1362 return val;
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1363 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1364 case Types.REAL:
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1365 try {
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1366 return Float.valueOf(val);
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1367 } catch (NumberFormatException e) {
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1368 return val;
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1369 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1370 case Types.DECIMAL:
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1371 case Types.NUMERIC:
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1372 try {
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1373 return new BigDecimal(val);
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1374 } catch (NumberFormatException e) {
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1375 return val;
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1376 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1377 case Types.BOOLEAN:
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1378 return Boolean.valueOf(val);
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1379 case Types.VARCHAR:
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1380 {
642
dd9b4fb14256 Added recognition of 'xml' type.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 623
diff changeset
1381 // The MonetDB types: inet, json, url, uuid and xml are all mapped to Types.VARCHAR in MonetDriver.typeMap
dd9b4fb14256 Added recognition of 'xml' type.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 623
diff changeset
1382 // For these MonetDB types (except json and xml, see comments below) we try to create objects of the corresponding class.
296
c5efd6e661e5 Add "final" keyword to classes, method arguments and local variables where possible.`
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 292
diff changeset
1383 final String MonetDBType = types[columnIndex - 1];
26
46dde2b2c991 Small code improvements
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 25
diff changeset
1384 switch (MonetDBType.length()) {
46dde2b2c991 Small code improvements
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 25
diff changeset
1385 case 3:
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1386 if ("url".equals(MonetDBType)) {
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1387 try {
391
f523727db392 Moved Java classes from packages starting with nl.cwi.monetdb.* to package org.monetdb.*
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 384
diff changeset
1388 final org.monetdb.jdbc.types.URL url_obj = new org.monetdb.jdbc.types.URL();
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1389 url_obj.fromString(val);
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1390 return url_obj;
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1391 } catch (Exception exc) {
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1392 // ignore exception and just return the val String object
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1393 return val;
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1394 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1395 }
26
46dde2b2c991 Small code improvements
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 25
diff changeset
1396 break;
46dde2b2c991 Small code improvements
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 25
diff changeset
1397 case 4:
46dde2b2c991 Small code improvements
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 25
diff changeset
1398 if ("inet".equals(MonetDBType)) {
46dde2b2c991 Small code improvements
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 25
diff changeset
1399 try {
391
f523727db392 Moved Java classes from packages starting with nl.cwi.monetdb.* to package org.monetdb.*
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 384
diff changeset
1400 final org.monetdb.jdbc.types.INET inet_obj = new org.monetdb.jdbc.types.INET();
26
46dde2b2c991 Small code improvements
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 25
diff changeset
1401 inet_obj.fromString(val);
46dde2b2c991 Small code improvements
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 25
diff changeset
1402 return inet_obj;
46dde2b2c991 Small code improvements
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 25
diff changeset
1403 } catch (Exception exc) {
46dde2b2c991 Small code improvements
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 25
diff changeset
1404 // ignore exception and just return the val String object
46dde2b2c991 Small code improvements
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 25
diff changeset
1405 return val;
46dde2b2c991 Small code improvements
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 25
diff changeset
1406 }
46dde2b2c991 Small code improvements
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 25
diff changeset
1407 } else
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1408 if ("uuid".equals(MonetDBType)) {
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1409 try {
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1410 return java.util.UUID.fromString(val);
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1411 } catch (IllegalArgumentException exc) {
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1412 // ignore exception and just return the val String object
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1413 return val;
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1414 }
26
46dde2b2c991 Small code improvements
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 25
diff changeset
1415 // } else
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1416 // if ("json".equals(MonetDBType)) {
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1417 // There is no support for JSON in standard java class libraries.
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1418 // Possibly we could use org.json.simple.JSONObject or other/faster libs
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1419 // javax.json.Json is not released yet (see https://json-processing-spec.java.net/)
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1420 // see also https://github.com/fabienrenaud/java-json-benchmark
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1421 // Note that it would make our JDBC driver dependent of an external jar
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1422 // and we don't want that so simply return it as String object
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1423 // return val;
26
46dde2b2c991 Small code improvements
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 25
diff changeset
1424 }
46dde2b2c991 Small code improvements
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 25
diff changeset
1425 break;
46dde2b2c991 Small code improvements
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 25
diff changeset
1426 }
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1427 return val;
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1428 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1429 case Types.CHAR:
735
3dd0d43014e8 Disable checks for Types.LONGVARCHAR and Types.LONGVARBINARY as MonetDB server does not support these data types, and no mappings exists to these JDBC Types and thus these cases will never be reached in JDBC Driver.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 725
diff changeset
1430 /* case Types.LONGVARCHAR: // MonetDB doesn't use type LONGVARCHAR */
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1431 return val;
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1432 case Types.CLOB:
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1433 return new MonetClob(val);
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1434 case Types.BLOB:
329
05c7989eae91 Removed duplicate code for converting a string of hex characters into a byte array, done both in MonetBlob.create() and in MonetResultSet.getBytes().
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 296
diff changeset
1435 return new MonetBlob(val);
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1436 case Types.DATE:
151
3d5ea891bb74 Update implementation to match the JDBC spec so use
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 145
diff changeset
1437 return getDate(columnIndex, null);
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1438 case Types.TIME:
820
4c35009cd59c In ResultSet.getObject() method added support for retrieving
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 774
diff changeset
1439 return getTime(columnIndex, null);
380
bf521f343172 Added support for new Java 8 java.sql.Types: Types.TIME_WITH_TIMEZONE and Types.TIMESTAMP_WITH_TIMEZONE.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 377
diff changeset
1440 case Types.TIME_WITH_TIMEZONE:
820
4c35009cd59c In ResultSet.getObject() method added support for retrieving
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 774
diff changeset
1441 return getOffsetTime(columnIndex);
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1442 case Types.TIMESTAMP:
820
4c35009cd59c In ResultSet.getObject() method added support for retrieving
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 774
diff changeset
1443 return getTimestamp(columnIndex, null);
380
bf521f343172 Added support for new Java 8 java.sql.Types: Types.TIME_WITH_TIMEZONE and Types.TIMESTAMP_WITH_TIMEZONE.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 377
diff changeset
1444 case Types.TIMESTAMP_WITH_TIMEZONE:
820
4c35009cd59c In ResultSet.getObject() method added support for retrieving
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 774
diff changeset
1445 return getOffsetDateTime(columnIndex);
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1446 case Types.BINARY:
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1447 case Types.VARBINARY:
735
3dd0d43014e8 Disable checks for Types.LONGVARCHAR and Types.LONGVARBINARY as MonetDB server does not support these data types, and no mappings exists to these JDBC Types and thus these cases will never be reached in JDBC Driver.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 725
diff changeset
1448 /* case Types.LONGVARBINARY: // MonetDB doesn't use type LONGVARBINARY */
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1449 return getBytes(columnIndex);
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1450 case Types.OTHER:
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1451 default:
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1452 // When we get here the column type is a non-standard JDBC SQL type, possibly a User Defined Type.
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1453 // Just call getObject(int, Map) for those rare cases.
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1454 return getObject(columnIndex, this.getStatement().getConnection().getTypeMap());
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1455 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1456 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1457
296
c5efd6e661e5 Add "final" keyword to classes, method arguments and local variables where possible.`
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 292
diff changeset
1458 private final boolean classImplementsSQLData(final Class<?> cl) {
c5efd6e661e5 Add "final" keyword to classes, method arguments and local variables where possible.`
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 292
diff changeset
1459 final Class<?>[] cls = cl.getInterfaces();
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1460 for (int i = 0; i < cls.length; i++) {
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1461 if (cls[i] == SQLData.class)
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1462 return true;
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1463 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1464 return false;
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1465 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1466
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1467 /**
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1468 * Gets the value of the designated column in the current row of this
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1469 * ResultSet object as an Object in the Java programming language.
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1470 *
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1471 * This method will return the value of the given column as a Java object.
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1472 * The type of the Java object will be the default Java object type corresponding
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1473 * to the column's SQL type, following the mapping for built-in types specified
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1474 * in the JDBC specification.
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1475 * If the value is an SQL NULL, the driver returns a Java null.
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1476 *
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1477 * This method may also be used to read database-specific abstract data types.
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1478 * In the JDBC 2.0 API, the behavior of method getObject is extended to
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1479 * materialize data of SQL user-defined types.
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1480 *
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1481 * If Connection.getTypeMap does not throw a SQLFeatureNotSupportedException, then
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1482 * when a column contains a structured or distinct value, the behavior of this
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1483 * method is as if it were a call to: getObject(columnIndex,
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1484 * this.getStatement().getConnection().getTypeMap()).
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1485 * If Connection.getTypeMap does throw a SQLFeatureNotSupportedException, then
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1486 * structured values are not supported, and distinct values are mapped to the
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1487 * default Java class as determined by the underlying SQL type of the DISTINCT type.
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1488 *
151
3d5ea891bb74 Update implementation to match the JDBC spec so use
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 145
diff changeset
1489 * @param columnIndex the first column is 1, the second is 2, ...
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1490 * @param map a java.util.Map object that contains the mapping from SQL
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1491 * type names to classes in the Java programming language
187
daa1a4c70879 For MonetresultSet class: added method checkNotClosed() and invocation for all methods which should test it.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 180
diff changeset
1492 * @return an Object in the Java programming language representing the SQL value
daa1a4c70879 For MonetresultSet class: added method checkNotClosed() and invocation for all methods which should test it.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 180
diff changeset
1493 * @throws SQLException if a database access error occurs or this method is called on a closed result set
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1494 */
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1495 @Override
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1496 @SuppressWarnings("unchecked")
296
c5efd6e661e5 Add "final" keyword to classes, method arguments and local variables where possible.`
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 292
diff changeset
1497 public Object getObject(final int columnIndex, final Map<String,Class<?>> map)
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1498 throws SQLException
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1499 {
187
daa1a4c70879 For MonetresultSet class: added method checkNotClosed() and invocation for all methods which should test it.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 180
diff changeset
1500 checkNotClosed();
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1501 final String val;
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1502 final String MonetDBtype;
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1503 try {
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1504 val = tlp.values[columnIndex - 1];
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1505 if (val == null) {
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1506 lastReadWasNull = true;
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1507 return null;
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1508 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1509 lastReadWasNull = false;
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1510 MonetDBtype = types[columnIndex - 1];
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1511 } catch (IndexOutOfBoundsException e) {
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1512 throw newSQLInvalidColumnIndexException(columnIndex);
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1513 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1514
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1515 Class<?> type = null;
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1516 if (map != null && map.containsKey(MonetDBtype)) {
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1517 type = map.get(MonetDBtype);
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1518 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1519 if (type == null) {
296
c5efd6e661e5 Add "final" keyword to classes, method arguments and local variables where possible.`
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 292
diff changeset
1520 // fallback to the standard SQL type Class mappings
714
ad7b08ef7745 Moving static method getClassForType() from MonetResulSet to MonetDriver class which is a much more logical place.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 713
diff changeset
1521 type = MonetDriver.getClassForType(JdbcSQLTypes[columnIndex - 1]);
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1522 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1523
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1524 if (type == null || type == String.class) {
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1525 return val;
820
4c35009cd59c In ResultSet.getObject() method added support for retrieving
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 774
diff changeset
1526 }
4c35009cd59c In ResultSet.getObject() method added support for retrieving
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 774
diff changeset
1527 if (type == BigDecimal.class) {
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1528 return getBigDecimal(columnIndex);
820
4c35009cd59c In ResultSet.getObject() method added support for retrieving
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 774
diff changeset
1529 }
4c35009cd59c In ResultSet.getObject() method added support for retrieving
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 774
diff changeset
1530 if (type == Boolean.class) {
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1531 return Boolean.valueOf(getBoolean(columnIndex));
820
4c35009cd59c In ResultSet.getObject() method added support for retrieving
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 774
diff changeset
1532 }
4c35009cd59c In ResultSet.getObject() method added support for retrieving
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 774
diff changeset
1533 if (type == Integer.class) {
4c35009cd59c In ResultSet.getObject() method added support for retrieving
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 774
diff changeset
1534 return Integer.valueOf(getInt(columnIndex));
4c35009cd59c In ResultSet.getObject() method added support for retrieving
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 774
diff changeset
1535 }
4c35009cd59c In ResultSet.getObject() method added support for retrieving
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 774
diff changeset
1536 if (type == Long.class) {
4c35009cd59c In ResultSet.getObject() method added support for retrieving
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 774
diff changeset
1537 return Long.valueOf(getLong(columnIndex));
4c35009cd59c In ResultSet.getObject() method added support for retrieving
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 774
diff changeset
1538 }
4c35009cd59c In ResultSet.getObject() method added support for retrieving
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 774
diff changeset
1539 if (type == Short.class) {
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1540 return Short.valueOf(getShort(columnIndex));
820
4c35009cd59c In ResultSet.getObject() method added support for retrieving
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 774
diff changeset
1541 }
4c35009cd59c In ResultSet.getObject() method added support for retrieving
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 774
diff changeset
1542 if (type == Double.class) {
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1543 return Double.valueOf(getDouble(columnIndex));
820
4c35009cd59c In ResultSet.getObject() method added support for retrieving
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 774
diff changeset
1544 }
4c35009cd59c In ResultSet.getObject() method added support for retrieving
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 774
diff changeset
1545 if (type == Float.class) {
4c35009cd59c In ResultSet.getObject() method added support for retrieving
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 774
diff changeset
1546 return Float.valueOf(getFloat(columnIndex));
4c35009cd59c In ResultSet.getObject() method added support for retrieving
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 774
diff changeset
1547 }
4c35009cd59c In ResultSet.getObject() method added support for retrieving
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 774
diff changeset
1548 if (type == Date.class) {
151
3d5ea891bb74 Update implementation to match the JDBC spec so use
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 145
diff changeset
1549 return getDate(columnIndex, null);
820
4c35009cd59c In ResultSet.getObject() method added support for retrieving
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 774
diff changeset
1550 }
4c35009cd59c In ResultSet.getObject() method added support for retrieving
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 774
diff changeset
1551 if (type == Time.class) {
151
3d5ea891bb74 Update implementation to match the JDBC spec so use
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 145
diff changeset
1552 return getTime(columnIndex, null);
820
4c35009cd59c In ResultSet.getObject() method added support for retrieving
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 774
diff changeset
1553 }
4c35009cd59c In ResultSet.getObject() method added support for retrieving
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 774
diff changeset
1554 if (type == Timestamp.class) {
151
3d5ea891bb74 Update implementation to match the JDBC spec so use
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 145
diff changeset
1555 return getTimestamp(columnIndex, null);
820
4c35009cd59c In ResultSet.getObject() method added support for retrieving
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 774
diff changeset
1556 }
832
7eb05cbf67dc In ResultSet.getObject(column, Class<T> type) and ResultSet.getObject(column, Map<String,Class<?>>) methods added support to return objects for classes: java.time.LocalDate, java.time.LocalDateTime.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 820
diff changeset
1557 if (type == LocalDate.class) {
7eb05cbf67dc In ResultSet.getObject(column, Class<T> type) and ResultSet.getObject(column, Map<String,Class<?>>) methods added support to return objects for classes: java.time.LocalDate, java.time.LocalDateTime.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 820
diff changeset
1558 return getLocalDate(columnIndex);
7eb05cbf67dc In ResultSet.getObject(column, Class<T> type) and ResultSet.getObject(column, Map<String,Class<?>>) methods added support to return objects for classes: java.time.LocalDate, java.time.LocalDateTime.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 820
diff changeset
1559 }
7eb05cbf67dc In ResultSet.getObject(column, Class<T> type) and ResultSet.getObject(column, Map<String,Class<?>>) methods added support to return objects for classes: java.time.LocalDate, java.time.LocalDateTime.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 820
diff changeset
1560 if (type == LocalDateTime.class) {
7eb05cbf67dc In ResultSet.getObject(column, Class<T> type) and ResultSet.getObject(column, Map<String,Class<?>>) methods added support to return objects for classes: java.time.LocalDate, java.time.LocalDateTime.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 820
diff changeset
1561 return getLocalDateTime(columnIndex);
7eb05cbf67dc In ResultSet.getObject(column, Class<T> type) and ResultSet.getObject(column, Map<String,Class<?>>) methods added support to return objects for classes: java.time.LocalDate, java.time.LocalDateTime.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 820
diff changeset
1562 }
7eb05cbf67dc In ResultSet.getObject(column, Class<T> type) and ResultSet.getObject(column, Map<String,Class<?>>) methods added support to return objects for classes: java.time.LocalDate, java.time.LocalDateTime.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 820
diff changeset
1563 if (type == LocalTime.class) {
7eb05cbf67dc In ResultSet.getObject(column, Class<T> type) and ResultSet.getObject(column, Map<String,Class<?>>) methods added support to return objects for classes: java.time.LocalDate, java.time.LocalDateTime.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 820
diff changeset
1564 return getLocalTime(columnIndex);
820
4c35009cd59c In ResultSet.getObject() method added support for retrieving
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 774
diff changeset
1565 }
4c35009cd59c In ResultSet.getObject() method added support for retrieving
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 774
diff changeset
1566 if (type == OffsetDateTime.class) {
4c35009cd59c In ResultSet.getObject() method added support for retrieving
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 774
diff changeset
1567 return getOffsetDateTime(columnIndex);
4c35009cd59c In ResultSet.getObject() method added support for retrieving
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 774
diff changeset
1568 }
832
7eb05cbf67dc In ResultSet.getObject(column, Class<T> type) and ResultSet.getObject(column, Map<String,Class<?>>) methods added support to return objects for classes: java.time.LocalDate, java.time.LocalDateTime.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 820
diff changeset
1569 if (type == OffsetTime.class) {
7eb05cbf67dc In ResultSet.getObject(column, Class<T> type) and ResultSet.getObject(column, Map<String,Class<?>>) methods added support to return objects for classes: java.time.LocalDate, java.time.LocalDateTime.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 820
diff changeset
1570 return getOffsetTime(columnIndex);
7eb05cbf67dc In ResultSet.getObject(column, Class<T> type) and ResultSet.getObject(column, Map<String,Class<?>>) methods added support to return objects for classes: java.time.LocalDate, java.time.LocalDateTime.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 820
diff changeset
1571 }
820
4c35009cd59c In ResultSet.getObject() method added support for retrieving
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 774
diff changeset
1572 if (type == Clob.class) {
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1573 return getClob(columnIndex);
820
4c35009cd59c In ResultSet.getObject() method added support for retrieving
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 774
diff changeset
1574 }
4c35009cd59c In ResultSet.getObject() method added support for retrieving
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 774
diff changeset
1575 if (type == Blob.class) {
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1576 return getBlob(columnIndex);
820
4c35009cd59c In ResultSet.getObject() method added support for retrieving
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 774
diff changeset
1577 }
4c35009cd59c In ResultSet.getObject() method added support for retrieving
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 774
diff changeset
1578 if (type == byte[].class) {
4c35009cd59c In ResultSet.getObject() method added support for retrieving
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 774
diff changeset
1579 return getBytes(columnIndex);
4c35009cd59c In ResultSet.getObject() method added support for retrieving
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 774
diff changeset
1580 }
4c35009cd59c In ResultSet.getObject() method added support for retrieving
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 774
diff changeset
1581 if (classImplementsSQLData(type)) {
296
c5efd6e661e5 Add "final" keyword to classes, method arguments and local variables where possible.`
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 292
diff changeset
1582 final SQLData x;
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1583 try {
296
c5efd6e661e5 Add "final" keyword to classes, method arguments and local variables where possible.`
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 292
diff changeset
1584 final java.lang.reflect.Constructor<? extends SQLData> ctor =
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1585 ((Class)type).getConstructor();
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1586 x = ctor.newInstance();
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1587 } catch (NoSuchMethodException nsme) {
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1588 throw new SQLException(nsme.getMessage(), "M0M27");
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1589 } catch (InstantiationException ie) {
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1590 throw new SQLException(ie.getMessage(), "M0M27");
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1591 } catch (IllegalAccessException iae) {
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1592 throw new SQLException(iae.getMessage(), "M0M27");
296
c5efd6e661e5 Add "final" keyword to classes, method arguments and local variables where possible.`
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 292
diff changeset
1593 } catch (java.lang.reflect.InvocationTargetException ite) {
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1594 throw new SQLException(ite.getMessage(), "M0M27");
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1595 } catch (SecurityException se) {
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1596 throw new SQLException(se.getMessage(), "M0M27");
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1597 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1598 final int colnum = columnIndex;
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1599 final boolean valwasnull = wasNull();
296
c5efd6e661e5 Add "final" keyword to classes, method arguments and local variables where possible.`
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 292
diff changeset
1600 final SQLInput input = new SQLInput() {
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1601 @Override
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1602 public String readString() throws SQLException {
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1603 return getString(colnum);
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1604 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1605
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1606 @Override
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1607 public boolean readBoolean() throws SQLException {
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1608 return getBoolean(colnum);
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1609 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1610
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1611 @Override
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1612 public byte readByte() throws SQLException {
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1613 return getByte(colnum);
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1614 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1615
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1616 @Override
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1617 public short readShort() throws SQLException {
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1618 return getShort(colnum);
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1619 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1620
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1621 @Override
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1622 public int readInt() throws SQLException {
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1623 return getInt(colnum);
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1624 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1625
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1626 @Override
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1627 public long readLong() throws SQLException {
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1628 return getLong(colnum);
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1629 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1630
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1631 @Override
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1632 public float readFloat() throws SQLException {
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1633 return getFloat(colnum);
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1634 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1635
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1636 @Override
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1637 public double readDouble() throws SQLException {
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1638 return getDouble(colnum);
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1639 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1640
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1641 @Override
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1642 public BigDecimal readBigDecimal() throws SQLException {
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1643 return getBigDecimal(colnum);
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1644 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1645
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1646 @Override
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1647 public byte[] readBytes() throws SQLException {
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1648 return getBytes(colnum);
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1649 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1650
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1651 @Override
773
2bd1983f1c11 Reduce code by importing java.sql.Date; and remove prefix java.sql. where no longer needed.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 769
diff changeset
1652 public Date readDate() throws SQLException {
151
3d5ea891bb74 Update implementation to match the JDBC spec so use
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 145
diff changeset
1653 return getDate(colnum, null);
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1654 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1655
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1656 @Override
773
2bd1983f1c11 Reduce code by importing java.sql.Date; and remove prefix java.sql. where no longer needed.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 769
diff changeset
1657 public Time readTime() throws SQLException {
151
3d5ea891bb74 Update implementation to match the JDBC spec so use
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 145
diff changeset
1658 return getTime(colnum, null);
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1659 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1660
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1661 @Override
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1662 public Timestamp readTimestamp() throws SQLException {
151
3d5ea891bb74 Update implementation to match the JDBC spec so use
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 145
diff changeset
1663 return getTimestamp(colnum, null);
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1664 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1665
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1666 @Override
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1667 public Reader readCharacterStream() throws SQLException {
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1668 return getCharacterStream(colnum);
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1669 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1670
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1671 @Override
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1672 public InputStream readAsciiStream() throws SQLException {
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1673 return getAsciiStream(colnum);
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1674 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1675
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1676 @Override
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1677 public InputStream readBinaryStream() throws SQLException {
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1678 return getBinaryStream(colnum);
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1679 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1680
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1681 @Override
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1682 public Object readObject() throws SQLException {
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1683 return getObject(colnum);
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1684 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1685
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1686 @Override
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1687 public Ref readRef() throws SQLException {
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1688 return getRef(colnum);
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1689 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1690
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1691 @Override
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1692 public Blob readBlob() throws SQLException {
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1693 return getBlob(colnum);
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1694 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1695
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1696 @Override
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1697 public Clob readClob() throws SQLException {
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1698 return getClob(colnum);
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1699 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1700
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1701 @Override
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1702 public Array readArray() throws SQLException {
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1703 return getArray(colnum);
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1704 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1705
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1706 @Override
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1707 public boolean wasNull() throws SQLException {
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1708 return valwasnull;
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1709 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1710
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1711 @Override
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1712 public URL readURL() throws SQLException {
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1713 return getURL(colnum);
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1714 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1715
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1716 @Override
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1717 public NClob readNClob() throws SQLException {
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1718 return getNClob(colnum);
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1719 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1720
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1721 @Override
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1722 public String readNString() throws SQLException {
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1723 return getNString(colnum);
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1724 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1725
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1726 @Override
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1727 public SQLXML readSQLXML() throws SQLException {
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1728 return getSQLXML(colnum);
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1729 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1730
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1731 @Override
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1732 public RowId readRowId() throws SQLException {
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1733 return getRowId(colnum);
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1734 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1735 };
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1736 x.readSQL(input, MonetDBtype);
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1737 return x;
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1738 }
820
4c35009cd59c In ResultSet.getObject() method added support for retrieving
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 774
diff changeset
1739 return val;
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1740 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1741
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1742 /**
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1743 * Gets the value of the designated column in the current row of this
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1744 * ResultSet object as an Object in the Java programming language.
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1745 *
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1746 * This method will return the value of the given column as a Java object.
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1747 * The type of the Java object will be the default Java object type
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1748 * corresponding to the column's SQL type, following the mapping for
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1749 * built-in types specified in the JDBC specification. If the value is an
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1750 * SQL NULL, the driver returns a Java null.
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1751 *
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1752 * This method may also be used to read database-specific abstract data
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1753 * types.
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1754 *
151
3d5ea891bb74 Update implementation to match the JDBC spec so use
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 145
diff changeset
1755 * @param columnLabel the SQL name of the column
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1756 * @return a java.lang.Object holding the column value
187
daa1a4c70879 For MonetresultSet class: added method checkNotClosed() and invocation for all methods which should test it.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 180
diff changeset
1757 * @throws SQLException if a database access error occurs or this method is called on a closed result set
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1758 */
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1759 @Override
296
c5efd6e661e5 Add "final" keyword to classes, method arguments and local variables where possible.`
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 292
diff changeset
1760 public Object getObject(final String columnLabel) throws SQLException {
151
3d5ea891bb74 Update implementation to match the JDBC spec so use
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 145
diff changeset
1761 return getObject(findColumn(columnLabel));
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1762 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1763
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1764 /**
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1765 * Retrieves the value of the designated column in the current row of this
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1766 * ResultSet object as an Object in the Java programming language. If the
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1767 * value is an SQL NULL, the driver returns a Java null. This method uses
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1768 * the specified Map object for custom mapping if appropriate.
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1769 *
151
3d5ea891bb74 Update implementation to match the JDBC spec so use
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 145
diff changeset
1770 * @param columnLabel the name of the column from which to retrieve the value
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1771 * @param map a java.util.Map object that contains the mapping from SQL
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1772 * type names to classes in the Java programming language
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1773 * @return an Object representing the SQL value in the specified column
187
daa1a4c70879 For MonetresultSet class: added method checkNotClosed() and invocation for all methods which should test it.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 180
diff changeset
1774 * @throws SQLException if a database access error occurs or this method is called on a closed result set
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1775 */
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1776 @Override
296
c5efd6e661e5 Add "final" keyword to classes, method arguments and local variables where possible.`
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 292
diff changeset
1777 public Object getObject(final String columnLabel, final Map<String,Class<?>> map) throws SQLException {
151
3d5ea891bb74 Update implementation to match the JDBC spec so use
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 145
diff changeset
1778 return getObject(findColumn(columnLabel), map);
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1779 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1780
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1781 @Override
151
3d5ea891bb74 Update implementation to match the JDBC spec so use
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 145
diff changeset
1782 public Ref getRef(int columnIndex) throws SQLException {
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1783 throw newSQLFeatureNotSupportedException("getRef");
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1784 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1785
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1786 @Override
296
c5efd6e661e5 Add "final" keyword to classes, method arguments and local variables where possible.`
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 292
diff changeset
1787 public Ref getRef(final String columnLabel) throws SQLException {
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1788 throw newSQLFeatureNotSupportedException("getRef");
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1789 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1790
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1791 /**
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1792 * Retrieves the current row number. The first row is number 1, the second
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1793 * number 2, and so on.
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1794 *
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1795 * @return the current row number; 0 if there is no current row
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1796 */
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1797 @Override
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1798 public int getRow() {
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1799 return curRow;
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1800 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1801
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1802 /**
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1803 * Retrieves the value of the designated column in the current row
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1804 * of this ResultSet object as a java.sql.RowId object in the Java
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1805 * programming language.
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1806 *
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1807 * @param columnIndex the first column is 1, the second is 2, ...
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1808 * @return the column value; if the value is SQL NULL, the value returned
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1809 * is null
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1810 * @throws SQLException if there is no such column
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1811 * @throws SQLFeatureNotSupportedException the JDBC driver does
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1812 * not support this method
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1813 */
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1814 @Override
296
c5efd6e661e5 Add "final" keyword to classes, method arguments and local variables where possible.`
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 292
diff changeset
1815 public RowId getRowId(final int columnIndex) throws SQLException {
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1816 throw newSQLFeatureNotSupportedException("getRowId");
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1817 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1818
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1819 /**
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1820 * Retrieves the value of the designated column in the current row
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1821 * of this ResultSet object as a java.sql.RowId object in the Java
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1822 * programming language.
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1823 *
151
3d5ea891bb74 Update implementation to match the JDBC spec so use
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 145
diff changeset
1824 * @param columnLabel the SQL name of the column
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1825 * @return the column value; if the value is SQL NULL, the value returned
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1826 * is null
151
3d5ea891bb74 Update implementation to match the JDBC spec so use
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 145
diff changeset
1827 * @throws SQLException if the ResultSet object does not contain columnLabel
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1828 * @throws SQLFeatureNotSupportedException the JDBC driver does
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1829 * not support this method
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1830 */
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1831 @Override
296
c5efd6e661e5 Add "final" keyword to classes, method arguments and local variables where possible.`
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 292
diff changeset
1832 public RowId getRowId(final String columnLabel) throws SQLException {
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1833 throw newSQLFeatureNotSupportedException("getRowId");
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1834 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1835
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1836 /**
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1837 * Retrieves the value of the designated column in the current row of this
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1838 * ResultSet object as a short in the Java programming language.
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1839 *
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1840 * @param columnIndex the first column is 1, the second is 2, ...
187
daa1a4c70879 For MonetresultSet class: added method checkNotClosed() and invocation for all methods which should test it.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 180
diff changeset
1841 * @return the column value; if the value is SQL NULL, the value returned is 0
daa1a4c70879 For MonetresultSet class: added method checkNotClosed() and invocation for all methods which should test it.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 180
diff changeset
1842 * @throws SQLException if there is no such column or this method is called on a closed result set
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1843 */
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1844 @Override
296
c5efd6e661e5 Add "final" keyword to classes, method arguments and local variables where possible.`
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 292
diff changeset
1845 public short getShort(final int columnIndex) throws SQLException {
187
daa1a4c70879 For MonetresultSet class: added method checkNotClosed() and invocation for all methods which should test it.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 180
diff changeset
1846 checkNotClosed();
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1847 try {
296
c5efd6e661e5 Add "final" keyword to classes, method arguments and local variables where possible.`
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 292
diff changeset
1848 final String val = tlp.values[columnIndex - 1];
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1849 if (val == null) {
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1850 lastReadWasNull = true;
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1851 return 0;
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1852 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1853 lastReadWasNull = false;
9
c37a76cc1e6e Corrected ResultSet methods: getByte(), getBigDecimal(), getShort(), getInt(), getLong(), getFloat() and getDouble()
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 8
diff changeset
1854 return Short.parseShort(val);
c37a76cc1e6e Corrected ResultSet methods: getByte(), getBigDecimal(), getShort(), getInt(), getLong(), getFloat() and getDouble()
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 8
diff changeset
1855 } catch (NumberFormatException e) {
c37a76cc1e6e Corrected ResultSet methods: getByte(), getBigDecimal(), getShort(), getInt(), getLong(), getFloat() and getDouble()
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 8
diff changeset
1856 throw newSQLNumberFormatException(e);
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1857 } catch (IndexOutOfBoundsException e) {
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1858 throw newSQLInvalidColumnIndexException(columnIndex);
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1859 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1860 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1861
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1862 /**
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1863 * Retrieves the value of the designated column in the current row of this
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1864 * ResultSet object as a short in the Java programming language.
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1865 *
151
3d5ea891bb74 Update implementation to match the JDBC spec so use
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 145
diff changeset
1866 * @param columnLabel the SQL name of the column
187
daa1a4c70879 For MonetresultSet class: added method checkNotClosed() and invocation for all methods which should test it.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 180
diff changeset
1867 * @return the column value; if the value is SQL NULL, the value returned is 0
151
3d5ea891bb74 Update implementation to match the JDBC spec so use
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 145
diff changeset
1868 * @throws SQLException if the ResultSet object does not contain columnLabel
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1869 */
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1870 @Override
296
c5efd6e661e5 Add "final" keyword to classes, method arguments and local variables where possible.`
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 292
diff changeset
1871 public short getShort(final String columnLabel) throws SQLException {
151
3d5ea891bb74 Update implementation to match the JDBC spec so use
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 145
diff changeset
1872 return getShort(findColumn(columnLabel));
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1873 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1874
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1875 /**
187
daa1a4c70879 For MonetresultSet class: added method checkNotClosed() and invocation for all methods which should test it.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 180
diff changeset
1876 * Retrieves the Statement object that produced this ResultSet object.
daa1a4c70879 For MonetresultSet class: added method checkNotClosed() and invocation for all methods which should test it.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 180
diff changeset
1877 * If the result set was generated some other way, such as by a
daa1a4c70879 For MonetresultSet class: added method checkNotClosed() and invocation for all methods which should test it.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 180
diff changeset
1878 * DatabaseMetaData method, this method may return null.
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1879 *
296
c5efd6e661e5 Add "final" keyword to classes, method arguments and local variables where possible.`
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 292
diff changeset
1880 * In our implementation we always return a non-null object, see constructors.
c5efd6e661e5 Add "final" keyword to classes, method arguments and local variables where possible.`
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 292
diff changeset
1881 * Also from subclass MonetVirtualResultSet, see its constructor.
c5efd6e661e5 Add "final" keyword to classes, method arguments and local variables where possible.`
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 292
diff changeset
1882 *
187
daa1a4c70879 For MonetresultSet class: added method checkNotClosed() and invocation for all methods which should test it.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 180
diff changeset
1883 * @return the Statement object that produced this ResultSet object or
daa1a4c70879 For MonetresultSet class: added method checkNotClosed() and invocation for all methods which should test it.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 180
diff changeset
1884 * null if the result set was produced some other way
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1885 */
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1886 @Override
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1887 public Statement getStatement() {
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1888 return statement;
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1889 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1890
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1891 /**
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1892 * Retrieves the value of the designated column in the current row of this
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1893 * ResultSet object as a String in the Java programming language.
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1894 *
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1895 * @param columnIndex the first column is 1, the second is 2, ...
187
daa1a4c70879 For MonetresultSet class: added method checkNotClosed() and invocation for all methods which should test it.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 180
diff changeset
1896 * @return the column value; if the value is SQL NULL, the value returned is null
daa1a4c70879 For MonetresultSet class: added method checkNotClosed() and invocation for all methods which should test it.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 180
diff changeset
1897 * @throws SQLException if there is no such column or this method is called on a closed result set
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1898 */
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1899 @Override
296
c5efd6e661e5 Add "final" keyword to classes, method arguments and local variables where possible.`
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 292
diff changeset
1900 public String getString(final int columnIndex) throws SQLException {
187
daa1a4c70879 For MonetresultSet class: added method checkNotClosed() and invocation for all methods which should test it.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 180
diff changeset
1901 checkNotClosed();
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1902 try {
296
c5efd6e661e5 Add "final" keyword to classes, method arguments and local variables where possible.`
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 292
diff changeset
1903 final String val = tlp.values[columnIndex - 1];
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1904 if (val == null) {
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1905 lastReadWasNull = true;
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1906 return null;
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1907 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1908 lastReadWasNull = false;
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1909 return val;
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1910 } catch (IndexOutOfBoundsException e) {
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1911 throw newSQLInvalidColumnIndexException(columnIndex);
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1912 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1913 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1914
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1915 /**
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1916 * Retrieves the value of the designated column in the current row of this
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1917 * ResultSet object as a String in the Java programming language.
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1918 *
151
3d5ea891bb74 Update implementation to match the JDBC spec so use
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 145
diff changeset
1919 * @param columnLabel the SQL name of the column
187
daa1a4c70879 For MonetresultSet class: added method checkNotClosed() and invocation for all methods which should test it.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 180
diff changeset
1920 * @return the column value; if the value is SQL NULL, the value returned is null
151
3d5ea891bb74 Update implementation to match the JDBC spec so use
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 145
diff changeset
1921 * @throws SQLException if the ResultSet object does not contain columnLabel
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1922 */
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1923 @Override
296
c5efd6e661e5 Add "final" keyword to classes, method arguments and local variables where possible.`
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 292
diff changeset
1924 public String getString(final String columnLabel) throws SQLException {
151
3d5ea891bb74 Update implementation to match the JDBC spec so use
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 145
diff changeset
1925 return getString(findColumn(columnLabel));
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1926 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1927
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1928 /**
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1929 * Retrieves the value of the designated column in the current row
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1930 * of this ResultSet object as a String in the Java programming
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1931 * language. It is intended for use when accessing NCHAR,NVARCHAR
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1932 * and LONGNVARCHAR columns.
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1933 *
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1934 * @param columnIndex the first column is 1, the second is 2, ...
187
daa1a4c70879 For MonetresultSet class: added method checkNotClosed() and invocation for all methods which should test it.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 180
diff changeset
1935 * @return the column value; if the value is SQL NULL, the value returned is null
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1936 * @throws SQLException if there is no such column
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1937 */
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1938 @Override
296
c5efd6e661e5 Add "final" keyword to classes, method arguments and local variables where possible.`
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 292
diff changeset
1939 public String getNString(final int columnIndex) throws SQLException {
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1940 return getString(columnIndex);
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1941 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1942
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1943 /**
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1944 * Retrieves the value of the designated column in the current row
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1945 * of this ResultSet object as a String in the Java programming
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1946 * language. It is intended for use when accessing NCHAR,NVARCHAR
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1947 * and LONGNVARCHAR columns.
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1948 *
151
3d5ea891bb74 Update implementation to match the JDBC spec so use
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 145
diff changeset
1949 * @param columnLabel the SQL name of the column
187
daa1a4c70879 For MonetresultSet class: added method checkNotClosed() and invocation for all methods which should test it.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 180
diff changeset
1950 * @return the column value; if the value is SQL NULL, the value returned is null
151
3d5ea891bb74 Update implementation to match the JDBC spec so use
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 145
diff changeset
1951 * @throws SQLException if the ResultSet object does not contain columnLabel
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1952 */
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1953 @Override
296
c5efd6e661e5 Add "final" keyword to classes, method arguments and local variables where possible.`
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 292
diff changeset
1954 public String getNString(final String columnLabel) throws SQLException {
152
352b54ff0436 Implemented ResultSet method getNCharacterStream()
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 151
diff changeset
1955 return getString(findColumn(columnLabel));
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1956 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1957
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1958 /**
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1959 * Retrieves the value of the designated column in the current row
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1960 * of this ResultSet as a java.sql.SQLXML object in the Java
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1961 * programming language.
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1962 *
151
3d5ea891bb74 Update implementation to match the JDBC spec so use
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 145
diff changeset
1963 * @param columnIndex the first column is 1, the second is 2, ...
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1964 * @return a SQLXML object that maps an SQL XML value
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1965 * @throws SQLException if a database access error occurs
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1966 * @throws SQLFeatureNotSupportedException the JDBC driver does
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1967 * not support this method
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1968 */
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1969 @Override
296
c5efd6e661e5 Add "final" keyword to classes, method arguments and local variables where possible.`
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 292
diff changeset
1970 public SQLXML getSQLXML(final int columnIndex) throws SQLException {
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1971 throw newSQLFeatureNotSupportedException("getSQLXML");
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1972 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1973
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1974 /**
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1975 * Retrieves the value of the designated column in the current row
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1976 * of this ResultSet as a java.sql.SQLXML object in the Java
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1977 * programming language.
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1978 *
151
3d5ea891bb74 Update implementation to match the JDBC spec so use
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 145
diff changeset
1979 * @param columnLabel the label for the column specified with the SQL AS
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1980 * clause. If the SQL AS clause was not specified, then the
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1981 * label is the name of the column
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1982 * @return a SQLXML object that maps an SQL XML value
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1983 * @throws SQLException if a database access error occurs
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1984 * @throws SQLFeatureNotSupportedException the JDBC driver does
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1985 * not support this method
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1986 */
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1987 @Override
296
c5efd6e661e5 Add "final" keyword to classes, method arguments and local variables where possible.`
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 292
diff changeset
1988 public SQLXML getSQLXML(final String columnLabel) throws SQLException {
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1989 throw newSQLFeatureNotSupportedException("getSQLXML");
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1990 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1991
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1992 // This behaviour is according table B-6 of Sun JDBC Specification 3.0
137
688cd5675466 Improved robustness of ResultSet methods:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 90
diff changeset
1993 private SimpleDateFormat dateFormat;
688cd5675466 Improved robustness of ResultSet methods:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 90
diff changeset
1994 private SimpleDateFormat timeFormat;
688cd5675466 Improved robustness of ResultSet methods:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 90
diff changeset
1995 private SimpleDateFormat timestampFormat;
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1996 /**
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1997 * Helper method which parses the date/time value for columns of type
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1998 * TIME, DATE and TIMESTAMP. For the types CHAR, VARCHAR and
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1999 * LONGVARCHAR an attempt is made to parse the date according to the
943
ff075ed5ce81 Spell check.
Sjoerd Mullender <sjoerd@acm.org>
parents: 937
diff changeset
2000 * given type. The given Calendar object is filled with the parsed
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2001 * data. Optional fractional seconds (nanos) are returned by this
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2002 * method. If the underlying type of the column is none of the
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2003 * mentioned six, January 1st 1970 0:00:00 GMT is returned.<br />
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2004 * The dates are parsed with the given Calendar.
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2005 *
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2006 * @param cal the Calendar to use/fill when parsing the date/time
554
9fa67487f38a Doc comment fixes
Joeri van Ruth <joeri.van.ruth@monetdbsolutions.com>
parents: 480
diff changeset
2007 * @param columnIndex the column to parse
187
daa1a4c70879 For MonetresultSet class: added method checkNotClosed() and invocation for all methods which should test it.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 180
diff changeset
2008 * @param type the corresponding java.sql.Types type of the calling function
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2009 * @return the fractional seconds (nanos) or -1 if the value is NULL
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2010 * @throws SQLException if a database error occurs
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2011 */
296
c5efd6e661e5 Add "final" keyword to classes, method arguments and local variables where possible.`
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 292
diff changeset
2012 private final int getJavaDate(final Calendar cal, final int columnIndex, int type)
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2013 throws SQLException
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2014 {
187
daa1a4c70879 For MonetresultSet class: added method checkNotClosed() and invocation for all methods which should test it.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 180
diff changeset
2015 checkNotClosed();
137
688cd5675466 Improved robustness of ResultSet methods:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 90
diff changeset
2016 if (cal == null)
688cd5675466 Improved robustness of ResultSet methods:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 90
diff changeset
2017 throw new IllegalArgumentException("No Calendar object given!");
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2018
198
376a15ce49e3 Improve parsing negative years.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 196
diff changeset
2019 final String monetDateStr;
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2020 final String monetDate;
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2021 final String MonetDBType;
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2022 int JdbcType;
198
376a15ce49e3 Improve parsing negative years.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 196
diff changeset
2023 boolean negativeYear = false;
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2024 try {
198
376a15ce49e3 Improve parsing negative years.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 196
diff changeset
2025 monetDateStr = tlp.values[columnIndex - 1];
376a15ce49e3 Improve parsing negative years.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 196
diff changeset
2026 if (monetDateStr == null) {
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2027 lastReadWasNull = true;
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2028 return -1;
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2029 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2030 lastReadWasNull = false;
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2031 MonetDBType = types[columnIndex - 1];
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2032 JdbcType = JdbcSQLTypes[columnIndex - 1];
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2033 // If we got a string type, set the JdbcType to the given type
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2034 // so we attempt to parse it as the caller thinks it is.
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2035 if (JdbcType == Types.CHAR ||
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2036 JdbcType == Types.VARCHAR ||
735
3dd0d43014e8 Disable checks for Types.LONGVARCHAR and Types.LONGVARBINARY as MonetDB server does not support these data types, and no mappings exists to these JDBC Types and thus these cases will never be reached in JDBC Driver.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 725
diff changeset
2037 /* JdbcType == Types.LONGVARCHAR || // MonetDB doesn't use type LONGVARCHAR */
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2038 JdbcType == Types.CLOB)
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2039 {
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2040 JdbcType = type;
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2041 }
198
376a15ce49e3 Improve parsing negative years.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 196
diff changeset
2042
380
bf521f343172 Added support for new Java 8 java.sql.Types: Types.TIME_WITH_TIMEZONE and Types.TIMESTAMP_WITH_TIMEZONE.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 377
diff changeset
2043 if ((JdbcType == Types.DATE || JdbcType == Types.TIMESTAMP || JdbcType == Types.TIMESTAMP_WITH_TIMEZONE)
bf521f343172 Added support for new Java 8 java.sql.Types: Types.TIME_WITH_TIMEZONE and Types.TIMESTAMP_WITH_TIMEZONE.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 377
diff changeset
2044 && monetDateStr.startsWith("-")) {
198
376a15ce49e3 Improve parsing negative years.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 196
diff changeset
2045 // the SimpleDateFormat parsers do not support to parse negative year numbers, deal with it separately
376a15ce49e3 Improve parsing negative years.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 196
diff changeset
2046 negativeYear = true;
376a15ce49e3 Improve parsing negative years.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 196
diff changeset
2047 monetDate = monetDateStr.substring(1);
376a15ce49e3 Improve parsing negative years.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 196
diff changeset
2048 } else {
376a15ce49e3 Improve parsing negative years.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 196
diff changeset
2049 monetDate = monetDateStr;
376a15ce49e3 Improve parsing negative years.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 196
diff changeset
2050 }
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2051 } catch (IndexOutOfBoundsException e) {
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2052 throw newSQLInvalidColumnIndexException(columnIndex);
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2053 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2054
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2055 TimeZone ptz = cal.getTimeZone();
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2056
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2057 // it is important to parse the time in the given timezone in
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2058 // order to get a correct (UTC) time value, hence we need to
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2059 // parse it first
26
46dde2b2c991 Small code improvements
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 25
diff changeset
2060 if (MonetDBType != null && ("timetz".equals(MonetDBType) || "timestamptz".equals(MonetDBType))) {
46dde2b2c991 Small code improvements
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 25
diff changeset
2061 int vallen = monetDate.length();
46dde2b2c991 Small code improvements
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 25
diff changeset
2062 if (vallen >= 6) {
46dde2b2c991 Small code improvements
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 25
diff changeset
2063 // MonetDB/SQL99: Sign TwoDigitHours : Minutes
46dde2b2c991 Small code improvements
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 25
diff changeset
2064 ptz = TimeZone.getTimeZone("GMT" + monetDate.substring(vallen - 6, vallen));
46dde2b2c991 Small code improvements
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 25
diff changeset
2065 }
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2066 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2067
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2068 java.util.Date pdate = null;
137
688cd5675466 Improved robustness of ResultSet methods:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 90
diff changeset
2069 final java.text.ParsePosition ppos = new java.text.ParsePosition(0);
773
2bd1983f1c11 Reduce code by importing java.sql.Date; and remove prefix java.sql. where no longer needed.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 769
diff changeset
2070 switch (JdbcType) {
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2071 case Types.DATE:
137
688cd5675466 Improved robustness of ResultSet methods:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 90
diff changeset
2072 if (dateFormat == null) {
688cd5675466 Improved robustness of ResultSet methods:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 90
diff changeset
2073 // first time usage, create and keep the dateFormat object for next usage
688cd5675466 Improved robustness of ResultSet methods:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 90
diff changeset
2074 dateFormat = new SimpleDateFormat("yyyy-MM-dd");
688cd5675466 Improved robustness of ResultSet methods:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 90
diff changeset
2075 }
688cd5675466 Improved robustness of ResultSet methods:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 90
diff changeset
2076 dateFormat.setTimeZone(ptz);
688cd5675466 Improved robustness of ResultSet methods:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 90
diff changeset
2077 pdate = dateFormat.parse(monetDate, ppos);
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2078 break;
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2079 case Types.TIME:
380
bf521f343172 Added support for new Java 8 java.sql.Types: Types.TIME_WITH_TIMEZONE and Types.TIMESTAMP_WITH_TIMEZONE.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 377
diff changeset
2080 case Types.TIME_WITH_TIMEZONE:
137
688cd5675466 Improved robustness of ResultSet methods:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 90
diff changeset
2081 if (timeFormat == null) {
688cd5675466 Improved robustness of ResultSet methods:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 90
diff changeset
2082 // first time usage, create and keep the timeFormat object for next usage
688cd5675466 Improved robustness of ResultSet methods:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 90
diff changeset
2083 timeFormat = new SimpleDateFormat("HH:mm:ss");
688cd5675466 Improved robustness of ResultSet methods:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 90
diff changeset
2084 }
688cd5675466 Improved robustness of ResultSet methods:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 90
diff changeset
2085 timeFormat.setTimeZone(ptz);
688cd5675466 Improved robustness of ResultSet methods:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 90
diff changeset
2086 pdate = timeFormat.parse(monetDate, ppos);
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2087 break;
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2088 case Types.TIMESTAMP:
380
bf521f343172 Added support for new Java 8 java.sql.Types: Types.TIME_WITH_TIMEZONE and Types.TIMESTAMP_WITH_TIMEZONE.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 377
diff changeset
2089 case Types.TIMESTAMP_WITH_TIMEZONE:
137
688cd5675466 Improved robustness of ResultSet methods:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 90
diff changeset
2090 if (timestampFormat == null) {
688cd5675466 Improved robustness of ResultSet methods:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 90
diff changeset
2091 // first time usage, create and keep the timestampFormat object for next usage
688cd5675466 Improved robustness of ResultSet methods:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 90
diff changeset
2092 timestampFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
688cd5675466 Improved robustness of ResultSet methods:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 90
diff changeset
2093 }
688cd5675466 Improved robustness of ResultSet methods:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 90
diff changeset
2094 timestampFormat.setTimeZone(ptz);
688cd5675466 Improved robustness of ResultSet methods:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 90
diff changeset
2095 pdate = timestampFormat.parse(monetDate, ppos);
198
376a15ce49e3 Improve parsing negative years.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 196
diff changeset
2096 // if parsing with timestampFormat failed try to parse it in dateFormat
376a15ce49e3 Improve parsing negative years.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 196
diff changeset
2097 if (pdate == null && monetDate.length() <= 10 && monetDate.contains("-")) {
376a15ce49e3 Improve parsing negative years.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 196
diff changeset
2098 if (dateFormat == null) {
376a15ce49e3 Improve parsing negative years.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 196
diff changeset
2099 // first time usage, create and keep the dateFormat object for next usage
376a15ce49e3 Improve parsing negative years.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 196
diff changeset
2100 dateFormat = new SimpleDateFormat("yyyy-MM-dd");
376a15ce49e3 Improve parsing negative years.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 196
diff changeset
2101 }
376a15ce49e3 Improve parsing negative years.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 196
diff changeset
2102 dateFormat.setTimeZone(ptz);
376a15ce49e3 Improve parsing negative years.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 196
diff changeset
2103 pdate = dateFormat.parse(monetDate, ppos);
376a15ce49e3 Improve parsing negative years.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 196
diff changeset
2104 }
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2105 break;
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2106 default:
198
376a15ce49e3 Improve parsing negative years.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 196
diff changeset
2107 throw new SQLException("Internal error, unsupported data type: " + type, "01M03");
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2108 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2109 if (pdate == null) {
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2110 // parsing failed
480
849af4b76b28 Optimise code by reducing local variables which are used only once, replacing complex string concatenation by using StringBuilder, replacing some ternairy operators.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 471
diff changeset
2111 final StringBuilder errMsg = new StringBuilder(128);
296
c5efd6e661e5 Add "final" keyword to classes, method arguments and local variables where possible.`
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 292
diff changeset
2112 final int epos = ppos.getErrorIndex();
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2113 if (epos == -1) {
480
849af4b76b28 Optimise code by reducing local variables which are used only once, replacing complex string concatenation by using StringBuilder, replacing some ternairy operators.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 471
diff changeset
2114 errMsg.append("parsing '").append(monetDateStr).append("' failed");
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2115 } else if (epos < monetDate.length()) {
480
849af4b76b28 Optimise code by reducing local variables which are used only once, replacing complex string concatenation by using StringBuilder, replacing some ternairy operators.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 471
diff changeset
2116 errMsg.append("parsing failed at pos ").append(epos + (negativeYear ? 2 : 1))
849af4b76b28 Optimise code by reducing local variables which are used only once, replacing complex string concatenation by using StringBuilder, replacing some ternairy operators.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 471
diff changeset
2117 .append(" found: '").append(monetDate.charAt(epos))
890
7621c80b08da Optimise code, use append(char) instead of append(String)
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 833
diff changeset
2118 .append("' in '").append(monetDateStr).append('\'');
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2119 } else {
890
7621c80b08da Optimise code, use append(char) instead of append(String)
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 833
diff changeset
2120 errMsg.append("parsing failed, expected more data after '").append(monetDateStr).append('\'');
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2121 }
480
849af4b76b28 Optimise code by reducing local variables which are used only once, replacing complex string concatenation by using StringBuilder, replacing some ternairy operators.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 471
diff changeset
2122 throw new SQLException(errMsg.toString(), "01M10");
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2123 }
198
376a15ce49e3 Improve parsing negative years.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 196
diff changeset
2124
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2125 cal.setTime(pdate);
198
376a15ce49e3 Improve parsing negative years.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 196
diff changeset
2126 if (negativeYear) {
376a15ce49e3 Improve parsing negative years.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 196
diff changeset
2127 // System.out.println("Current cal: " + cal.toString());
376a15ce49e3 Improve parsing negative years.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 196
diff changeset
2128 // using cal.set(Calendar.YEAR, -(cal.get(Calendar.YEAR))); does not work. We must set the ERA instead
376a15ce49e3 Improve parsing negative years.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 196
diff changeset
2129 cal.set(Calendar.ERA, java.util.GregorianCalendar.BC);
376a15ce49e3 Improve parsing negative years.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 196
diff changeset
2130 // System.out.println("Corrected cal: " + cal.toString());
376a15ce49e3 Improve parsing negative years.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 196
diff changeset
2131 }
376a15ce49e3 Improve parsing negative years.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 196
diff changeset
2132
380
bf521f343172 Added support for new Java 8 java.sql.Types: Types.TIME_WITH_TIMEZONE and Types.TIMESTAMP_WITH_TIMEZONE.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 377
diff changeset
2133 if (JdbcType == Types.TIME
bf521f343172 Added support for new Java 8 java.sql.Types: Types.TIME_WITH_TIMEZONE and Types.TIMESTAMP_WITH_TIMEZONE.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 377
diff changeset
2134 || JdbcType == Types.TIME_WITH_TIMEZONE
bf521f343172 Added support for new Java 8 java.sql.Types: Types.TIME_WITH_TIMEZONE and Types.TIMESTAMP_WITH_TIMEZONE.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 377
diff changeset
2135 || JdbcType == Types.TIMESTAMP
bf521f343172 Added support for new Java 8 java.sql.Types: Types.TIME_WITH_TIMEZONE and Types.TIMESTAMP_WITH_TIMEZONE.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 377
diff changeset
2136 || JdbcType == Types.TIMESTAMP_WITH_TIMEZONE) {
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2137 // parse additional nanos (if any)
198
376a15ce49e3 Improve parsing negative years.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 196
diff changeset
2138 int nanos = 0;
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2139 int pos = ppos.getIndex();
296
c5efd6e661e5 Add "final" keyword to classes, method arguments and local variables where possible.`
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 292
diff changeset
2140 final char[] monDate = monetDate.toCharArray();
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2141 if (pos < monDate.length && monDate[pos] == '.') {
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2142 pos++;
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2143 try {
296
c5efd6e661e5 Add "final" keyword to classes, method arguments and local variables where possible.`
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 292
diff changeset
2144 int ctr;
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2145 nanos = getIntrinsicValue(monDate[pos], pos++);
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2146 for (ctr = 1;
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2147 pos < monDate.length &&
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2148 monDate[pos] >= '0' &&
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2149 monDate[pos] <= '9';
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2150 ctr++)
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2151 {
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2152 if (ctr < 9) {
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2153 nanos *= 10;
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2154 nanos += (getIntrinsicValue(monDate[pos], pos));
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2155 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2156 if (ctr == 2) // we have three at this point
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2157 cal.set(Calendar.MILLISECOND, nanos);
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2158 pos++;
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2159 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2160 while (ctr++ < 9)
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2161 nanos *= 10;
187
daa1a4c70879 For MonetresultSet class: added method checkNotClosed() and invocation for all methods which should test it.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 180
diff changeset
2162 } catch (MCLParseException e) {
480
849af4b76b28 Optimise code by reducing local variables which are used only once, replacing complex string concatenation by using StringBuilder, replacing some ternairy operators.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 471
diff changeset
2163 final int offset = e.getErrorOffset();
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2164 addWarning(e.getMessage() +
480
849af4b76b28 Optimise code by reducing local variables which are used only once, replacing complex string concatenation by using StringBuilder, replacing some ternairy operators.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 471
diff changeset
2165 " found: '" + monDate[offset] +
849af4b76b28 Optimise code by reducing local variables which are used only once, replacing complex string concatenation by using StringBuilder, replacing some ternairy operators.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 471
diff changeset
2166 "' in: \"" + monetDate +
849af4b76b28 Optimise code by reducing local variables which are used only once, replacing complex string concatenation by using StringBuilder, replacing some ternairy operators.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 471
diff changeset
2167 "\" at pos: " + offset, "01M10");
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2168 // default value
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2169 nanos = 0;
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2170 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2171 }
198
376a15ce49e3 Improve parsing negative years.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 196
diff changeset
2172 return nanos;
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2173 }
198
376a15ce49e3 Improve parsing negative years.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 196
diff changeset
2174
376a15ce49e3 Improve parsing negative years.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 196
diff changeset
2175 return 0;
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2176 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2177
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2178 /**
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2179 * Small helper method that returns the intrinsic value of a char if
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2180 * it represents a digit. If a non-digit character is encountered
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2181 * an MCLParseException is thrown.
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2182 *
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2183 * @param c the char
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2184 * @param pos the position
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2185 * @return the intrinsic value of the char
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2186 * @throws MCLParseException if c is not a digit
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2187 */
296
c5efd6e661e5 Add "final" keyword to classes, method arguments and local variables where possible.`
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 292
diff changeset
2188 private static final int getIntrinsicValue(final char c, final int pos)
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2189 throws MCLParseException
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2190 {
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2191 // note: don't use Character.isDigit() here, because
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2192 // we only want ISO-LATIN-1 digits
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2193 if (c >= '0' && c <= '9') {
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2194 return (int)c - (int)'0';
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2195 } else {
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2196 throw new MCLParseException("Expected a digit", pos);
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2197 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2198 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2199
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2200 /**
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2201 * Retrieves the value of the designated column in the current row of this
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2202 * ResultSet object as a java.sql.Date object in the Java programming
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2203 * language.
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2204 *
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2205 * @param columnIndex the first column is 1, the second is 2, ...
187
daa1a4c70879 For MonetresultSet class: added method checkNotClosed() and invocation for all methods which should test it.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 180
diff changeset
2206 * @return the column value as a java.sql.Date object; if the value is SQL NULL, the value returned is null
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2207 * @throws SQLException if a database access error occurs
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2208 * @see #getDate(int col, Calendar cal)
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2209 */
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2210 @Override
773
2bd1983f1c11 Reduce code by importing java.sql.Date; and remove prefix java.sql. where no longer needed.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 769
diff changeset
2211 public Date getDate(final int columnIndex) throws SQLException {
137
688cd5675466 Improved robustness of ResultSet methods:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 90
diff changeset
2212 return getDate(columnIndex, null);
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2213 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2214
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2215 /**
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2216 * Retrieves the value of the designated column in the current row of this
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2217 * ResultSet object as a java.sql.Date object in the Java programming
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2218 * language. This method uses the given calendar to construct an appropriate
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2219 * millisecond value for the date if the underlying database does not store
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2220 * timezone information.
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2221 *
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2222 * @param columnIndex the first column is 1, the second is 2, ...
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2223 * @param cal the java.util.Calendar object to use in constructing the date
187
daa1a4c70879 For MonetresultSet class: added method checkNotClosed() and invocation for all methods which should test it.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 180
diff changeset
2224 * @return the column value as a java.sql.Date object; if the value is SQL NULL, the value returned is null
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2225 * @throws SQLException if a database access error occurs
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2226 */
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2227 @Override
773
2bd1983f1c11 Reduce code by importing java.sql.Date; and remove prefix java.sql. where no longer needed.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 769
diff changeset
2228 public Date getDate(final int columnIndex, Calendar cal)
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2229 throws SQLException
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2230 {
187
daa1a4c70879 For MonetresultSet class: added method checkNotClosed() and invocation for all methods which should test it.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 180
diff changeset
2231 checkNotClosed();
139
9df089b0d69d Improve performance of ResulSet methods getDate(), getTime() getTimestamp()
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 137
diff changeset
2232 try {
296
c5efd6e661e5 Add "final" keyword to classes, method arguments and local variables where possible.`
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 292
diff changeset
2233 final String val = tlp.values[columnIndex - 1];
143
dcf7879d4862 Optimised ResulSet methods getDate(column), getTime(column) and getTimestamp(column)
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 139
diff changeset
2234 if (val == null) {
139
9df089b0d69d Improve performance of ResulSet methods getDate(), getTime() getTimestamp()
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 137
diff changeset
2235 lastReadWasNull = true;
9df089b0d69d Improve performance of ResulSet methods getDate(), getTime() getTimestamp()
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 137
diff changeset
2236 return null;
9df089b0d69d Improve performance of ResulSet methods getDate(), getTime() getTimestamp()
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 137
diff changeset
2237 }
143
dcf7879d4862 Optimised ResulSet methods getDate(column), getTime(column) and getTimestamp(column)
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 139
diff changeset
2238 lastReadWasNull = false;
dcf7879d4862 Optimised ResulSet methods getDate(column), getTime(column) and getTimestamp(column)
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 139
diff changeset
2239 if (cal == null) {
196
95b48b249f68 First fix for bug 6468
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 194
diff changeset
2240 // try to convert string directly to a Date object
95b48b249f68 First fix for bug 6468
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 194
diff changeset
2241 // Note: the string must be in JDBC date escape format: yyyy-[m]m-[d]d
95b48b249f68 First fix for bug 6468
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 194
diff changeset
2242 try {
773
2bd1983f1c11 Reduce code by importing java.sql.Date; and remove prefix java.sql. where no longer needed.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 769
diff changeset
2243 return Date.valueOf(val);
196
95b48b249f68 First fix for bug 6468
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 194
diff changeset
2244 } catch (IllegalArgumentException iae) {
95b48b249f68 First fix for bug 6468
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 194
diff changeset
2245 // this happens if string doesn't match the format, such as for years < 1000 (including negative years)
95b48b249f68 First fix for bug 6468
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 194
diff changeset
2246 // in those cases just continue and use slower getJavaDate(cal, columnIndex, Types.DATE) method
145
b18cfb312330 Improved code to fix failing tests in sql/jdbc/tests/Tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 144
diff changeset
2247 }
b18cfb312330 Improved code to fix failing tests in sql/jdbc/tests/Tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 144
diff changeset
2248 cal = Calendar.getInstance();
143
dcf7879d4862 Optimised ResulSet methods getDate(column), getTime(column) and getTimestamp(column)
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 139
diff changeset
2249 }
480
849af4b76b28 Optimise code by reducing local variables which are used only once, replacing complex string concatenation by using StringBuilder, replacing some ternairy operators.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 471
diff changeset
2250 if (getJavaDate(cal, columnIndex, Types.DATE) == -1)
849af4b76b28 Optimise code by reducing local variables which are used only once, replacing complex string concatenation by using StringBuilder, replacing some ternairy operators.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 471
diff changeset
2251 return null;
773
2bd1983f1c11 Reduce code by importing java.sql.Date; and remove prefix java.sql. where no longer needed.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 769
diff changeset
2252 return new Date(cal.getTimeInMillis());
139
9df089b0d69d Improve performance of ResulSet methods getDate(), getTime() getTimestamp()
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 137
diff changeset
2253 } catch (IndexOutOfBoundsException e) {
9df089b0d69d Improve performance of ResulSet methods getDate(), getTime() getTimestamp()
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 137
diff changeset
2254 throw newSQLInvalidColumnIndexException(columnIndex);
9df089b0d69d Improve performance of ResulSet methods getDate(), getTime() getTimestamp()
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 137
diff changeset
2255 }
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2256 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2257
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2258 /**
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2259 * Retrieves the value of the designated column in the current row of this
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2260 * ResultSet object as a java.sql.Date object in the Java programming
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2261 * language.
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2262 *
187
daa1a4c70879 For MonetresultSet class: added method checkNotClosed() and invocation for all methods which should test it.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 180
diff changeset
2263 * @param columnLabel the SQL name of the column from which to retrieve the value
daa1a4c70879 For MonetresultSet class: added method checkNotClosed() and invocation for all methods which should test it.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 180
diff changeset
2264 * @return the column value as a java.sql.Date object; if the value is SQL NULL, the value returned is null
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2265 * @throws SQLException if a database access error occurs
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2266 */
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2267 @Override
773
2bd1983f1c11 Reduce code by importing java.sql.Date; and remove prefix java.sql. where no longer needed.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 769
diff changeset
2268 public Date getDate(final String columnLabel) throws SQLException {
151
3d5ea891bb74 Update implementation to match the JDBC spec so use
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 145
diff changeset
2269 return getDate(findColumn(columnLabel), null);
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2270 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2271
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2272 /**
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2273 * Retrieves the value of the designated column in the current row of this
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2274 * ResultSet object as a java.sql.Date object in the Java programming
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2275 * language. This method uses the given calendar to construct an appropriate
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2276 * millisecond value for the date if the underlying database does not store
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2277 * timezone information.
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2278 *
187
daa1a4c70879 For MonetresultSet class: added method checkNotClosed() and invocation for all methods which should test it.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 180
diff changeset
2279 * @param columnLabel the SQL name of the column from which to retrieve the value
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2280 * @param cal the java.util.Calendar object to use in constructing the date
187
daa1a4c70879 For MonetresultSet class: added method checkNotClosed() and invocation for all methods which should test it.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 180
diff changeset
2281 * @return the column value as a java.sql.Date object; if the value is SQL NULL, the value returned is null
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2282 * @throws SQLException if a database access error occurs
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2283 */
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2284 @Override
773
2bd1983f1c11 Reduce code by importing java.sql.Date; and remove prefix java.sql. where no longer needed.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 769
diff changeset
2285 public Date getDate(final String columnLabel, final Calendar cal)
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2286 throws SQLException
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2287 {
151
3d5ea891bb74 Update implementation to match the JDBC spec so use
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 145
diff changeset
2288 return getDate(findColumn(columnLabel), cal);
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2289 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2290
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2291 /**
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2292 * Retrieves the value of the designated column in the current row of this
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2293 * ResultSet object as a java.sql.Time object in the Java programming
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2294 * language.
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2295 *
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2296 * @param columnIndex the first column is 1, the second is 2, ...
187
daa1a4c70879 For MonetresultSet class: added method checkNotClosed() and invocation for all methods which should test it.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 180
diff changeset
2297 * @return the column value as a java.sql.Time object; if the value is SQL NULL, the value returned is null
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2298 * @throws SQLException if a database access error occurs
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2299 */
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2300 @Override
296
c5efd6e661e5 Add "final" keyword to classes, method arguments and local variables where possible.`
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 292
diff changeset
2301 public Time getTime(final int columnIndex) throws SQLException {
137
688cd5675466 Improved robustness of ResultSet methods:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 90
diff changeset
2302 return getTime(columnIndex, null);
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2303 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2304
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2305 /**
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2306 * Retrieves the value of the designated column in the current row of
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2307 * this ResultSet object as a java.sql.Time object in the Java programming
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2308 * language. This method uses the given calendar to construct an appropriate
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2309 * millisecond value for the time if the underlying database does not store
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2310 * timezone information.
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2311 *
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2312 * @param columnIndex the first column is 1, the second is 2, ...
187
daa1a4c70879 For MonetresultSet class: added method checkNotClosed() and invocation for all methods which should test it.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 180
diff changeset
2313 * @param cal the java.util.Calendar object to use in constructing the timestamp
daa1a4c70879 For MonetresultSet class: added method checkNotClosed() and invocation for all methods which should test it.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 180
diff changeset
2314 * @return the column value as a java.sql.Time object; if the value is SQL NULL, the value returned is null
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2315 * @throws SQLException if a database access error occurs
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2316 */
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2317 @Override
296
c5efd6e661e5 Add "final" keyword to classes, method arguments and local variables where possible.`
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 292
diff changeset
2318 public Time getTime(final int columnIndex, Calendar cal)
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2319 throws SQLException
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2320 {
187
daa1a4c70879 For MonetresultSet class: added method checkNotClosed() and invocation for all methods which should test it.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 180
diff changeset
2321 checkNotClosed();
139
9df089b0d69d Improve performance of ResulSet methods getDate(), getTime() getTimestamp()
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 137
diff changeset
2322 try {
296
c5efd6e661e5 Add "final" keyword to classes, method arguments and local variables where possible.`
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 292
diff changeset
2323 final String val = tlp.values[columnIndex - 1];
143
dcf7879d4862 Optimised ResulSet methods getDate(column), getTime(column) and getTimestamp(column)
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 139
diff changeset
2324 if (val == null) {
139
9df089b0d69d Improve performance of ResulSet methods getDate(), getTime() getTimestamp()
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 137
diff changeset
2325 lastReadWasNull = true;
9df089b0d69d Improve performance of ResulSet methods getDate(), getTime() getTimestamp()
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 137
diff changeset
2326 return null;
9df089b0d69d Improve performance of ResulSet methods getDate(), getTime() getTimestamp()
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 137
diff changeset
2327 }
143
dcf7879d4862 Optimised ResulSet methods getDate(column), getTime(column) and getTimestamp(column)
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 139
diff changeset
2328 lastReadWasNull = false;
dcf7879d4862 Optimised ResulSet methods getDate(column), getTime(column) and getTimestamp(column)
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 139
diff changeset
2329 if (cal == null) {
196
95b48b249f68 First fix for bug 6468
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 194
diff changeset
2330 // try to convert string directly to a Time object
95b48b249f68 First fix for bug 6468
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 194
diff changeset
2331 // Note: the string must be in JDBC time escape format: hh:mm:ss
95b48b249f68 First fix for bug 6468
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 194
diff changeset
2332 try {
145
b18cfb312330 Improved code to fix failing tests in sql/jdbc/tests/Tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 144
diff changeset
2333 return Time.valueOf(val);
196
95b48b249f68 First fix for bug 6468
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 194
diff changeset
2334 } catch (IllegalArgumentException iae) {
95b48b249f68 First fix for bug 6468
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 194
diff changeset
2335 // this happens if string doesn't match the format or hh >= 24 or mm >= 60 or ss >= 60
95b48b249f68 First fix for bug 6468
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 194
diff changeset
2336 // in those cases just continue and use slower getJavaDate(cal, columnIndex, Types.TIME) method
145
b18cfb312330 Improved code to fix failing tests in sql/jdbc/tests/Tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 144
diff changeset
2337 }
b18cfb312330 Improved code to fix failing tests in sql/jdbc/tests/Tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 144
diff changeset
2338 cal = Calendar.getInstance();
143
dcf7879d4862 Optimised ResulSet methods getDate(column), getTime(column) and getTimestamp(column)
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 139
diff changeset
2339 }
480
849af4b76b28 Optimise code by reducing local variables which are used only once, replacing complex string concatenation by using StringBuilder, replacing some ternairy operators.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 471
diff changeset
2340 if (getJavaDate(cal, columnIndex, Types.TIME) == -1)
849af4b76b28 Optimise code by reducing local variables which are used only once, replacing complex string concatenation by using StringBuilder, replacing some ternairy operators.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 471
diff changeset
2341 return null;
849af4b76b28 Optimise code by reducing local variables which are used only once, replacing complex string concatenation by using StringBuilder, replacing some ternairy operators.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 471
diff changeset
2342 return new Time(cal.getTimeInMillis());
139
9df089b0d69d Improve performance of ResulSet methods getDate(), getTime() getTimestamp()
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 137
diff changeset
2343 } catch (IndexOutOfBoundsException e) {
9df089b0d69d Improve performance of ResulSet methods getDate(), getTime() getTimestamp()
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 137
diff changeset
2344 throw newSQLInvalidColumnIndexException(columnIndex);
9df089b0d69d Improve performance of ResulSet methods getDate(), getTime() getTimestamp()
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 137
diff changeset
2345 }
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2346 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2347
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2348 /**
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2349 * Retrieves the value of the designated column in the current row of this
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2350 * ResultSet object as a java.sql.Time object in the Java programming
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2351 * language.
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2352 *
151
3d5ea891bb74 Update implementation to match the JDBC spec so use
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 145
diff changeset
2353 * @param columnLabel the SQL name of the column
187
daa1a4c70879 For MonetresultSet class: added method checkNotClosed() and invocation for all methods which should test it.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 180
diff changeset
2354 * @return the column value as a java.sql.Time object; if the value is SQL NULL, the value returned is null
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2355 * @throws SQLException if a database access error occurs
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2356 */
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2357 @Override
296
c5efd6e661e5 Add "final" keyword to classes, method arguments and local variables where possible.`
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 292
diff changeset
2358 public Time getTime(final String columnLabel) throws SQLException {
151
3d5ea891bb74 Update implementation to match the JDBC spec so use
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 145
diff changeset
2359 return getTime(findColumn(columnLabel), null);
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2360 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2361
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2362 /**
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2363 * Retrieves the value of the designated column in the current row of
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2364 * this ResultSet object as a java.sql.Time object in the Java programming
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2365 * language. This method uses the given calendar to construct an appropriate
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2366 * millisecond value for the time if the underlying database does not store
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2367 * timezone information.
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2368 *
151
3d5ea891bb74 Update implementation to match the JDBC spec so use
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 145
diff changeset
2369 * @param columnLabel the SQL name of the column
187
daa1a4c70879 For MonetresultSet class: added method checkNotClosed() and invocation for all methods which should test it.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 180
diff changeset
2370 * @param cal the java.util.Calendar object to use in constructing the timestamp
daa1a4c70879 For MonetresultSet class: added method checkNotClosed() and invocation for all methods which should test it.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 180
diff changeset
2371 * @return the column value as a java.sql.Time object; if the value is SQL NULL, the value returned is null
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2372 * @throws SQLException if a database access error occurs
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2373 */
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2374 @Override
296
c5efd6e661e5 Add "final" keyword to classes, method arguments and local variables where possible.`
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 292
diff changeset
2375 public Time getTime(final String columnLabel, final Calendar cal)
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2376 throws SQLException
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2377 {
151
3d5ea891bb74 Update implementation to match the JDBC spec so use
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 145
diff changeset
2378 return getTime(findColumn(columnLabel), cal);
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2379 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2380
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2381 /**
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2382 * Retrieves the value of the designated column in the current row of this
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2383 * ResultSet object as a java.sql.Timestamp object in the Java programming
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2384 * language.
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2385 *
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2386 * @param columnIndex the first column is 1, the second is 2, ...
187
daa1a4c70879 For MonetresultSet class: added method checkNotClosed() and invocation for all methods which should test it.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 180
diff changeset
2387 * @return the column value as a java.sql.Timestamp object; if the value is SQL NULL, the value returned is null
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2388 * @throws SQLException if a database access error occurs
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2389 */
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2390 @Override
296
c5efd6e661e5 Add "final" keyword to classes, method arguments and local variables where possible.`
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 292
diff changeset
2391 public Timestamp getTimestamp(final int columnIndex) throws SQLException {
137
688cd5675466 Improved robustness of ResultSet methods:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 90
diff changeset
2392 return getTimestamp(columnIndex, null);
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2393 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2394
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2395 /**
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2396 * Retrieves the value of the designated column in the current row of this
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2397 * ResultSet object as a java.sql.Timestamp object in the Java programming
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2398 * language. This method uses the given calendar to construct an appropriate
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2399 * millisecond value for the timestamp if the underlying database does not
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2400 * store timezone information.
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2401 *
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2402 * @param columnIndex the first column is 1, the second is 2, ...
187
daa1a4c70879 For MonetresultSet class: added method checkNotClosed() and invocation for all methods which should test it.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 180
diff changeset
2403 * @param cal the java.util.Calendar object to use in constructing the timestamp
daa1a4c70879 For MonetresultSet class: added method checkNotClosed() and invocation for all methods which should test it.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 180
diff changeset
2404 * @return the column value as a java.sql.Timestamp object; if the value is SQL NULL, the value returned is null
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2405 * @throws SQLException if a database access error occurs
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2406 */
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2407 @Override
296
c5efd6e661e5 Add "final" keyword to classes, method arguments and local variables where possible.`
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 292
diff changeset
2408 public Timestamp getTimestamp(final int columnIndex, Calendar cal)
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2409 throws SQLException
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2410 {
187
daa1a4c70879 For MonetresultSet class: added method checkNotClosed() and invocation for all methods which should test it.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 180
diff changeset
2411 checkNotClosed();
139
9df089b0d69d Improve performance of ResulSet methods getDate(), getTime() getTimestamp()
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 137
diff changeset
2412 try {
296
c5efd6e661e5 Add "final" keyword to classes, method arguments and local variables where possible.`
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 292
diff changeset
2413 final String val = tlp.values[columnIndex - 1];
143
dcf7879d4862 Optimised ResulSet methods getDate(column), getTime(column) and getTimestamp(column)
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 139
diff changeset
2414 if (val == null) {
139
9df089b0d69d Improve performance of ResulSet methods getDate(), getTime() getTimestamp()
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 137
diff changeset
2415 lastReadWasNull = true;
9df089b0d69d Improve performance of ResulSet methods getDate(), getTime() getTimestamp()
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 137
diff changeset
2416 return null;
9df089b0d69d Improve performance of ResulSet methods getDate(), getTime() getTimestamp()
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 137
diff changeset
2417 }
143
dcf7879d4862 Optimised ResulSet methods getDate(column), getTime(column) and getTimestamp(column)
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 139
diff changeset
2418 lastReadWasNull = false;
dcf7879d4862 Optimised ResulSet methods getDate(column), getTime(column) and getTimestamp(column)
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 139
diff changeset
2419 if (cal == null) {
196
95b48b249f68 First fix for bug 6468
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 194
diff changeset
2420 // try to convert the string directly to a Timestamp object
95b48b249f68 First fix for bug 6468
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 194
diff changeset
2421 // Note: the string must be in JDBC timestamp escape format: yyyy-[m]m-[d]d hh:mm:ss[.f...]
95b48b249f68 First fix for bug 6468
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 194
diff changeset
2422 try {
145
b18cfb312330 Improved code to fix failing tests in sql/jdbc/tests/Tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 144
diff changeset
2423 return Timestamp.valueOf(val);
196
95b48b249f68 First fix for bug 6468
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 194
diff changeset
2424 } catch (IllegalArgumentException iae) {
95b48b249f68 First fix for bug 6468
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 194
diff changeset
2425 // this happens if string doesn't match the format, such as for years < 1000 (including negative years)
95b48b249f68 First fix for bug 6468
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 194
diff changeset
2426 // in those cases just continue and use slower getJavaDate(cal, columnIndex, Types.TIMESTAMP) method
145
b18cfb312330 Improved code to fix failing tests in sql/jdbc/tests/Tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 144
diff changeset
2427 }
b18cfb312330 Improved code to fix failing tests in sql/jdbc/tests/Tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 144
diff changeset
2428 cal = Calendar.getInstance();
143
dcf7879d4862 Optimised ResulSet methods getDate(column), getTime(column) and getTimestamp(column)
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 139
diff changeset
2429 }
296
c5efd6e661e5 Add "final" keyword to classes, method arguments and local variables where possible.`
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 292
diff changeset
2430 final int nanos = getJavaDate(cal, columnIndex, Types.TIMESTAMP);
145
b18cfb312330 Improved code to fix failing tests in sql/jdbc/tests/Tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 144
diff changeset
2431 if (nanos == -1)
b18cfb312330 Improved code to fix failing tests in sql/jdbc/tests/Tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 144
diff changeset
2432 return null;
b18cfb312330 Improved code to fix failing tests in sql/jdbc/tests/Tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 144
diff changeset
2433
296
c5efd6e661e5 Add "final" keyword to classes, method arguments and local variables where possible.`
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 292
diff changeset
2434 final Timestamp ts = new Timestamp(cal.getTimeInMillis());
145
b18cfb312330 Improved code to fix failing tests in sql/jdbc/tests/Tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 144
diff changeset
2435 ts.setNanos(nanos);
b18cfb312330 Improved code to fix failing tests in sql/jdbc/tests/Tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 144
diff changeset
2436 return ts;
139
9df089b0d69d Improve performance of ResulSet methods getDate(), getTime() getTimestamp()
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 137
diff changeset
2437 } catch (IndexOutOfBoundsException e) {
9df089b0d69d Improve performance of ResulSet methods getDate(), getTime() getTimestamp()
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 137
diff changeset
2438 throw newSQLInvalidColumnIndexException(columnIndex);
9df089b0d69d Improve performance of ResulSet methods getDate(), getTime() getTimestamp()
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 137
diff changeset
2439 }
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2440 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2441
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2442 /**
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2443 * Retrieves the value of the designated column in the current row of this
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2444 * ResultSet object as a java.sql.Timestamp object in the Java programming
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2445 * language.
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2446 *
151
3d5ea891bb74 Update implementation to match the JDBC spec so use
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 145
diff changeset
2447 * @param columnLabel the SQL name of the column
187
daa1a4c70879 For MonetresultSet class: added method checkNotClosed() and invocation for all methods which should test it.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 180
diff changeset
2448 * @return the column value as a java.sql.Timestamp object; if the value is SQL NULL, the value returned is null
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2449 * @throws SQLException if a database access error occurs
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2450 */
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2451 @Override
296
c5efd6e661e5 Add "final" keyword to classes, method arguments and local variables where possible.`
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 292
diff changeset
2452 public Timestamp getTimestamp(final String columnLabel) throws SQLException {
151
3d5ea891bb74 Update implementation to match the JDBC spec so use
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 145
diff changeset
2453 return getTimestamp(findColumn(columnLabel), null);
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2454 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2455
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2456 /**
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2457 * Retrieves the value of the designated column in the current row of this
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2458 * ResultSet object as a java.sql.Timestamp object in the Java programming
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2459 * language. This method uses the given calendar to construct an appropriate
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2460 * millisecond value for the timestamp if the underlying database does not
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2461 * store timezone information.
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2462 *
151
3d5ea891bb74 Update implementation to match the JDBC spec so use
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 145
diff changeset
2463 * @param columnLabel the SQL name of the column
187
daa1a4c70879 For MonetresultSet class: added method checkNotClosed() and invocation for all methods which should test it.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 180
diff changeset
2464 * @param cal the java.util.Calendar object to use in constructing the timestamp
daa1a4c70879 For MonetresultSet class: added method checkNotClosed() and invocation for all methods which should test it.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 180
diff changeset
2465 * @return the column value as a java.sql.Timestamp object; if the value is SQL NULL, the value returned is null
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2466 * @throws SQLException if a database access error occurs
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2467 */
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2468 @Override
296
c5efd6e661e5 Add "final" keyword to classes, method arguments and local variables where possible.`
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 292
diff changeset
2469 public Timestamp getTimestamp(final String columnLabel, final Calendar cal)
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2470 throws SQLException
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2471 {
151
3d5ea891bb74 Update implementation to match the JDBC spec so use
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 145
diff changeset
2472 return getTimestamp(findColumn(columnLabel), cal);
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2473 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2474
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2475 /**
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2476 * Retrieves the type of this ResultSet object. The type is determined by
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2477 * the Statement object that created the result set.
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2478 *
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2479 * @return ResultSet.TYPE_FORWARD_ONLY, ResultSet.TYPE_SCROLL_INSENSITIVE,
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2480 * or ResultSet.TYPE_SCROLL_SENSITIVE
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2481 */
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2482 @Override
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2483 public int getType() {
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2484 return type;
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2485 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2486
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2487 /**
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2488 * Retrieves the value of the designated column in the current row
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2489 * of this ResultSet object as a java.net.URL object in the Java
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2490 * programming language.
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2491 *
187
daa1a4c70879 For MonetresultSet class: added method checkNotClosed() and invocation for all methods which should test it.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 180
diff changeset
2492 * @param columnIndex the index of the column 1 is the first, 2 is the second,...
daa1a4c70879 For MonetresultSet class: added method checkNotClosed() and invocation for all methods which should test it.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 180
diff changeset
2493 * @return the column value as a java.net.URL object; if the value is SQL NULL, the value returned is null
daa1a4c70879 For MonetresultSet class: added method checkNotClosed() and invocation for all methods which should test it.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 180
diff changeset
2494 * @throws SQLException if a database access error occurs, or if a URL is malformed
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2495 */
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2496 @Override
296
c5efd6e661e5 Add "final" keyword to classes, method arguments and local variables where possible.`
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 292
diff changeset
2497 public URL getURL(final int columnIndex) throws SQLException {
187
daa1a4c70879 For MonetresultSet class: added method checkNotClosed() and invocation for all methods which should test it.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 180
diff changeset
2498 checkNotClosed();
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2499 try {
296
c5efd6e661e5 Add "final" keyword to classes, method arguments and local variables where possible.`
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 292
diff changeset
2500 final String val = tlp.values[columnIndex - 1];
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2501 if (val == null) {
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2502 lastReadWasNull = true;
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2503 return null;
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2504 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2505 lastReadWasNull = false;
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2506 try {
769
b6d113ee35ae Fixed javac version 20 compiler warnings.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 735
diff changeset
2507 // Note: as of Java version 20 java.net.URL(String) constructor is deprecated.
b6d113ee35ae Fixed javac version 20 compiler warnings.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 735
diff changeset
2508 // https://docs.oracle.com/en/java/javase/20/docs/api/java.base/java/net/URL.html#%3Cinit%3E(java.lang.String)
b6d113ee35ae Fixed javac version 20 compiler warnings.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 735
diff changeset
2509 return new java.net.URI(val).toURL();
b6d113ee35ae Fixed javac version 20 compiler warnings.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 735
diff changeset
2510 } catch (java.net.URISyntaxException | java.net.MalformedURLException e) {
b6d113ee35ae Fixed javac version 20 compiler warnings.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 735
diff changeset
2511 throw new SQLException(e.getMessage(), "22M30");
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2512 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2513 } catch (IndexOutOfBoundsException e) {
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2514 throw newSQLInvalidColumnIndexException(columnIndex);
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2515 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2516 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2517
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2518 /**
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2519 * Retrieves the value of the designated column in the current row
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2520 * of this ResultSet object as a java.net.URL object in the Java
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2521 * programming language.
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2522 *
151
3d5ea891bb74 Update implementation to match the JDBC spec so use
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 145
diff changeset
2523 * @param columnLabel the SQL name of the column
187
daa1a4c70879 For MonetresultSet class: added method checkNotClosed() and invocation for all methods which should test it.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 180
diff changeset
2524 * @return the column value as a java.net.URL object; if the value is SQL NULL, the value returned is null
daa1a4c70879 For MonetresultSet class: added method checkNotClosed() and invocation for all methods which should test it.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 180
diff changeset
2525 * @throws SQLException if a database access error occurs, or if a URL is malformed
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2526 */
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2527 @Override
296
c5efd6e661e5 Add "final" keyword to classes, method arguments and local variables where possible.`
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 292
diff changeset
2528 public URL getURL(final String columnLabel) throws SQLException {
151
3d5ea891bb74 Update implementation to match the JDBC spec so use
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 145
diff changeset
2529 return getURL(findColumn(columnLabel));
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2530 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2531
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2532 /**
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2533 * Retrieves the first warning reported by calls on this ResultSet object.
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2534 * If there is more than one warning, subsequent warnings will be chained to
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2535 * the first one and can be retrieved by calling the method
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2536 * SQLWarning.getNextWarning on the warning that was retrieved previously.
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2537 *
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2538 * This method may not be called on a closed result set; doing so will cause
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2539 * an SQLException to be thrown.
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2540 *
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2541 * Note: Subsequent warnings will be chained to this SQLWarning.
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2542 *
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2543 * @return the first SQLWarning object or null if there are none
187
daa1a4c70879 For MonetresultSet class: added method checkNotClosed() and invocation for all methods which should test it.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 180
diff changeset
2544 * @throws SQLException if a database access error occurs or this method is called on a closed result set
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2545 */
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2546 @Override
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2547 public SQLWarning getWarnings() throws SQLException {
187
daa1a4c70879 For MonetresultSet class: added method checkNotClosed() and invocation for all methods which should test it.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 180
diff changeset
2548 checkNotClosed();
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2549 // if there are no warnings, this will be null, which fits with the
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2550 // specification.
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2551 return warnings;
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2552 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2553
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2554 /**
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2555 * Retrieves whether the cursor is after the last row in this ResultSet
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2556 * object.
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2557 *
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2558 * @return true if the cursor is after the last row; false if the cursor is
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2559 * at any other position or the result set contains no rows
187
daa1a4c70879 For MonetresultSet class: added method checkNotClosed() and invocation for all methods which should test it.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 180
diff changeset
2560 * @throws SQLException if a database access error occurs or this method is called on a closed result set
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2561 */
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2562 @Override
187
daa1a4c70879 For MonetresultSet class: added method checkNotClosed() and invocation for all methods which should test it.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 180
diff changeset
2563 public boolean isAfterLast() throws SQLException {
daa1a4c70879 For MonetresultSet class: added method checkNotClosed() and invocation for all methods which should test it.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 180
diff changeset
2564 checkNotClosed();
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2565 return curRow == tupleCount + 1;
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2566 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2567
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2568 /**
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2569 * Retrieves whether the cursor is before the first row in this ResultSet
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2570 * object.
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2571 *
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2572 * @return true if the cursor is before the first row; false if the cursor
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2573 * is at any other position or the result set contains no rows
187
daa1a4c70879 For MonetresultSet class: added method checkNotClosed() and invocation for all methods which should test it.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 180
diff changeset
2574 * @throws SQLException if a database access error occurs or this method is called on a closed result set
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2575 */
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2576 @Override
187
daa1a4c70879 For MonetresultSet class: added method checkNotClosed() and invocation for all methods which should test it.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 180
diff changeset
2577 public boolean isBeforeFirst() throws SQLException {
daa1a4c70879 For MonetresultSet class: added method checkNotClosed() and invocation for all methods which should test it.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 180
diff changeset
2578 checkNotClosed();
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2579 return curRow == 0;
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2580 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2581
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2582 /**
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2583 * Retrieves whether this ResultSet object has been closed. A
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2584 * ResultSet is closed if the method close has been called on it, or
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2585 * if it is automatically closed.
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2586 *
187
daa1a4c70879 For MonetresultSet class: added method checkNotClosed() and invocation for all methods which should test it.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 180
diff changeset
2587 * @return true if this ResultSet object is closed; false if it is still open
daa1a4c70879 For MonetresultSet class: added method checkNotClosed() and invocation for all methods which should test it.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 180
diff changeset
2588 * @throws SQLException if a database access error occurs or this method is called on a closed result set
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2589 */
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2590 @Override
187
daa1a4c70879 For MonetresultSet class: added method checkNotClosed() and invocation for all methods which should test it.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 180
diff changeset
2591 public boolean isClosed() throws SQLException {
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2592 return header != null && header.isClosed();
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2593 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2594
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2595 /**
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2596 * Retrieves whether the cursor is on the first row of this ResultSet
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2597 * object.
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2598 *
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2599 * @return true if the cursor is on the first row; false otherwise
187
daa1a4c70879 For MonetresultSet class: added method checkNotClosed() and invocation for all methods which should test it.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 180
diff changeset
2600 * @throws SQLException if a database access error occurs or this method is called on a closed result set
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2601 */
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2602 @Override
187
daa1a4c70879 For MonetresultSet class: added method checkNotClosed() and invocation for all methods which should test it.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 180
diff changeset
2603 public boolean isFirst() throws SQLException {
daa1a4c70879 For MonetresultSet class: added method checkNotClosed() and invocation for all methods which should test it.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 180
diff changeset
2604 checkNotClosed();
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2605 return curRow == 1;
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2606 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2607
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2608 /**
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2609 * Retrieves whether the cursor is on the last row of this ResultSet object.
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2610 *
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2611 * @return true if the cursor is on the last row; false otherwise
187
daa1a4c70879 For MonetresultSet class: added method checkNotClosed() and invocation for all methods which should test it.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 180
diff changeset
2612 * @throws SQLException if a database access error occurs or this method is called on a closed result set
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2613 */
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2614 @Override
187
daa1a4c70879 For MonetresultSet class: added method checkNotClosed() and invocation for all methods which should test it.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 180
diff changeset
2615 public boolean isLast() throws SQLException {
daa1a4c70879 For MonetresultSet class: added method checkNotClosed() and invocation for all methods which should test it.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 180
diff changeset
2616 checkNotClosed();
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2617 return curRow == tupleCount;
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2618 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2619
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2620 /**
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2621 * Moves the cursor to the last row in this ResultSet object.
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2622 *
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2623 * @return true if the cursor is on a valid row; false if there are no rows
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2624 * in the result set
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2625 * @throws SQLException if a database access error occurs or the result set
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2626 * type is TYPE_FORWARD_ONLY
187
daa1a4c70879 For MonetresultSet class: added method checkNotClosed() and invocation for all methods which should test it.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 180
diff changeset
2627 * @throws SQLException if a database access error occurs or this method is called on a closed result set
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2628 */
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2629 @Override
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2630 public boolean last() throws SQLException {
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2631 return absolute(-1);
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2632 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2633
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2634 /**
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2635 * Moves the cursor down one row from its current position. A ResultSet
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2636 * cursor is initially positioned before the first row; the first call to
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2637 * the method next makes the first row the current row; the second call
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2638 * makes the second row the current row, and so on.
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2639 *
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2640 * If an input stream is open for the current row, a call to the method
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2641 * next will implicitly close it. A ResultSet object's warning chain is
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2642 * cleared when a new row is read.
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2643 *
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2644 * @return true if the new current row is valid; false if there are no
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2645 * more rows
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2646 * @throws SQLException if a database access error occurs or ResultSet is
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2647 * closed
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2648 */
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2649 @Override
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2650 public boolean next() throws SQLException {
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2651 return relative(1);
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2652 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2653
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2654 /**
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2655 * Moves the cursor to the previous row in this ResultSet object.
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2656 *
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2657 * @return true if the cursor is on a valid row; false if it is off
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2658 * the result set
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2659 * @throws SQLException if a database access error occurs or ResultSet is
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2660 * closed or the result set type is TYPE_FORWARD_ONLY
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2661 */
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2662 @Override
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2663 public boolean previous() throws SQLException {
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2664 return relative(-1);
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2665 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2666
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2667 /**
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2668 * Moves the cursor a relative number of rows, either positive or negative.
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2669 * Attempting to move beyond the first/last row in the result set positions
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2670 * the cursor before/after the the first/last row. Calling relative(0) is
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2671 * valid, but does not change the cursor position.
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2672 *
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2673 * Note: Calling the method relative(1) is identical to calling the method
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2674 * next() and calling the method relative(-1) is identical to calling the
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2675 * method previous().
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2676 *
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2677 * @param rows an int specifying the number of rows to move from the current
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2678 * row; a positive number moves the cursor forward; a negative number
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2679 * moves the cursor backward
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2680 * @return true if the cursor is on a row; false otherwise
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2681 * @throws SQLException if a database access error occurs, there is no current
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2682 * row, or the result set type is TYPE_FORWARD_ONLY
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2683 */
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2684 @Override
296
c5efd6e661e5 Add "final" keyword to classes, method arguments and local variables where possible.`
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 292
diff changeset
2685 public boolean relative(final int rows) throws SQLException {
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2686 return absolute(curRow + rows);
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2687 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2688
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2689 /**
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2690 * Retrieves whether a row has been deleted. A deleted row may leave a visible "hole" in a result set.
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2691 * This method can be used to detect holes in a result set.
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2692 * The value returned depends on whether or not this ResultSet object can detect deletions.
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2693 *
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2694 * Note: Support for the rowDeleted method is optional with a result set concurrency of CONCUR_READ_ONLY
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2695 *
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2696 * Returns: true if the current row is detected to have been deleted by the owner or another; false otherwise
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2697 *
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2698 * Throws:
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2699 * SQLException - if a database access error occurs or this method is called on a closed result set
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2700 * Since: 1.2
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2701 * See Also: DatabaseMetaData.deletesAreDetected(int)
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2702 */
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2703 @Override
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2704 public boolean rowDeleted() throws SQLException {
187
daa1a4c70879 For MonetresultSet class: added method checkNotClosed() and invocation for all methods which should test it.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 180
diff changeset
2705 checkNotClosed();
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2706 return false;
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2707 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2708
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2709 /**
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2710 * Retrieves whether the current row has had an insertion.
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2711 * The value returned depends on whether or not this ResultSet object can detect visible inserts.
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2712 *
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2713 * Note: Support for the rowInserted method is optional with a result set concurrency of CONCUR_READ_ONLY
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2714 *
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2715 * Returns: true if the current row is detected to have been inserted; false otherwise
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2716 *
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2717 * Throws:
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2718 * SQLException - if a database access error occurs or this method is called on a closed result set
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2719 * Since: 1.2
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2720 * See Also: DatabaseMetaData.insertsAreDetected(int)
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2721 */
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2722 @Override
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2723 public boolean rowInserted() throws SQLException {
187
daa1a4c70879 For MonetresultSet class: added method checkNotClosed() and invocation for all methods which should test it.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 180
diff changeset
2724 checkNotClosed();
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2725 return false;
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2726 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2727
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2728 /**
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2729 * Retrieves whether the current row has been updated.
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2730 * The value returned depends on whether or not the result set can detect updates.
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2731 *
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2732 * Note: Support for the rowUpdated method is optional with a result set concurrency of CONCUR_READ_ONLY
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2733 *
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2734 * Returns: true if the current row is detected to have been visibly updated by the owner or another; false otherwise
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2735 *
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2736 * Throws:
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2737 * SQLException - if a database access error occurs or this method is called on a closed result set
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2738 * Since: 1.2
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2739 * See Also: DatabaseMetaData.updatesAreDetected(int)
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2740 */
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2741 @Override
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2742 public boolean rowUpdated() throws SQLException {
187
daa1a4c70879 For MonetresultSet class: added method checkNotClosed() and invocation for all methods which should test it.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 180
diff changeset
2743 checkNotClosed();
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2744 return false;
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2745 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2746
262
2d62ca1f758b Moved utility method newSQLFeatureNotSupportedException(String name) from MonetPreparedStatement.java and MonetResultSet.java
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 261
diff changeset
2747
2d62ca1f758b Moved utility method newSQLFeatureNotSupportedException(String name) from MonetPreparedStatement.java and MonetResultSet.java
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 261
diff changeset
2748 /* Next methods are all related to updateable result sets, which we do not support.
2d62ca1f758b Moved utility method newSQLFeatureNotSupportedException(String name) from MonetPreparedStatement.java and MonetResultSet.java
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 261
diff changeset
2749 * @throws SQLFeatureNotSupportedException if the JDBC driver does not support this method
2d62ca1f758b Moved utility method newSQLFeatureNotSupportedException(String name) from MonetPreparedStatement.java and MonetResultSet.java
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 261
diff changeset
2750 */
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2751 @Override
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2752 public void cancelRowUpdates() throws SQLException {
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2753 throw newSQLFeatureNotSupportedException("cancelRowUpdates");
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2754 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2755
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2756 @Override
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2757 public void deleteRow() throws SQLException {
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2758 throw newSQLFeatureNotSupportedException("deleteRow");
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2759 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2760
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2761 @Override
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2762 public void insertRow() throws SQLException {
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2763 throw newSQLFeatureNotSupportedException("insertRow");
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2764 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2765
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2766 @Override
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2767 public void moveToCurrentRow() throws SQLException {
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2768 throw newSQLFeatureNotSupportedException("moveToCurrentRow");
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2769 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2770
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2771 @Override
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2772 public void moveToInsertRow() throws SQLException {
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2773 throw newSQLFeatureNotSupportedException("moveToInsertRow");
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2774 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2775
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2776 @Override
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2777 public void refreshRow() throws SQLException {
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2778 throw newSQLFeatureNotSupportedException("refreshRow");
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2779 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2780
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2781
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2782 @Override
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2783 public void updateArray(int columnIndex, Array x) throws SQLException {
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2784 throw newSQLFeatureNotSupportedException("updateArray");
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2785 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2786
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2787 @Override
151
3d5ea891bb74 Update implementation to match the JDBC spec so use
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 145
diff changeset
2788 public void updateArray(String columnLabel, Array x) throws SQLException {
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2789 throw newSQLFeatureNotSupportedException("updateArray");
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2790 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2791
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2792 @Override
262
2d62ca1f758b Moved utility method newSQLFeatureNotSupportedException(String name) from MonetPreparedStatement.java and MonetResultSet.java
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 261
diff changeset
2793 public void updateAsciiStream(int columnIndex, InputStream x) throws SQLException {
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2794 throw newSQLFeatureNotSupportedException("updateAsciiStream");
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2795 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2796
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2797 @Override
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2798 public void updateAsciiStream(int columnIndex, InputStream x, int length) throws SQLException {
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2799 throw newSQLFeatureNotSupportedException("updateAsciiStream");
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2800 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2801
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2802 @Override
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2803 public void updateAsciiStream(int columnIndex, InputStream x, long length) throws SQLException {
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2804 throw newSQLFeatureNotSupportedException("updateAsciiStream");
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2805 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2806
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2807 @Override
151
3d5ea891bb74 Update implementation to match the JDBC spec so use
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 145
diff changeset
2808 public void updateAsciiStream(String columnLabel, InputStream x) throws SQLException {
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2809 throw newSQLFeatureNotSupportedException("updateAsciiStream");
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2810 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2811
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2812 @Override
151
3d5ea891bb74 Update implementation to match the JDBC spec so use
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 145
diff changeset
2813 public void updateAsciiStream(String columnLabel, InputStream x, int length) throws SQLException {
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2814 throw newSQLFeatureNotSupportedException("updateAsciiStream");
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2815 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2816
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2817 @Override
151
3d5ea891bb74 Update implementation to match the JDBC spec so use
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 145
diff changeset
2818 public void updateAsciiStream(String columnLabel, InputStream x, long length) throws SQLException {
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2819 throw newSQLFeatureNotSupportedException("updateAsciiStream");
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2820 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2821
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2822 @Override
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2823 public void updateBigDecimal(int columnIndex, BigDecimal x) throws SQLException {
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2824 throw newSQLFeatureNotSupportedException("updateBigDecimal");
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2825 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2826
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2827 @Override
151
3d5ea891bb74 Update implementation to match the JDBC spec so use
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 145
diff changeset
2828 public void updateBigDecimal(String columnLabel, BigDecimal x) throws SQLException {
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2829 throw newSQLFeatureNotSupportedException("updateBigDecimal");
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2830 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2831
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2832 @Override
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2833 public void updateBinaryStream(int columnIndex, InputStream x) throws SQLException {
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2834 throw newSQLFeatureNotSupportedException("updateBinaryStream");
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2835 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2836
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2837 @Override
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2838 public void updateBinaryStream(int columnIndex, InputStream x, int length) throws SQLException {
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2839 throw newSQLFeatureNotSupportedException("updateBinaryStream");
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2840 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2841
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2842 @Override
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2843 public void updateBinaryStream(int columnIndex, InputStream x, long length) throws SQLException {
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2844 throw newSQLFeatureNotSupportedException("updateBinaryStream");
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2845 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2846
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2847 @Override
151
3d5ea891bb74 Update implementation to match the JDBC spec so use
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 145
diff changeset
2848 public void updateBinaryStream(String columnLabel, InputStream x) throws SQLException {
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2849 throw newSQLFeatureNotSupportedException("updateBinaryStream");
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2850 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2851
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2852 @Override
151
3d5ea891bb74 Update implementation to match the JDBC spec so use
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 145
diff changeset
2853 public void updateBinaryStream(String columnLabel, InputStream x, int length) throws SQLException {
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2854 throw newSQLFeatureNotSupportedException("updateBinaryStream");
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2855 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2856
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2857 @Override
151
3d5ea891bb74 Update implementation to match the JDBC spec so use
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 145
diff changeset
2858 public void updateBinaryStream(String columnLabel, InputStream x, long length) throws SQLException {
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2859 throw newSQLFeatureNotSupportedException("updateBinaryStream");
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2860 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2861
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2862 @Override
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2863 public void updateBlob(int columnIndex, Blob x) throws SQLException {
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2864 throw newSQLFeatureNotSupportedException("updateBlob");
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2865 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2866
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2867 @Override
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2868 public void updateBlob(int columnIndex, InputStream s) throws SQLException {
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2869 throw newSQLFeatureNotSupportedException("updateBlob");
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2870 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2871
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2872 @Override
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2873 public void updateBlob(int columnIndex, InputStream s, long length) throws SQLException {
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2874 throw newSQLFeatureNotSupportedException("updateBlob");
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2875 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2876
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2877 @Override
151
3d5ea891bb74 Update implementation to match the JDBC spec so use
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 145
diff changeset
2878 public void updateBlob(String columnLabel, Blob x) throws SQLException {
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2879 throw newSQLFeatureNotSupportedException("updateBlob");
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2880 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2881
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2882 @Override
151
3d5ea891bb74 Update implementation to match the JDBC spec so use
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 145
diff changeset
2883 public void updateBlob(String columnLabel, InputStream s) throws SQLException {
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2884 throw newSQLFeatureNotSupportedException("updateBlob");
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2885 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2886
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2887 @Override
151
3d5ea891bb74 Update implementation to match the JDBC spec so use
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 145
diff changeset
2888 public void updateBlob(String columnLabel, InputStream s, long length) throws SQLException {
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2889 throw newSQLFeatureNotSupportedException("updateBlob");
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2890 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2891
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2892 @Override
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2893 public void updateBoolean(int columnIndex, boolean x) throws SQLException {
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2894 throw newSQLFeatureNotSupportedException("updateBoolean");
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2895 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2896
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2897 @Override
151
3d5ea891bb74 Update implementation to match the JDBC spec so use
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 145
diff changeset
2898 public void updateBoolean(String columnLabel, boolean x) throws SQLException {
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2899 throw newSQLFeatureNotSupportedException("updateBoolean");
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2900 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2901
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2902 @Override
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2903 public void updateByte(int columnIndex, byte x) throws SQLException {
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2904 throw newSQLFeatureNotSupportedException("updateByte");
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2905 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2906
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2907 @Override
151
3d5ea891bb74 Update implementation to match the JDBC spec so use
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 145
diff changeset
2908 public void updateByte(String columnLabel, byte x) throws SQLException {
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2909 throw newSQLFeatureNotSupportedException("updateByte");
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2910 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2911
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2912 @Override
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2913 public void updateBytes(int columnIndex, byte[] x) throws SQLException {
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2914 throw newSQLFeatureNotSupportedException("updateBytes");
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2915 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2916
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2917 @Override
151
3d5ea891bb74 Update implementation to match the JDBC spec so use
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 145
diff changeset
2918 public void updateBytes(String columnLabel, byte[] x) throws SQLException {
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2919 throw newSQLFeatureNotSupportedException("updateBytes");
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2920 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2921
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2922 @Override
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2923 public void updateCharacterStream(int columnIndex, Reader x) throws SQLException {
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2924 throw newSQLFeatureNotSupportedException("updateCharacterStream");
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2925 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2926
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2927 @Override
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2928 public void updateCharacterStream(int columnIndex, Reader x, int length) throws SQLException {
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2929 throw newSQLFeatureNotSupportedException("updateCharacterStream");
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2930 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2931
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2932 @Override
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2933 public void updateCharacterStream(int columnIndex, Reader x, long length) throws SQLException {
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2934 throw newSQLFeatureNotSupportedException("updateCharacterStream");
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2935 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2936
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2937 @Override
151
3d5ea891bb74 Update implementation to match the JDBC spec so use
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 145
diff changeset
2938 public void updateCharacterStream(String columnLabel, Reader reader) throws SQLException {
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2939 throw newSQLFeatureNotSupportedException("updateCharacterStream");
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2940 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2941
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2942 @Override
151
3d5ea891bb74 Update implementation to match the JDBC spec so use
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 145
diff changeset
2943 public void updateCharacterStream(String columnLabel, Reader reader, int length) throws SQLException {
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2944 throw newSQLFeatureNotSupportedException("updateCharacterStream");
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2945 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2946
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2947 @Override
151
3d5ea891bb74 Update implementation to match the JDBC spec so use
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 145
diff changeset
2948 public void updateCharacterStream(String columnLabel, Reader reader, long length) throws SQLException {
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2949 throw newSQLFeatureNotSupportedException("updateCharacterStream");
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2950 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2951
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2952 @Override
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2953 public void updateNCharacterStream(int columnIndex, Reader x) throws SQLException {
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2954 throw newSQLFeatureNotSupportedException("updateNCharacterStream");
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2955 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2956
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2957 @Override
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2958 public void updateNCharacterStream(int columnIndex, Reader x, long length) throws SQLException {
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2959 throw newSQLFeatureNotSupportedException("updateNCharacterStream");
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2960 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2961
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2962 @Override
151
3d5ea891bb74 Update implementation to match the JDBC spec so use
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 145
diff changeset
2963 public void updateNCharacterStream(String columnLabel, Reader reader) throws SQLException {
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2964 throw newSQLFeatureNotSupportedException("updateNCharacterStream");
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2965 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2966
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2967 @Override
151
3d5ea891bb74 Update implementation to match the JDBC spec so use
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 145
diff changeset
2968 public void updateNCharacterStream(String columnLabel, Reader reader, long length) throws SQLException {
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2969 throw newSQLFeatureNotSupportedException("updateNCharacterStream");
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2970 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2971
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2972 @Override
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2973 public void updateClob(int columnIndex, Clob x) throws SQLException {
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2974 throw newSQLFeatureNotSupportedException("updateClob");
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2975 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2976
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2977 @Override
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2978 public void updateClob(int columnIndex, Reader r) throws SQLException {
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2979 throw newSQLFeatureNotSupportedException("updateClob");
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2980 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2981
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2982 @Override
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2983 public void updateClob(int columnIndex, Reader r, long length) throws SQLException {
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2984 throw newSQLFeatureNotSupportedException("updateClob");
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2985 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2986
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2987 @Override
151
3d5ea891bb74 Update implementation to match the JDBC spec so use
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 145
diff changeset
2988 public void updateClob(String columnLabel, Clob x) throws SQLException {
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2989 throw newSQLFeatureNotSupportedException("updateClob");
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2990 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2991
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2992 @Override
151
3d5ea891bb74 Update implementation to match the JDBC spec so use
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 145
diff changeset
2993 public void updateClob(String columnLabel, Reader r) throws SQLException {
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2994 throw newSQLFeatureNotSupportedException("updateClob");
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2995 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2996
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2997 @Override
151
3d5ea891bb74 Update implementation to match the JDBC spec so use
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 145
diff changeset
2998 public void updateClob(String columnLabel, Reader r, long length) throws SQLException {
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2999 throw newSQLFeatureNotSupportedException("updateClob");
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
3000 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
3001
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
3002 @Override
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
3003 public void updateNClob(int columnIndex, NClob x) throws SQLException {
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
3004 throw newSQLFeatureNotSupportedException("updateNClob");
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
3005 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
3006
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
3007 @Override
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
3008 public void updateNClob(int columnIndex, Reader r) throws SQLException {
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
3009 throw newSQLFeatureNotSupportedException("updateNClob");
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
3010 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
3011
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
3012 @Override
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
3013 public void updateNClob(int columnIndex, Reader r, long length) throws SQLException {
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
3014 throw newSQLFeatureNotSupportedException("updateNClob");
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
3015 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
3016
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
3017 @Override
151
3d5ea891bb74 Update implementation to match the JDBC spec so use
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 145
diff changeset
3018 public void updateNClob(String columnLabel, NClob x) throws SQLException {
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
3019 throw newSQLFeatureNotSupportedException("updateNClob");
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
3020 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
3021
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
3022 @Override
151
3d5ea891bb74 Update implementation to match the JDBC spec so use
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 145
diff changeset
3023 public void updateNClob(String columnLabel, Reader r) throws SQLException {
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
3024 throw newSQLFeatureNotSupportedException("updateNClob");
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
3025 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
3026
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
3027 @Override
151
3d5ea891bb74 Update implementation to match the JDBC spec so use
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 145
diff changeset
3028 public void updateNClob(String columnLabel, Reader r, long length) throws SQLException {
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
3029 throw newSQLFeatureNotSupportedException("updateNClob");
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
3030 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
3031
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
3032 @Override
773
2bd1983f1c11 Reduce code by importing java.sql.Date; and remove prefix java.sql. where no longer needed.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 769
diff changeset
3033 public void updateDate(int columnIndex, Date x) throws SQLException {
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
3034 throw newSQLFeatureNotSupportedException("updateDate");
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
3035 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
3036
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
3037 @Override
773
2bd1983f1c11 Reduce code by importing java.sql.Date; and remove prefix java.sql. where no longer needed.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 769
diff changeset
3038 public void updateDate(String columnLabel, Date x) throws SQLException {
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
3039 throw newSQLFeatureNotSupportedException("updateDate");
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
3040 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
3041
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
3042 @Override
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
3043 public void updateDouble(int columnIndex, double x) throws SQLException {
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
3044 throw newSQLFeatureNotSupportedException("updateDouble");
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
3045 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
3046
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
3047 @Override
151
3d5ea891bb74 Update implementation to match the JDBC spec so use
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 145
diff changeset
3048 public void updateDouble(String columnLabel, double x) throws SQLException {
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
3049 throw newSQLFeatureNotSupportedException("updateDouble");
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
3050 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
3051
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
3052 @Override
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
3053 public void updateFloat(int columnIndex, float x) throws SQLException {
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
3054 throw newSQLFeatureNotSupportedException("updateFloat");
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
3055 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
3056
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
3057 @Override
151
3d5ea891bb74 Update implementation to match the JDBC spec so use
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 145
diff changeset
3058 public void updateFloat(String columnLabel, float x) throws SQLException {
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
3059 throw newSQLFeatureNotSupportedException("updateFloat");
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
3060 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
3061
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
3062 @Override
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
3063 public void updateInt(int columnIndex, int x) throws SQLException {
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
3064 throw newSQLFeatureNotSupportedException("updateInt");
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
3065 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
3066
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
3067 @Override
151
3d5ea891bb74 Update implementation to match the JDBC spec so use
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 145
diff changeset
3068 public void updateInt(String columnLabel, int x) throws SQLException {
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
3069 throw newSQLFeatureNotSupportedException("updateInt");
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
3070 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
3071
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
3072 @Override
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
3073 public void updateLong(int columnIndex, long x) throws SQLException {
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
3074 throw newSQLFeatureNotSupportedException("updateLong");
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
3075 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
3076
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
3077 @Override
151
3d5ea891bb74 Update implementation to match the JDBC spec so use
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 145
diff changeset
3078 public void updateLong(String columnLabel, long x) throws SQLException {
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
3079 throw newSQLFeatureNotSupportedException("updateLong");
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
3080 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
3081
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
3082 @Override
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
3083 public void updateNull(int columnIndex) throws SQLException {
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
3084 throw newSQLFeatureNotSupportedException("updateNull");
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
3085 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
3086
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
3087 @Override
151
3d5ea891bb74 Update implementation to match the JDBC spec so use
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 145
diff changeset
3088 public void updateNull(String columnLabel) throws SQLException {
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
3089 throw newSQLFeatureNotSupportedException("updateNull");
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
3090 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
3091
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
3092 @Override
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
3093 public void updateObject(int columnIndex, Object x) throws SQLException {
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
3094 throw newSQLFeatureNotSupportedException("updateObject");
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
3095 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
3096
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
3097 @Override
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
3098 public void updateObject(int columnIndex, Object x, int scale) throws SQLException {
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
3099 throw newSQLFeatureNotSupportedException("updateObject");
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
3100 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
3101
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
3102 @Override
151
3d5ea891bb74 Update implementation to match the JDBC spec so use
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 145
diff changeset
3103 public void updateObject(String columnLabel, Object x) throws SQLException {
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
3104 throw newSQLFeatureNotSupportedException("updateObject");
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
3105 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
3106
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
3107 @Override
151
3d5ea891bb74 Update implementation to match the JDBC spec so use
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 145
diff changeset
3108 public void updateObject(String columnLabel, Object x, int scale) throws SQLException {
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
3109 throw newSQLFeatureNotSupportedException("updateObject");
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
3110 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
3111
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
3112 @Override
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
3113 public void updateRef(int columnIndex, Ref x) throws SQLException {
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
3114 throw newSQLFeatureNotSupportedException("updateRef");
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
3115 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
3116
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
3117 @Override
151
3d5ea891bb74 Update implementation to match the JDBC spec so use
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 145
diff changeset
3118 public void updateRef(String columnLabel, Ref x) throws SQLException {
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
3119 throw newSQLFeatureNotSupportedException("updateRef");
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
3120 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
3121
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
3122 @Override
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
3123 public void updateRow() throws SQLException {
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
3124 throw newSQLFeatureNotSupportedException("updateRow");
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
3125 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
3126
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
3127 @Override
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
3128 public void updateRowId(int columnIndex, RowId x) throws SQLException {
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
3129 throw newSQLFeatureNotSupportedException("updateRowId");
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
3130 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
3131
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
3132 @Override
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
3133 public void updateRowId(String columnLabel, RowId x) throws SQLException {
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
3134 throw newSQLFeatureNotSupportedException("updateRowId");
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
3135 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
3136
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
3137 @Override
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
3138 public void updateShort(int columnIndex, short x) throws SQLException {
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
3139 throw newSQLFeatureNotSupportedException("updateShort");
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
3140 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
3141
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
3142 @Override
151
3d5ea891bb74 Update implementation to match the JDBC spec so use
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 145
diff changeset
3143 public void updateShort(String columnLabel, short x) throws SQLException {
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
3144 throw newSQLFeatureNotSupportedException("updateShort");
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
3145 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
3146
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
3147 @Override
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
3148 public void updateString(int columnIndex, String x) throws SQLException {
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
3149 throw newSQLFeatureNotSupportedException("updateString");
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
3150 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
3151
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
3152 @Override
151
3d5ea891bb74 Update implementation to match the JDBC spec so use
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 145
diff changeset
3153 public void updateString(String columnLabel, String x) throws SQLException {
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
3154 throw newSQLFeatureNotSupportedException("updateString");
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
3155 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
3156
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
3157 @Override
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
3158 public void updateNString(int columnIndex, String x) throws SQLException {
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
3159 throw newSQLFeatureNotSupportedException("updateNString");
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
3160 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
3161
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
3162 @Override
151
3d5ea891bb74 Update implementation to match the JDBC spec so use
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 145
diff changeset
3163 public void updateNString(String columnLabel, String x) throws SQLException {
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
3164 throw newSQLFeatureNotSupportedException("updateNString");
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
3165 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
3166
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
3167 @Override
262
2d62ca1f758b Moved utility method newSQLFeatureNotSupportedException(String name) from MonetPreparedStatement.java and MonetResultSet.java
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 261
diff changeset
3168 public void updateSQLXML(int columnIndex, SQLXML x) throws SQLException {
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
3169 throw newSQLFeatureNotSupportedException("updateSQLXML");
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
3170 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
3171
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
3172 @Override
262
2d62ca1f758b Moved utility method newSQLFeatureNotSupportedException(String name) from MonetPreparedStatement.java and MonetResultSet.java
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 261
diff changeset
3173 public void updateSQLXML(String columnLabel, SQLXML x) throws SQLException {
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
3174 throw newSQLFeatureNotSupportedException("updateSQLXML");
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
3175 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
3176
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
3177 @Override
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
3178 public void updateTime(int columnIndex, Time x) throws SQLException {
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
3179 throw newSQLFeatureNotSupportedException("updateTime");
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
3180 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
3181
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
3182 @Override
151
3d5ea891bb74 Update implementation to match the JDBC spec so use
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 145
diff changeset
3183 public void updateTime(String columnLabel, Time x) throws SQLException {
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
3184 throw newSQLFeatureNotSupportedException("updateTime");
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
3185 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
3186
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
3187 @Override
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
3188 public void updateTimestamp(int columnIndex, Timestamp x) throws SQLException {
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
3189 throw newSQLFeatureNotSupportedException("updateTimestamp");
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
3190 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
3191
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
3192 @Override
151
3d5ea891bb74 Update implementation to match the JDBC spec so use
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 145
diff changeset
3193 public void updateTimestamp(String columnLabel, Timestamp x) throws SQLException {
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
3194 throw newSQLFeatureNotSupportedException("updateTimestamp");
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
3195 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
3196
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
3197 // Chapter 14.2.3.3 Sun JDBC 3.0 Specification
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
3198 /**
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
3199 * Reports whether the last column read had a value of SQL NULL. Note that
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
3200 * you must first call one of the getter methods on a column to try to read
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
3201 * its value and then call the method wasNull to see if the value read was
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
3202 * SQL NULL.
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
3203 *
187
daa1a4c70879 For MonetresultSet class: added method checkNotClosed() and invocation for all methods which should test it.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 180
diff changeset
3204 * @return true if the last column value read was SQL NULL and false otherwise
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
3205 */
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
3206 @Override
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
3207 public boolean wasNull() {
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
3208 return lastReadWasNull;
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
3209 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
3210
376
ffdc7b0e102d Updated JDBC driver to comply with JDBC 4.2 interface now we compile for Java 8. This includes:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 350
diff changeset
3211 //== Java 1.7 methods (JDBC 4.1)
ffdc7b0e102d Updated JDBC driver to comply with JDBC 4.2 interface now we compile for Java 8. This includes:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 350
diff changeset
3212
ffdc7b0e102d Updated JDBC driver to comply with JDBC 4.2 interface now we compile for Java 8. This includes:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 350
diff changeset
3213 /**
ffdc7b0e102d Updated JDBC driver to comply with JDBC 4.2 interface now we compile for Java 8. This includes:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 350
diff changeset
3214 * Retrieves the value of the designated column in the current row
ffdc7b0e102d Updated JDBC driver to comply with JDBC 4.2 interface now we compile for Java 8. This includes:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 350
diff changeset
3215 * of this ResultSet object and will convert from the SQL type of
ffdc7b0e102d Updated JDBC driver to comply with JDBC 4.2 interface now we compile for Java 8. This includes:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 350
diff changeset
3216 * the column to the requested Java data type, if the conversion is
ffdc7b0e102d Updated JDBC driver to comply with JDBC 4.2 interface now we compile for Java 8. This includes:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 350
diff changeset
3217 * supported. If the conversion is not supported or null is
ffdc7b0e102d Updated JDBC driver to comply with JDBC 4.2 interface now we compile for Java 8. This includes:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 350
diff changeset
3218 * specified for the type, a SQLException is thrown.
ffdc7b0e102d Updated JDBC driver to comply with JDBC 4.2 interface now we compile for Java 8. This includes:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 350
diff changeset
3219 *
ffdc7b0e102d Updated JDBC driver to comply with JDBC 4.2 interface now we compile for Java 8. This includes:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 350
diff changeset
3220 * At a minimum, an implementation must support the conversions defined
ffdc7b0e102d Updated JDBC driver to comply with JDBC 4.2 interface now we compile for Java 8. This includes:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 350
diff changeset
3221 * in Appendix B, Table B-3 and conversion of appropriate user defined
ffdc7b0e102d Updated JDBC driver to comply with JDBC 4.2 interface now we compile for Java 8. This includes:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 350
diff changeset
3222 * SQL types to a Java type which implements SQLData, or Struct.
ffdc7b0e102d Updated JDBC driver to comply with JDBC 4.2 interface now we compile for Java 8. This includes:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 350
diff changeset
3223 * Additional conversions may be supported and are vendor defined.
ffdc7b0e102d Updated JDBC driver to comply with JDBC 4.2 interface now we compile for Java 8. This includes:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 350
diff changeset
3224 *
ffdc7b0e102d Updated JDBC driver to comply with JDBC 4.2 interface now we compile for Java 8. This includes:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 350
diff changeset
3225 * @param columnIndex the first column is 1, the second is 2, ...
ffdc7b0e102d Updated JDBC driver to comply with JDBC 4.2 interface now we compile for Java 8. This includes:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 350
diff changeset
3226 * @param type Class representing the Java data type to convert the
ffdc7b0e102d Updated JDBC driver to comply with JDBC 4.2 interface now we compile for Java 8. This includes:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 350
diff changeset
3227 * designated column to
ffdc7b0e102d Updated JDBC driver to comply with JDBC 4.2 interface now we compile for Java 8. This includes:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 350
diff changeset
3228 * @return an instance of type holding the column value
ffdc7b0e102d Updated JDBC driver to comply with JDBC 4.2 interface now we compile for Java 8. This includes:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 350
diff changeset
3229 * @throws SQLException if conversion is not supported, type is
ffdc7b0e102d Updated JDBC driver to comply with JDBC 4.2 interface now we compile for Java 8. This includes:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 350
diff changeset
3230 * null or another error occurs. The getCause() method of
ffdc7b0e102d Updated JDBC driver to comply with JDBC 4.2 interface now we compile for Java 8. This includes:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 350
diff changeset
3231 * the exception may provide a more detailed exception, for
ffdc7b0e102d Updated JDBC driver to comply with JDBC 4.2 interface now we compile for Java 8. This includes:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 350
diff changeset
3232 * example, if a conversion error occurs
ffdc7b0e102d Updated JDBC driver to comply with JDBC 4.2 interface now we compile for Java 8. This includes:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 350
diff changeset
3233 */
ffdc7b0e102d Updated JDBC driver to comply with JDBC 4.2 interface now we compile for Java 8. This includes:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 350
diff changeset
3234 @Override
ffdc7b0e102d Updated JDBC driver to comply with JDBC 4.2 interface now we compile for Java 8. This includes:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 350
diff changeset
3235 public <T> T getObject(final int columnIndex, final Class<T> type) throws SQLException {
ffdc7b0e102d Updated JDBC driver to comply with JDBC 4.2 interface now we compile for Java 8. This includes:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 350
diff changeset
3236 checkNotClosed();
ffdc7b0e102d Updated JDBC driver to comply with JDBC 4.2 interface now we compile for Java 8. This includes:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 350
diff changeset
3237 if (type == null)
ffdc7b0e102d Updated JDBC driver to comply with JDBC 4.2 interface now we compile for Java 8. This includes:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 350
diff changeset
3238 throw new SQLException("type is null", "M1M05");
ffdc7b0e102d Updated JDBC driver to comply with JDBC 4.2 interface now we compile for Java 8. This includes:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 350
diff changeset
3239
774
e029af7551b7 Implemented ResultSet methods:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 773
diff changeset
3240 final String val;
e029af7551b7 Implemented ResultSet methods:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 773
diff changeset
3241 try {
e029af7551b7 Implemented ResultSet methods:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 773
diff changeset
3242 val = tlp.values[columnIndex - 1];
e029af7551b7 Implemented ResultSet methods:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 773
diff changeset
3243 if (val == null) {
e029af7551b7 Implemented ResultSet methods:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 773
diff changeset
3244 lastReadWasNull = true;
e029af7551b7 Implemented ResultSet methods:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 773
diff changeset
3245 return null;
e029af7551b7 Implemented ResultSet methods:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 773
diff changeset
3246 }
e029af7551b7 Implemented ResultSet methods:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 773
diff changeset
3247 lastReadWasNull = false;
e029af7551b7 Implemented ResultSet methods:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 773
diff changeset
3248 } catch (IndexOutOfBoundsException e) {
e029af7551b7 Implemented ResultSet methods:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 773
diff changeset
3249 throw newSQLInvalidColumnIndexException(columnIndex);
e029af7551b7 Implemented ResultSet methods:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 773
diff changeset
3250 }
e029af7551b7 Implemented ResultSet methods:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 773
diff changeset
3251
e029af7551b7 Implemented ResultSet methods:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 773
diff changeset
3252 if (type == String.class) {
e029af7551b7 Implemented ResultSet methods:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 773
diff changeset
3253 return type.cast(val);
e029af7551b7 Implemented ResultSet methods:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 773
diff changeset
3254 }
e029af7551b7 Implemented ResultSet methods:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 773
diff changeset
3255 if (type == Integer.class) {
e029af7551b7 Implemented ResultSet methods:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 773
diff changeset
3256 return type.cast(Integer.valueOf(getInt(columnIndex)));
e029af7551b7 Implemented ResultSet methods:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 773
diff changeset
3257 }
e029af7551b7 Implemented ResultSet methods:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 773
diff changeset
3258 if (type == Long.class) {
e029af7551b7 Implemented ResultSet methods:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 773
diff changeset
3259 return type.cast(Long.valueOf(getLong(columnIndex)));
e029af7551b7 Implemented ResultSet methods:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 773
diff changeset
3260 }
e029af7551b7 Implemented ResultSet methods:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 773
diff changeset
3261 if (type == Short.class) {
e029af7551b7 Implemented ResultSet methods:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 773
diff changeset
3262 return type.cast(Short.valueOf(getShort(columnIndex)));
e029af7551b7 Implemented ResultSet methods:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 773
diff changeset
3263 }
e029af7551b7 Implemented ResultSet methods:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 773
diff changeset
3264 if (type == Double.class) {
e029af7551b7 Implemented ResultSet methods:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 773
diff changeset
3265 return type.cast(Double.valueOf(getDouble(columnIndex)));
e029af7551b7 Implemented ResultSet methods:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 773
diff changeset
3266 }
e029af7551b7 Implemented ResultSet methods:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 773
diff changeset
3267 if (type == Float.class) {
e029af7551b7 Implemented ResultSet methods:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 773
diff changeset
3268 return type.cast(Float.valueOf(getFloat(columnIndex)));
e029af7551b7 Implemented ResultSet methods:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 773
diff changeset
3269 }
e029af7551b7 Implemented ResultSet methods:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 773
diff changeset
3270 if (type == BigDecimal.class) {
e029af7551b7 Implemented ResultSet methods:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 773
diff changeset
3271 return type.cast(getBigDecimal(columnIndex));
e029af7551b7 Implemented ResultSet methods:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 773
diff changeset
3272 }
e029af7551b7 Implemented ResultSet methods:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 773
diff changeset
3273 if (type == Boolean.class) {
e029af7551b7 Implemented ResultSet methods:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 773
diff changeset
3274 return type.cast(Boolean.valueOf(getBoolean(columnIndex)));
e029af7551b7 Implemented ResultSet methods:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 773
diff changeset
3275 }
e029af7551b7 Implemented ResultSet methods:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 773
diff changeset
3276 if (type == byte[].class) {
e029af7551b7 Implemented ResultSet methods:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 773
diff changeset
3277 return type.cast(getBytes(columnIndex));
e029af7551b7 Implemented ResultSet methods:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 773
diff changeset
3278 }
e029af7551b7 Implemented ResultSet methods:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 773
diff changeset
3279 if (type == Blob.class || type == MonetBlob.class) {
e029af7551b7 Implemented ResultSet methods:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 773
diff changeset
3280 return type.cast(getBlob(columnIndex));
e029af7551b7 Implemented ResultSet methods:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 773
diff changeset
3281 }
e029af7551b7 Implemented ResultSet methods:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 773
diff changeset
3282 if (type == Clob.class || type == MonetClob.class) {
e029af7551b7 Implemented ResultSet methods:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 773
diff changeset
3283 return type.cast(getClob(columnIndex));
e029af7551b7 Implemented ResultSet methods:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 773
diff changeset
3284 }
e029af7551b7 Implemented ResultSet methods:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 773
diff changeset
3285 if (type == URL.class) {
e029af7551b7 Implemented ResultSet methods:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 773
diff changeset
3286 return type.cast(getURL(columnIndex));
e029af7551b7 Implemented ResultSet methods:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 773
diff changeset
3287 }
e029af7551b7 Implemented ResultSet methods:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 773
diff changeset
3288 if (type == Date.class) {
e029af7551b7 Implemented ResultSet methods:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 773
diff changeset
3289 return type.cast(getDate(columnIndex, null));
e029af7551b7 Implemented ResultSet methods:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 773
diff changeset
3290 }
e029af7551b7 Implemented ResultSet methods:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 773
diff changeset
3291 if (type == Time.class) {
e029af7551b7 Implemented ResultSet methods:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 773
diff changeset
3292 return type.cast(getTime(columnIndex, null));
e029af7551b7 Implemented ResultSet methods:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 773
diff changeset
3293 }
e029af7551b7 Implemented ResultSet methods:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 773
diff changeset
3294 if (type == Timestamp.class) {
e029af7551b7 Implemented ResultSet methods:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 773
diff changeset
3295 return type.cast(getTimestamp(columnIndex, null));
e029af7551b7 Implemented ResultSet methods:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 773
diff changeset
3296 }
832
7eb05cbf67dc In ResultSet.getObject(column, Class<T> type) and ResultSet.getObject(column, Map<String,Class<?>>) methods added support to return objects for classes: java.time.LocalDate, java.time.LocalDateTime.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 820
diff changeset
3297 if (type == LocalDate.class) {
7eb05cbf67dc In ResultSet.getObject(column, Class<T> type) and ResultSet.getObject(column, Map<String,Class<?>>) methods added support to return objects for classes: java.time.LocalDate, java.time.LocalDateTime.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 820
diff changeset
3298 return type.cast(getLocalDate(columnIndex));
7eb05cbf67dc In ResultSet.getObject(column, Class<T> type) and ResultSet.getObject(column, Map<String,Class<?>>) methods added support to return objects for classes: java.time.LocalDate, java.time.LocalDateTime.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 820
diff changeset
3299 }
7eb05cbf67dc In ResultSet.getObject(column, Class<T> type) and ResultSet.getObject(column, Map<String,Class<?>>) methods added support to return objects for classes: java.time.LocalDate, java.time.LocalDateTime.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 820
diff changeset
3300 if (type == LocalDateTime.class) {
7eb05cbf67dc In ResultSet.getObject(column, Class<T> type) and ResultSet.getObject(column, Map<String,Class<?>>) methods added support to return objects for classes: java.time.LocalDate, java.time.LocalDateTime.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 820
diff changeset
3301 return type.cast(getLocalDateTime(columnIndex));
7eb05cbf67dc In ResultSet.getObject(column, Class<T> type) and ResultSet.getObject(column, Map<String,Class<?>>) methods added support to return objects for classes: java.time.LocalDate, java.time.LocalDateTime.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 820
diff changeset
3302 }
7eb05cbf67dc In ResultSet.getObject(column, Class<T> type) and ResultSet.getObject(column, Map<String,Class<?>>) methods added support to return objects for classes: java.time.LocalDate, java.time.LocalDateTime.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 820
diff changeset
3303 if (type == LocalTime.class) {
7eb05cbf67dc In ResultSet.getObject(column, Class<T> type) and ResultSet.getObject(column, Map<String,Class<?>>) methods added support to return objects for classes: java.time.LocalDate, java.time.LocalDateTime.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 820
diff changeset
3304 return type.cast(getLocalTime(columnIndex));
820
4c35009cd59c In ResultSet.getObject() method added support for retrieving
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 774
diff changeset
3305 }
4c35009cd59c In ResultSet.getObject() method added support for retrieving
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 774
diff changeset
3306 if (type == OffsetDateTime.class) {
4c35009cd59c In ResultSet.getObject() method added support for retrieving
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 774
diff changeset
3307 return type.cast(getOffsetDateTime(columnIndex));
4c35009cd59c In ResultSet.getObject() method added support for retrieving
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 774
diff changeset
3308 }
832
7eb05cbf67dc In ResultSet.getObject(column, Class<T> type) and ResultSet.getObject(column, Map<String,Class<?>>) methods added support to return objects for classes: java.time.LocalDate, java.time.LocalDateTime.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 820
diff changeset
3309 if (type == OffsetTime.class) {
7eb05cbf67dc In ResultSet.getObject(column, Class<T> type) and ResultSet.getObject(column, Map<String,Class<?>>) methods added support to return objects for classes: java.time.LocalDate, java.time.LocalDateTime.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 820
diff changeset
3310 return type.cast(getOffsetTime(columnIndex));
7eb05cbf67dc In ResultSet.getObject(column, Class<T> type) and ResultSet.getObject(column, Map<String,Class<?>>) methods added support to return objects for classes: java.time.LocalDate, java.time.LocalDateTime.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 820
diff changeset
3311 }
774
e029af7551b7 Implemented ResultSet methods:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 773
diff changeset
3312 if (type == java.util.Date.class) {
e029af7551b7 Implemented ResultSet methods:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 773
diff changeset
3313 final Timestamp timestamp = getTimestamp(columnIndex, null);
e029af7551b7 Implemented ResultSet methods:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 773
diff changeset
3314 return type.cast(new java.util.Date(timestamp.getTime()));
e029af7551b7 Implemented ResultSet methods:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 773
diff changeset
3315 }
e029af7551b7 Implemented ResultSet methods:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 773
diff changeset
3316 if (type == Calendar.class) {
e029af7551b7 Implemented ResultSet methods:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 773
diff changeset
3317 final Calendar cal = Calendar.getInstance();
e029af7551b7 Implemented ResultSet methods:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 773
diff changeset
3318 getJavaDate(cal, columnIndex, Types.TIMESTAMP);
e029af7551b7 Implemented ResultSet methods:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 773
diff changeset
3319 return type.cast(cal);
e029af7551b7 Implemented ResultSet methods:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 773
diff changeset
3320 }
e029af7551b7 Implemented ResultSet methods:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 773
diff changeset
3321 if (type == java.util.UUID.class) {
e029af7551b7 Implemented ResultSet methods:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 773
diff changeset
3322 try {
e029af7551b7 Implemented ResultSet methods:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 773
diff changeset
3323 return type.cast(java.util.UUID.fromString(val));
e029af7551b7 Implemented ResultSet methods:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 773
diff changeset
3324 } catch (IllegalArgumentException exc) {
e029af7551b7 Implemented ResultSet methods:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 773
diff changeset
3325 throw new SQLException("conversion to java.util.UUID object failed: " + exc.getMessage(), "M1M05");
e029af7551b7 Implemented ResultSet methods:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 773
diff changeset
3326 }
e029af7551b7 Implemented ResultSet methods:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 773
diff changeset
3327 }
e029af7551b7 Implemented ResultSet methods:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 773
diff changeset
3328 if (type == java.net.InetAddress.class) {
e029af7551b7 Implemented ResultSet methods:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 773
diff changeset
3329 final int slash = val.indexOf('/');
e029af7551b7 Implemented ResultSet methods:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 773
diff changeset
3330 try {
e029af7551b7 Implemented ResultSet methods:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 773
diff changeset
3331 return type.cast(java.net.InetAddress.getByName(slash < 0 ? val : val.substring(0, slash)));
e029af7551b7 Implemented ResultSet methods:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 773
diff changeset
3332 } catch (java.net.UnknownHostException exc) {
e029af7551b7 Implemented ResultSet methods:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 773
diff changeset
3333 throw new SQLException("conversion to java.net.InetAddress object failed: " + exc.getMessage(), "M1M05");
e029af7551b7 Implemented ResultSet methods:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 773
diff changeset
3334 }
e029af7551b7 Implemented ResultSet methods:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 773
diff changeset
3335 }
e029af7551b7 Implemented ResultSet methods:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 773
diff changeset
3336
e029af7551b7 Implemented ResultSet methods:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 773
diff changeset
3337 throw new SQLException("conversion to '" + type.getName() + "' is not supported", "M1M05");
376
ffdc7b0e102d Updated JDBC driver to comply with JDBC 4.2 interface now we compile for Java 8. This includes:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 350
diff changeset
3338 }
ffdc7b0e102d Updated JDBC driver to comply with JDBC 4.2 interface now we compile for Java 8. This includes:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 350
diff changeset
3339
ffdc7b0e102d Updated JDBC driver to comply with JDBC 4.2 interface now we compile for Java 8. This includes:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 350
diff changeset
3340 /**
ffdc7b0e102d Updated JDBC driver to comply with JDBC 4.2 interface now we compile for Java 8. This includes:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 350
diff changeset
3341 * Retrieves the value of the designated column in the current row
ffdc7b0e102d Updated JDBC driver to comply with JDBC 4.2 interface now we compile for Java 8. This includes:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 350
diff changeset
3342 * of this ResultSet object and will convert from the SQL type of
ffdc7b0e102d Updated JDBC driver to comply with JDBC 4.2 interface now we compile for Java 8. This includes:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 350
diff changeset
3343 * the column to the requested Java data type, if the conversion is
ffdc7b0e102d Updated JDBC driver to comply with JDBC 4.2 interface now we compile for Java 8. This includes:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 350
diff changeset
3344 * supported. If the conversion is not supported or null is
ffdc7b0e102d Updated JDBC driver to comply with JDBC 4.2 interface now we compile for Java 8. This includes:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 350
diff changeset
3345 * specified for the type, a SQLException is thrown.
ffdc7b0e102d Updated JDBC driver to comply with JDBC 4.2 interface now we compile for Java 8. This includes:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 350
diff changeset
3346 *
ffdc7b0e102d Updated JDBC driver to comply with JDBC 4.2 interface now we compile for Java 8. This includes:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 350
diff changeset
3347 * @param columnLabel the label for the column specified with the
ffdc7b0e102d Updated JDBC driver to comply with JDBC 4.2 interface now we compile for Java 8. This includes:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 350
diff changeset
3348 * SQL AS clause. If the SQL AS clause was not specified,
ffdc7b0e102d Updated JDBC driver to comply with JDBC 4.2 interface now we compile for Java 8. This includes:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 350
diff changeset
3349 * then the label is the name of the column
ffdc7b0e102d Updated JDBC driver to comply with JDBC 4.2 interface now we compile for Java 8. This includes:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 350
diff changeset
3350 * @param type Class representing the Java data type to convert the
ffdc7b0e102d Updated JDBC driver to comply with JDBC 4.2 interface now we compile for Java 8. This includes:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 350
diff changeset
3351 * designated column to
ffdc7b0e102d Updated JDBC driver to comply with JDBC 4.2 interface now we compile for Java 8. This includes:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 350
diff changeset
3352 * @return an instance of type holding the column value
ffdc7b0e102d Updated JDBC driver to comply with JDBC 4.2 interface now we compile for Java 8. This includes:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 350
diff changeset
3353 * @throws SQLException if conversion is not supported, type is
ffdc7b0e102d Updated JDBC driver to comply with JDBC 4.2 interface now we compile for Java 8. This includes:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 350
diff changeset
3354 * null or another error occurs. The getCause() method of
ffdc7b0e102d Updated JDBC driver to comply with JDBC 4.2 interface now we compile for Java 8. This includes:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 350
diff changeset
3355 * the exception may provide a more detailed exception, for
ffdc7b0e102d Updated JDBC driver to comply with JDBC 4.2 interface now we compile for Java 8. This includes:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 350
diff changeset
3356 * example, if a conversion error occurs
ffdc7b0e102d Updated JDBC driver to comply with JDBC 4.2 interface now we compile for Java 8. This includes:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 350
diff changeset
3357 */
ffdc7b0e102d Updated JDBC driver to comply with JDBC 4.2 interface now we compile for Java 8. This includes:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 350
diff changeset
3358 @Override
ffdc7b0e102d Updated JDBC driver to comply with JDBC 4.2 interface now we compile for Java 8. This includes:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 350
diff changeset
3359 public <T> T getObject(final String columnLabel, final Class<T> type) throws SQLException {
ffdc7b0e102d Updated JDBC driver to comply with JDBC 4.2 interface now we compile for Java 8. This includes:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 350
diff changeset
3360 return getObject(findColumn(columnLabel), type);
ffdc7b0e102d Updated JDBC driver to comply with JDBC 4.2 interface now we compile for Java 8. This includes:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 350
diff changeset
3361 }
ffdc7b0e102d Updated JDBC driver to comply with JDBC 4.2 interface now we compile for Java 8. This includes:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 350
diff changeset
3362
ffdc7b0e102d Updated JDBC driver to comply with JDBC 4.2 interface now we compile for Java 8. This includes:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 350
diff changeset
3363 //== Java 1.8 methods (JDBC 4.2)
ffdc7b0e102d Updated JDBC driver to comply with JDBC 4.2 interface now we compile for Java 8. This includes:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 350
diff changeset
3364
ffdc7b0e102d Updated JDBC driver to comply with JDBC 4.2 interface now we compile for Java 8. This includes:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 350
diff changeset
3365 @Override
ffdc7b0e102d Updated JDBC driver to comply with JDBC 4.2 interface now we compile for Java 8. This includes:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 350
diff changeset
3366 public void updateObject(int columnIndex, Object x, SQLType targetSqlType, int scaleOrLength) throws SQLException {
ffdc7b0e102d Updated JDBC driver to comply with JDBC 4.2 interface now we compile for Java 8. This includes:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 350
diff changeset
3367 throw newSQLFeatureNotSupportedException("updateObject");
ffdc7b0e102d Updated JDBC driver to comply with JDBC 4.2 interface now we compile for Java 8. This includes:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 350
diff changeset
3368 }
ffdc7b0e102d Updated JDBC driver to comply with JDBC 4.2 interface now we compile for Java 8. This includes:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 350
diff changeset
3369
ffdc7b0e102d Updated JDBC driver to comply with JDBC 4.2 interface now we compile for Java 8. This includes:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 350
diff changeset
3370 @Override
ffdc7b0e102d Updated JDBC driver to comply with JDBC 4.2 interface now we compile for Java 8. This includes:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 350
diff changeset
3371 public void updateObject(String columnLabel, Object x, SQLType targetSqlType, int scaleOrLength) throws SQLException {
ffdc7b0e102d Updated JDBC driver to comply with JDBC 4.2 interface now we compile for Java 8. This includes:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 350
diff changeset
3372 throw newSQLFeatureNotSupportedException("updateObject");
ffdc7b0e102d Updated JDBC driver to comply with JDBC 4.2 interface now we compile for Java 8. This includes:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 350
diff changeset
3373 }
ffdc7b0e102d Updated JDBC driver to comply with JDBC 4.2 interface now we compile for Java 8. This includes:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 350
diff changeset
3374
ffdc7b0e102d Updated JDBC driver to comply with JDBC 4.2 interface now we compile for Java 8. This includes:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 350
diff changeset
3375 @Override
ffdc7b0e102d Updated JDBC driver to comply with JDBC 4.2 interface now we compile for Java 8. This includes:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 350
diff changeset
3376 public void updateObject(int columnIndex, Object x, SQLType targetSqlType) throws SQLException {
ffdc7b0e102d Updated JDBC driver to comply with JDBC 4.2 interface now we compile for Java 8. This includes:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 350
diff changeset
3377 throw newSQLFeatureNotSupportedException("updateObject");
ffdc7b0e102d Updated JDBC driver to comply with JDBC 4.2 interface now we compile for Java 8. This includes:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 350
diff changeset
3378 }
ffdc7b0e102d Updated JDBC driver to comply with JDBC 4.2 interface now we compile for Java 8. This includes:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 350
diff changeset
3379
ffdc7b0e102d Updated JDBC driver to comply with JDBC 4.2 interface now we compile for Java 8. This includes:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 350
diff changeset
3380 @Override
ffdc7b0e102d Updated JDBC driver to comply with JDBC 4.2 interface now we compile for Java 8. This includes:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 350
diff changeset
3381 public void updateObject(String columnLabel, Object x, SQLType targetSqlType) throws SQLException {
ffdc7b0e102d Updated JDBC driver to comply with JDBC 4.2 interface now we compile for Java 8. This includes:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 350
diff changeset
3382 throw newSQLFeatureNotSupportedException("updateObject");
ffdc7b0e102d Updated JDBC driver to comply with JDBC 4.2 interface now we compile for Java 8. This includes:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 350
diff changeset
3383 }
ffdc7b0e102d Updated JDBC driver to comply with JDBC 4.2 interface now we compile for Java 8. This includes:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 350
diff changeset
3384
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
3385 //== end methods of interface ResultSet
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
3386
376
ffdc7b0e102d Updated JDBC driver to comply with JDBC 4.2 interface now we compile for Java 8. This includes:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 350
diff changeset
3387
ffdc7b0e102d Updated JDBC driver to comply with JDBC 4.2 interface now we compile for Java 8. This includes:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 350
diff changeset
3388 //== internal helper methods which do not belong to the JDBC interface
ffdc7b0e102d Updated JDBC driver to comply with JDBC 4.2 interface now we compile for Java 8. This includes:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 350
diff changeset
3389
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
3390 /**
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
3391 * Adds a warning to the pile of warnings this ResultSet object has. If
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
3392 * there were no warnings (or clearWarnings was called) this warning will
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
3393 * be the first, otherwise this warning will get appended to the current
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
3394 * warning.
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
3395 *
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
3396 * @param reason the warning message
709
bdeabbd46ec6 Resolve javac and javadoc warnings when compiled with JDK19.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 694
diff changeset
3397 * @param sqlstate the SQLState code (5 characters)
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
3398 */
296
c5efd6e661e5 Add "final" keyword to classes, method arguments and local variables where possible.`
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 292
diff changeset
3399 private void addWarning(final String reason, final String sqlstate) {
187
daa1a4c70879 For MonetresultSet class: added method checkNotClosed() and invocation for all methods which should test it.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 180
diff changeset
3400 SQLWarning warng = new SQLWarning(reason, sqlstate);
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
3401 if (warnings == null) {
187
daa1a4c70879 For MonetresultSet class: added method checkNotClosed() and invocation for all methods which should test it.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 180
diff changeset
3402 warnings = warng;
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
3403 } else {
187
daa1a4c70879 For MonetresultSet class: added method checkNotClosed() and invocation for all methods which should test it.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 180
diff changeset
3404 warnings.setNextWarning(warng);
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
3405 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
3406 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
3407
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
3408 /**
187
daa1a4c70879 For MonetresultSet class: added method checkNotClosed() and invocation for all methods which should test it.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 180
diff changeset
3409 * Local helper method to test whether the ResultSet object is closed
daa1a4c70879 For MonetresultSet class: added method checkNotClosed() and invocation for all methods which should test it.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 180
diff changeset
3410 * When closed it throws an SQLException
709
bdeabbd46ec6 Resolve javac and javadoc warnings when compiled with JDK19.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 694
diff changeset
3411 *
bdeabbd46ec6 Resolve javac and javadoc warnings when compiled with JDK19.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 694
diff changeset
3412 * @throws SQLException if this ResultSet is closed
187
daa1a4c70879 For MonetresultSet class: added method checkNotClosed() and invocation for all methods which should test it.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 180
diff changeset
3413 */
daa1a4c70879 For MonetresultSet class: added method checkNotClosed() and invocation for all methods which should test it.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 180
diff changeset
3414 private void checkNotClosed() throws SQLException {
daa1a4c70879 For MonetresultSet class: added method checkNotClosed() and invocation for all methods which should test it.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 180
diff changeset
3415 if (isClosed())
daa1a4c70879 For MonetresultSet class: added method checkNotClosed() and invocation for all methods which should test it.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 180
diff changeset
3416 throw new SQLException("ResultSet is closed", "M1M20");
daa1a4c70879 For MonetresultSet class: added method checkNotClosed() and invocation for all methods which should test it.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 180
diff changeset
3417 }
daa1a4c70879 For MonetresultSet class: added method checkNotClosed() and invocation for all methods which should test it.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 180
diff changeset
3418
daa1a4c70879 For MonetresultSet class: added method checkNotClosed() and invocation for all methods which should test it.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 180
diff changeset
3419 /**
820
4c35009cd59c In ResultSet.getObject() method added support for retrieving
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 774
diff changeset
3420 * Retrieves the value of the designated column in the current row
832
7eb05cbf67dc In ResultSet.getObject(column, Class<T> type) and ResultSet.getObject(column, Map<String,Class<?>>) methods added support to return objects for classes: java.time.LocalDate, java.time.LocalDateTime.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 820
diff changeset
3421 * of this ResultSet object and will convert to LocalDate.
820
4c35009cd59c In ResultSet.getObject() method added support for retrieving
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 774
diff changeset
3422 * If the conversion is not supported a SQLException is thrown.
4c35009cd59c In ResultSet.getObject() method added support for retrieving
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 774
diff changeset
3423 *
4c35009cd59c In ResultSet.getObject() method added support for retrieving
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 774
diff changeset
3424 * @param columnIndex the first column is 1, the second is 2, ...
832
7eb05cbf67dc In ResultSet.getObject(column, Class<T> type) and ResultSet.getObject(column, Map<String,Class<?>>) methods added support to return objects for classes: java.time.LocalDate, java.time.LocalDateTime.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 820
diff changeset
3425 * @return LocalDate object or null
820
4c35009cd59c In ResultSet.getObject() method added support for retrieving
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 774
diff changeset
3426 * @throws SQLException if conversion is not supported
4c35009cd59c In ResultSet.getObject() method added support for retrieving
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 774
diff changeset
3427 */
832
7eb05cbf67dc In ResultSet.getObject(column, Class<T> type) and ResultSet.getObject(column, Map<String,Class<?>>) methods added support to return objects for classes: java.time.LocalDate, java.time.LocalDateTime.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 820
diff changeset
3428 private LocalDate getLocalDate(final int columnIndex) throws SQLException {
820
4c35009cd59c In ResultSet.getObject() method added support for retrieving
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 774
diff changeset
3429 final String val;
4c35009cd59c In ResultSet.getObject() method added support for retrieving
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 774
diff changeset
3430 try {
4c35009cd59c In ResultSet.getObject() method added support for retrieving
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 774
diff changeset
3431 val = tlp.values[columnIndex - 1];
4c35009cd59c In ResultSet.getObject() method added support for retrieving
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 774
diff changeset
3432 if (val == null) {
4c35009cd59c In ResultSet.getObject() method added support for retrieving
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 774
diff changeset
3433 lastReadWasNull = true;
4c35009cd59c In ResultSet.getObject() method added support for retrieving
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 774
diff changeset
3434 return null;
4c35009cd59c In ResultSet.getObject() method added support for retrieving
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 774
diff changeset
3435 }
4c35009cd59c In ResultSet.getObject() method added support for retrieving
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 774
diff changeset
3436 lastReadWasNull = false;
832
7eb05cbf67dc In ResultSet.getObject(column, Class<T> type) and ResultSet.getObject(column, Map<String,Class<?>>) methods added support to return objects for classes: java.time.LocalDate, java.time.LocalDateTime.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 820
diff changeset
3437
7eb05cbf67dc In ResultSet.getObject(column, Class<T> type) and ResultSet.getObject(column, Map<String,Class<?>>) methods added support to return objects for classes: java.time.LocalDate, java.time.LocalDateTime.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 820
diff changeset
3438 // Note: ISO_LOCAL_DATE format requires the year to have 4 (or more) digits else parse will fail
7eb05cbf67dc In ResultSet.getObject(column, Class<T> type) and ResultSet.getObject(column, Map<String,Class<?>>) methods added support to return objects for classes: java.time.LocalDate, java.time.LocalDateTime.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 820
diff changeset
3439 // This means years -999 to 999 will fail to parse. They should have been zero padded, so -0999 to 0999.
7eb05cbf67dc In ResultSet.getObject(column, Class<T> type) and ResultSet.getObject(column, Map<String,Class<?>>) methods added support to return objects for classes: java.time.LocalDate, java.time.LocalDateTime.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 820
diff changeset
3440 return LocalDate.parse(val, DateTimeFormatter.ISO_LOCAL_DATE);
820
4c35009cd59c In ResultSet.getObject() method added support for retrieving
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 774
diff changeset
3441 } catch (IndexOutOfBoundsException e) {
4c35009cd59c In ResultSet.getObject() method added support for retrieving
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 774
diff changeset
3442 throw newSQLInvalidColumnIndexException(columnIndex);
4c35009cd59c In ResultSet.getObject() method added support for retrieving
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 774
diff changeset
3443 } catch (java.time.format.DateTimeParseException e) {
832
7eb05cbf67dc In ResultSet.getObject(column, Class<T> type) and ResultSet.getObject(column, Map<String,Class<?>>) methods added support to return objects for classes: java.time.LocalDate, java.time.LocalDateTime.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 820
diff changeset
3444 throw new SQLException("Failed to convert to LocalDate: " + e.getMessage(), "22M33");
7eb05cbf67dc In ResultSet.getObject(column, Class<T> type) and ResultSet.getObject(column, Map<String,Class<?>>) methods added support to return objects for classes: java.time.LocalDate, java.time.LocalDateTime.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 820
diff changeset
3445 }
7eb05cbf67dc In ResultSet.getObject(column, Class<T> type) and ResultSet.getObject(column, Map<String,Class<?>>) methods added support to return objects for classes: java.time.LocalDate, java.time.LocalDateTime.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 820
diff changeset
3446 }
7eb05cbf67dc In ResultSet.getObject(column, Class<T> type) and ResultSet.getObject(column, Map<String,Class<?>>) methods added support to return objects for classes: java.time.LocalDate, java.time.LocalDateTime.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 820
diff changeset
3447
7eb05cbf67dc In ResultSet.getObject(column, Class<T> type) and ResultSet.getObject(column, Map<String,Class<?>>) methods added support to return objects for classes: java.time.LocalDate, java.time.LocalDateTime.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 820
diff changeset
3448 /**
7eb05cbf67dc In ResultSet.getObject(column, Class<T> type) and ResultSet.getObject(column, Map<String,Class<?>>) methods added support to return objects for classes: java.time.LocalDate, java.time.LocalDateTime.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 820
diff changeset
3449 * Retrieves the value of the designated column in the current row
7eb05cbf67dc In ResultSet.getObject(column, Class<T> type) and ResultSet.getObject(column, Map<String,Class<?>>) methods added support to return objects for classes: java.time.LocalDate, java.time.LocalDateTime.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 820
diff changeset
3450 * of this ResultSet object and will convert to LocalDateTime.
7eb05cbf67dc In ResultSet.getObject(column, Class<T> type) and ResultSet.getObject(column, Map<String,Class<?>>) methods added support to return objects for classes: java.time.LocalDate, java.time.LocalDateTime.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 820
diff changeset
3451 * If the conversion is not supported a SQLException is thrown.
7eb05cbf67dc In ResultSet.getObject(column, Class<T> type) and ResultSet.getObject(column, Map<String,Class<?>>) methods added support to return objects for classes: java.time.LocalDate, java.time.LocalDateTime.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 820
diff changeset
3452 *
7eb05cbf67dc In ResultSet.getObject(column, Class<T> type) and ResultSet.getObject(column, Map<String,Class<?>>) methods added support to return objects for classes: java.time.LocalDate, java.time.LocalDateTime.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 820
diff changeset
3453 * @param columnIndex the first column is 1, the second is 2, ...
7eb05cbf67dc In ResultSet.getObject(column, Class<T> type) and ResultSet.getObject(column, Map<String,Class<?>>) methods added support to return objects for classes: java.time.LocalDate, java.time.LocalDateTime.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 820
diff changeset
3454 * @return LocalDateTime object or null
7eb05cbf67dc In ResultSet.getObject(column, Class<T> type) and ResultSet.getObject(column, Map<String,Class<?>>) methods added support to return objects for classes: java.time.LocalDate, java.time.LocalDateTime.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 820
diff changeset
3455 * @throws SQLException if conversion is not supported
7eb05cbf67dc In ResultSet.getObject(column, Class<T> type) and ResultSet.getObject(column, Map<String,Class<?>>) methods added support to return objects for classes: java.time.LocalDate, java.time.LocalDateTime.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 820
diff changeset
3456 */
7eb05cbf67dc In ResultSet.getObject(column, Class<T> type) and ResultSet.getObject(column, Map<String,Class<?>>) methods added support to return objects for classes: java.time.LocalDate, java.time.LocalDateTime.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 820
diff changeset
3457 private LocalDateTime getLocalDateTime(final int columnIndex) throws SQLException {
7eb05cbf67dc In ResultSet.getObject(column, Class<T> type) and ResultSet.getObject(column, Map<String,Class<?>>) methods added support to return objects for classes: java.time.LocalDate, java.time.LocalDateTime.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 820
diff changeset
3458 final String val;
7eb05cbf67dc In ResultSet.getObject(column, Class<T> type) and ResultSet.getObject(column, Map<String,Class<?>>) methods added support to return objects for classes: java.time.LocalDate, java.time.LocalDateTime.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 820
diff changeset
3459 try {
7eb05cbf67dc In ResultSet.getObject(column, Class<T> type) and ResultSet.getObject(column, Map<String,Class<?>>) methods added support to return objects for classes: java.time.LocalDate, java.time.LocalDateTime.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 820
diff changeset
3460 val = tlp.values[columnIndex - 1];
7eb05cbf67dc In ResultSet.getObject(column, Class<T> type) and ResultSet.getObject(column, Map<String,Class<?>>) methods added support to return objects for classes: java.time.LocalDate, java.time.LocalDateTime.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 820
diff changeset
3461 if (val == null) {
7eb05cbf67dc In ResultSet.getObject(column, Class<T> type) and ResultSet.getObject(column, Map<String,Class<?>>) methods added support to return objects for classes: java.time.LocalDate, java.time.LocalDateTime.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 820
diff changeset
3462 lastReadWasNull = true;
7eb05cbf67dc In ResultSet.getObject(column, Class<T> type) and ResultSet.getObject(column, Map<String,Class<?>>) methods added support to return objects for classes: java.time.LocalDate, java.time.LocalDateTime.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 820
diff changeset
3463 return null;
7eb05cbf67dc In ResultSet.getObject(column, Class<T> type) and ResultSet.getObject(column, Map<String,Class<?>>) methods added support to return objects for classes: java.time.LocalDate, java.time.LocalDateTime.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 820
diff changeset
3464 }
7eb05cbf67dc In ResultSet.getObject(column, Class<T> type) and ResultSet.getObject(column, Map<String,Class<?>>) methods added support to return objects for classes: java.time.LocalDate, java.time.LocalDateTime.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 820
diff changeset
3465 lastReadWasNull = false;
7eb05cbf67dc In ResultSet.getObject(column, Class<T> type) and ResultSet.getObject(column, Map<String,Class<?>>) methods added support to return objects for classes: java.time.LocalDate, java.time.LocalDateTime.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 820
diff changeset
3466
7eb05cbf67dc In ResultSet.getObject(column, Class<T> type) and ResultSet.getObject(column, Map<String,Class<?>>) methods added support to return objects for classes: java.time.LocalDate, java.time.LocalDateTime.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 820
diff changeset
3467 // ISO_LOCAL_DATE_TIME format expects a 'T' instead of a space between date and time parts
7eb05cbf67dc In ResultSet.getObject(column, Class<T> type) and ResultSet.getObject(column, Map<String,Class<?>>) methods added support to return objects for classes: java.time.LocalDate, java.time.LocalDateTime.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 820
diff changeset
3468 // replace the space between date and time parts with 'T'
7eb05cbf67dc In ResultSet.getObject(column, Class<T> type) and ResultSet.getObject(column, Map<String,Class<?>>) methods added support to return objects for classes: java.time.LocalDate, java.time.LocalDateTime.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 820
diff changeset
3469 String val_new = val;
7eb05cbf67dc In ResultSet.getObject(column, Class<T> type) and ResultSet.getObject(column, Map<String,Class<?>>) methods added support to return objects for classes: java.time.LocalDate, java.time.LocalDateTime.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 820
diff changeset
3470 final int space = val.indexOf(' ', 4);
7eb05cbf67dc In ResultSet.getObject(column, Class<T> type) and ResultSet.getObject(column, Map<String,Class<?>>) methods added support to return objects for classes: java.time.LocalDate, java.time.LocalDateTime.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 820
diff changeset
3471 if (space > 4 && space < 16) {
7eb05cbf67dc In ResultSet.getObject(column, Class<T> type) and ResultSet.getObject(column, Map<String,Class<?>>) methods added support to return objects for classes: java.time.LocalDate, java.time.LocalDateTime.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 820
diff changeset
3472 val_new = val.substring(0, space) + "T" + val.substring(space + 1);
7eb05cbf67dc In ResultSet.getObject(column, Class<T> type) and ResultSet.getObject(column, Map<String,Class<?>>) methods added support to return objects for classes: java.time.LocalDate, java.time.LocalDateTime.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 820
diff changeset
3473 // System.out.println("getLocalDateTime() changed " + val + " into " + val_new);
7eb05cbf67dc In ResultSet.getObject(column, Class<T> type) and ResultSet.getObject(column, Map<String,Class<?>>) methods added support to return objects for classes: java.time.LocalDate, java.time.LocalDateTime.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 820
diff changeset
3474 }
7eb05cbf67dc In ResultSet.getObject(column, Class<T> type) and ResultSet.getObject(column, Map<String,Class<?>>) methods added support to return objects for classes: java.time.LocalDate, java.time.LocalDateTime.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 820
diff changeset
3475
7eb05cbf67dc In ResultSet.getObject(column, Class<T> type) and ResultSet.getObject(column, Map<String,Class<?>>) methods added support to return objects for classes: java.time.LocalDate, java.time.LocalDateTime.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 820
diff changeset
3476 // Note: ISO_LOCAL_DATE_TIME format requires the year to have 4 (or more) digits else parse will fail
7eb05cbf67dc In ResultSet.getObject(column, Class<T> type) and ResultSet.getObject(column, Map<String,Class<?>>) methods added support to return objects for classes: java.time.LocalDate, java.time.LocalDateTime.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 820
diff changeset
3477 // This means years -999 to 999 will fail to parse. They should have been zero padded, so -0999 to 0999.
7eb05cbf67dc In ResultSet.getObject(column, Class<T> type) and ResultSet.getObject(column, Map<String,Class<?>>) methods added support to return objects for classes: java.time.LocalDate, java.time.LocalDateTime.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 820
diff changeset
3478 return LocalDateTime.parse(val_new, DateTimeFormatter.ISO_LOCAL_DATE_TIME);
7eb05cbf67dc In ResultSet.getObject(column, Class<T> type) and ResultSet.getObject(column, Map<String,Class<?>>) methods added support to return objects for classes: java.time.LocalDate, java.time.LocalDateTime.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 820
diff changeset
3479 } catch (IndexOutOfBoundsException e) {
7eb05cbf67dc In ResultSet.getObject(column, Class<T> type) and ResultSet.getObject(column, Map<String,Class<?>>) methods added support to return objects for classes: java.time.LocalDate, java.time.LocalDateTime.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 820
diff changeset
3480 throw newSQLInvalidColumnIndexException(columnIndex);
7eb05cbf67dc In ResultSet.getObject(column, Class<T> type) and ResultSet.getObject(column, Map<String,Class<?>>) methods added support to return objects for classes: java.time.LocalDate, java.time.LocalDateTime.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 820
diff changeset
3481 } catch (java.time.format.DateTimeParseException e) {
7eb05cbf67dc In ResultSet.getObject(column, Class<T> type) and ResultSet.getObject(column, Map<String,Class<?>>) methods added support to return objects for classes: java.time.LocalDate, java.time.LocalDateTime.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 820
diff changeset
3482 throw new SQLException("Failed to convert to LocalDateTime: " + e.getMessage(), "22M35");
7eb05cbf67dc In ResultSet.getObject(column, Class<T> type) and ResultSet.getObject(column, Map<String,Class<?>>) methods added support to return objects for classes: java.time.LocalDate, java.time.LocalDateTime.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 820
diff changeset
3483 }
7eb05cbf67dc In ResultSet.getObject(column, Class<T> type) and ResultSet.getObject(column, Map<String,Class<?>>) methods added support to return objects for classes: java.time.LocalDate, java.time.LocalDateTime.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 820
diff changeset
3484 }
7eb05cbf67dc In ResultSet.getObject(column, Class<T> type) and ResultSet.getObject(column, Map<String,Class<?>>) methods added support to return objects for classes: java.time.LocalDate, java.time.LocalDateTime.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 820
diff changeset
3485
7eb05cbf67dc In ResultSet.getObject(column, Class<T> type) and ResultSet.getObject(column, Map<String,Class<?>>) methods added support to return objects for classes: java.time.LocalDate, java.time.LocalDateTime.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 820
diff changeset
3486 /**
7eb05cbf67dc In ResultSet.getObject(column, Class<T> type) and ResultSet.getObject(column, Map<String,Class<?>>) methods added support to return objects for classes: java.time.LocalDate, java.time.LocalDateTime.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 820
diff changeset
3487 * Retrieves the value of the designated column in the current row
7eb05cbf67dc In ResultSet.getObject(column, Class<T> type) and ResultSet.getObject(column, Map<String,Class<?>>) methods added support to return objects for classes: java.time.LocalDate, java.time.LocalDateTime.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 820
diff changeset
3488 * of this ResultSet object and will convert to LocalTime.
7eb05cbf67dc In ResultSet.getObject(column, Class<T> type) and ResultSet.getObject(column, Map<String,Class<?>>) methods added support to return objects for classes: java.time.LocalDate, java.time.LocalDateTime.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 820
diff changeset
3489 * If the conversion is not supported a SQLException is thrown.
7eb05cbf67dc In ResultSet.getObject(column, Class<T> type) and ResultSet.getObject(column, Map<String,Class<?>>) methods added support to return objects for classes: java.time.LocalDate, java.time.LocalDateTime.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 820
diff changeset
3490 *
7eb05cbf67dc In ResultSet.getObject(column, Class<T> type) and ResultSet.getObject(column, Map<String,Class<?>>) methods added support to return objects for classes: java.time.LocalDate, java.time.LocalDateTime.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 820
diff changeset
3491 * @param columnIndex the first column is 1, the second is 2, ...
7eb05cbf67dc In ResultSet.getObject(column, Class<T> type) and ResultSet.getObject(column, Map<String,Class<?>>) methods added support to return objects for classes: java.time.LocalDate, java.time.LocalDateTime.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 820
diff changeset
3492 * @return LocalTime object or null
7eb05cbf67dc In ResultSet.getObject(column, Class<T> type) and ResultSet.getObject(column, Map<String,Class<?>>) methods added support to return objects for classes: java.time.LocalDate, java.time.LocalDateTime.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 820
diff changeset
3493 * @throws SQLException if conversion is not supported
7eb05cbf67dc In ResultSet.getObject(column, Class<T> type) and ResultSet.getObject(column, Map<String,Class<?>>) methods added support to return objects for classes: java.time.LocalDate, java.time.LocalDateTime.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 820
diff changeset
3494 */
7eb05cbf67dc In ResultSet.getObject(column, Class<T> type) and ResultSet.getObject(column, Map<String,Class<?>>) methods added support to return objects for classes: java.time.LocalDate, java.time.LocalDateTime.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 820
diff changeset
3495 private LocalTime getLocalTime(final int columnIndex) throws SQLException {
7eb05cbf67dc In ResultSet.getObject(column, Class<T> type) and ResultSet.getObject(column, Map<String,Class<?>>) methods added support to return objects for classes: java.time.LocalDate, java.time.LocalDateTime.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 820
diff changeset
3496 final String val;
7eb05cbf67dc In ResultSet.getObject(column, Class<T> type) and ResultSet.getObject(column, Map<String,Class<?>>) methods added support to return objects for classes: java.time.LocalDate, java.time.LocalDateTime.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 820
diff changeset
3497 try {
7eb05cbf67dc In ResultSet.getObject(column, Class<T> type) and ResultSet.getObject(column, Map<String,Class<?>>) methods added support to return objects for classes: java.time.LocalDate, java.time.LocalDateTime.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 820
diff changeset
3498 val = tlp.values[columnIndex - 1];
7eb05cbf67dc In ResultSet.getObject(column, Class<T> type) and ResultSet.getObject(column, Map<String,Class<?>>) methods added support to return objects for classes: java.time.LocalDate, java.time.LocalDateTime.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 820
diff changeset
3499 if (val == null) {
7eb05cbf67dc In ResultSet.getObject(column, Class<T> type) and ResultSet.getObject(column, Map<String,Class<?>>) methods added support to return objects for classes: java.time.LocalDate, java.time.LocalDateTime.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 820
diff changeset
3500 lastReadWasNull = true;
7eb05cbf67dc In ResultSet.getObject(column, Class<T> type) and ResultSet.getObject(column, Map<String,Class<?>>) methods added support to return objects for classes: java.time.LocalDate, java.time.LocalDateTime.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 820
diff changeset
3501 return null;
7eb05cbf67dc In ResultSet.getObject(column, Class<T> type) and ResultSet.getObject(column, Map<String,Class<?>>) methods added support to return objects for classes: java.time.LocalDate, java.time.LocalDateTime.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 820
diff changeset
3502 }
7eb05cbf67dc In ResultSet.getObject(column, Class<T> type) and ResultSet.getObject(column, Map<String,Class<?>>) methods added support to return objects for classes: java.time.LocalDate, java.time.LocalDateTime.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 820
diff changeset
3503 lastReadWasNull = false;
7eb05cbf67dc In ResultSet.getObject(column, Class<T> type) and ResultSet.getObject(column, Map<String,Class<?>>) methods added support to return objects for classes: java.time.LocalDate, java.time.LocalDateTime.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 820
diff changeset
3504 return LocalTime.parse(val, DateTimeFormatter.ISO_LOCAL_TIME);
7eb05cbf67dc In ResultSet.getObject(column, Class<T> type) and ResultSet.getObject(column, Map<String,Class<?>>) methods added support to return objects for classes: java.time.LocalDate, java.time.LocalDateTime.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 820
diff changeset
3505 } catch (IndexOutOfBoundsException e) {
7eb05cbf67dc In ResultSet.getObject(column, Class<T> type) and ResultSet.getObject(column, Map<String,Class<?>>) methods added support to return objects for classes: java.time.LocalDate, java.time.LocalDateTime.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 820
diff changeset
3506 throw newSQLInvalidColumnIndexException(columnIndex);
7eb05cbf67dc In ResultSet.getObject(column, Class<T> type) and ResultSet.getObject(column, Map<String,Class<?>>) methods added support to return objects for classes: java.time.LocalDate, java.time.LocalDateTime.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 820
diff changeset
3507 } catch (java.time.format.DateTimeParseException e) {
7eb05cbf67dc In ResultSet.getObject(column, Class<T> type) and ResultSet.getObject(column, Map<String,Class<?>>) methods added support to return objects for classes: java.time.LocalDate, java.time.LocalDateTime.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 820
diff changeset
3508 throw new SQLException("Failed to convert to LocalTime: " + e.getMessage(), "22M34");
820
4c35009cd59c In ResultSet.getObject() method added support for retrieving
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 774
diff changeset
3509 }
4c35009cd59c In ResultSet.getObject() method added support for retrieving
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 774
diff changeset
3510 }
4c35009cd59c In ResultSet.getObject() method added support for retrieving
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 774
diff changeset
3511
4c35009cd59c In ResultSet.getObject() method added support for retrieving
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 774
diff changeset
3512 /**
4c35009cd59c In ResultSet.getObject() method added support for retrieving
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 774
diff changeset
3513 * Retrieves the value of the designated column in the current row
4c35009cd59c In ResultSet.getObject() method added support for retrieving
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 774
diff changeset
3514 * of this ResultSet object and will convert to OffsetDateTime.
4c35009cd59c In ResultSet.getObject() method added support for retrieving
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 774
diff changeset
3515 * If the conversion is not supported a SQLException is thrown.
4c35009cd59c In ResultSet.getObject() method added support for retrieving
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 774
diff changeset
3516 *
4c35009cd59c In ResultSet.getObject() method added support for retrieving
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 774
diff changeset
3517 * @param columnIndex the first column is 1, the second is 2, ...
4c35009cd59c In ResultSet.getObject() method added support for retrieving
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 774
diff changeset
3518 * @return OffsetDateTime object or null
4c35009cd59c In ResultSet.getObject() method added support for retrieving
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 774
diff changeset
3519 * @throws SQLException if conversion is not supported
4c35009cd59c In ResultSet.getObject() method added support for retrieving
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 774
diff changeset
3520 */
4c35009cd59c In ResultSet.getObject() method added support for retrieving
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 774
diff changeset
3521 private OffsetDateTime getOffsetDateTime(final int columnIndex) throws SQLException {
4c35009cd59c In ResultSet.getObject() method added support for retrieving
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 774
diff changeset
3522 final String val;
4c35009cd59c In ResultSet.getObject() method added support for retrieving
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 774
diff changeset
3523 try {
4c35009cd59c In ResultSet.getObject() method added support for retrieving
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 774
diff changeset
3524 val = tlp.values[columnIndex - 1];
4c35009cd59c In ResultSet.getObject() method added support for retrieving
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 774
diff changeset
3525 if (val == null) {
4c35009cd59c In ResultSet.getObject() method added support for retrieving
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 774
diff changeset
3526 lastReadWasNull = true;
4c35009cd59c In ResultSet.getObject() method added support for retrieving
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 774
diff changeset
3527 return null;
4c35009cd59c In ResultSet.getObject() method added support for retrieving
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 774
diff changeset
3528 }
4c35009cd59c In ResultSet.getObject() method added support for retrieving
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 774
diff changeset
3529 lastReadWasNull = false;
4c35009cd59c In ResultSet.getObject() method added support for retrieving
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 774
diff changeset
3530
4c35009cd59c In ResultSet.getObject() method added support for retrieving
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 774
diff changeset
3531 // ISO_OFFSET_DATE_TIME format expects a 'T' instead of a space between date and time parts
4c35009cd59c In ResultSet.getObject() method added support for retrieving
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 774
diff changeset
3532 // replace the space between date and time parts with 'T'
4c35009cd59c In ResultSet.getObject() method added support for retrieving
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 774
diff changeset
3533 String val_new = val;
4c35009cd59c In ResultSet.getObject() method added support for retrieving
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 774
diff changeset
3534 final int space = val.indexOf(' ', 4);
4c35009cd59c In ResultSet.getObject() method added support for retrieving
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 774
diff changeset
3535 if (space > 4 && space < 16) {
4c35009cd59c In ResultSet.getObject() method added support for retrieving
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 774
diff changeset
3536 val_new = val.substring(0, space) + "T" + val.substring(space + 1);
832
7eb05cbf67dc In ResultSet.getObject(column, Class<T> type) and ResultSet.getObject(column, Map<String,Class<?>>) methods added support to return objects for classes: java.time.LocalDate, java.time.LocalDateTime.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 820
diff changeset
3537 // System.out.println("getOffsetDateTime() changed " + val + " into " + val_new);
820
4c35009cd59c In ResultSet.getObject() method added support for retrieving
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 774
diff changeset
3538 }
832
7eb05cbf67dc In ResultSet.getObject(column, Class<T> type) and ResultSet.getObject(column, Map<String,Class<?>>) methods added support to return objects for classes: java.time.LocalDate, java.time.LocalDateTime.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 820
diff changeset
3539
7eb05cbf67dc In ResultSet.getObject(column, Class<T> type) and ResultSet.getObject(column, Map<String,Class<?>>) methods added support to return objects for classes: java.time.LocalDate, java.time.LocalDateTime.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 820
diff changeset
3540 // Note: ISO_OFFSET_DATE_TIME format requires the year to have 4 (or more) digits else parse will fail
7eb05cbf67dc In ResultSet.getObject(column, Class<T> type) and ResultSet.getObject(column, Map<String,Class<?>>) methods added support to return objects for classes: java.time.LocalDate, java.time.LocalDateTime.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 820
diff changeset
3541 // This means years -999 to 999 will fail to parse. They should have been zero padded, so -0999 to 0999.
7eb05cbf67dc In ResultSet.getObject(column, Class<T> type) and ResultSet.getObject(column, Map<String,Class<?>>) methods added support to return objects for classes: java.time.LocalDate, java.time.LocalDateTime.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 820
diff changeset
3542 return OffsetDateTime.parse(val_new, DateTimeFormatter.ISO_OFFSET_DATE_TIME);
820
4c35009cd59c In ResultSet.getObject() method added support for retrieving
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 774
diff changeset
3543 } catch (IndexOutOfBoundsException e) {
4c35009cd59c In ResultSet.getObject() method added support for retrieving
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 774
diff changeset
3544 throw newSQLInvalidColumnIndexException(columnIndex);
4c35009cd59c In ResultSet.getObject() method added support for retrieving
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 774
diff changeset
3545 } catch (java.time.format.DateTimeParseException e) {
4c35009cd59c In ResultSet.getObject() method added support for retrieving
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 774
diff changeset
3546 throw new SQLException("Failed to convert to OffsetDateTime: " + e.getMessage(), "22M37");
4c35009cd59c In ResultSet.getObject() method added support for retrieving
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 774
diff changeset
3547 }
4c35009cd59c In ResultSet.getObject() method added support for retrieving
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 774
diff changeset
3548 }
4c35009cd59c In ResultSet.getObject() method added support for retrieving
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 774
diff changeset
3549
4c35009cd59c In ResultSet.getObject() method added support for retrieving
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 774
diff changeset
3550 /**
832
7eb05cbf67dc In ResultSet.getObject(column, Class<T> type) and ResultSet.getObject(column, Map<String,Class<?>>) methods added support to return objects for classes: java.time.LocalDate, java.time.LocalDateTime.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 820
diff changeset
3551 * Retrieves the value of the designated column in the current row
7eb05cbf67dc In ResultSet.getObject(column, Class<T> type) and ResultSet.getObject(column, Map<String,Class<?>>) methods added support to return objects for classes: java.time.LocalDate, java.time.LocalDateTime.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 820
diff changeset
3552 * of this ResultSet object and will convert to OffsetTime.
7eb05cbf67dc In ResultSet.getObject(column, Class<T> type) and ResultSet.getObject(column, Map<String,Class<?>>) methods added support to return objects for classes: java.time.LocalDate, java.time.LocalDateTime.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 820
diff changeset
3553 * If the conversion is not supported a SQLException is thrown.
7eb05cbf67dc In ResultSet.getObject(column, Class<T> type) and ResultSet.getObject(column, Map<String,Class<?>>) methods added support to return objects for classes: java.time.LocalDate, java.time.LocalDateTime.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 820
diff changeset
3554 *
7eb05cbf67dc In ResultSet.getObject(column, Class<T> type) and ResultSet.getObject(column, Map<String,Class<?>>) methods added support to return objects for classes: java.time.LocalDate, java.time.LocalDateTime.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 820
diff changeset
3555 * @param columnIndex the first column is 1, the second is 2, ...
7eb05cbf67dc In ResultSet.getObject(column, Class<T> type) and ResultSet.getObject(column, Map<String,Class<?>>) methods added support to return objects for classes: java.time.LocalDate, java.time.LocalDateTime.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 820
diff changeset
3556 * @return OffsetTime object or null
7eb05cbf67dc In ResultSet.getObject(column, Class<T> type) and ResultSet.getObject(column, Map<String,Class<?>>) methods added support to return objects for classes: java.time.LocalDate, java.time.LocalDateTime.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 820
diff changeset
3557 * @throws SQLException if conversion is not supported
7eb05cbf67dc In ResultSet.getObject(column, Class<T> type) and ResultSet.getObject(column, Map<String,Class<?>>) methods added support to return objects for classes: java.time.LocalDate, java.time.LocalDateTime.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 820
diff changeset
3558 */
7eb05cbf67dc In ResultSet.getObject(column, Class<T> type) and ResultSet.getObject(column, Map<String,Class<?>>) methods added support to return objects for classes: java.time.LocalDate, java.time.LocalDateTime.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 820
diff changeset
3559 private OffsetTime getOffsetTime(final int columnIndex) throws SQLException {
7eb05cbf67dc In ResultSet.getObject(column, Class<T> type) and ResultSet.getObject(column, Map<String,Class<?>>) methods added support to return objects for classes: java.time.LocalDate, java.time.LocalDateTime.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 820
diff changeset
3560 final String val;
7eb05cbf67dc In ResultSet.getObject(column, Class<T> type) and ResultSet.getObject(column, Map<String,Class<?>>) methods added support to return objects for classes: java.time.LocalDate, java.time.LocalDateTime.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 820
diff changeset
3561 try {
7eb05cbf67dc In ResultSet.getObject(column, Class<T> type) and ResultSet.getObject(column, Map<String,Class<?>>) methods added support to return objects for classes: java.time.LocalDate, java.time.LocalDateTime.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 820
diff changeset
3562 val = tlp.values[columnIndex - 1];
7eb05cbf67dc In ResultSet.getObject(column, Class<T> type) and ResultSet.getObject(column, Map<String,Class<?>>) methods added support to return objects for classes: java.time.LocalDate, java.time.LocalDateTime.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 820
diff changeset
3563 if (val == null) {
7eb05cbf67dc In ResultSet.getObject(column, Class<T> type) and ResultSet.getObject(column, Map<String,Class<?>>) methods added support to return objects for classes: java.time.LocalDate, java.time.LocalDateTime.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 820
diff changeset
3564 lastReadWasNull = true;
7eb05cbf67dc In ResultSet.getObject(column, Class<T> type) and ResultSet.getObject(column, Map<String,Class<?>>) methods added support to return objects for classes: java.time.LocalDate, java.time.LocalDateTime.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 820
diff changeset
3565 return null;
7eb05cbf67dc In ResultSet.getObject(column, Class<T> type) and ResultSet.getObject(column, Map<String,Class<?>>) methods added support to return objects for classes: java.time.LocalDate, java.time.LocalDateTime.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 820
diff changeset
3566 }
7eb05cbf67dc In ResultSet.getObject(column, Class<T> type) and ResultSet.getObject(column, Map<String,Class<?>>) methods added support to return objects for classes: java.time.LocalDate, java.time.LocalDateTime.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 820
diff changeset
3567 lastReadWasNull = false;
7eb05cbf67dc In ResultSet.getObject(column, Class<T> type) and ResultSet.getObject(column, Map<String,Class<?>>) methods added support to return objects for classes: java.time.LocalDate, java.time.LocalDateTime.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 820
diff changeset
3568 return OffsetTime.parse(val, DateTimeFormatter.ISO_TIME);
7eb05cbf67dc In ResultSet.getObject(column, Class<T> type) and ResultSet.getObject(column, Map<String,Class<?>>) methods added support to return objects for classes: java.time.LocalDate, java.time.LocalDateTime.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 820
diff changeset
3569 } catch (IndexOutOfBoundsException e) {
7eb05cbf67dc In ResultSet.getObject(column, Class<T> type) and ResultSet.getObject(column, Map<String,Class<?>>) methods added support to return objects for classes: java.time.LocalDate, java.time.LocalDateTime.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 820
diff changeset
3570 throw newSQLInvalidColumnIndexException(columnIndex);
7eb05cbf67dc In ResultSet.getObject(column, Class<T> type) and ResultSet.getObject(column, Map<String,Class<?>>) methods added support to return objects for classes: java.time.LocalDate, java.time.LocalDateTime.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 820
diff changeset
3571 } catch (java.time.format.DateTimeParseException e) {
7eb05cbf67dc In ResultSet.getObject(column, Class<T> type) and ResultSet.getObject(column, Map<String,Class<?>>) methods added support to return objects for classes: java.time.LocalDate, java.time.LocalDateTime.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 820
diff changeset
3572 throw new SQLException("Failed to convert to OffsetTime: " + e.getMessage(), "22M36");
7eb05cbf67dc In ResultSet.getObject(column, Class<T> type) and ResultSet.getObject(column, Map<String,Class<?>>) methods added support to return objects for classes: java.time.LocalDate, java.time.LocalDateTime.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 820
diff changeset
3573 }
7eb05cbf67dc In ResultSet.getObject(column, Class<T> type) and ResultSet.getObject(column, Map<String,Class<?>>) methods added support to return objects for classes: java.time.LocalDate, java.time.LocalDateTime.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 820
diff changeset
3574 }
7eb05cbf67dc In ResultSet.getObject(column, Class<T> type) and ResultSet.getObject(column, Map<String,Class<?>>) methods added support to return objects for classes: java.time.LocalDate, java.time.LocalDateTime.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 820
diff changeset
3575
7eb05cbf67dc In ResultSet.getObject(column, Class<T> type) and ResultSet.getObject(column, Map<String,Class<?>>) methods added support to return objects for classes: java.time.LocalDate, java.time.LocalDateTime.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 820
diff changeset
3576 /**
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
3577 * Small helper method that formats the "Invalid Column Index number ..." message
144
d6abd1ffffbb Use SQLNonTransientConnectionException instead of SQLException where applicable (SQLState starts with 08)
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 143
diff changeset
3578 * and creates a new SQLDataException object whose SQLState is set
d6abd1ffffbb Use SQLNonTransientConnectionException instead of SQLException where applicable (SQLState starts with 08)
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 143
diff changeset
3579 * to "22010": invalid indicator parameter value.
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
3580 *
12
a0e8adf10d41 Improved ResultSetMetaData methods isAutoIncrement(), getPrecision(), getScale(), isNullable().
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 11
diff changeset
3581 * @param colIdx the column index number
144
d6abd1ffffbb Use SQLNonTransientConnectionException instead of SQLException where applicable (SQLState starts with 08)
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 143
diff changeset
3582 * @return a new created SQLDataException object with SQLState 22010
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
3583 */
296
c5efd6e661e5 Add "final" keyword to classes, method arguments and local variables where possible.`
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 292
diff changeset
3584 public static final SQLDataException newSQLInvalidColumnIndexException(final int colIdx) {
144
d6abd1ffffbb Use SQLNonTransientConnectionException instead of SQLException where applicable (SQLState starts with 08)
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 143
diff changeset
3585 return new SQLDataException("Invalid Column Index number: " + colIdx, "22010");
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
3586 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
3587
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
3588 /**
9
c37a76cc1e6e Corrected ResultSet methods: getByte(), getBigDecimal(), getShort(), getInt(), getLong(), getFloat() and getDouble()
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 8
diff changeset
3589 * Small helper method that formats the "Could not convert value to a number" message
144
d6abd1ffffbb Use SQLNonTransientConnectionException instead of SQLException where applicable (SQLState starts with 08)
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 143
diff changeset
3590 * and creates a new SQLDataException object whose SQLState is set
d6abd1ffffbb Use SQLNonTransientConnectionException instead of SQLException where applicable (SQLState starts with 08)
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 143
diff changeset
3591 * to "22003": Numeric value out of range.
9
c37a76cc1e6e Corrected ResultSet methods: getByte(), getBigDecimal(), getShort(), getInt(), getLong(), getFloat() and getDouble()
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 8
diff changeset
3592 *
c37a76cc1e6e Corrected ResultSet methods: getByte(), getBigDecimal(), getShort(), getInt(), getLong(), getFloat() and getDouble()
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 8
diff changeset
3593 * @param error the NumberFormatException
144
d6abd1ffffbb Use SQLNonTransientConnectionException instead of SQLException where applicable (SQLState starts with 08)
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 143
diff changeset
3594 * @return a new created SQLDataException object with SQLState 22003
9
c37a76cc1e6e Corrected ResultSet methods: getByte(), getBigDecimal(), getShort(), getInt(), getLong(), getFloat() and getDouble()
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 8
diff changeset
3595 */
296
c5efd6e661e5 Add "final" keyword to classes, method arguments and local variables where possible.`
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 292
diff changeset
3596 private static final SQLDataException newSQLNumberFormatException(final NumberFormatException error) {
144
d6abd1ffffbb Use SQLNonTransientConnectionException instead of SQLException where applicable (SQLState starts with 08)
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 143
diff changeset
3597 return new SQLDataException("Could not convert value to a number. " + error.getMessage(), "22003");
9
c37a76cc1e6e Corrected ResultSet methods: getByte(), getBigDecimal(), getShort(), getInt(), getLong(), getFloat() and getDouble()
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 8
diff changeset
3598 }
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
3599 }