annotate src/main/java/org/monetdb/jdbc/MonetResultSet.java @ 820:4c35009cd59c

In ResultSet.getObject() method added support for retrieving TIMESTAMP WITH TIME ZONE data as java.time.OffsetDateTime object and TIME WITH TIME ZONE as java.time.OffsetTime object. Also methods ResultSetMetaData.getColumnClassName() and ParameterMetaData.getParameterClassName() now return java.time.OffsetDateTime.class for columns of type TIMESTAMP WITH TIME ZONE and java.time.OffsetTime.class for columns of type TIME WITH TIME ZONE.
author Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
date Thu, 14 Dec 2023 14:58:21 +0100 (16 months ago)
parents e029af7551b7
children 7eb05cbf67dc
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 /*
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2 * 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
3 * 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
4 * 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
5 *
716
aeb268156580 Updated Copyright year.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 714
diff changeset
6 * Copyright 1997 - July 2008 CWI, August 2008 - 2023 MonetDB B.V.
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
7 */
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
8
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
9 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
10
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
11 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
12 import org.monetdb.mcl.parser.TupleLineParser;
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
13 import java.io.InputStream;
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
14 import java.io.Reader;
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
15 import java.math.BigDecimal;
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
16 import java.net.URL;
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
17 import java.sql.Array;
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
18 import java.sql.Blob;
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
19 import java.sql.Clob;
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
20 import java.sql.Connection;
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
21 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
22 import java.sql.Date;
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
23 import java.sql.NClob;
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
24 import java.sql.Ref;
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
25 import java.sql.ResultSet;
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
26 import java.sql.ResultSetMetaData;
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
27 import java.sql.RowId;
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
28 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
29 import java.sql.SQLDataException;
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
30 import java.sql.SQLException;
266
eefa7f625673 Resolve javadoc errors:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 262
diff changeset
31 import java.sql.SQLFeatureNotSupportedException;
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
32 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
33 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
34 import java.sql.SQLWarning;
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
35 import java.sql.SQLXML;
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
36 import java.sql.Statement;
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
37 import java.sql.Time;
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
38 import java.sql.Timestamp;
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
39 import java.sql.Types;
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
40 import java.text.SimpleDateFormat;
820
4c35009cd59c In ResultSet.getObject() method added support for retrieving
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 774
diff changeset
41 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
42 import java.time.OffsetTime;
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
43 import java.util.Calendar;
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
44 import java.util.Map;
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
45 import java.util.TimeZone;
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
46
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
47 /**
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
48 *<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
49 * 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
50 *
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
51 * 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
52 * 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
53 *
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
54 * 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
55 * 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
56 * 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
57 * 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
58 * iterate through the result set.
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
59 *
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
60 * 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
61 * 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
62 * 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
63 * 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
64 * 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
65 *</pre>
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
66 *
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
67 * @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
68 * @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
69 * @version 1.0
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
70 */
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
71 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
72 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
73 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
74 {
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
75 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
76 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
77 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
78 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
79
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
80 /** 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
81 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
82 /** 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
83 private final MonetConnection.ResultSetResponse header;
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
84 /** The names of the columns in this ResultSet */
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
85 private final String[] columns;
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
86 /** 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
87 private final String[] types;
713
c3c424a90a42 Improve implementation of ResultSet.getMetaData().
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 709
diff changeset
88 /** 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
89 * 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
90 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
91
713
c3c424a90a42 Improve implementation of ResultSet.getMetaData().
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 709
diff changeset
92 /** 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
93 private ResultSetMetaData rsmd;
c3c424a90a42 Improve implementation of ResultSet.getMetaData().
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 709
diff changeset
94
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
95 // 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
96 // 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
97 /** 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
98 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
99 /** 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
100 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
101 /** 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
102 protected int curRow;
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
103
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
104 /** 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
105 private int type = DEF_RESULTSETTYPE;
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
106 /** 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
107 private int concurrency = DEF_CONCURRENCY;
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
108 /** The warnings for this ResultSet object */
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
109 private SQLWarning warnings;
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
110 /** 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
111 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
112 /** to store the fetchsize set. */
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
113 private int fetchSize;
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
114
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
115 /**
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
116 * Main constructor backed by the given Header.
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
117 *
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
118 * @param statement the statement which created this ResultSet
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
119 * @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
120 * @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
121 */
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
122 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
123 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
124 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
125 throws IllegalArgumentException
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
126 {
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
127 if (statement == null) {
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
128 throw new IllegalArgumentException("Statement may not be null!");
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 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
131 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
132 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
133 this.statement = statement;
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
134 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
135 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
136 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
137 /* 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
138 fetchSize = header.getCacheSize();
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
139 columns = header.getNames();
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
140 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
141 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
142 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
143 }
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 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
145 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
146 }
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
147 tupleCount = header.tuplecount;
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
148
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
149 // create result array
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
150 tlp = new TupleLineParser(columns.length);
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
151
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
152 // 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
153 JdbcSQLTypes = new int[types.length];
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
154 populateJdbcSQLtypesArray();
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
155 }
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 /**
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
158 * Constructor used by MonetVirtualResultSet.
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
159 * 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
160 *
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
161 * @param statement the statement which created this ResultSet
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
162 * @param columns the column names
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
163 * @param types the column types
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
164 * @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
165 * @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
166 */
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
167 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
168 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
169 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
170 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
171 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
172 throws IllegalArgumentException
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
173 {
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
174 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
175 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
176 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
177 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
178 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
179 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
180 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
181 throw new IllegalArgumentException("Negative rowcount not allowed");
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
182 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
183
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
184 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
185 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
186 fetchSize = 0;
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 this.columns = columns;
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
189 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
190 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
191
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
192 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
193
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 // 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
195 JdbcSQLTypes = new int[types.length];
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
196 populateJdbcSQLtypesArray();
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
197 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
198
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
199 /**
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
200 * 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
201 * 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
202 * 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
203 */
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
204 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
205 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
206 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
207 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
208 } 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
209
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
210 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
211 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
212 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
213 if (connection != null && connection.mapClobAsVarChar())
180
fdf4c888d5b7 Small code and layout improvements
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 175
diff changeset
214 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
215 } else
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
216 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
217 if (connection != null && connection.mapBlobAsVarBinary())
180
fdf4c888d5b7 Small code and layout improvements
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 175
diff changeset
218 javaSQLtype = Types.VARBINARY;
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
219 }
180
fdf4c888d5b7 Small code and layout improvements
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 175
diff changeset
220 JdbcSQLTypes[i] = javaSQLtype;
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
221 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
222 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
223
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
224
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
225 //== methods of interface ResultSet
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
226
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
227 // 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
228 /**
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
229 * 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
230 *
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
231 * 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
232 * 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
233 * the second is row 2, and so on.
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 * 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
236 * 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
237 * 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
238 * 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
239 *
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
240 * 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
241 * 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
242 * 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
243 * absolute(-1) is the same as calling last().
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
244 *
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
245 * @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
246 * 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
247 * 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
248 * 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
249 * @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
250 * @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
251 * type is TYPE_FORWARD_ONLY
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 @Override
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
254 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
255 checkNotClosed();
137
688cd5675466 Improved robustness of ResultSet methods:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 90
diff changeset
256 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
257 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
258
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
259 // first calculate what the JDBC row is
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
260 if (row < 0) {
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
261 // 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
262 row = (int) tupleCount + row + 1;
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
263 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
264 // 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
265 if (row < 0)
688cd5675466 Improved robustness of ResultSet methods:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 90
diff changeset
266 row = 0; // before first
688cd5675466 Improved robustness of ResultSet methods:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 90
diff changeset
267 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
268 row = (int) tupleCount + 1; // after last
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
269
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
270 // store it
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
271 curRow = row;
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
272
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
273 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
274 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
275
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
276 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
277 if (tmpLine == null)
688cd5675466 Improved robustness of ResultSet methods:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 90
diff changeset
278 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
279
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
280 try {
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
281 tlp.parse(tmpLine);
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
282 } catch (MCLParseException e) {
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
283 throw new SQLException(e.getMessage(), "M0M10");
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
284 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
285
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
286 return true;
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
287 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
288
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
289 /**
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
290 * 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
291 * 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
292 *
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
293 * @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
294 * type is TYPE_FORWARD_ONLY
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 @Override
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
297 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
298 absolute((int)tupleCount + 1);
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
299 }
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 /**
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
302 * 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
303 * 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
304 *
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
305 * @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
306 * type is TYPE_FORWARD_ONLY
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 @Override
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
309 public void beforeFirst() throws SQLException {
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
310 absolute(0);
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
311 }
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 /**
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
314 * 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
315 * 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
316 * reported for this ResultSet object.
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
317 */
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
318 @Override
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
319 public void clearWarnings() {
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
320 warnings = null;
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
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
323 /**
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
324 * 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
325 * 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
326 * automatically closed.
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
327 */
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
328 @Override
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
329 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
330 clearWarnings();
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
331 if (header != null && !header.isClosed()) {
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
332 header.close();
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
333 }
713
c3c424a90a42 Improve implementation of ResultSet.getMetaData().
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 709
diff changeset
334 rsmd = null;
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
335 if (statement instanceof MonetStatement)
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
336 ((MonetStatement)statement).closeIfCompletion();
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
337 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
338
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
339 // 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
340 /**
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
341 * 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
342 * 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
343 * 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
344 * column will be returned.
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
345 *
151
3d5ea891bb74 Update implementation to match the JDBC spec so use
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 145
diff changeset
346 * @param columnLabel the name of the column
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
347 * @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
348 * @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
349 * 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
350 */
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
351 @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
352 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
353 checkNotClosed();
151
3d5ea891bb74 Update implementation to match the JDBC spec so use
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 145
diff changeset
354 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
355 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
356 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
357 if (columnLabel.equals(columns[i]))
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
358 return i + 1;
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
359 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
360 /* 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
361 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
362 if (columnLabel.equalsIgnoreCase(columns[i]))
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
363 return i + 1;
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
364 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
365 }
151
3d5ea891bb74 Update implementation to match the JDBC spec so use
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 145
diff changeset
366 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
367 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
368
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
369 /**
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
370 * 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
371 *
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
372 * @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
373 * in the result set
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
374 * @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
375 * set type is TYPE_FORWARD_ONLY
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 @Override
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
378 public boolean first() throws SQLException {
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
379 return absolute(1);
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
380 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
381
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
382 @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
383 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
384 throw newSQLFeatureNotSupportedException("getArray");
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
385 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
386 @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
387 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
388 throw newSQLFeatureNotSupportedException("getArray");
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
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
391 /* 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
392 @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
393 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
394 throw newSQLFeatureNotSupportedException("getAsciiStream");
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
395 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
396 @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
397 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
398 throw newSQLFeatureNotSupportedException("getAsciiStream");
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
399 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
400
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
401 @Override
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
402 @Deprecated
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
403 public InputStream getUnicodeStream(int columnIndex) throws SQLException {
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
404 throw newSQLFeatureNotSupportedException("getUnicodeStream");
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
405 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
406 @Override
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
407 @Deprecated
151
3d5ea891bb74 Update implementation to match the JDBC spec so use
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 145
diff changeset
408 public InputStream getUnicodeStream(String columnLabel) throws SQLException {
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
409 throw newSQLFeatureNotSupportedException("getUnicodeStream");
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
410 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
411
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
412 /**
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
413 * 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
414 * 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
415 * 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
416 * 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
417 *
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
418 * 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
419 * 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
420 * 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
421 * 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
422 * data available or not.
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
423 *
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
424 * @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
425 * @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
426 * 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
427 * NULL, the value returned is null
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
428 * @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
429 * 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
430 */
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
431 @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
432 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
433 checkNotClosed();
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
434 try {
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
435 switch (JdbcSQLTypes[columnIndex - 1]) {
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
436 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
437 final Blob blob = getBlob(columnIndex);
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
438 if (blob == null)
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
439 return null;
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
440 return blob.getBinaryStream();
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
441 case Types.BINARY:
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
442 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
443 /* 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
444 final byte[] bte = getBytes(columnIndex);
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
445 if (bte == null)
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
446 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
447 return new java.io.ByteArrayInputStream(bte);
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
448 }
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
449 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
450 } catch (IndexOutOfBoundsException e) {
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
451 throw newSQLInvalidColumnIndexException(columnIndex);
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
452 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
453 }
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
454
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
455 /**
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
456 * 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
457 * 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
458 * 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
459 * 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
460 *
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
461 * 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
462 * 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
463 * 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
464 * 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
465 * available or not.
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
466 *
151
3d5ea891bb74 Update implementation to match the JDBC spec so use
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 145
diff changeset
467 * @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
468 * 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
469 * the label is the name of the column
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
470 * @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
471 * 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
472 * NULL, the result is null
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
473 * @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
474 * 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
475 */
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
476 @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
477 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
478 return getBinaryStream(findColumn(columnLabel));
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
479 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
480
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
481 /**
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
482 * 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
483 * 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
484 *
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
485 * @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
486 * @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
487 * 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
488 * 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
489 * @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
490 */
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
491 @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
492 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
493 checkNotClosed();
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
494 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
495 final String val = tlp.values[columnIndex - 1];
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
496 if (val == null) {
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
497 lastReadWasNull = true;
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
498 return null;
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
499 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
500 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
501 return new java.io.StringReader(val);
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
502 } catch (IndexOutOfBoundsException e) {
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
503 throw newSQLInvalidColumnIndexException(columnIndex);
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
504 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
505 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
506
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 * 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
509 * 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
510 *
151
3d5ea891bb74 Update implementation to match the JDBC spec so use
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 145
diff changeset
511 * @param columnLabel the name of the column
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
512 * @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
513 * 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
514 * the Java programming language.
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
515 * @throws SQLException if a database access error occurs
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
516 */
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
517 @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
518 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
519 return getCharacterStream(findColumn(columnLabel));
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
520 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
521
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
522 /**
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
523 * 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
524 * 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
525 * 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
526 * columns.
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
527 *
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
528 * @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
529 * @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
530 * 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
531 * the Java programming language.
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
532 * @throws SQLException if a database access error occurs
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
533 */
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
534 @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
535 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
536 return getCharacterStream(columnIndex);
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
537 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
538
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
539 /**
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
540 * 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
541 * 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
542 * 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
543 * columns.
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
544 *
151
3d5ea891bb74 Update implementation to match the JDBC spec so use
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 145
diff changeset
545 * @param columnLabel the name of the column
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
546 * @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
547 * 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
548 * the Java programming language.
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
549 * @throws SQLException if a database access error occurs
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
550 */
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
551 @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
552 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
553 return getCharacterStream(findColumn(columnLabel));
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
554 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
555
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
556 /**
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
557 * 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
558 * 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
559 * language.
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
560 *
151
3d5ea891bb74 Update implementation to match the JDBC spec so use
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 145
diff changeset
561 * @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
562 * @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
563 * 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
564 * @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
565 */
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
566 @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
567 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
568 checkNotClosed();
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
569 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
570 final String val = tlp.values[columnIndex - 1];
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
571 if (val == null) {
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
572 lastReadWasNull = true;
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
573 return null;
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
574 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
575 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
576 return new MonetBlob(val);
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
577 } catch (IndexOutOfBoundsException e) {
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
578 throw newSQLInvalidColumnIndexException(columnIndex);
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
579 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
580 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
581
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 * 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
584 * 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
585 * language.
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
586 *
151
3d5ea891bb74 Update implementation to match the JDBC spec so use
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 145
diff changeset
587 * @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
588 * the value
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
589 * @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
590 * specified column
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
591 * @throws SQLException if a database access error occurs
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
592 */
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
593 @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
594 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
595 return getBlob(findColumn(columnLabel));
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
596 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
597
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
598 /**
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
599 * 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
600 * 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
601 * Java programming language.
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
602 *
151
3d5ea891bb74 Update implementation to match the JDBC spec so use
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 145
diff changeset
603 * @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
604 * @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
605 * 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
606 * @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
607 */
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
608 @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
609 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
610 checkNotClosed();
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
611 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
612 final String val = tlp.values[columnIndex - 1];
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
613 if (val == null) {
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
614 lastReadWasNull = true;
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
615 return null;
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
616 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
617 lastReadWasNull = false;
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
618 return new MonetClob(val);
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
619 } catch (IndexOutOfBoundsException e) {
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
620 throw newSQLInvalidColumnIndexException(columnIndex);
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
621 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
622 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
623
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 * 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
626 * 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
627 * Java programming language.
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
628 *
151
3d5ea891bb74 Update implementation to match the JDBC spec so use
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 145
diff changeset
629 * @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
630 * the value
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
631 * @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
632 * specified column
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
633 * @throws SQLException if a database access error occurs
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
634 */
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
635 @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
636 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
637 return getClob(findColumn(columnLabel));
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
638 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
639
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
640 /**
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
641 * 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
642 * 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
643 * Java programming language.
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
644 *
151
3d5ea891bb74 Update implementation to match the JDBC spec so use
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 145
diff changeset
645 * @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
646 * @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
647 * specified column
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
648 * @throws SQLException if a database access error occurs
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
649 * @throws SQLFeatureNotSupportedException the JDBC driver does
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
650 * not support this method
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
651 */
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
652 @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
653 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
654 throw newSQLFeatureNotSupportedException("getNClob");
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
655 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
656
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
657 /**
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
658 * 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
659 * 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
660 * Java programming language.
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
661 *
151
3d5ea891bb74 Update implementation to match the JDBC spec so use
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 145
diff changeset
662 * @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
663 * the value
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
664 * @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
665 * specified column
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
666 * @throws SQLException if a database access error occurs
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
667 * @throws SQLFeatureNotSupportedException the JDBC driver does
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
668 * not support this method
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
669 */
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
670 @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
671 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
672 throw newSQLFeatureNotSupportedException("getNClob");
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
673 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
674
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
675 /**
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
676 * 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
677 * 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
678 *
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
679 * @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
680 * @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
681 * 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
682 * @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
683 */
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
684 @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
685 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
686 checkNotClosed();
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
687 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
688 final String val = tlp.values[columnIndex - 1];
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
689 if (val == null) {
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
690 lastReadWasNull = true;
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
691 return null;
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
692 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
693 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
694 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
695 } 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
696 throw newSQLNumberFormatException(e);
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
697 } catch (IndexOutOfBoundsException e) {
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
698 throw newSQLInvalidColumnIndexException(columnIndex);
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
699 }
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
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
702 /**
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
703 * 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
704 * 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
705 *
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
706 * @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
707 * @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
708 * @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
709 * 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
710 * @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
711 */
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
712 @Override
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
713 @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
714 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
715 throws SQLException
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
716 {
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
717 checkNotClosed();
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
718 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
719 final String val = tlp.values[columnIndex - 1];
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
720 if (val == null) {
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
721 lastReadWasNull = true;
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
722 return null;
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
723 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
724 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
725 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
726 } 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
727 throw newSQLNumberFormatException(e);
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
728 } catch (IndexOutOfBoundsException e) {
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
729 throw newSQLInvalidColumnIndexException(columnIndex);
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
730 }
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
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
733 /**
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
734 * 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
735 * 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
736 *
151
3d5ea891bb74 Update implementation to match the JDBC spec so use
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 145
diff changeset
737 * @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
738 * @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
739 * 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
740 * @throws SQLException if a database access error occurs
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 @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
743 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
744 return getBigDecimal(findColumn(columnLabel));
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
745 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
746
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
747 /**
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
748 * 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
749 * 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
750 *
151
3d5ea891bb74 Update implementation to match the JDBC spec so use
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 145
diff changeset
751 * @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
752 * @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
753 * @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
754 * 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
755 * @throws SQLException if a database access error occurs
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
756 */
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
757 @Override
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
758 @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
759 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
760 throws SQLException
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
761 {
151
3d5ea891bb74 Update implementation to match the JDBC spec so use
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 145
diff changeset
762 return getBigDecimal(findColumn(columnLabel), scale);
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
763 }
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 // 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
766 /**
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
767 * 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
768 * 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
769 *
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
770 * @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
771 * @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
772 * 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
773 * @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
774 * 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
775 */
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
776 @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
777 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
778 checkNotClosed();
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
779 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
780 final String val = tlp.values[columnIndex - 1];
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
781 if (val == null) {
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
782 lastReadWasNull = true;
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
783 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
784 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
785 lastReadWasNull = false;
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
786
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
787 // match common cases first
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
788 if ("false".equalsIgnoreCase(val) || "0".equals(val))
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
789 return false;
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
790 if ("true".equalsIgnoreCase(val) || "1".equals(val))
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
791 return true;
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 // match type specific values
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
794 switch (JdbcSQLTypes[columnIndex - 1]) {
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
795 case Types.BOOLEAN:
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
796 case Types.CHAR:
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
797 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
798 /* 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
799 case Types.CLOB:
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
800 // 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
801 return Boolean.parseBoolean(val);
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
802 case Types.TINYINT:
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
803 case Types.SMALLINT:
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
804 case Types.INTEGER:
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
805 if (getInt(columnIndex) == 0) {
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
806 return false;
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
807 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
808 return true;
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
809 case Types.BIGINT:
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
810 if (getLong(columnIndex) == 0L) {
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
811 return false;
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
812 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
813 return true;
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
814 case Types.DOUBLE:
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
815 case Types.FLOAT:
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
816 case Types.REAL:
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
817 if (getDouble(columnIndex) == 0.0) {
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
818 return false;
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
819 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
820 return true;
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
821 case Types.DECIMAL:
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
822 case Types.NUMERIC:
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
823 if (getBigDecimal(columnIndex).compareTo(BigDecimal.ZERO) == 0) {
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
824 return false;
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
825 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
826 return true;
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
827 default:
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
828 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
829 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
830 } catch (IndexOutOfBoundsException e) {
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
831 throw newSQLInvalidColumnIndexException(columnIndex);
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
832 }
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
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
835 /**
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
836 * 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
837 * 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
838 *
151
3d5ea891bb74 Update implementation to match the JDBC spec so use
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 145
diff changeset
839 * @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
840 * @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
841 * 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
842 * @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
843 */
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
844 @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
845 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
846 return getBoolean(findColumn(columnLabel));
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
847 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
848
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
849 /**
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
850 * 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
851 * 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
852 *
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
853 * @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
854 * @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
855 * 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
856 * @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
857 */
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
858 @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
859 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
860 checkNotClosed();
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
861 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
862 final String val = tlp.values[columnIndex - 1];
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
863 if (val == null) {
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
864 lastReadWasNull = true;
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
865 return (byte) 0;
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
866 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
867 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
868 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
869 } 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
870 throw newSQLNumberFormatException(e);
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
871 } catch (IndexOutOfBoundsException e) {
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
872 throw newSQLInvalidColumnIndexException(columnIndex);
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
873 }
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
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
876 /**
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
877 * 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
878 * 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
879 *
151
3d5ea891bb74 Update implementation to match the JDBC spec so use
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 145
diff changeset
880 * @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
881 * @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
882 * is 0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
883 * @throws SQLException if a database access error occurs
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 @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
886 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
887 return getByte(findColumn(columnLabel));
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
888 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
889
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
890 /**
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
891 * 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
892 * 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
893 * 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
894 *
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
895 * @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
896 * @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
897 * 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
898 * @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
899 */
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
900 @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
901 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
902 checkNotClosed();
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
903 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
904 final String val = tlp.values[columnIndex - 1];
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
905 if (val == null) {
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
906 lastReadWasNull = true;
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
907 return null;
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
908 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
909 lastReadWasNull = false;
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
910
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
911 // 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
912 switch (JdbcSQLTypes[columnIndex - 1]) {
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
913 case Types.BLOB:
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
914 case Types.BINARY:
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
915 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
916 /* 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
917 return MonetBlob.hexStrToByteArray(val);
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
918 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
919 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
920 }
20
dbb8e7c2dbbf Added missing catch (NumberFormatException e) to getBytes(col)
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 12
diff changeset
921 } catch (NumberFormatException e) {
dbb8e7c2dbbf Added missing catch (NumberFormatException e) to getBytes(col)
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 12
diff changeset
922 throw newSQLNumberFormatException(e);
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
923 } catch (IndexOutOfBoundsException e) {
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
924 throw newSQLInvalidColumnIndexException(columnIndex);
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
925 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
926 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
927
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
928 /**
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
929 * 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
930 * 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
931 * 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
932 *
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
933 * 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
934 * 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
935 * 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
936 * charset.
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
937 *
151
3d5ea891bb74 Update implementation to match the JDBC spec so use
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 145
diff changeset
938 * @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
939 * @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
940 * is null
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
941 * @throws SQLException if a database access error occurs
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
942 */
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
943 @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
944 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
945 return getBytes(findColumn(columnLabel));
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
946 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
947
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
948 /**
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
949 * 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
950 * 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
951 *
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
952 * 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
953 * ResultSet.CONCUR_READ_ONLY
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 * @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
956 * ResultSet.CONCUR_UPDATABLE
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
957 */
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
958 @Override
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
959 public int getConcurrency() {
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
960 return concurrency;
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
961 }
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 /**
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
964 * 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
965 * 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
966 * 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
967 * 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
968 * 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
969 * 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
970 * 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
971 * 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
972 *
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
973 * 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
974 * 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
975 * 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
976 *
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
977 * 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
978 * 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
979 * thrown for now.
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 * @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
982 * @throws SQLException if a database access error occurs
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
983 */
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
984 @Override
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
985 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
986 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
987 + (header != null ? header.id + ")" : ")"), "0AM21");
0
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
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
990 /**
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
991 * 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
992 * 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
993 *
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
994 * @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
995 * @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
996 * @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
997 */
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
998 @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
999 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
1000 checkNotClosed();
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1001 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
1002 final String val = tlp.values[columnIndex - 1];
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1003 if (val == null) {
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1004 lastReadWasNull = true;
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1005 return 0;
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1006 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1007 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
1008 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
1009 } 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
1010 throw newSQLNumberFormatException(e);
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1011 } catch (IndexOutOfBoundsException e) {
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1012 throw newSQLInvalidColumnIndexException(columnIndex);
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1013 }
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
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1016 /**
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1017 * 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
1018 * 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
1019 *
151
3d5ea891bb74 Update implementation to match the JDBC spec so use
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 145
diff changeset
1020 * @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
1021 * @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
1022 * @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
1023 */
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1024 @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
1025 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
1026 return getDouble(findColumn(columnLabel));
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1027 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1028
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1029 /**
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1030 * Retrieves the holdability of this ResultSet object.
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 * @return either ResultSet.HOLD_CURSORS_OVER_COMMIT or
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1033 * ResultSet.CLOSE_CURSORS_AT_COMMIT
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1034 * @throws SQLException if a database access error occurs
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 @Override
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1037 public int getHoldability() throws SQLException {
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1038 return getStatement().getConnection().getHoldability();
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
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1041 /**
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1042 * Retrieves the fetch direction for this ResultSet object.
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 * @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
1045 */
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1046 @Override
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1047 public int getFetchDirection() {
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1048 return ResultSet.FETCH_FORWARD;
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
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 * 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
1053 * 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
1054 * Statement object that produced this ResultSet object.
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1055 * 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
1056 *
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1057 * @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
1058 * 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
1059 */
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1060 @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
1061 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
1062 switch (direction) {
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1063 case ResultSet.FETCH_FORWARD:
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1064 break;
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1065 case ResultSet.FETCH_REVERSE:
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1066 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
1067 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
1068 default:
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1069 throw new SQLException("Illegal direction: " + direction, "M1M05");
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1070 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1071 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1072
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1073 /**
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1074 * Retrieves the fetch size for this ResultSet object.
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1075 *
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1076 * @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
1077 * @throws SQLException if a database access error occurs
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 @Override
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1080 public int getFetchSize() throws SQLException {
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1081 return fetchSize;
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1082 }
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 /**
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1085 * 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
1086 * 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
1087 * 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
1088 * 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
1089 * MonetConnection.ResultSetResponse passed to its constructor. Since all
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1090 * 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
1091 * 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
1092 * 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
1093 * the default fetchSize, please use MonetStatement.setFetchSize() instead.
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1094 *
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1095 * @param rows the number of rows to fetch
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1096 * @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
1097 */
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1098 @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
1099 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
1100 if (rows >= 0) {
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1101 fetchSize = rows;
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1102 } else {
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1103 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
1104 }
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
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1107 /**
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1108 * 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
1109 * 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
1110 *
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1111 * @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
1112 * @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
1113 * @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
1114 */
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1115 @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
1116 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
1117 checkNotClosed();
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1118 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
1119 final String val = tlp.values[columnIndex - 1];
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1120 if (val == null) {
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1121 lastReadWasNull = true;
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1122 return 0;
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1123 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1124 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
1125 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
1126 } 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
1127 throw newSQLNumberFormatException(e);
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1128 } catch (IndexOutOfBoundsException e) {
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1129 throw newSQLInvalidColumnIndexException(columnIndex);
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1130 }
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
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1133 /**
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1134 * 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
1135 * 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
1136 *
151
3d5ea891bb74 Update implementation to match the JDBC spec so use
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 145
diff changeset
1137 * @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
1138 * @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
1139 * @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
1140 */
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1141 @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
1142 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
1143 return getFloat(findColumn(columnLabel));
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1144 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1145
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1146 /**
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1147 * 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
1148 * 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
1149 *
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1150 * @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
1151 * @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
1152 * @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
1153 */
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1154 @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
1155 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
1156 checkNotClosed();
11
01b9672e9308 Improved speed of ResultSet.getLong().
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 10
diff changeset
1157 String val = "";
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1158 try {
11
01b9672e9308 Improved speed of ResultSet.getLong().
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 10
diff changeset
1159 val = tlp.values[columnIndex - 1];
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1160 if (val == null) {
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1161 lastReadWasNull = true;
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1162 return 0;
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1163 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1164 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
1165 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
1166 } catch (NumberFormatException e) {
11
01b9672e9308 Improved speed of ResultSet.getLong().
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 10
diff changeset
1167 // The oid datatype values (as string) have a @0 suffix in the string value.
01b9672e9308 Improved speed of ResultSet.getLong().
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 10
diff changeset
1168 // To allow succesful parsing and conversion to int, we need to remove the suffix first
01b9672e9308 Improved speed of ResultSet.getLong().
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 10
diff changeset
1169 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
1170 if (val.endsWith("@0")) {
11
01b9672e9308 Improved speed of ResultSet.getLong().
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 10
diff changeset
1171 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
1172 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
1173 } catch (NumberFormatException nfe) {
01b9672e9308 Improved speed of ResultSet.getLong().
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 10
diff changeset
1174 throw newSQLNumberFormatException(nfe);
01b9672e9308 Improved speed of ResultSet.getLong().
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 10
diff changeset
1175 }
01b9672e9308 Improved speed of ResultSet.getLong().
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 10
diff changeset
1176 }
01b9672e9308 Improved speed of ResultSet.getLong().
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 10
diff changeset
1177 }
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
1178 throw newSQLNumberFormatException(e);
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1179 } catch (IndexOutOfBoundsException e) {
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1180 throw newSQLInvalidColumnIndexException(columnIndex);
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1181 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1182 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1183
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1184 /**
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1185 * 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
1186 * 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
1187 *
151
3d5ea891bb74 Update implementation to match the JDBC spec so use
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 145
diff changeset
1188 * @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
1189 * @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
1190 * @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
1191 */
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1192 @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
1193 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
1194 return getInt(findColumn(columnLabel));
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1195 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1196
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1197 /**
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1198 * 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
1199 * 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
1200 *
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1201 * @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
1202 * @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
1203 * @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
1204 */
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1205 @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
1206 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
1207 checkNotClosed();
11
01b9672e9308 Improved speed of ResultSet.getLong().
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 10
diff changeset
1208 String val = "";
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1209 try {
11
01b9672e9308 Improved speed of ResultSet.getLong().
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 10
diff changeset
1210 val = tlp.values[columnIndex - 1];
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1211 if (val == null) {
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1212 lastReadWasNull = true;
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1213 return 0;
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1214 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1215 lastReadWasNull = false;
11
01b9672e9308 Improved speed of ResultSet.getLong().
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 10
diff changeset
1216 return Long.parseLong(val);
01b9672e9308 Improved speed of ResultSet.getLong().
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 10
diff changeset
1217 } catch (NumberFormatException e) {
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1218 // The oid datatype values (as string) have a @0 suffix in the string value.
11
01b9672e9308 Improved speed of ResultSet.getLong().
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 10
diff changeset
1219 // To allow succesful 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
1220 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
1221 if (val.endsWith("@0")) {
11
01b9672e9308 Improved speed of ResultSet.getLong().
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 10
diff changeset
1222 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
1223 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
1224 } catch (NumberFormatException nfe) {
01b9672e9308 Improved speed of ResultSet.getLong().
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 10
diff changeset
1225 throw newSQLNumberFormatException(nfe);
01b9672e9308 Improved speed of ResultSet.getLong().
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 10
diff changeset
1226 }
01b9672e9308 Improved speed of ResultSet.getLong().
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 10
diff changeset
1227 }
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1228 }
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
1229 throw newSQLNumberFormatException(e);
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1230 } catch (IndexOutOfBoundsException e) {
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1231 throw newSQLInvalidColumnIndexException(columnIndex);
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1232 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1233 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1234
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1235 /**
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1236 * 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
1237 * 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
1238 *
151
3d5ea891bb74 Update implementation to match the JDBC spec so use
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 145
diff changeset
1239 * @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
1240 * @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
1241 * @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
1242 */
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1243 @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
1244 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
1245 return getLong(findColumn(columnLabel));
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1246 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1247
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1248 /**
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1249 * 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
1250 * columns.
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1251 *
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1252 * @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
1253 * @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
1254 */
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1255 @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
1256 public ResultSetMetaData getMetaData() throws SQLException {
713
c3c424a90a42 Improve implementation of ResultSet.getMetaData().
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 709
diff changeset
1257 if (rsmd == null) {
716
aeb268156580 Updated Copyright year.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 714
diff changeset
1258 // 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
1259 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
1260 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
1261 } 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
1262 // 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
1263 // 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
1264 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
1265 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
1266 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
1267 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
1268 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
1269 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
1270 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
1271 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
1272 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
1273 // 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
1274 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
1275 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
1276 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
1277 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
1278 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
1279 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
1280 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
1281 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
1282 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
1283 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
1284 }
713
c3c424a90a42 Improve implementation of ResultSet.getMetaData().
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 709
diff changeset
1285 }
c3c424a90a42 Improve implementation of ResultSet.getMetaData().
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 709
diff changeset
1286 return rsmd;
c3c424a90a42 Improve implementation of ResultSet.getMetaData().
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 709
diff changeset
1287 }
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1288
713
c3c424a90a42 Improve implementation of ResultSet.getMetaData().
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 709
diff changeset
1289 /**
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1290 * 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
1291 * 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
1292 *
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1293 * 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
1294 * 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
1295 * 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
1296 * 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
1297 * 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
1298 *
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1299 * 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
1300 * 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
1301 * 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
1302 * 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
1303 * 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
1304 *
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1305 * @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
1306 * @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
1307 * @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
1308 */
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1309 @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
1310 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
1311 // 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
1312 // 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
1313 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
1314
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1315 final int JdbcType;
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1316 final String val;
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1317 try {
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1318 val = tlp.values[columnIndex - 1];
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1319 if (val == null) {
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1320 lastReadWasNull = true;
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1321 return null;
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1322 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1323 lastReadWasNull = false;
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1324 JdbcType = JdbcSQLTypes[columnIndex - 1];
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1325 } catch (IndexOutOfBoundsException e) {
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1326 throw newSQLInvalidColumnIndexException(columnIndex);
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1327 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1328
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
1329 switch (JdbcType) {
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1330 case Types.TINYINT:
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1331 case Types.SMALLINT:
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1332 try {
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1333 return Short.valueOf(val);
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1334 } catch (NumberFormatException e) {
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1335 return val;
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1336 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1337 case Types.INTEGER:
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1338 try {
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1339 return Integer.valueOf(val);
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1340 } catch (NumberFormatException e) {
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1341 return val;
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1342 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1343 case Types.BIGINT:
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1344 try {
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1345 return Long.valueOf(val);
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1346 } catch (NumberFormatException e) {
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1347 return val;
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1348 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1349 case Types.DOUBLE:
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1350 case Types.FLOAT:
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1351 try {
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1352 return Double.valueOf(val);
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1353 } catch (NumberFormatException e) {
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1354 return val;
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1355 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1356 case Types.REAL:
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1357 try {
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1358 return Float.valueOf(val);
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1359 } catch (NumberFormatException e) {
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1360 return val;
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1361 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1362 case Types.DECIMAL:
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1363 case Types.NUMERIC:
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1364 try {
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1365 return new BigDecimal(val);
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1366 } catch (NumberFormatException e) {
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1367 return val;
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1368 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1369 case Types.BOOLEAN:
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1370 return Boolean.valueOf(val);
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1371 case Types.VARCHAR:
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1372 {
642
dd9b4fb14256 Added recognition of 'xml' type.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 623
diff changeset
1373 // 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
1374 // 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
1375 final String MonetDBType = types[columnIndex - 1];
26
46dde2b2c991 Small code improvements
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 25
diff changeset
1376 switch (MonetDBType.length()) {
46dde2b2c991 Small code improvements
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 25
diff changeset
1377 case 3:
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1378 if ("url".equals(MonetDBType)) {
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1379 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
1380 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
1381 url_obj.fromString(val);
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1382 return url_obj;
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1383 } catch (Exception exc) {
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1384 // 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
1385 return val;
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1386 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1387 }
26
46dde2b2c991 Small code improvements
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 25
diff changeset
1388 break;
46dde2b2c991 Small code improvements
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 25
diff changeset
1389 case 4:
46dde2b2c991 Small code improvements
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 25
diff changeset
1390 if ("inet".equals(MonetDBType)) {
46dde2b2c991 Small code improvements
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 25
diff changeset
1391 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
1392 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
1393 inet_obj.fromString(val);
46dde2b2c991 Small code improvements
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 25
diff changeset
1394 return inet_obj;
46dde2b2c991 Small code improvements
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 25
diff changeset
1395 } catch (Exception exc) {
46dde2b2c991 Small code improvements
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 25
diff changeset
1396 // 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
1397 return val;
46dde2b2c991 Small code improvements
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 25
diff changeset
1398 }
46dde2b2c991 Small code improvements
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 25
diff changeset
1399 } else
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1400 if ("uuid".equals(MonetDBType)) {
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1401 try {
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1402 return java.util.UUID.fromString(val);
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1403 } catch (IllegalArgumentException exc) {
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1404 // 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
1405 return val;
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1406 }
26
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 ("json".equals(MonetDBType)) {
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1409 // 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
1410 // 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
1411 // 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
1412 // 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
1413 // 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
1414 // 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
1415 // return val;
26
46dde2b2c991 Small code improvements
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 25
diff changeset
1416 }
46dde2b2c991 Small code improvements
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 25
diff changeset
1417 break;
46dde2b2c991 Small code improvements
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 25
diff changeset
1418 }
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1419 return val;
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1420 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1421 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
1422 /* 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
1423 return val;
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1424 case Types.CLOB:
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1425 return new MonetClob(val);
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1426 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
1427 return new MonetBlob(val);
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1428 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
1429 return getDate(columnIndex, null);
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1430 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
1431 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
1432 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
1433 return getOffsetTime(columnIndex);
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1434 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
1435 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
1436 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
1437 return getOffsetDateTime(columnIndex);
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1438 case Types.BINARY:
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1439 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
1440 /* 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
1441 return getBytes(columnIndex);
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1442 case Types.OTHER:
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1443 default:
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1444 // 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
1445 // 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
1446 return getObject(columnIndex, this.getStatement().getConnection().getTypeMap());
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1447 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1448 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1449
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
1450 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
1451 final Class<?>[] cls = cl.getInterfaces();
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1452 for (int i = 0; i < cls.length; i++) {
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1453 if (cls[i] == SQLData.class)
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1454 return true;
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 return false;
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1457 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1458
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1459 /**
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1460 * 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
1461 * 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
1462 *
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1463 * 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
1464 * 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
1465 * 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
1466 * in the JDBC specification.
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1467 * 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
1468 *
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1469 * 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
1470 * 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
1471 * materialize data of SQL user-defined types.
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1472 *
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1473 * 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
1474 * 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
1475 * 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
1476 * this.getStatement().getConnection().getTypeMap()).
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1477 * If Connection.getTypeMap does throw a SQLFeatureNotSupportedException, then
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1478 * 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
1479 * 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
1480 *
151
3d5ea891bb74 Update implementation to match the JDBC spec so use
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 145
diff changeset
1481 * @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
1482 * @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
1483 * 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
1484 * @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
1485 * @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
1486 */
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1487 @Override
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1488 @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
1489 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
1490 throws SQLException
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1491 {
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 checkNotClosed();
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1493 final String val;
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1494 final String MonetDBtype;
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1495 try {
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1496 val = tlp.values[columnIndex - 1];
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1497 if (val == null) {
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1498 lastReadWasNull = true;
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1499 return null;
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1500 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1501 lastReadWasNull = false;
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1502 MonetDBtype = types[columnIndex - 1];
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1503 } catch (IndexOutOfBoundsException e) {
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1504 throw newSQLInvalidColumnIndexException(columnIndex);
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1505 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1506
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1507 Class<?> type = null;
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1508 if (map != null && map.containsKey(MonetDBtype)) {
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1509 type = map.get(MonetDBtype);
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1510 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1511 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
1512 // 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
1513 type = MonetDriver.getClassForType(JdbcSQLTypes[columnIndex - 1]);
0
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
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1516 if (type == null || type == String.class) {
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1517 return val;
820
4c35009cd59c In ResultSet.getObject() method added support for retrieving
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 774
diff changeset
1518 }
4c35009cd59c In ResultSet.getObject() method added support for retrieving
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 774
diff changeset
1519 if (type == BigDecimal.class) {
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1520 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
1521 }
4c35009cd59c In ResultSet.getObject() method added support for retrieving
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 774
diff changeset
1522 if (type == Boolean.class) {
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1523 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
1524 }
4c35009cd59c In ResultSet.getObject() method added support for retrieving
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 774
diff changeset
1525 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
1526 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
1527 }
4c35009cd59c In ResultSet.getObject() method added support for retrieving
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 774
diff changeset
1528 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
1529 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
1530 }
4c35009cd59c In ResultSet.getObject() method added support for retrieving
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 774
diff changeset
1531 if (type == Short.class) {
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1532 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
1533 }
4c35009cd59c In ResultSet.getObject() method added support for retrieving
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 774
diff changeset
1534 if (type == Double.class) {
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1535 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
1536 }
4c35009cd59c In ResultSet.getObject() method added support for retrieving
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 774
diff changeset
1537 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
1538 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
1539 }
4c35009cd59c In ResultSet.getObject() method added support for retrieving
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 774
diff changeset
1540 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
1541 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
1542 }
4c35009cd59c In ResultSet.getObject() method added support for retrieving
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 774
diff changeset
1543 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
1544 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
1545 }
4c35009cd59c In ResultSet.getObject() method added support for retrieving
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 774
diff changeset
1546 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
1547 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
1548 }
4c35009cd59c In ResultSet.getObject() method added support for retrieving
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 774
diff changeset
1549 if (type == OffsetTime.class) {
4c35009cd59c In ResultSet.getObject() method added support for retrieving
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 774
diff changeset
1550 return getOffsetTime(columnIndex);
4c35009cd59c In ResultSet.getObject() method added support for retrieving
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 774
diff changeset
1551 }
4c35009cd59c In ResultSet.getObject() method added support for retrieving
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 774
diff changeset
1552 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
1553 return getOffsetDateTime(columnIndex);
4c35009cd59c In ResultSet.getObject() method added support for retrieving
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 774
diff changeset
1554 }
4c35009cd59c In ResultSet.getObject() method added support for retrieving
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 774
diff changeset
1555 if (type == Clob.class) {
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1556 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
1557 }
4c35009cd59c In ResultSet.getObject() method added support for retrieving
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 774
diff changeset
1558 if (type == Blob.class) {
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1559 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
1560 }
4c35009cd59c In ResultSet.getObject() method added support for retrieving
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 774
diff changeset
1561 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
1562 return getBytes(columnIndex);
4c35009cd59c In ResultSet.getObject() method added support for retrieving
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 774
diff changeset
1563 }
4c35009cd59c In ResultSet.getObject() method added support for retrieving
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 774
diff changeset
1564 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
1565 final SQLData x;
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1566 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
1567 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
1568 ((Class)type).getConstructor();
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1569 x = ctor.newInstance();
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1570 } catch (NoSuchMethodException nsme) {
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1571 throw new SQLException(nsme.getMessage(), "M0M27");
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1572 } catch (InstantiationException ie) {
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1573 throw new SQLException(ie.getMessage(), "M0M27");
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1574 } catch (IllegalAccessException iae) {
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1575 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
1576 } catch (java.lang.reflect.InvocationTargetException ite) {
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1577 throw new SQLException(ite.getMessage(), "M0M27");
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1578 } catch (SecurityException se) {
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1579 throw new SQLException(se.getMessage(), "M0M27");
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1580 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1581 final int colnum = columnIndex;
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1582 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
1583 final SQLInput input = new SQLInput() {
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1584 @Override
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1585 public String readString() throws SQLException {
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1586 return getString(colnum);
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1587 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1588
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1589 @Override
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1590 public boolean readBoolean() throws SQLException {
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1591 return getBoolean(colnum);
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1592 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1593
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1594 @Override
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1595 public byte readByte() throws SQLException {
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1596 return getByte(colnum);
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
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1599 @Override
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1600 public short readShort() throws SQLException {
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1601 return getShort(colnum);
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1602 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1603
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1604 @Override
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1605 public int readInt() throws SQLException {
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1606 return getInt(colnum);
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1607 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1608
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1609 @Override
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1610 public long readLong() throws SQLException {
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1611 return getLong(colnum);
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1612 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1613
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1614 @Override
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1615 public float readFloat() throws SQLException {
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1616 return getFloat(colnum);
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1617 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1618
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1619 @Override
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1620 public double readDouble() throws SQLException {
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1621 return getDouble(colnum);
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1622 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1623
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1624 @Override
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1625 public BigDecimal readBigDecimal() throws SQLException {
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1626 return getBigDecimal(colnum);
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1627 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1628
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1629 @Override
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1630 public byte[] readBytes() throws SQLException {
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1631 return getBytes(colnum);
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1632 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1633
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1634 @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
1635 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
1636 return getDate(colnum, null);
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1637 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1638
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1639 @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
1640 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
1641 return getTime(colnum, null);
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1642 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1643
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1644 @Override
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1645 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
1646 return getTimestamp(colnum, null);
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1647 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1648
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1649 @Override
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1650 public Reader readCharacterStream() throws SQLException {
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1651 return getCharacterStream(colnum);
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1652 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1653
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1654 @Override
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1655 public InputStream readAsciiStream() throws SQLException {
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1656 return getAsciiStream(colnum);
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1657 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1658
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1659 @Override
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1660 public InputStream readBinaryStream() throws SQLException {
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1661 return getBinaryStream(colnum);
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1662 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1663
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1664 @Override
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1665 public Object readObject() throws SQLException {
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1666 return getObject(colnum);
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1667 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1668
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1669 @Override
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1670 public Ref readRef() throws SQLException {
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1671 return getRef(colnum);
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1672 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1673
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1674 @Override
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1675 public Blob readBlob() throws SQLException {
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1676 return getBlob(colnum);
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1677 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1678
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1679 @Override
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1680 public Clob readClob() throws SQLException {
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1681 return getClob(colnum);
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1682 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1683
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1684 @Override
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1685 public Array readArray() throws SQLException {
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1686 return getArray(colnum);
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1687 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1688
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1689 @Override
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1690 public boolean wasNull() throws SQLException {
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1691 return valwasnull;
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1692 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1693
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1694 @Override
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1695 public URL readURL() throws SQLException {
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1696 return getURL(colnum);
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1697 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1698
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1699 @Override
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1700 public NClob readNClob() throws SQLException {
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1701 return getNClob(colnum);
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1702 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1703
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1704 @Override
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1705 public String readNString() throws SQLException {
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1706 return getNString(colnum);
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1707 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1708
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1709 @Override
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1710 public SQLXML readSQLXML() throws SQLException {
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1711 return getSQLXML(colnum);
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1712 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1713
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1714 @Override
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1715 public RowId readRowId() throws SQLException {
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1716 return getRowId(colnum);
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1717 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1718 };
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1719 x.readSQL(input, MonetDBtype);
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1720 return x;
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1721 }
820
4c35009cd59c In ResultSet.getObject() method added support for retrieving
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 774
diff changeset
1722 return val;
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1723 }
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 * 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
1727 * 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
1728 *
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1729 * 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
1730 * 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
1731 * 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
1732 * 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
1733 * SQL NULL, the driver returns a Java null.
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 * 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
1736 * types.
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1737 *
151
3d5ea891bb74 Update implementation to match the JDBC spec so use
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 145
diff changeset
1738 * @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
1739 * @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
1740 * @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
1741 */
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1742 @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
1743 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
1744 return getObject(findColumn(columnLabel));
0
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
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1747 /**
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1748 * 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
1749 * 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
1750 * 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
1751 * 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
1752 *
151
3d5ea891bb74 Update implementation to match the JDBC spec so use
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 145
diff changeset
1753 * @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
1754 * @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
1755 * 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
1756 * @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
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, 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
1761 return getObject(findColumn(columnLabel), map);
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 @Override
151
3d5ea891bb74 Update implementation to match the JDBC spec so use
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 145
diff changeset
1765 public Ref getRef(int columnIndex) throws SQLException {
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1766 throw newSQLFeatureNotSupportedException("getRef");
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1767 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1768
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1769 @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
1770 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
1771 throw newSQLFeatureNotSupportedException("getRef");
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1772 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1773
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1774 /**
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1775 * 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
1776 * number 2, and so on.
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1777 *
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1778 * @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
1779 */
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1780 @Override
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1781 public int getRow() {
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1782 return curRow;
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1783 }
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 * 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
1787 * 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
1788 * programming language.
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 * @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
1791 * @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
1792 * is null
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1793 * @throws SQLException if there is no such column
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1794 * @throws SQLFeatureNotSupportedException the JDBC driver does
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1795 * not support this method
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
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
1798 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
1799 throw newSQLFeatureNotSupportedException("getRowId");
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 *
151
3d5ea891bb74 Update implementation to match the JDBC spec so use
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 145
diff changeset
1807 * @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
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
151
3d5ea891bb74 Update implementation to match the JDBC spec so use
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 145
diff changeset
1810 * @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
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 String columnLabel) 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 of this
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1821 * 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
1822 *
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1823 * @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
1824 * @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
1825 * @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
1826 */
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1827 @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
1828 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
1829 checkNotClosed();
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1830 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
1831 final String val = tlp.values[columnIndex - 1];
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1832 if (val == null) {
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1833 lastReadWasNull = true;
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1834 return 0;
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 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
1837 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
1838 } 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
1839 throw newSQLNumberFormatException(e);
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1840 } catch (IndexOutOfBoundsException e) {
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1841 throw newSQLInvalidColumnIndexException(columnIndex);
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1842 }
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
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1845 /**
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1846 * 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
1847 * 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
1848 *
151
3d5ea891bb74 Update implementation to match the JDBC spec so use
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 145
diff changeset
1849 * @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
1850 * @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
1851 * @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
1852 */
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1853 @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
1854 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
1855 return getShort(findColumn(columnLabel));
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1856 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1857
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1858 /**
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
1859 * 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
1860 * 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
1861 * DatabaseMetaData method, this method may return null.
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1862 *
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
1863 * 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
1864 * 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
1865 *
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
1866 * @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
1867 * 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
1868 */
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1869 @Override
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1870 public Statement getStatement() {
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1871 return statement;
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1872 }
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 * 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
1876 * 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
1877 *
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1878 * @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
1879 * @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
1880 * @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
1881 */
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1882 @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
1883 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
1884 checkNotClosed();
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1885 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
1886 final String val = tlp.values[columnIndex - 1];
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1887 if (val == null) {
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1888 lastReadWasNull = true;
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1889 return null;
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 lastReadWasNull = false;
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1892 return val;
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1893 } catch (IndexOutOfBoundsException e) {
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1894 throw newSQLInvalidColumnIndexException(columnIndex);
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1895 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1896 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1897
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 * 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
1900 * 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
1901 *
151
3d5ea891bb74 Update implementation to match the JDBC spec so use
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 145
diff changeset
1902 * @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
1903 * @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
1904 * @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
1905 */
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1906 @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
1907 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
1908 return getString(findColumn(columnLabel));
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1909 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1910
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1911 /**
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1912 * 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
1913 * 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
1914 * 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
1915 * and LONGNVARCHAR columns.
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1916 *
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1917 * @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
1918 * @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
1919 * @throws SQLException if there is no such column
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1920 */
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1921 @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
1922 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
1923 return getString(columnIndex);
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1924 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1925
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 * 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
1928 * 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
1929 * 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
1930 * and LONGNVARCHAR columns.
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1931 *
151
3d5ea891bb74 Update implementation to match the JDBC spec so use
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 145
diff changeset
1932 * @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
1933 * @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
1934 * @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
1935 */
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1936 @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
1937 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
1938 return getString(findColumn(columnLabel));
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1939 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1940
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 * 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
1943 * 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
1944 * programming language.
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1945 *
151
3d5ea891bb74 Update implementation to match the JDBC spec so use
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 145
diff changeset
1946 * @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
1947 * @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
1948 * @throws SQLException if a database access error occurs
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1949 * @throws SQLFeatureNotSupportedException the JDBC driver does
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1950 * not support this method
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1951 */
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1952 @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
1953 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
1954 throw newSQLFeatureNotSupportedException("getSQLXML");
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1955 }
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 * 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
1959 * 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
1960 * programming language.
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1961 *
151
3d5ea891bb74 Update implementation to match the JDBC spec so use
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 145
diff changeset
1962 * @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
1963 * 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
1964 * label is the name of the column
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1965 * @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
1966 * @throws SQLException if a database access error occurs
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1967 * @throws SQLFeatureNotSupportedException the JDBC driver does
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1968 * not support this method
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1969 */
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1970 @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
1971 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
1972 throw newSQLFeatureNotSupportedException("getSQLXML");
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 // 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
1976 private SimpleDateFormat dateFormat;
688cd5675466 Improved robustness of ResultSet methods:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 90
diff changeset
1977 private SimpleDateFormat timeFormat;
688cd5675466 Improved robustness of ResultSet methods:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 90
diff changeset
1978 private SimpleDateFormat timestampFormat;
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1979 /**
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1980 * 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
1981 * 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
1982 * LONGVARCHAR an attempt is made to parse the date according to the
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1983 * given type. The given Calender object is filled with the parsed
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1984 * 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
1985 * 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
1986 * 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
1987 * The dates are parsed with the given Calendar.
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1988 *
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1989 * @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
1990 * @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
1991 * @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
1992 * @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
1993 * @throws SQLException if a database error occurs
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1994 */
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
1995 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
1996 throws SQLException
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
1997 {
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
1998 checkNotClosed();
137
688cd5675466 Improved robustness of ResultSet methods:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 90
diff changeset
1999 if (cal == null)
688cd5675466 Improved robustness of ResultSet methods:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 90
diff changeset
2000 throw new IllegalArgumentException("No Calendar object given!");
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2001
198
376a15ce49e3 Improve parsing negative years.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 196
diff changeset
2002 final String monetDateStr;
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2003 final String monetDate;
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2004 final String MonetDBType;
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2005 int JdbcType;
198
376a15ce49e3 Improve parsing negative years.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 196
diff changeset
2006 boolean negativeYear = false;
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2007 try {
198
376a15ce49e3 Improve parsing negative years.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 196
diff changeset
2008 monetDateStr = tlp.values[columnIndex - 1];
376a15ce49e3 Improve parsing negative years.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 196
diff changeset
2009 if (monetDateStr == null) {
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2010 lastReadWasNull = true;
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2011 return -1;
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2012 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2013 lastReadWasNull = false;
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2014 MonetDBType = types[columnIndex - 1];
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2015 JdbcType = JdbcSQLTypes[columnIndex - 1];
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2016 // 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
2017 // 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
2018 if (JdbcType == Types.CHAR ||
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2019 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
2020 /* 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
2021 JdbcType == Types.CLOB)
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2022 {
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2023 JdbcType = type;
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2024 }
198
376a15ce49e3 Improve parsing negative years.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 196
diff changeset
2025
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
2026 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
2027 && monetDateStr.startsWith("-")) {
198
376a15ce49e3 Improve parsing negative years.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 196
diff changeset
2028 // 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
2029 negativeYear = true;
376a15ce49e3 Improve parsing negative years.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 196
diff changeset
2030 monetDate = monetDateStr.substring(1);
376a15ce49e3 Improve parsing negative years.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 196
diff changeset
2031 } else {
376a15ce49e3 Improve parsing negative years.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 196
diff changeset
2032 monetDate = monetDateStr;
376a15ce49e3 Improve parsing negative years.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 196
diff changeset
2033 }
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2034 } catch (IndexOutOfBoundsException e) {
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2035 throw newSQLInvalidColumnIndexException(columnIndex);
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2036 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2037
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2038 TimeZone ptz = cal.getTimeZone();
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 // 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
2041 // 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
2042 // parse it first
26
46dde2b2c991 Small code improvements
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 25
diff changeset
2043 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
2044 int vallen = monetDate.length();
46dde2b2c991 Small code improvements
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 25
diff changeset
2045 if (vallen >= 6) {
46dde2b2c991 Small code improvements
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 25
diff changeset
2046 // MonetDB/SQL99: Sign TwoDigitHours : Minutes
46dde2b2c991 Small code improvements
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 25
diff changeset
2047 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
2048 }
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2049 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2050
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2051 java.util.Date pdate = null;
137
688cd5675466 Improved robustness of ResultSet methods:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 90
diff changeset
2052 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
2053 switch (JdbcType) {
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2054 case Types.DATE:
137
688cd5675466 Improved robustness of ResultSet methods:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 90
diff changeset
2055 if (dateFormat == null) {
688cd5675466 Improved robustness of ResultSet methods:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 90
diff changeset
2056 // 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
2057 dateFormat = new SimpleDateFormat("yyyy-MM-dd");
688cd5675466 Improved robustness of ResultSet methods:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 90
diff changeset
2058 }
688cd5675466 Improved robustness of ResultSet methods:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 90
diff changeset
2059 dateFormat.setTimeZone(ptz);
688cd5675466 Improved robustness of ResultSet methods:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 90
diff changeset
2060 pdate = dateFormat.parse(monetDate, ppos);
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2061 break;
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2062 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
2063 case Types.TIME_WITH_TIMEZONE:
137
688cd5675466 Improved robustness of ResultSet methods:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 90
diff changeset
2064 if (timeFormat == null) {
688cd5675466 Improved robustness of ResultSet methods:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 90
diff changeset
2065 // 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
2066 timeFormat = new SimpleDateFormat("HH:mm:ss");
688cd5675466 Improved robustness of ResultSet methods:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 90
diff changeset
2067 }
688cd5675466 Improved robustness of ResultSet methods:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 90
diff changeset
2068 timeFormat.setTimeZone(ptz);
688cd5675466 Improved robustness of ResultSet methods:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 90
diff changeset
2069 pdate = timeFormat.parse(monetDate, ppos);
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2070 break;
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2071 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
2072 case Types.TIMESTAMP_WITH_TIMEZONE:
137
688cd5675466 Improved robustness of ResultSet methods:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 90
diff changeset
2073 if (timestampFormat == null) {
688cd5675466 Improved robustness of ResultSet methods:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 90
diff changeset
2074 // 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
2075 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
2076 }
688cd5675466 Improved robustness of ResultSet methods:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 90
diff changeset
2077 timestampFormat.setTimeZone(ptz);
688cd5675466 Improved robustness of ResultSet methods:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 90
diff changeset
2078 pdate = timestampFormat.parse(monetDate, ppos);
198
376a15ce49e3 Improve parsing negative years.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 196
diff changeset
2079 // 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
2080 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
2081 if (dateFormat == null) {
376a15ce49e3 Improve parsing negative years.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 196
diff changeset
2082 // 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
2083 dateFormat = new SimpleDateFormat("yyyy-MM-dd");
376a15ce49e3 Improve parsing negative years.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 196
diff changeset
2084 }
376a15ce49e3 Improve parsing negative years.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 196
diff changeset
2085 dateFormat.setTimeZone(ptz);
376a15ce49e3 Improve parsing negative years.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 196
diff changeset
2086 pdate = dateFormat.parse(monetDate, ppos);
376a15ce49e3 Improve parsing negative years.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 196
diff changeset
2087 }
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2088 break;
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2089 default:
198
376a15ce49e3 Improve parsing negative years.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 196
diff changeset
2090 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
2091 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2092 if (pdate == null) {
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2093 // 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
2094 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
2095 final int epos = ppos.getErrorIndex();
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2096 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
2097 errMsg.append("parsing '").append(monetDateStr).append("' failed");
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2098 } 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
2099 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
2100 .append(" found: '").append(monetDate.charAt(epos))
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
2101 .append("' in '").append(monetDateStr).append("'");
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2102 } else {
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
2103 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
2104 }
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
2105 throw new SQLException(errMsg.toString(), "01M10");
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2106 }
198
376a15ce49e3 Improve parsing negative years.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 196
diff changeset
2107
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2108 cal.setTime(pdate);
198
376a15ce49e3 Improve parsing negative years.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 196
diff changeset
2109 if (negativeYear) {
376a15ce49e3 Improve parsing negative years.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 196
diff changeset
2110 // System.out.println("Current cal: " + cal.toString());
376a15ce49e3 Improve parsing negative years.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 196
diff changeset
2111 // 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
2112 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
2113 // System.out.println("Corrected cal: " + cal.toString());
376a15ce49e3 Improve parsing negative years.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 196
diff changeset
2114 }
376a15ce49e3 Improve parsing negative years.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 196
diff changeset
2115
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
2116 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
2117 || 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
2118 || 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
2119 || JdbcType == Types.TIMESTAMP_WITH_TIMEZONE) {
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2120 // parse additional nanos (if any)
198
376a15ce49e3 Improve parsing negative years.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 196
diff changeset
2121 int nanos = 0;
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2122 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
2123 final char[] monDate = monetDate.toCharArray();
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2124 if (pos < monDate.length && monDate[pos] == '.') {
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2125 pos++;
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2126 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
2127 int ctr;
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2128 nanos = getIntrinsicValue(monDate[pos], pos++);
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2129 for (ctr = 1;
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2130 pos < monDate.length &&
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2131 monDate[pos] >= '0' &&
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2132 monDate[pos] <= '9';
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2133 ctr++)
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2134 {
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2135 if (ctr < 9) {
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2136 nanos *= 10;
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2137 nanos += (getIntrinsicValue(monDate[pos], pos));
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2138 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2139 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
2140 cal.set(Calendar.MILLISECOND, nanos);
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2141 pos++;
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2142 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2143 while (ctr++ < 9)
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2144 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
2145 } 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
2146 final int offset = e.getErrorOffset();
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2147 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
2148 " 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
2149 "' 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
2150 "\" at pos: " + offset, "01M10");
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2151 // default value
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2152 nanos = 0;
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2153 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2154 }
198
376a15ce49e3 Improve parsing negative years.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 196
diff changeset
2155 return nanos;
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2156 }
198
376a15ce49e3 Improve parsing negative years.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 196
diff changeset
2157
376a15ce49e3 Improve parsing negative years.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 196
diff changeset
2158 return 0;
0
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
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2161 /**
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2162 * 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
2163 * 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
2164 * an MCLParseException is thrown.
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2165 *
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2166 * @param c the char
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2167 * @param pos the position
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2168 * @return the intrinsic value of the char
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2169 * @throws MCLParseException if c is not a digit
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2170 */
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
2171 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
2172 throws MCLParseException
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2173 {
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2174 // note: don't use Character.isDigit() here, because
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2175 // we only want ISO-LATIN-1 digits
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2176 if (c >= '0' && c <= '9') {
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2177 return (int)c - (int)'0';
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2178 } else {
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2179 throw new MCLParseException("Expected a digit", pos);
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2180 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2181 }
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 /**
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2184 * 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
2185 * 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
2186 * language.
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2187 *
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2188 * @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
2189 * @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
2190 * @throws SQLException if a database access error occurs
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2191 * @see #getDate(int col, Calendar cal)
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2192 */
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2193 @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
2194 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
2195 return getDate(columnIndex, null);
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2196 }
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 * 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
2200 * 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
2201 * 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
2202 * 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
2203 * timezone information.
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, ...
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2206 * @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
2207 * @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
2208 * @throws SQLException if a database access error occurs
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, Calendar cal)
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2212 throws SQLException
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2213 {
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
2214 checkNotClosed();
139
9df089b0d69d Improve performance of ResulSet methods getDate(), getTime() getTimestamp()
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 137
diff changeset
2215 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
2216 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
2217 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
2218 lastReadWasNull = true;
9df089b0d69d Improve performance of ResulSet methods getDate(), getTime() getTimestamp()
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 137
diff changeset
2219 return null;
9df089b0d69d Improve performance of ResulSet methods getDate(), getTime() getTimestamp()
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 137
diff changeset
2220 }
143
dcf7879d4862 Optimised ResulSet methods getDate(column), getTime(column) and getTimestamp(column)
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 139
diff changeset
2221 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
2222 if (cal == null) {
196
95b48b249f68 First fix for bug 6468
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 194
diff changeset
2223 // 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
2224 // 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
2225 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
2226 return Date.valueOf(val);
196
95b48b249f68 First fix for bug 6468
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 194
diff changeset
2227 } catch (IllegalArgumentException iae) {
95b48b249f68 First fix for bug 6468
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 194
diff changeset
2228 // 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
2229 // 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
2230 }
b18cfb312330 Improved code to fix failing tests in sql/jdbc/tests/Tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 144
diff changeset
2231 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
2232 }
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
2233 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
2234 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
2235 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
2236 } catch (IndexOutOfBoundsException e) {
9df089b0d69d Improve performance of ResulSet methods getDate(), getTime() getTimestamp()
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 137
diff changeset
2237 throw newSQLInvalidColumnIndexException(columnIndex);
9df089b0d69d Improve performance of ResulSet methods getDate(), getTime() getTimestamp()
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 137
diff changeset
2238 }
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2239 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2240
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2241 /**
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2242 * 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
2243 * 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
2244 * language.
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2245 *
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
2246 * @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
2247 * @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
2248 * @throws SQLException if a database access error occurs
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2249 */
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2250 @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
2251 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
2252 return getDate(findColumn(columnLabel), null);
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2253 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2254
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2255 /**
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2256 * 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
2257 * 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
2258 * 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
2259 * 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
2260 * timezone information.
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2261 *
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
2262 * @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
2263 * @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
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, final Calendar cal)
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2269 throws SQLException
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2270 {
151
3d5ea891bb74 Update implementation to match the JDBC spec so use
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 145
diff changeset
2271 return getDate(findColumn(columnLabel), cal);
0
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
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2274 /**
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2275 * 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
2276 * 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
2277 * language.
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2278 *
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2279 * @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
2280 * @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
2281 * @throws SQLException if a database access error occurs
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2282 */
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2283 @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
2284 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
2285 return getTime(columnIndex, null);
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2286 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2287
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2288 /**
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2289 * 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
2290 * 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
2291 * 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
2292 * 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
2293 * timezone information.
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2294 *
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2295 * @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
2296 * @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
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, Calendar cal)
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2302 throws SQLException
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2303 {
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
2304 checkNotClosed();
139
9df089b0d69d Improve performance of ResulSet methods getDate(), getTime() getTimestamp()
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 137
diff changeset
2305 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
2306 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
2307 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
2308 lastReadWasNull = true;
9df089b0d69d Improve performance of ResulSet methods getDate(), getTime() getTimestamp()
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 137
diff changeset
2309 return null;
9df089b0d69d Improve performance of ResulSet methods getDate(), getTime() getTimestamp()
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 137
diff changeset
2310 }
143
dcf7879d4862 Optimised ResulSet methods getDate(column), getTime(column) and getTimestamp(column)
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 139
diff changeset
2311 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
2312 if (cal == null) {
196
95b48b249f68 First fix for bug 6468
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 194
diff changeset
2313 // 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
2314 // 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
2315 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
2316 return Time.valueOf(val);
196
95b48b249f68 First fix for bug 6468
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 194
diff changeset
2317 } catch (IllegalArgumentException iae) {
95b48b249f68 First fix for bug 6468
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 194
diff changeset
2318 // 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
2319 // 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
2320 }
b18cfb312330 Improved code to fix failing tests in sql/jdbc/tests/Tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 144
diff changeset
2321 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
2322 }
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
2323 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
2324 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
2325 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
2326 } catch (IndexOutOfBoundsException e) {
9df089b0d69d Improve performance of ResulSet methods getDate(), getTime() getTimestamp()
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 137
diff changeset
2327 throw newSQLInvalidColumnIndexException(columnIndex);
9df089b0d69d Improve performance of ResulSet methods getDate(), getTime() getTimestamp()
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 137
diff changeset
2328 }
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2329 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2330
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2331 /**
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2332 * 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
2333 * 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
2334 * language.
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2335 *
151
3d5ea891bb74 Update implementation to match the JDBC spec so use
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 145
diff changeset
2336 * @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
2337 * @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
2338 * @throws SQLException if a database access error occurs
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2339 */
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2340 @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
2341 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
2342 return getTime(findColumn(columnLabel), null);
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2343 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2344
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2345 /**
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2346 * 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
2347 * 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
2348 * 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
2349 * 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
2350 * timezone information.
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2351 *
151
3d5ea891bb74 Update implementation to match the JDBC spec so use
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 145
diff changeset
2352 * @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
2353 * @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
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, final Calendar cal)
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2359 throws SQLException
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2360 {
151
3d5ea891bb74 Update implementation to match the JDBC spec so use
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 145
diff changeset
2361 return getTime(findColumn(columnLabel), cal);
0
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
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2364 /**
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2365 * 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
2366 * 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
2367 * language.
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2368 *
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2369 * @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
2370 * @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
2371 * @throws SQLException if a database access error occurs
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2372 */
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2373 @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
2374 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
2375 return getTimestamp(columnIndex, null);
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2376 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2377
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2378 /**
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2379 * 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
2380 * 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
2381 * 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
2382 * 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
2383 * store timezone information.
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2384 *
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2385 * @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
2386 * @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
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, Calendar cal)
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2392 throws SQLException
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2393 {
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
2394 checkNotClosed();
139
9df089b0d69d Improve performance of ResulSet methods getDate(), getTime() getTimestamp()
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 137
diff changeset
2395 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
2396 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
2397 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
2398 lastReadWasNull = true;
9df089b0d69d Improve performance of ResulSet methods getDate(), getTime() getTimestamp()
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 137
diff changeset
2399 return null;
9df089b0d69d Improve performance of ResulSet methods getDate(), getTime() getTimestamp()
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 137
diff changeset
2400 }
143
dcf7879d4862 Optimised ResulSet methods getDate(column), getTime(column) and getTimestamp(column)
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 139
diff changeset
2401 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
2402 if (cal == null) {
196
95b48b249f68 First fix for bug 6468
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 194
diff changeset
2403 // 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
2404 // 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
2405 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
2406 return Timestamp.valueOf(val);
196
95b48b249f68 First fix for bug 6468
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 194
diff changeset
2407 } catch (IllegalArgumentException iae) {
95b48b249f68 First fix for bug 6468
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 194
diff changeset
2408 // 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
2409 // 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
2410 }
b18cfb312330 Improved code to fix failing tests in sql/jdbc/tests/Tests
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 144
diff changeset
2411 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
2412 }
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 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
2414 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
2415 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
2416
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
2417 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
2418 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
2419 return ts;
139
9df089b0d69d Improve performance of ResulSet methods getDate(), getTime() getTimestamp()
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 137
diff changeset
2420 } catch (IndexOutOfBoundsException e) {
9df089b0d69d Improve performance of ResulSet methods getDate(), getTime() getTimestamp()
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 137
diff changeset
2421 throw newSQLInvalidColumnIndexException(columnIndex);
9df089b0d69d Improve performance of ResulSet methods getDate(), getTime() getTimestamp()
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 137
diff changeset
2422 }
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2423 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2424
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2425 /**
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2426 * 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
2427 * 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
2428 * language.
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2429 *
151
3d5ea891bb74 Update implementation to match the JDBC spec so use
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 145
diff changeset
2430 * @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
2431 * @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
2432 * @throws SQLException if a database access error occurs
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2433 */
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2434 @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
2435 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
2436 return getTimestamp(findColumn(columnLabel), null);
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2437 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2438
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2439 /**
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2440 * 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
2441 * 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
2442 * 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
2443 * 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
2444 * store timezone information.
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2445 *
151
3d5ea891bb74 Update implementation to match the JDBC spec so use
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 145
diff changeset
2446 * @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
2447 * @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
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, final Calendar cal)
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2453 throws SQLException
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2454 {
151
3d5ea891bb74 Update implementation to match the JDBC spec so use
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 145
diff changeset
2455 return getTimestamp(findColumn(columnLabel), cal);
0
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
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2458 /**
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2459 * 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
2460 * the Statement object that created the result set.
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2461 *
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2462 * @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
2463 * or ResultSet.TYPE_SCROLL_SENSITIVE
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2464 */
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2465 @Override
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2466 public int getType() {
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2467 return type;
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2468 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2469
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2470 /**
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2471 * 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
2472 * 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
2473 * programming language.
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2474 *
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
2475 * @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
2476 * @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
2477 * @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
2478 */
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2479 @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
2480 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
2481 checkNotClosed();
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2482 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
2483 final String val = tlp.values[columnIndex - 1];
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2484 if (val == null) {
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2485 lastReadWasNull = true;
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2486 return null;
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 lastReadWasNull = false;
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2489 try {
769
b6d113ee35ae Fixed javac version 20 compiler warnings.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 735
diff changeset
2490 // 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
2491 // 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
2492 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
2493 } 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
2494 throw new SQLException(e.getMessage(), "22M30");
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 } catch (IndexOutOfBoundsException e) {
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2497 throw newSQLInvalidColumnIndexException(columnIndex);
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2498 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2499 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2500
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2501 /**
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2502 * 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
2503 * 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
2504 * programming language.
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2505 *
151
3d5ea891bb74 Update implementation to match the JDBC spec so use
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 145
diff changeset
2506 * @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
2507 * @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
2508 * @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
2509 */
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2510 @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
2511 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
2512 return getURL(findColumn(columnLabel));
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2513 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2514
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 * 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
2517 * 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
2518 * 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
2519 * 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
2520 *
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2521 * 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
2522 * an SQLException to be thrown.
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2523 *
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2524 * 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
2525 *
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2526 * @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
2527 * @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
2528 */
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2529 @Override
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2530 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
2531 checkNotClosed();
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2532 // 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
2533 // specification.
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2534 return warnings;
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2535 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2536
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 * 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
2539 * object.
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 * @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
2542 * 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
2543 * @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
2544 */
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2545 @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
2546 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
2547 checkNotClosed();
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2548 return curRow == tupleCount + 1;
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2549 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2550
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2551 /**
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2552 * 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
2553 * object.
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 * @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
2556 * 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
2557 * @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
2558 */
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2559 @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
2560 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
2561 checkNotClosed();
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2562 return curRow == 0;
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2563 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2564
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2565 /**
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2566 * 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
2567 * 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
2568 * if it is automatically closed.
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2569 *
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
2570 * @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
2571 * @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
2572 */
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2573 @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
2574 public boolean isClosed() throws SQLException {
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2575 return header != null && header.isClosed();
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2576 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2577
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2578 /**
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2579 * 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
2580 * object.
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 * @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
2583 * @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
2584 */
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2585 @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
2586 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
2587 checkNotClosed();
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2588 return curRow == 1;
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
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2591 /**
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2592 * 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
2593 *
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2594 * @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
2595 * @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
2596 */
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2597 @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
2598 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
2599 checkNotClosed();
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2600 return curRow == tupleCount;
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
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2603 /**
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2604 * 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
2605 *
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2606 * @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
2607 * in the result set
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2608 * @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
2609 * 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
2610 * @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
2611 */
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2612 @Override
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2613 public boolean last() throws SQLException {
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2614 return absolute(-1);
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2615 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2616
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2617 /**
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2618 * 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
2619 * 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
2620 * 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
2621 * 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
2622 *
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2623 * 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
2624 * 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
2625 * cleared when a new row is read.
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2626 *
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2627 * @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
2628 * more rows
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2629 * @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
2630 * closed
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2631 */
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2632 @Override
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2633 public boolean next() throws SQLException {
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2634 return relative(1);
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2635 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2636
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2637 /**
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2638 * 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
2639 *
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2640 * @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
2641 * the result set
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2642 * @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
2643 * 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
2644 */
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2645 @Override
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2646 public boolean previous() throws SQLException {
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2647 return relative(-1);
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
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2650 /**
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2651 * 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
2652 * 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
2653 * 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
2654 * valid, but does not change the cursor position.
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2655 *
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2656 * 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
2657 * 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
2658 * method previous().
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2659 *
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2660 * @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
2661 * 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
2662 * moves the cursor backward
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2663 * @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
2664 * @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
2665 * 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
2666 */
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2667 @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
2668 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
2669 return absolute(curRow + rows);
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2670 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2671
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 * 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
2674 * 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
2675 * 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
2676 *
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2677 * 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
2678 *
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2679 * 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
2680 *
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2681 * Throws:
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2682 * 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
2683 * Since: 1.2
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2684 * See Also: DatabaseMetaData.deletesAreDetected(int)
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2685 */
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2686 @Override
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2687 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
2688 checkNotClosed();
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2689 return false;
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2690 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2691
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2692 /**
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2693 * 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
2694 * 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
2695 *
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2696 * 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
2697 *
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2698 * 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
2699 *
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2700 * Throws:
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2701 * 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
2702 * Since: 1.2
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2703 * See Also: DatabaseMetaData.insertsAreDetected(int)
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2704 */
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2705 @Override
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2706 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
2707 checkNotClosed();
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2708 return false;
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
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2711 /**
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2712 * Retrieves whether the current row has been updated.
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2713 * 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
2714 *
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2715 * 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
2716 *
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2717 * 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
2718 *
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2719 * Throws:
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2720 * 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
2721 * Since: 1.2
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2722 * See Also: DatabaseMetaData.updatesAreDetected(int)
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2723 */
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2724 @Override
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2725 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
2726 checkNotClosed();
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2727 return false;
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
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
2730
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
2731 /* 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
2732 * @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
2733 */
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2734 @Override
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2735 public void cancelRowUpdates() throws SQLException {
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2736 throw newSQLFeatureNotSupportedException("cancelRowUpdates");
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2737 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2738
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2739 @Override
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2740 public void deleteRow() throws SQLException {
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2741 throw newSQLFeatureNotSupportedException("deleteRow");
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2742 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2743
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2744 @Override
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2745 public void insertRow() throws SQLException {
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2746 throw newSQLFeatureNotSupportedException("insertRow");
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2747 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2748
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2749 @Override
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2750 public void moveToCurrentRow() throws SQLException {
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2751 throw newSQLFeatureNotSupportedException("moveToCurrentRow");
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2752 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2753
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2754 @Override
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2755 public void moveToInsertRow() throws SQLException {
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2756 throw newSQLFeatureNotSupportedException("moveToInsertRow");
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2757 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2758
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2759 @Override
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2760 public void refreshRow() throws SQLException {
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2761 throw newSQLFeatureNotSupportedException("refreshRow");
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2762 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2763
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 @Override
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2766 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
2767 throw newSQLFeatureNotSupportedException("updateArray");
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2768 }
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 @Override
151
3d5ea891bb74 Update implementation to match the JDBC spec so use
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 145
diff changeset
2771 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
2772 throw newSQLFeatureNotSupportedException("updateArray");
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2773 }
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 @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
2776 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
2777 throw newSQLFeatureNotSupportedException("updateAsciiStream");
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2778 }
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 @Override
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2781 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
2782 throw newSQLFeatureNotSupportedException("updateAsciiStream");
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2783 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2784
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2785 @Override
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2786 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
2787 throw newSQLFeatureNotSupportedException("updateAsciiStream");
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2788 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2789
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2790 @Override
151
3d5ea891bb74 Update implementation to match the JDBC spec so use
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 145
diff changeset
2791 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
2792 throw newSQLFeatureNotSupportedException("updateAsciiStream");
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2793 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2794
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2795 @Override
151
3d5ea891bb74 Update implementation to match the JDBC spec so use
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 145
diff changeset
2796 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
2797 throw newSQLFeatureNotSupportedException("updateAsciiStream");
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2798 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2799
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2800 @Override
151
3d5ea891bb74 Update implementation to match the JDBC spec so use
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 145
diff changeset
2801 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
2802 throw newSQLFeatureNotSupportedException("updateAsciiStream");
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2803 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2804
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2805 @Override
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2806 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
2807 throw newSQLFeatureNotSupportedException("updateBigDecimal");
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2808 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2809
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2810 @Override
151
3d5ea891bb74 Update implementation to match the JDBC spec so use
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 145
diff changeset
2811 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
2812 throw newSQLFeatureNotSupportedException("updateBigDecimal");
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2813 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2814
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2815 @Override
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2816 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
2817 throw newSQLFeatureNotSupportedException("updateBinaryStream");
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2818 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2819
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2820 @Override
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2821 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
2822 throw newSQLFeatureNotSupportedException("updateBinaryStream");
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2823 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2824
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2825 @Override
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2826 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
2827 throw newSQLFeatureNotSupportedException("updateBinaryStream");
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2828 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2829
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2830 @Override
151
3d5ea891bb74 Update implementation to match the JDBC spec so use
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 145
diff changeset
2831 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
2832 throw newSQLFeatureNotSupportedException("updateBinaryStream");
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2833 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2834
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2835 @Override
151
3d5ea891bb74 Update implementation to match the JDBC spec so use
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 145
diff changeset
2836 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
2837 throw newSQLFeatureNotSupportedException("updateBinaryStream");
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2838 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2839
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2840 @Override
151
3d5ea891bb74 Update implementation to match the JDBC spec so use
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 145
diff changeset
2841 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
2842 throw newSQLFeatureNotSupportedException("updateBinaryStream");
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2843 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2844
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2845 @Override
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2846 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
2847 throw newSQLFeatureNotSupportedException("updateBlob");
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2848 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2849
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2850 @Override
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2851 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
2852 throw newSQLFeatureNotSupportedException("updateBlob");
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2853 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2854
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2855 @Override
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2856 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
2857 throw newSQLFeatureNotSupportedException("updateBlob");
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2858 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2859
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2860 @Override
151
3d5ea891bb74 Update implementation to match the JDBC spec so use
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 145
diff changeset
2861 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
2862 throw newSQLFeatureNotSupportedException("updateBlob");
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2863 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2864
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2865 @Override
151
3d5ea891bb74 Update implementation to match the JDBC spec so use
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 145
diff changeset
2866 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
2867 throw newSQLFeatureNotSupportedException("updateBlob");
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2868 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2869
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2870 @Override
151
3d5ea891bb74 Update implementation to match the JDBC spec so use
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 145
diff changeset
2871 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
2872 throw newSQLFeatureNotSupportedException("updateBlob");
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2873 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2874
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2875 @Override
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2876 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
2877 throw newSQLFeatureNotSupportedException("updateBoolean");
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2878 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2879
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2880 @Override
151
3d5ea891bb74 Update implementation to match the JDBC spec so use
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 145
diff changeset
2881 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
2882 throw newSQLFeatureNotSupportedException("updateBoolean");
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2883 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2884
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2885 @Override
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2886 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
2887 throw newSQLFeatureNotSupportedException("updateByte");
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2888 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2889
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2890 @Override
151
3d5ea891bb74 Update implementation to match the JDBC spec so use
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 145
diff changeset
2891 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
2892 throw newSQLFeatureNotSupportedException("updateByte");
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2893 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2894
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2895 @Override
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2896 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
2897 throw newSQLFeatureNotSupportedException("updateBytes");
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2898 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2899
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2900 @Override
151
3d5ea891bb74 Update implementation to match the JDBC spec so use
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 145
diff changeset
2901 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
2902 throw newSQLFeatureNotSupportedException("updateBytes");
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2903 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2904
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2905 @Override
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2906 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
2907 throw newSQLFeatureNotSupportedException("updateCharacterStream");
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2908 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2909
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2910 @Override
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2911 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
2912 throw newSQLFeatureNotSupportedException("updateCharacterStream");
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2913 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2914
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2915 @Override
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2916 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
2917 throw newSQLFeatureNotSupportedException("updateCharacterStream");
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2918 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2919
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2920 @Override
151
3d5ea891bb74 Update implementation to match the JDBC spec so use
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 145
diff changeset
2921 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
2922 throw newSQLFeatureNotSupportedException("updateCharacterStream");
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2923 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2924
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2925 @Override
151
3d5ea891bb74 Update implementation to match the JDBC spec so use
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 145
diff changeset
2926 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
2927 throw newSQLFeatureNotSupportedException("updateCharacterStream");
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2928 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2929
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2930 @Override
151
3d5ea891bb74 Update implementation to match the JDBC spec so use
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 145
diff changeset
2931 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
2932 throw newSQLFeatureNotSupportedException("updateCharacterStream");
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2933 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2934
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2935 @Override
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2936 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
2937 throw newSQLFeatureNotSupportedException("updateNCharacterStream");
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2938 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2939
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2940 @Override
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2941 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
2942 throw newSQLFeatureNotSupportedException("updateNCharacterStream");
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2943 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2944
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2945 @Override
151
3d5ea891bb74 Update implementation to match the JDBC spec so use
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 145
diff changeset
2946 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
2947 throw newSQLFeatureNotSupportedException("updateNCharacterStream");
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2948 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2949
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2950 @Override
151
3d5ea891bb74 Update implementation to match the JDBC spec so use
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 145
diff changeset
2951 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
2952 throw newSQLFeatureNotSupportedException("updateNCharacterStream");
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2953 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2954
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2955 @Override
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2956 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
2957 throw newSQLFeatureNotSupportedException("updateClob");
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2958 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2959
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2960 @Override
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2961 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
2962 throw newSQLFeatureNotSupportedException("updateClob");
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2963 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2964
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2965 @Override
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2966 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
2967 throw newSQLFeatureNotSupportedException("updateClob");
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2968 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2969
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2970 @Override
151
3d5ea891bb74 Update implementation to match the JDBC spec so use
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 145
diff changeset
2971 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
2972 throw newSQLFeatureNotSupportedException("updateClob");
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2973 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2974
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2975 @Override
151
3d5ea891bb74 Update implementation to match the JDBC spec so use
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 145
diff changeset
2976 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
2977 throw newSQLFeatureNotSupportedException("updateClob");
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2978 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2979
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2980 @Override
151
3d5ea891bb74 Update implementation to match the JDBC spec so use
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 145
diff changeset
2981 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
2982 throw newSQLFeatureNotSupportedException("updateClob");
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2983 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2984
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2985 @Override
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2986 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
2987 throw newSQLFeatureNotSupportedException("updateNClob");
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2988 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2989
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2990 @Override
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2991 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
2992 throw newSQLFeatureNotSupportedException("updateNClob");
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2993 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2994
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2995 @Override
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2996 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
2997 throw newSQLFeatureNotSupportedException("updateNClob");
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2998 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
2999
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
3000 @Override
151
3d5ea891bb74 Update implementation to match the JDBC spec so use
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 145
diff changeset
3001 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
3002 throw newSQLFeatureNotSupportedException("updateNClob");
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
3003 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
3004
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
3005 @Override
151
3d5ea891bb74 Update implementation to match the JDBC spec so use
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 145
diff changeset
3006 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
3007 throw newSQLFeatureNotSupportedException("updateNClob");
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
3008 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
3009
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
3010 @Override
151
3d5ea891bb74 Update implementation to match the JDBC spec so use
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 145
diff changeset
3011 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
3012 throw newSQLFeatureNotSupportedException("updateNClob");
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
3013 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
3014
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
3015 @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
3016 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
3017 throw newSQLFeatureNotSupportedException("updateDate");
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
3018 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
3019
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
3020 @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
3021 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
3022 throw newSQLFeatureNotSupportedException("updateDate");
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
3023 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
3024
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
3025 @Override
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
3026 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
3027 throw newSQLFeatureNotSupportedException("updateDouble");
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
3028 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
3029
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
3030 @Override
151
3d5ea891bb74 Update implementation to match the JDBC spec so use
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 145
diff changeset
3031 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
3032 throw newSQLFeatureNotSupportedException("updateDouble");
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
3033 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
3034
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
3035 @Override
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
3036 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
3037 throw newSQLFeatureNotSupportedException("updateFloat");
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
3038 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
3039
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
3040 @Override
151
3d5ea891bb74 Update implementation to match the JDBC spec so use
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 145
diff changeset
3041 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
3042 throw newSQLFeatureNotSupportedException("updateFloat");
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
3043 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
3044
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
3045 @Override
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
3046 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
3047 throw newSQLFeatureNotSupportedException("updateInt");
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
3048 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
3049
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
3050 @Override
151
3d5ea891bb74 Update implementation to match the JDBC spec so use
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 145
diff changeset
3051 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
3052 throw newSQLFeatureNotSupportedException("updateInt");
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
3053 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
3054
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
3055 @Override
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
3056 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
3057 throw newSQLFeatureNotSupportedException("updateLong");
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
3058 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
3059
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
3060 @Override
151
3d5ea891bb74 Update implementation to match the JDBC spec so use
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 145
diff changeset
3061 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
3062 throw newSQLFeatureNotSupportedException("updateLong");
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
3063 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
3064
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
3065 @Override
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
3066 public void updateNull(int columnIndex) throws SQLException {
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
3067 throw newSQLFeatureNotSupportedException("updateNull");
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
3068 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
3069
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
3070 @Override
151
3d5ea891bb74 Update implementation to match the JDBC spec so use
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 145
diff changeset
3071 public void updateNull(String columnLabel) throws SQLException {
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
3072 throw newSQLFeatureNotSupportedException("updateNull");
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
3073 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
3074
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
3075 @Override
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
3076 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
3077 throw newSQLFeatureNotSupportedException("updateObject");
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
3078 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
3079
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
3080 @Override
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
3081 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
3082 throw newSQLFeatureNotSupportedException("updateObject");
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
3083 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
3084
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
3085 @Override
151
3d5ea891bb74 Update implementation to match the JDBC spec so use
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 145
diff changeset
3086 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
3087 throw newSQLFeatureNotSupportedException("updateObject");
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
3088 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
3089
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
3090 @Override
151
3d5ea891bb74 Update implementation to match the JDBC spec so use
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 145
diff changeset
3091 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
3092 throw newSQLFeatureNotSupportedException("updateObject");
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
3093 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
3094
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
3095 @Override
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
3096 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
3097 throw newSQLFeatureNotSupportedException("updateRef");
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
3098 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
3099
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
3100 @Override
151
3d5ea891bb74 Update implementation to match the JDBC spec so use
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 145
diff changeset
3101 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
3102 throw newSQLFeatureNotSupportedException("updateRef");
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
3103 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
3104
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
3105 @Override
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
3106 public void updateRow() throws SQLException {
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
3107 throw newSQLFeatureNotSupportedException("updateRow");
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
3108 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
3109
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
3110 @Override
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
3111 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
3112 throw newSQLFeatureNotSupportedException("updateRowId");
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
3113 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
3114
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
3115 @Override
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
3116 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
3117 throw newSQLFeatureNotSupportedException("updateRowId");
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
3118 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
3119
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
3120 @Override
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
3121 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
3122 throw newSQLFeatureNotSupportedException("updateShort");
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
3123 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
3124
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
3125 @Override
151
3d5ea891bb74 Update implementation to match the JDBC spec so use
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 145
diff changeset
3126 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
3127 throw newSQLFeatureNotSupportedException("updateShort");
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
3128 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
3129
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
3130 @Override
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
3131 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
3132 throw newSQLFeatureNotSupportedException("updateString");
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
3133 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
3134
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
3135 @Override
151
3d5ea891bb74 Update implementation to match the JDBC spec so use
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 145
diff changeset
3136 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
3137 throw newSQLFeatureNotSupportedException("updateString");
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
3138 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
3139
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
3140 @Override
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
3141 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
3142 throw newSQLFeatureNotSupportedException("updateNString");
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
3143 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
3144
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
3145 @Override
151
3d5ea891bb74 Update implementation to match the JDBC spec so use
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 145
diff changeset
3146 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
3147 throw newSQLFeatureNotSupportedException("updateNString");
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
3148 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
3149
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
3150 @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
3151 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
3152 throw newSQLFeatureNotSupportedException("updateSQLXML");
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
3153 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
3154
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
3155 @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
3156 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
3157 throw newSQLFeatureNotSupportedException("updateSQLXML");
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
3158 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
3159
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
3160 @Override
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
3161 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
3162 throw newSQLFeatureNotSupportedException("updateTime");
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
3163 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
3164
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
3165 @Override
151
3d5ea891bb74 Update implementation to match the JDBC spec so use
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 145
diff changeset
3166 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
3167 throw newSQLFeatureNotSupportedException("updateTime");
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
3168 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
3169
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
3170 @Override
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
3171 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
3172 throw newSQLFeatureNotSupportedException("updateTimestamp");
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
3173 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
3174
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
3175 @Override
151
3d5ea891bb74 Update implementation to match the JDBC spec so use
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 145
diff changeset
3176 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
3177 throw newSQLFeatureNotSupportedException("updateTimestamp");
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
3178 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
3179
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
3180 // 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
3181 /**
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
3182 * 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
3183 * 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
3184 * 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
3185 * SQL NULL.
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
3186 *
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
3187 * @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
3188 */
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
3189 @Override
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
3190 public boolean wasNull() {
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
3191 return lastReadWasNull;
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
3192 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
3193
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
3194 //== 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
3195
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
3196 /**
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
3197 * 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
3198 * 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
3199 * 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
3200 * 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
3201 * 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
3202 *
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
3203 * 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
3204 * 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
3205 * 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
3206 * 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
3207 *
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
3208 * @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
3209 * @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
3210 * 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
3211 * @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
3212 * @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
3213 * 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
3214 * 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
3215 * 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
3216 */
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 @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
3218 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
3219 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
3220 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
3221 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
3222
774
e029af7551b7 Implemented ResultSet methods:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 773
diff changeset
3223 final String val;
e029af7551b7 Implemented ResultSet methods:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 773
diff changeset
3224 try {
e029af7551b7 Implemented ResultSet methods:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 773
diff changeset
3225 val = tlp.values[columnIndex - 1];
e029af7551b7 Implemented ResultSet methods:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 773
diff changeset
3226 if (val == null) {
e029af7551b7 Implemented ResultSet methods:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 773
diff changeset
3227 lastReadWasNull = true;
e029af7551b7 Implemented ResultSet methods:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 773
diff changeset
3228 return null;
e029af7551b7 Implemented ResultSet methods:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 773
diff changeset
3229 }
e029af7551b7 Implemented ResultSet methods:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 773
diff changeset
3230 lastReadWasNull = false;
e029af7551b7 Implemented ResultSet methods:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 773
diff changeset
3231 } catch (IndexOutOfBoundsException e) {
e029af7551b7 Implemented ResultSet methods:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 773
diff changeset
3232 throw newSQLInvalidColumnIndexException(columnIndex);
e029af7551b7 Implemented ResultSet methods:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 773
diff changeset
3233 }
e029af7551b7 Implemented ResultSet methods:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 773
diff changeset
3234
e029af7551b7 Implemented ResultSet methods:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 773
diff changeset
3235 if (type == String.class) {
e029af7551b7 Implemented ResultSet methods:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 773
diff changeset
3236 return type.cast(val);
e029af7551b7 Implemented ResultSet methods:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 773
diff changeset
3237 }
e029af7551b7 Implemented ResultSet methods:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 773
diff changeset
3238 if (type == Integer.class) {
e029af7551b7 Implemented ResultSet methods:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 773
diff changeset
3239 return type.cast(Integer.valueOf(getInt(columnIndex)));
e029af7551b7 Implemented ResultSet methods:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 773
diff changeset
3240 }
e029af7551b7 Implemented ResultSet methods:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 773
diff changeset
3241 if (type == Long.class) {
e029af7551b7 Implemented ResultSet methods:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 773
diff changeset
3242 return type.cast(Long.valueOf(getLong(columnIndex)));
e029af7551b7 Implemented ResultSet methods:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 773
diff changeset
3243 }
e029af7551b7 Implemented ResultSet methods:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 773
diff changeset
3244 if (type == Short.class) {
e029af7551b7 Implemented ResultSet methods:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 773
diff changeset
3245 return type.cast(Short.valueOf(getShort(columnIndex)));
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 if (type == Double.class) {
e029af7551b7 Implemented ResultSet methods:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 773
diff changeset
3248 return type.cast(Double.valueOf(getDouble(columnIndex)));
e029af7551b7 Implemented ResultSet methods:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 773
diff changeset
3249 }
e029af7551b7 Implemented ResultSet methods:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 773
diff changeset
3250 if (type == Float.class) {
e029af7551b7 Implemented ResultSet methods:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 773
diff changeset
3251 return type.cast(Float.valueOf(getFloat(columnIndex)));
e029af7551b7 Implemented ResultSet methods:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 773
diff changeset
3252 }
e029af7551b7 Implemented ResultSet methods:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 773
diff changeset
3253 if (type == BigDecimal.class) {
e029af7551b7 Implemented ResultSet methods:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 773
diff changeset
3254 return type.cast(getBigDecimal(columnIndex));
e029af7551b7 Implemented ResultSet methods:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 773
diff changeset
3255 }
e029af7551b7 Implemented ResultSet methods:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 773
diff changeset
3256 if (type == Boolean.class) {
e029af7551b7 Implemented ResultSet methods:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 773
diff changeset
3257 return type.cast(Boolean.valueOf(getBoolean(columnIndex)));
e029af7551b7 Implemented ResultSet methods:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 773
diff changeset
3258 }
e029af7551b7 Implemented ResultSet methods:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 773
diff changeset
3259 if (type == byte[].class) {
e029af7551b7 Implemented ResultSet methods:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 773
diff changeset
3260 return type.cast(getBytes(columnIndex));
e029af7551b7 Implemented ResultSet methods:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 773
diff changeset
3261 }
e029af7551b7 Implemented ResultSet methods:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 773
diff changeset
3262 if (type == Blob.class || type == MonetBlob.class) {
e029af7551b7 Implemented ResultSet methods:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 773
diff changeset
3263 return type.cast(getBlob(columnIndex));
e029af7551b7 Implemented ResultSet methods:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 773
diff changeset
3264 }
e029af7551b7 Implemented ResultSet methods:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 773
diff changeset
3265 if (type == Clob.class || type == MonetClob.class) {
e029af7551b7 Implemented ResultSet methods:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 773
diff changeset
3266 return type.cast(getClob(columnIndex));
e029af7551b7 Implemented ResultSet methods:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 773
diff changeset
3267 }
e029af7551b7 Implemented ResultSet methods:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 773
diff changeset
3268 if (type == URL.class) {
e029af7551b7 Implemented ResultSet methods:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 773
diff changeset
3269 return type.cast(getURL(columnIndex));
e029af7551b7 Implemented ResultSet methods:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 773
diff changeset
3270 }
e029af7551b7 Implemented ResultSet methods:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 773
diff changeset
3271 if (type == Date.class) {
e029af7551b7 Implemented ResultSet methods:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 773
diff changeset
3272 return type.cast(getDate(columnIndex, null));
e029af7551b7 Implemented ResultSet methods:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 773
diff changeset
3273 }
e029af7551b7 Implemented ResultSet methods:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 773
diff changeset
3274 if (type == Time.class) {
e029af7551b7 Implemented ResultSet methods:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 773
diff changeset
3275 return type.cast(getTime(columnIndex, null));
e029af7551b7 Implemented ResultSet methods:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 773
diff changeset
3276 }
e029af7551b7 Implemented ResultSet methods:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 773
diff changeset
3277 if (type == Timestamp.class) {
e029af7551b7 Implemented ResultSet methods:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 773
diff changeset
3278 return type.cast(getTimestamp(columnIndex, null));
e029af7551b7 Implemented ResultSet methods:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 773
diff changeset
3279 }
820
4c35009cd59c In ResultSet.getObject() method added support for retrieving
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 774
diff changeset
3280 if (type == OffsetTime.class) {
4c35009cd59c In ResultSet.getObject() method added support for retrieving
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 774
diff changeset
3281 return type.cast(getOffsetTime(columnIndex));
4c35009cd59c In ResultSet.getObject() method added support for retrieving
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 774
diff changeset
3282 }
4c35009cd59c In ResultSet.getObject() method added support for retrieving
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 774
diff changeset
3283 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
3284 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
3285 }
774
e029af7551b7 Implemented ResultSet methods:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 773
diff changeset
3286 if (type == java.util.Date.class) {
e029af7551b7 Implemented ResultSet methods:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 773
diff changeset
3287 final Timestamp timestamp = getTimestamp(columnIndex, null);
e029af7551b7 Implemented ResultSet methods:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 773
diff changeset
3288 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
3289 }
e029af7551b7 Implemented ResultSet methods:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 773
diff changeset
3290 if (type == Calendar.class) {
e029af7551b7 Implemented ResultSet methods:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 773
diff changeset
3291 final Calendar cal = Calendar.getInstance();
e029af7551b7 Implemented ResultSet methods:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 773
diff changeset
3292 getJavaDate(cal, columnIndex, Types.TIMESTAMP);
e029af7551b7 Implemented ResultSet methods:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 773
diff changeset
3293 return type.cast(cal);
e029af7551b7 Implemented ResultSet methods:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 773
diff changeset
3294 }
e029af7551b7 Implemented ResultSet methods:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 773
diff changeset
3295 if (type == java.util.UUID.class) {
e029af7551b7 Implemented ResultSet methods:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 773
diff changeset
3296 try {
e029af7551b7 Implemented ResultSet methods:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 773
diff changeset
3297 return type.cast(java.util.UUID.fromString(val));
e029af7551b7 Implemented ResultSet methods:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 773
diff changeset
3298 } catch (IllegalArgumentException exc) {
e029af7551b7 Implemented ResultSet methods:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 773
diff changeset
3299 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
3300 }
e029af7551b7 Implemented ResultSet methods:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 773
diff changeset
3301 }
e029af7551b7 Implemented ResultSet methods:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 773
diff changeset
3302 if (type == java.net.InetAddress.class) {
e029af7551b7 Implemented ResultSet methods:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 773
diff changeset
3303 final int slash = val.indexOf('/');
e029af7551b7 Implemented ResultSet methods:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 773
diff changeset
3304 try {
e029af7551b7 Implemented ResultSet methods:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 773
diff changeset
3305 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
3306 } catch (java.net.UnknownHostException exc) {
e029af7551b7 Implemented ResultSet methods:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 773
diff changeset
3307 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
3308 }
e029af7551b7 Implemented ResultSet methods:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 773
diff changeset
3309 }
e029af7551b7 Implemented ResultSet methods:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 773
diff changeset
3310
e029af7551b7 Implemented ResultSet methods:
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 773
diff changeset
3311 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
3312 }
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
3313
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
3314 /**
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
3315 * 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
3316 * 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
3317 * 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
3318 * 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
3319 * 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
3320 *
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
3321 * @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
3322 * 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
3323 * 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
3324 * @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
3325 * 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
3326 * @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
3327 * @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
3328 * 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
3329 * 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
3330 * 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
3331 */
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
3332 @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
3333 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
3334 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
3335 }
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
3336
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
3337 //== 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
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 @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
3340 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
3341 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
3342 }
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
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 @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
3345 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
3346 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
3347 }
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
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 @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
3350 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
3351 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
3352 }
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
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 @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
3355 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
3356 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
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
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
3359 //== end methods of interface ResultSet
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
3360
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
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 //== 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
3363
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
3364 /**
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
3365 * 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
3366 * 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
3367 * 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
3368 * warning.
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
3369 *
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
3370 * @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
3371 * @param sqlstate the SQLState code (5 characters)
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
3372 */
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
3373 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
3374 SQLWarning warng = new SQLWarning(reason, sqlstate);
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
3375 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
3376 warnings = warng;
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
3377 } 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
3378 warnings.setNextWarning(warng);
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
3379 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
3380 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
3381
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
3382 /**
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
3383 * 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
3384 * 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
3385 *
bdeabbd46ec6 Resolve javac and javadoc warnings when compiled with JDK19.
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 694
diff changeset
3386 * @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
3387 */
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
3388 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
3389 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
3390 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
3391 }
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
3392
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
3393 /**
820
4c35009cd59c In ResultSet.getObject() method added support for retrieving
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 774
diff changeset
3394 * 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
3395 * of this ResultSet object and will convert to OffsetTime.
4c35009cd59c In ResultSet.getObject() method added support for retrieving
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 774
diff changeset
3396 * 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
3397 *
4c35009cd59c In ResultSet.getObject() method added support for retrieving
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 774
diff changeset
3398 * @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
3399 * @return OffsetTime object or null
4c35009cd59c In ResultSet.getObject() method added support for retrieving
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 774
diff changeset
3400 * @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
3401 */
4c35009cd59c In ResultSet.getObject() method added support for retrieving
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 774
diff changeset
3402 private OffsetTime getOffsetTime(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
3403 final String val;
4c35009cd59c In ResultSet.getObject() method added support for retrieving
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 774
diff changeset
3404 try {
4c35009cd59c In ResultSet.getObject() method added support for retrieving
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 774
diff changeset
3405 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
3406 if (val == null) {
4c35009cd59c In ResultSet.getObject() method added support for retrieving
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 774
diff changeset
3407 lastReadWasNull = true;
4c35009cd59c In ResultSet.getObject() method added support for retrieving
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 774
diff changeset
3408 return null;
4c35009cd59c In ResultSet.getObject() method added support for retrieving
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 774
diff changeset
3409 }
4c35009cd59c In ResultSet.getObject() method added support for retrieving
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 774
diff changeset
3410 lastReadWasNull = false;
4c35009cd59c In ResultSet.getObject() method added support for retrieving
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 774
diff changeset
3411 return OffsetTime.parse(val, java.time.format.DateTimeFormatter.ISO_TIME);
4c35009cd59c In ResultSet.getObject() method added support for retrieving
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 774
diff changeset
3412 } catch (IndexOutOfBoundsException e) {
4c35009cd59c In ResultSet.getObject() method added support for retrieving
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 774
diff changeset
3413 throw newSQLInvalidColumnIndexException(columnIndex);
4c35009cd59c In ResultSet.getObject() method added support for retrieving
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 774
diff changeset
3414 } 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
3415 throw new SQLException("Failed to convert to OffsetTime: " + e.getMessage(), "22M36");
4c35009cd59c In ResultSet.getObject() method added support for retrieving
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 774
diff changeset
3416 }
4c35009cd59c In ResultSet.getObject() method added support for retrieving
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 774
diff changeset
3417 }
4c35009cd59c In ResultSet.getObject() method added support for retrieving
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 774
diff changeset
3418
4c35009cd59c In ResultSet.getObject() method added support for retrieving
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 774
diff changeset
3419 /**
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
4c35009cd59c In ResultSet.getObject() method added support for retrieving
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 774
diff changeset
3421 * 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
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, ...
4c35009cd59c In ResultSet.getObject() method added support for retrieving
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 774
diff changeset
3425 * @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
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 */
4c35009cd59c In ResultSet.getObject() method added support for retrieving
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 774
diff changeset
3428 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
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;
4c35009cd59c In ResultSet.getObject() method added support for retrieving
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 774
diff changeset
3437
4c35009cd59c In ResultSet.getObject() method added support for retrieving
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 774
diff changeset
3438 // 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
3439 // 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
3440 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
3441 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
3442 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
3443 val_new = val.substring(0, space) + "T" + val.substring(space + 1);
4c35009cd59c In ResultSet.getObject() method added support for retrieving
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 774
diff changeset
3444 }
4c35009cd59c In ResultSet.getObject() method added support for retrieving
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 774
diff changeset
3445 // System.out.println("getOffsetDateTime() changed " + val + " into " + val_new);
4c35009cd59c In ResultSet.getObject() method added support for retrieving
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 774
diff changeset
3446 return OffsetDateTime.parse(val_new, java.time.format.DateTimeFormatter.ISO_OFFSET_DATE_TIME);
4c35009cd59c In ResultSet.getObject() method added support for retrieving
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 774
diff changeset
3447 } catch (IndexOutOfBoundsException e) {
4c35009cd59c In ResultSet.getObject() method added support for retrieving
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 774
diff changeset
3448 throw newSQLInvalidColumnIndexException(columnIndex);
4c35009cd59c In ResultSet.getObject() method added support for retrieving
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 774
diff changeset
3449 } 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
3450 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
3451 }
4c35009cd59c In ResultSet.getObject() method added support for retrieving
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 774
diff changeset
3452 }
4c35009cd59c In ResultSet.getObject() method added support for retrieving
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 774
diff changeset
3453
4c35009cd59c In ResultSet.getObject() method added support for retrieving
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 774
diff changeset
3454 /**
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
3455 * 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
3456 * 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
3457 * to "22010": invalid indicator parameter value.
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
3458 *
12
a0e8adf10d41 Improved ResultSetMetaData methods isAutoIncrement(), getPrecision(), getScale(), isNullable().
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 11
diff changeset
3459 * @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
3460 * @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
3461 */
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
3462 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
3463 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
3464 }
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
3465
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
3466 /**
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
3467 * 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
3468 * 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
3469 * 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
3470 *
c37a76cc1e6e Corrected ResultSet methods: getByte(), getBigDecimal(), getShort(), getInt(), getLong(), getFloat() and getDouble()
Martin van Dinther <martin.van.dinther@monetdbsolutions.com>
parents: 8
diff changeset
3471 * @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
3472 * @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
3473 */
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
3474 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
3475 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
3476 }
0
a5a898f6886c Copy of MonetDB java directory changeset e6e32756ad31.
Sjoerd Mullender <sjoerd@acm.org>
parents:
diff changeset
3477 }