jdk/src/share/classes/javax/sql/rowset/serial/SQLInputImpl.java
author lancea
Thu, 26 Jan 2012 19:41:35 -0500
changeset 11683 5e02efd89af6
parent 11129 f9ad1aadf3fa
child 15277 245068ba31b3
permissions -rw-r--r--
7133815: address the findbug errors in CachedRowSetImpl, SerialStruct, BaseRow, SerialInputImpl, SerialOutputImpl Reviewed-by: forax
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     1
/*
11683
5e02efd89af6 7133815: address the findbug errors in CachedRowSetImpl, SerialStruct, BaseRow, SerialInputImpl, SerialOutputImpl
lancea
parents: 11129
diff changeset
     2
 * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
90ce3da70b43 Initial load
duke
parents:
diff changeset
     4
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
90ce3da70b43 Initial load
duke
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
     7
 * published by the Free Software Foundation.  Oracle designates this
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     8
 * particular file as subject to the "Classpath" exception as provided
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
     9
 * by Oracle in the LICENSE file that accompanied this code.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    10
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    11
 * This code is distributed in the hope that it will be useful, but WITHOUT
90ce3da70b43 Initial load
duke
parents:
diff changeset
    12
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
90ce3da70b43 Initial load
duke
parents:
diff changeset
    13
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
90ce3da70b43 Initial load
duke
parents:
diff changeset
    14
 * version 2 for more details (a copy is included in the LICENSE file that
90ce3da70b43 Initial load
duke
parents:
diff changeset
    15
 * accompanied this code).
90ce3da70b43 Initial load
duke
parents:
diff changeset
    16
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    17
 * You should have received a copy of the GNU General Public License version
90ce3da70b43 Initial load
duke
parents:
diff changeset
    18
 * 2 along with this work; if not, write to the Free Software Foundation,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    19
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    20
 *
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
    21
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
    22
 * or visit www.oracle.com if you need additional information or have any
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
    23
 * questions.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    24
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    25
package javax.sql.rowset.serial;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    26
90ce3da70b43 Initial load
duke
parents:
diff changeset
    27
import java.sql.*;
11683
5e02efd89af6 7133815: address the findbug errors in CachedRowSetImpl, SerialStruct, BaseRow, SerialInputImpl, SerialOutputImpl
lancea
parents: 11129
diff changeset
    28
import java.util.Arrays;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    29
import java.util.Map;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    30
90ce3da70b43 Initial load
duke
parents:
diff changeset
    31
/**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    32
 * An input stream used for custom mapping user-defined types (UDTs).
90ce3da70b43 Initial load
duke
parents:
diff changeset
    33
 * An <code>SQLInputImpl</code> object is an input stream that contains a
90ce3da70b43 Initial load
duke
parents:
diff changeset
    34
 * stream of values that are the attributes of a UDT.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    35
 * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    36
 * This class is used by the driver behind the scenes when the method
90ce3da70b43 Initial load
duke
parents:
diff changeset
    37
 * <code>getObject</code> is called on an SQL structured or distinct type
90ce3da70b43 Initial load
duke
parents:
diff changeset
    38
 * that has a custom mapping; a programmer never invokes
90ce3da70b43 Initial load
duke
parents:
diff changeset
    39
 * <code>SQLInputImpl</code> methods directly. They are provided here as a
90ce3da70b43 Initial load
duke
parents:
diff changeset
    40
 * convenience for those who write <code>RowSet</code> implementations.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    41
 * <P>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    42
 * The <code>SQLInputImpl</code> class provides a set of
90ce3da70b43 Initial load
duke
parents:
diff changeset
    43
 * reader methods analogous to the <code>ResultSet</code> getter
90ce3da70b43 Initial load
duke
parents:
diff changeset
    44
 * methods.  These methods make it possible to read the values in an
90ce3da70b43 Initial load
duke
parents:
diff changeset
    45
 * <code>SQLInputImpl</code> object.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    46
 * <P>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    47
 * The method <code>wasNull</code> is used to determine whether the
90ce3da70b43 Initial load
duke
parents:
diff changeset
    48
 * the last value read was SQL <code>NULL</code>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    49
 * <P>When the method <code>getObject</code> is called with an
90ce3da70b43 Initial load
duke
parents:
diff changeset
    50
 * object of a class implementing the interface <code>SQLData</code>,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    51
 * the JDBC driver calls the method <code>SQLData.getSQLType</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    52
 * to determine the SQL type of the UDT being custom mapped. The driver
90ce3da70b43 Initial load
duke
parents:
diff changeset
    53
 * creates an instance of <code>SQLInputImpl</code>, populating it with the
90ce3da70b43 Initial load
duke
parents:
diff changeset
    54
 * attributes of the UDT.  The driver then passes the input
90ce3da70b43 Initial load
duke
parents:
diff changeset
    55
 * stream to the method <code>SQLData.readSQL</code>, which in turn
90ce3da70b43 Initial load
duke
parents:
diff changeset
    56
 * calls the <code>SQLInputImpl</code> reader methods
90ce3da70b43 Initial load
duke
parents:
diff changeset
    57
 * to read the attributes from the input stream.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    58
 * @see java.sql.SQLData
90ce3da70b43 Initial load
duke
parents:
diff changeset
    59
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    60
public class SQLInputImpl implements SQLInput {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    61
90ce3da70b43 Initial load
duke
parents:
diff changeset
    62
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    63
     * <code>true</code> if the last value returned was <code>SQL NULL</code>;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    64
     * <code>false</code> otherwise.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    65
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    66
    private boolean lastValueWasNull;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    67
90ce3da70b43 Initial load
duke
parents:
diff changeset
    68
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    69
     * The current index into the array of SQL structured type attributes
90ce3da70b43 Initial load
duke
parents:
diff changeset
    70
     * that will be read from this <code>SQLInputImpl</code> object and
90ce3da70b43 Initial load
duke
parents:
diff changeset
    71
     * mapped to the fields of a class in the Java programming language.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    72
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    73
    private int idx;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    74
90ce3da70b43 Initial load
duke
parents:
diff changeset
    75
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    76
     * The array of attributes to be read from this stream.  The order
90ce3da70b43 Initial load
duke
parents:
diff changeset
    77
     * of the attributes is the same as the order in which they were
90ce3da70b43 Initial load
duke
parents:
diff changeset
    78
     * listed in the SQL definition of the UDT.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    79
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    80
    private Object attrib[];
90ce3da70b43 Initial load
duke
parents:
diff changeset
    81
90ce3da70b43 Initial load
duke
parents:
diff changeset
    82
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    83
     * The type map to use when the method <code>readObject</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    84
     * is invoked. This is a <code>java.util.Map</code> object in which
90ce3da70b43 Initial load
duke
parents:
diff changeset
    85
     * there may be zero or more entries.  Each entry consists of the
90ce3da70b43 Initial load
duke
parents:
diff changeset
    86
     * fully qualified name of a UDT (the value to be mapped) and the
90ce3da70b43 Initial load
duke
parents:
diff changeset
    87
     * <code>Class</code> object for a class that implements
90ce3da70b43 Initial load
duke
parents:
diff changeset
    88
     * <code>SQLData</code> (the Java class that defines how the UDT
90ce3da70b43 Initial load
duke
parents:
diff changeset
    89
     * will be mapped).
90ce3da70b43 Initial load
duke
parents:
diff changeset
    90
     */
11129
f9ad1aadf3fa 7116445: Miscellaneous warnings in the JDBC/RowSet classes
lancea
parents: 5506
diff changeset
    91
    private Map<String,Class<?>> map;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    92
90ce3da70b43 Initial load
duke
parents:
diff changeset
    93
90ce3da70b43 Initial load
duke
parents:
diff changeset
    94
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    95
     * Creates an <code>SQLInputImpl</code> object initialized with the
90ce3da70b43 Initial load
duke
parents:
diff changeset
    96
     * given array of attributes and the given type map. If any of the
90ce3da70b43 Initial load
duke
parents:
diff changeset
    97
     * attributes is a UDT whose name is in an entry in the type map,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    98
     * the attribute will be mapped according to the corresponding
90ce3da70b43 Initial load
duke
parents:
diff changeset
    99
     * <code>SQLData</code> implementation.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   100
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   101
     * @param attributes an array of <code>Object</code> instances in which
90ce3da70b43 Initial load
duke
parents:
diff changeset
   102
     *        each element is an attribute of a UDT. The order of the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   103
     *        attributes in the array is the same order in which
90ce3da70b43 Initial load
duke
parents:
diff changeset
   104
     *        the attributes were defined in the UDT definition.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   105
     * @param map a <code>java.util.Map</code> object containing zero or more
90ce3da70b43 Initial load
duke
parents:
diff changeset
   106
     *        entries, with each entry consisting of 1) a <code>String</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   107
     *        giving the fully
90ce3da70b43 Initial load
duke
parents:
diff changeset
   108
     *        qualified name of the UDT and 2) the <code>Class</code> object
90ce3da70b43 Initial load
duke
parents:
diff changeset
   109
     *        for the <code>SQLData</code> implementation that defines how
90ce3da70b43 Initial load
duke
parents:
diff changeset
   110
     *        the UDT is to be mapped
90ce3da70b43 Initial load
duke
parents:
diff changeset
   111
     * @throws SQLException if the <code>attributes</code> or the <code>map</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   112
     *        is a <code>null</code> value
90ce3da70b43 Initial load
duke
parents:
diff changeset
   113
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   114
90ce3da70b43 Initial load
duke
parents:
diff changeset
   115
    public SQLInputImpl(Object[] attributes, Map<String,Class<?>> map)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   116
        throws SQLException
90ce3da70b43 Initial load
duke
parents:
diff changeset
   117
    {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   118
        if ((attributes == null) || (map == null)) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   119
            throw new SQLException("Cannot instantiate a SQLInputImpl " +
90ce3da70b43 Initial load
duke
parents:
diff changeset
   120
            "object with null parameters");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   121
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   122
        // assign our local reference to the attribute stream
11683
5e02efd89af6 7133815: address the findbug errors in CachedRowSetImpl, SerialStruct, BaseRow, SerialInputImpl, SerialOutputImpl
lancea
parents: 11129
diff changeset
   123
        attrib = Arrays.copyOf(attributes, attributes.length);
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   124
        // init the index point before the head of the stream
90ce3da70b43 Initial load
duke
parents:
diff changeset
   125
        idx = -1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   126
        // set the map
90ce3da70b43 Initial load
duke
parents:
diff changeset
   127
        this.map = map;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   128
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   129
90ce3da70b43 Initial load
duke
parents:
diff changeset
   130
90ce3da70b43 Initial load
duke
parents:
diff changeset
   131
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   132
     * Retrieves the next attribute in this <code>SQLInputImpl</code> object
90ce3da70b43 Initial load
duke
parents:
diff changeset
   133
     * as an <code>Object</code> in the Java programming language.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   134
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   135
     * @return the next value in the input stream
90ce3da70b43 Initial load
duke
parents:
diff changeset
   136
     *         as an <code>Object</code> in the Java programming language
90ce3da70b43 Initial load
duke
parents:
diff changeset
   137
     * @throws SQLException if the read position is located at an invalid
90ce3da70b43 Initial load
duke
parents:
diff changeset
   138
     *         position or if there are no further values in the stream
90ce3da70b43 Initial load
duke
parents:
diff changeset
   139
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   140
    private Object getNextAttribute() throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   141
        if (++idx >= attrib.length) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   142
            throw new SQLException("SQLInputImpl exception: Invalid read " +
90ce3da70b43 Initial load
duke
parents:
diff changeset
   143
                                   "position");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   144
        } else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   145
            return attrib[idx];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   146
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   147
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   148
90ce3da70b43 Initial load
duke
parents:
diff changeset
   149
90ce3da70b43 Initial load
duke
parents:
diff changeset
   150
    //================================================================
90ce3da70b43 Initial load
duke
parents:
diff changeset
   151
    // Methods for reading attributes from the stream of SQL data.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   152
    // These methods correspond to the column-accessor methods of
90ce3da70b43 Initial load
duke
parents:
diff changeset
   153
    // java.sql.ResultSet.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   154
    //================================================================
90ce3da70b43 Initial load
duke
parents:
diff changeset
   155
90ce3da70b43 Initial load
duke
parents:
diff changeset
   156
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   157
     * Retrieves the next attribute in this <code>SQLInputImpl</code> object as
90ce3da70b43 Initial load
duke
parents:
diff changeset
   158
     * a <code>String</code> in the Java programming language.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   159
     * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   160
     * This method does not perform type-safe checking to determine if the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   161
     * returned type is the expected type; this responsibility is delegated
90ce3da70b43 Initial load
duke
parents:
diff changeset
   162
     * to the UDT mapping as defined by a <code>SQLData</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   163
     * implementation.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   164
     * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   165
     * @return the next attribute in this <code>SQLInputImpl</code> object;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   166
     *     if the value is <code>SQL NULL</code>, return <code>null</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   167
     * @throws SQLException if the read position is located at an invalid
90ce3da70b43 Initial load
duke
parents:
diff changeset
   168
     *     position or if there are no further values in the stream.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   169
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   170
    public String readString() throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   171
90ce3da70b43 Initial load
duke
parents:
diff changeset
   172
        String attrib = (String)getNextAttribute();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   173
90ce3da70b43 Initial load
duke
parents:
diff changeset
   174
        if (attrib == null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   175
            lastValueWasNull = true;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   176
            return null;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   177
        } else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   178
            lastValueWasNull = false;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   179
            return attrib;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   180
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   181
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   182
90ce3da70b43 Initial load
duke
parents:
diff changeset
   183
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   184
     * Retrieves the next attribute in this <code>SQLInputImpl</code> object as
90ce3da70b43 Initial load
duke
parents:
diff changeset
   185
     * a <code>boolean</code> in the Java programming language.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   186
     * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   187
     * This method does not perform type-safe checking to determine if the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   188
     * returned type is the expected type; this responsibility is delegated
90ce3da70b43 Initial load
duke
parents:
diff changeset
   189
     * to the UDT mapping as defined by a <code>SQLData</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   190
     * implementation.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   191
     * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   192
     * @return the next attribute in this <code>SQLInputImpl</code> object;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   193
     *     if the value is <code>SQL NULL</code>, return <code>null</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   194
     * @throws SQLException if the read position is located at an invalid
90ce3da70b43 Initial load
duke
parents:
diff changeset
   195
     *     position or if there are no further values in the stream.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   196
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   197
    public boolean readBoolean() throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   198
90ce3da70b43 Initial load
duke
parents:
diff changeset
   199
        Boolean attrib = (Boolean)getNextAttribute();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   200
90ce3da70b43 Initial load
duke
parents:
diff changeset
   201
        if (attrib == null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   202
            lastValueWasNull = true;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   203
            return false;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   204
        } else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   205
            lastValueWasNull = false;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   206
            return attrib.booleanValue();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   207
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   208
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   209
90ce3da70b43 Initial load
duke
parents:
diff changeset
   210
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   211
     * Retrieves the next attribute in this <code>SQLInputImpl</code> object as
90ce3da70b43 Initial load
duke
parents:
diff changeset
   212
     * a <code>byte</code> in the Java programming language.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   213
     * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   214
     * This method does not perform type-safe checking to determine if the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   215
     * returned type is the expected type; this responsibility is delegated
90ce3da70b43 Initial load
duke
parents:
diff changeset
   216
     * to the UDT mapping as defined by a <code>SQLData</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   217
     * implementation.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   218
     * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   219
     * @return the next attribute in this <code>SQLInputImpl</code> object;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   220
     *     if the value is <code>SQL NULL</code>, return <code>null</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   221
     * @throws SQLException if the read position is located at an invalid
90ce3da70b43 Initial load
duke
parents:
diff changeset
   222
     *     position or if there are no further values in the stream
90ce3da70b43 Initial load
duke
parents:
diff changeset
   223
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   224
    public byte readByte() throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   225
        Byte attrib = (Byte)getNextAttribute();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   226
90ce3da70b43 Initial load
duke
parents:
diff changeset
   227
        if (attrib == null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   228
            lastValueWasNull = true;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   229
            return (byte)0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   230
        } else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   231
            lastValueWasNull = false;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   232
            return attrib.byteValue();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   233
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   234
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   235
90ce3da70b43 Initial load
duke
parents:
diff changeset
   236
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   237
     * Retrieves the next attribute in this <code>SQLInputImpl</code> object
90ce3da70b43 Initial load
duke
parents:
diff changeset
   238
     * as a <code>short</code> in the Java programming language.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   239
     * <P>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   240
     * This method does not perform type-safe checking to determine if the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   241
     * returned type is the expected type; this responsibility is delegated
90ce3da70b43 Initial load
duke
parents:
diff changeset
   242
     * to the UDT mapping as defined by a <code>SQLData</code> implementation.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   243
     * <P>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   244
     * @return the next attribute in this <code>SQLInputImpl</code> object;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   245
     *       if the value is <code>SQL NULL</code>, return <code>null</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   246
     * @throws SQLException if the read position is located at an invalid
90ce3da70b43 Initial load
duke
parents:
diff changeset
   247
     *       position or if there are no more values in the stream
90ce3da70b43 Initial load
duke
parents:
diff changeset
   248
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   249
    public short readShort() throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   250
        Short attrib = (Short)getNextAttribute();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   251
90ce3da70b43 Initial load
duke
parents:
diff changeset
   252
        if (attrib == null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   253
            lastValueWasNull = true;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   254
            return (short)0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   255
        } else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   256
            lastValueWasNull = false;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   257
            return attrib.shortValue();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   258
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   259
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   260
90ce3da70b43 Initial load
duke
parents:
diff changeset
   261
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   262
     * Retrieves the next attribute in this <code>SQLInputImpl</code> object
90ce3da70b43 Initial load
duke
parents:
diff changeset
   263
     * as an <code>int</code> in the Java programming language.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   264
     * <P>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   265
     * This method does not perform type-safe checking to determine if the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   266
     * returned type is the expected type; this responsibility is delegated
90ce3da70b43 Initial load
duke
parents:
diff changeset
   267
     * to the UDT mapping as defined by a <code>SQLData</code> implementation.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   268
     * <P>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   269
     * @return the next attribute in this <code>SQLInputImpl</code> object;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   270
     *       if the value is <code>SQL NULL</code>, return <code>null</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   271
     * @throws SQLException if the read position is located at an invalid
90ce3da70b43 Initial load
duke
parents:
diff changeset
   272
     *       position or if there are no more values in the stream
90ce3da70b43 Initial load
duke
parents:
diff changeset
   273
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   274
    public int readInt() throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   275
        Integer attrib = (Integer)getNextAttribute();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   276
90ce3da70b43 Initial load
duke
parents:
diff changeset
   277
        if (attrib == null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   278
            lastValueWasNull = true;
11129
f9ad1aadf3fa 7116445: Miscellaneous warnings in the JDBC/RowSet classes
lancea
parents: 5506
diff changeset
   279
            return 0;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   280
        } else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   281
            lastValueWasNull = false;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   282
            return attrib.intValue();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   283
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   284
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   285
90ce3da70b43 Initial load
duke
parents:
diff changeset
   286
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   287
     * Retrieves the next attribute in this <code>SQLInputImpl</code> object
90ce3da70b43 Initial load
duke
parents:
diff changeset
   288
     * as a <code>long</code> in the Java programming language.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   289
     * <P>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   290
     * This method does not perform type-safe checking to determine if the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   291
     * returned type is the expected type; this responsibility is delegated
90ce3da70b43 Initial load
duke
parents:
diff changeset
   292
     * to the UDT mapping as defined by a <code>SQLData</code> implementation.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   293
     * <P>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   294
     * @return the next attribute in this <code>SQLInputImpl</code> object;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   295
     *       if the value is <code>SQL NULL</code>, return <code>null</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   296
     * @throws SQLException if the read position is located at an invalid
90ce3da70b43 Initial load
duke
parents:
diff changeset
   297
     *       position or if there are no more values in the stream
90ce3da70b43 Initial load
duke
parents:
diff changeset
   298
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   299
    public long readLong() throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   300
        Long attrib = (Long)getNextAttribute();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   301
90ce3da70b43 Initial load
duke
parents:
diff changeset
   302
        if (attrib == null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   303
            lastValueWasNull = true;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   304
            return (long)0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   305
        } else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   306
            lastValueWasNull = false;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   307
            return attrib.longValue();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   308
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   309
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   310
90ce3da70b43 Initial load
duke
parents:
diff changeset
   311
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   312
     * Retrieves the next attribute in this <code>SQLInputImpl</code> object
90ce3da70b43 Initial load
duke
parents:
diff changeset
   313
     * as a <code>float</code> in the Java programming language.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   314
     * <P>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   315
     * This method does not perform type-safe checking to determine if the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   316
     * returned type is the expected type; this responsibility is delegated
90ce3da70b43 Initial load
duke
parents:
diff changeset
   317
     * to the UDT mapping as defined by a <code>SQLData</code> implementation.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   318
     * <P>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   319
     * @return the next attribute in this <code>SQLInputImpl</code> object;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   320
     *       if the value is <code>SQL NULL</code>, return <code>null</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   321
     * @throws SQLException if the read position is located at an invalid
90ce3da70b43 Initial load
duke
parents:
diff changeset
   322
     *       position or if there are no more values in the stream
90ce3da70b43 Initial load
duke
parents:
diff changeset
   323
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   324
    public float readFloat() throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   325
        Float attrib = (Float)getNextAttribute();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   326
90ce3da70b43 Initial load
duke
parents:
diff changeset
   327
        if (attrib == null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   328
            lastValueWasNull = true;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   329
            return (float)0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   330
        } else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   331
            lastValueWasNull = false;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   332
            return attrib.floatValue();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   333
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   334
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   335
90ce3da70b43 Initial load
duke
parents:
diff changeset
   336
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   337
     * Retrieves the next attribute in this <code>SQLInputImpl</code> object
90ce3da70b43 Initial load
duke
parents:
diff changeset
   338
     * as a <code>double</code> in the Java programming language.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   339
     * <P>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   340
     * This method does not perform type-safe checking to determine if the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   341
     * returned type is the expected type; this responsibility is delegated
90ce3da70b43 Initial load
duke
parents:
diff changeset
   342
     * to the UDT mapping as defined by a <code>SQLData</code> implementation.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   343
     * <P>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   344
     * @return the next attribute in this <code>SQLInputImpl</code> object;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   345
     *       if the value is <code>SQL NULL</code>, return <code>null</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   346
     * @throws SQLException if the read position is located at an invalid
90ce3da70b43 Initial load
duke
parents:
diff changeset
   347
     *       position or if there are no more values in the stream
90ce3da70b43 Initial load
duke
parents:
diff changeset
   348
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   349
    public double readDouble() throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   350
        Double attrib = (Double)getNextAttribute();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   351
90ce3da70b43 Initial load
duke
parents:
diff changeset
   352
        if (attrib == null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   353
            lastValueWasNull = true;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   354
            return (double)0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   355
        } else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   356
            lastValueWasNull = false;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   357
            return attrib.doubleValue();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   358
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   359
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   360
90ce3da70b43 Initial load
duke
parents:
diff changeset
   361
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   362
     * Retrieves the next attribute in this <code>SQLInputImpl</code> object
90ce3da70b43 Initial load
duke
parents:
diff changeset
   363
     * as a <code>java.math.BigDecimal</code>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   364
     * <P>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   365
     * This method does not perform type-safe checking to determine if the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   366
     * returned type is the expected type; this responsibility is delegated
90ce3da70b43 Initial load
duke
parents:
diff changeset
   367
     * to the UDT mapping as defined by a <code>SQLData</code> implementation.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   368
     * <P>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   369
     * @return the next attribute in this <code>SQLInputImpl</code> object;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   370
     *       if the value is <code>SQL NULL</code>, return <code>null</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   371
     * @throws SQLException if the read position is located at an invalid
90ce3da70b43 Initial load
duke
parents:
diff changeset
   372
     *       position or if there are no more values in the stream
90ce3da70b43 Initial load
duke
parents:
diff changeset
   373
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   374
    public java.math.BigDecimal readBigDecimal() throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   375
        java.math.BigDecimal attrib = (java.math.BigDecimal)getNextAttribute();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   376
90ce3da70b43 Initial load
duke
parents:
diff changeset
   377
        if (attrib == null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   378
            lastValueWasNull = true;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   379
            return null;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   380
        } else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   381
            lastValueWasNull = false;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   382
            return attrib;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   383
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   384
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   385
90ce3da70b43 Initial load
duke
parents:
diff changeset
   386
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   387
     * Retrieves the next attribute in this <code>SQLInputImpl</code> object
90ce3da70b43 Initial load
duke
parents:
diff changeset
   388
     * as an array of bytes.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   389
     * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   390
     * This method does not perform type-safe checking to determine if the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   391
     * returned type is the expected type; this responsibility is delegated
90ce3da70b43 Initial load
duke
parents:
diff changeset
   392
     * to the UDT mapping as defined by a <code>SQLData</code> implementation.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   393
     * <P>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   394
     * @return the next attribute in this <code>SQLInputImpl</code> object;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   395
     *       if the value is <code>SQL NULL</code>, return <code>null</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   396
     * @throws SQLException if the read position is located at an invalid
90ce3da70b43 Initial load
duke
parents:
diff changeset
   397
     *       position or if there are no more values in the stream
90ce3da70b43 Initial load
duke
parents:
diff changeset
   398
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   399
    public byte[] readBytes() throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   400
        byte[] attrib = (byte[])getNextAttribute();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   401
90ce3da70b43 Initial load
duke
parents:
diff changeset
   402
        if (attrib == null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   403
            lastValueWasNull = true;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   404
            return null;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   405
        } else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   406
            lastValueWasNull = false;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   407
            return attrib;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   408
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   409
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   410
90ce3da70b43 Initial load
duke
parents:
diff changeset
   411
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   412
     * Retrieves the next attribute in this <code>SQLInputImpl</code> as
90ce3da70b43 Initial load
duke
parents:
diff changeset
   413
     * a <code>java.sql.Date</code> object.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   414
     * <P>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   415
     * This method does not perform type-safe checking to determine if the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   416
     * returned type is the expected type; this responsibility is delegated
90ce3da70b43 Initial load
duke
parents:
diff changeset
   417
     * to the UDT mapping as defined by a <code>SQLData</code> implementation.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   418
     * <P>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   419
     * @return the next attribute in this <code>SQLInputImpl</code> object;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   420
     *       if the value is <code>SQL NULL</code>, return <code>null</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   421
     * @throws SQLException if the read position is located at an invalid
90ce3da70b43 Initial load
duke
parents:
diff changeset
   422
     *       position or if there are no more values in the stream
90ce3da70b43 Initial load
duke
parents:
diff changeset
   423
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   424
    public java.sql.Date readDate() throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   425
        java.sql.Date attrib = (java.sql.Date)getNextAttribute();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   426
90ce3da70b43 Initial load
duke
parents:
diff changeset
   427
        if (attrib == null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   428
            lastValueWasNull = true;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   429
            return null;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   430
        } else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   431
            lastValueWasNull = false;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   432
            return attrib;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   433
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   434
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   435
90ce3da70b43 Initial load
duke
parents:
diff changeset
   436
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   437
     * Retrieves the next attribute in this <code>SQLInputImpl</code> object as
90ce3da70b43 Initial load
duke
parents:
diff changeset
   438
     * a <code>java.sql.Time</code> object.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   439
     * <P>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   440
     * This method does not perform type-safe checking to determine if the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   441
     * returned type is the expected type as this responsibility is delegated
90ce3da70b43 Initial load
duke
parents:
diff changeset
   442
     * to the UDT mapping as implemented by a <code>SQLData</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   443
     * implementation.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   444
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   445
     * @return the attribute; if the value is <code>SQL NULL</code>, return
90ce3da70b43 Initial load
duke
parents:
diff changeset
   446
     * <code>null</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   447
     * @throws SQLException if the read position is located at an invalid
90ce3da70b43 Initial load
duke
parents:
diff changeset
   448
     * position; or if there are no further values in the stream.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   449
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   450
    public java.sql.Time readTime() throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   451
        java.sql.Time attrib = (java.sql.Time)getNextAttribute();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   452
90ce3da70b43 Initial load
duke
parents:
diff changeset
   453
        if (attrib == null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   454
            lastValueWasNull = true;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   455
            return null;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   456
        } else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   457
            lastValueWasNull = false;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   458
            return attrib;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   459
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   460
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   461
90ce3da70b43 Initial load
duke
parents:
diff changeset
   462
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   463
     * Retrieves the next attribute in this <code>SQLInputImpl</code> object as
90ce3da70b43 Initial load
duke
parents:
diff changeset
   464
     * a <code>java.sql.Timestamp</code> object.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   465
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   466
     * @return the attribute; if the value is <code>SQL NULL</code>, return
90ce3da70b43 Initial load
duke
parents:
diff changeset
   467
     * <code>null</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   468
     * @throws SQLException if the read position is located at an invalid
90ce3da70b43 Initial load
duke
parents:
diff changeset
   469
     * position; or if there are no further values in the stream.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   470
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   471
    public java.sql.Timestamp readTimestamp() throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   472
        java.sql.Timestamp attrib = (java.sql.Timestamp)getNextAttribute();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   473
90ce3da70b43 Initial load
duke
parents:
diff changeset
   474
        if (attrib == null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   475
            lastValueWasNull = true;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   476
            return null;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   477
        } else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   478
            lastValueWasNull = false;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   479
            return attrib;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   480
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   481
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   482
90ce3da70b43 Initial load
duke
parents:
diff changeset
   483
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   484
     * Retrieves the next attribute in this <code>SQLInputImpl</code> object
90ce3da70b43 Initial load
duke
parents:
diff changeset
   485
     * as a stream of Unicode characters.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   486
     * <P>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   487
     * This method does not perform type-safe checking to determine if the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   488
     * returned type is the expected type as this responsibility is delegated
90ce3da70b43 Initial load
duke
parents:
diff changeset
   489
     * to the UDT mapping as implemented by a <code>SQLData</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   490
     * implementation.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   491
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   492
     * @return the attribute; if the value is <code>SQL NULL</code>, return <code>null</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   493
     * @throws SQLException if the read position is located at an invalid
90ce3da70b43 Initial load
duke
parents:
diff changeset
   494
     * position; or if there are no further values in the stream.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   495
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   496
    public java.io.Reader readCharacterStream() throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   497
        java.io.Reader attrib = (java.io.Reader)getNextAttribute();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   498
90ce3da70b43 Initial load
duke
parents:
diff changeset
   499
        if (attrib == null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   500
            lastValueWasNull = true;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   501
            return null;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   502
        } else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   503
            lastValueWasNull = false;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   504
            return attrib;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   505
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   506
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   507
90ce3da70b43 Initial load
duke
parents:
diff changeset
   508
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   509
     * Returns the next attribute in this <code>SQLInputImpl</code> object
90ce3da70b43 Initial load
duke
parents:
diff changeset
   510
     * as a stream of ASCII characters.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   511
     * <P>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   512
     * This method does not perform type-safe checking to determine if the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   513
     * returned type is the expected type as this responsibility is delegated
90ce3da70b43 Initial load
duke
parents:
diff changeset
   514
     * to the UDT mapping as implemented by a <code>SQLData</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   515
     * implementation.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   516
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   517
     * @return the attribute; if the value is <code>SQL NULL</code>,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   518
     * return <code>null</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   519
     * @throws SQLException if the read position is located at an invalid
90ce3da70b43 Initial load
duke
parents:
diff changeset
   520
     * position; or if there are no further values in the stream.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   521
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   522
    public java.io.InputStream readAsciiStream() throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   523
        java.io.InputStream attrib = (java.io.InputStream)getNextAttribute();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   524
90ce3da70b43 Initial load
duke
parents:
diff changeset
   525
        if (attrib == null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   526
            lastValueWasNull = true;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   527
            return null;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   528
        } else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   529
            lastValueWasNull = false;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   530
            return attrib;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   531
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   532
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   533
90ce3da70b43 Initial load
duke
parents:
diff changeset
   534
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   535
     * Returns the next attribute in this <code>SQLInputImpl</code> object
90ce3da70b43 Initial load
duke
parents:
diff changeset
   536
     * as a stream of uninterpreted bytes.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   537
     * <P>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   538
     * This method does not perform type-safe checking to determine if the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   539
     * returned type is the expected type as this responsibility is delegated
90ce3da70b43 Initial load
duke
parents:
diff changeset
   540
     * to the UDT mapping as implemented by a <code>SQLData</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   541
     * implementation.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   542
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   543
     * @return the attribute; if the value is <code>SQL NULL</code>, return
90ce3da70b43 Initial load
duke
parents:
diff changeset
   544
     * <code>null</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   545
     * @throws SQLException if the read position is located at an invalid
90ce3da70b43 Initial load
duke
parents:
diff changeset
   546
     * position; or if there are no further values in the stream.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   547
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   548
    public java.io.InputStream readBinaryStream() throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   549
        java.io.InputStream attrib = (java.io.InputStream)getNextAttribute();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   550
90ce3da70b43 Initial load
duke
parents:
diff changeset
   551
        if (attrib == null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   552
            lastValueWasNull = true;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   553
            return null;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   554
        } else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   555
            lastValueWasNull = false;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   556
            return attrib;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   557
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   558
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   559
90ce3da70b43 Initial load
duke
parents:
diff changeset
   560
    //================================================================
90ce3da70b43 Initial load
duke
parents:
diff changeset
   561
    // Methods for reading items of SQL user-defined types from the stream.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   562
    //================================================================
90ce3da70b43 Initial load
duke
parents:
diff changeset
   563
90ce3da70b43 Initial load
duke
parents:
diff changeset
   564
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   565
     * Retrieves the value at the head of this <code>SQLInputImpl</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   566
     * object as an <code>Object</code> in the Java programming language.  The
90ce3da70b43 Initial load
duke
parents:
diff changeset
   567
     * actual type of the object returned is determined by the default
90ce3da70b43 Initial load
duke
parents:
diff changeset
   568
     * mapping of SQL types to types in the Java programming language unless
90ce3da70b43 Initial load
duke
parents:
diff changeset
   569
     * there is a custom mapping, in which case the type of the object
90ce3da70b43 Initial load
duke
parents:
diff changeset
   570
     * returned is determined by this stream's type map.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   571
     * <P>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   572
     * The JDBC technology-enabled driver registers a type map with the stream
90ce3da70b43 Initial load
duke
parents:
diff changeset
   573
     * before passing the stream to the application.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   574
     * <P>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   575
     * When the datum at the head of the stream is an SQL <code>NULL</code>,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   576
     * this method returns <code>null</code>.  If the datum is an SQL
90ce3da70b43 Initial load
duke
parents:
diff changeset
   577
     * structured or distinct type with a custom mapping, this method
90ce3da70b43 Initial load
duke
parents:
diff changeset
   578
     * determines the SQL type of the datum at the head of the stream,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   579
     * constructs an object of the appropriate class, and calls the method
90ce3da70b43 Initial load
duke
parents:
diff changeset
   580
     * <code>SQLData.readSQL</code> on that object. The <code>readSQL</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   581
     * method then calls the appropriate <code>SQLInputImpl.readXXX</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   582
     * methods to retrieve the attribute values from the stream.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   583
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   584
     * @return the value at the head of the stream as an <code>Object</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   585
     *         in the Java programming language; <code>null</code> if
90ce3da70b43 Initial load
duke
parents:
diff changeset
   586
     *         the value is SQL <code>NULL</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   587
     * @throws SQLException if the read position is located at an invalid
90ce3da70b43 Initial load
duke
parents:
diff changeset
   588
     * position; or if there are no further values in the stream.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   589
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   590
    public Object readObject() throws SQLException {
11129
f9ad1aadf3fa 7116445: Miscellaneous warnings in the JDBC/RowSet classes
lancea
parents: 5506
diff changeset
   591
        Object attrib = getNextAttribute();
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   592
90ce3da70b43 Initial load
duke
parents:
diff changeset
   593
        if (attrib == null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   594
            lastValueWasNull = true;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   595
            return null;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   596
        } else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   597
            lastValueWasNull = false;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   598
            if (attrib instanceof Struct) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   599
                Struct s = (Struct)attrib;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   600
                // look up the class in the map
11129
f9ad1aadf3fa 7116445: Miscellaneous warnings in the JDBC/RowSet classes
lancea
parents: 5506
diff changeset
   601
                Class<?> c = map.get(s.getSQLTypeName());
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   602
                if (c != null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   603
                    // create new instance of the class
90ce3da70b43 Initial load
duke
parents:
diff changeset
   604
                    SQLData obj = null;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   605
                    try {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   606
                        obj = (SQLData)c.newInstance();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   607
                    } catch (java.lang.InstantiationException ex) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   608
                        throw new SQLException("Unable to instantiate: " +
90ce3da70b43 Initial load
duke
parents:
diff changeset
   609
                                               ex.getMessage());
90ce3da70b43 Initial load
duke
parents:
diff changeset
   610
                    } catch (java.lang.IllegalAccessException ex) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   611
                        throw new SQLException("Unable to instantiate: " +
90ce3da70b43 Initial load
duke
parents:
diff changeset
   612
                                               ex.getMessage());
90ce3da70b43 Initial load
duke
parents:
diff changeset
   613
                    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   614
                    // get the attributes from the struct
90ce3da70b43 Initial load
duke
parents:
diff changeset
   615
                    Object attribs[] = s.getAttributes(map);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   616
                    // create the SQLInput "stream"
90ce3da70b43 Initial load
duke
parents:
diff changeset
   617
                    SQLInputImpl sqlInput = new SQLInputImpl(attribs, map);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   618
                    // read the values...
90ce3da70b43 Initial load
duke
parents:
diff changeset
   619
                    obj.readSQL(sqlInput, s.getSQLTypeName());
11129
f9ad1aadf3fa 7116445: Miscellaneous warnings in the JDBC/RowSet classes
lancea
parents: 5506
diff changeset
   620
                    return obj;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   621
                }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   622
            }
11129
f9ad1aadf3fa 7116445: Miscellaneous warnings in the JDBC/RowSet classes
lancea
parents: 5506
diff changeset
   623
            return attrib;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   624
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   625
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   626
90ce3da70b43 Initial load
duke
parents:
diff changeset
   627
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   628
     * Retrieves the value at the head of this <code>SQLInputImpl</code> object
90ce3da70b43 Initial load
duke
parents:
diff changeset
   629
     * as a <code>Ref</code> object in the Java programming language.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   630
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   631
     * @return a <code>Ref</code> object representing the SQL
90ce3da70b43 Initial load
duke
parents:
diff changeset
   632
     *         <code>REF</code> value at the head of the stream; if the value
90ce3da70b43 Initial load
duke
parents:
diff changeset
   633
     *         is <code>SQL NULL</code> return <code>null</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   634
     * @throws SQLException if the read position is located at an invalid
90ce3da70b43 Initial load
duke
parents:
diff changeset
   635
     *         position; or if there are no further values in the stream.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   636
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   637
    public Ref readRef() throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   638
        Ref attrib = (Ref)getNextAttribute();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   639
90ce3da70b43 Initial load
duke
parents:
diff changeset
   640
        if (attrib == null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   641
            lastValueWasNull = true;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   642
            return null;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   643
        } else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   644
            lastValueWasNull = false;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   645
            return attrib;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   646
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   647
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   648
90ce3da70b43 Initial load
duke
parents:
diff changeset
   649
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   650
     * Retrieves the <code>BLOB</code> value at the head of this
90ce3da70b43 Initial load
duke
parents:
diff changeset
   651
     * <code>SQLInputImpl</code> object as a <code>Blob</code> object
90ce3da70b43 Initial load
duke
parents:
diff changeset
   652
     * in the Java programming language.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   653
     * <P>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   654
     * This method does not perform type-safe checking to determine if the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   655
     * returned type is the expected type as this responsibility is delegated
90ce3da70b43 Initial load
duke
parents:
diff changeset
   656
     * to the UDT mapping as implemented by a <code>SQLData</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   657
     * implementation.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   658
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   659
     * @return a <code>Blob</code> object representing the SQL
90ce3da70b43 Initial load
duke
parents:
diff changeset
   660
     *         <code>BLOB</code> value at the head of this stream;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   661
     *         if the value is <code>SQL NULL</code>, return
90ce3da70b43 Initial load
duke
parents:
diff changeset
   662
     *         <code>null</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   663
     * @throws SQLException if the read position is located at an invalid
90ce3da70b43 Initial load
duke
parents:
diff changeset
   664
     * position; or if there are no further values in the stream.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   665
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   666
    public Blob readBlob() throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   667
        Blob attrib = (Blob)getNextAttribute();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   668
90ce3da70b43 Initial load
duke
parents:
diff changeset
   669
        if (attrib == null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   670
            lastValueWasNull = true;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   671
            return null;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   672
        } else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   673
            lastValueWasNull = false;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   674
            return attrib;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   675
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   676
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   677
90ce3da70b43 Initial load
duke
parents:
diff changeset
   678
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   679
     * Retrieves the <code>CLOB</code> value at the head of this
90ce3da70b43 Initial load
duke
parents:
diff changeset
   680
     * <code>SQLInputImpl</code> object as a <code>Clob</code> object
90ce3da70b43 Initial load
duke
parents:
diff changeset
   681
     * in the Java programming language.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   682
     * <P>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   683
     * This method does not perform type-safe checking to determine if the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   684
     * returned type is the expected type as this responsibility is delegated
90ce3da70b43 Initial load
duke
parents:
diff changeset
   685
     * to the UDT mapping as implemented by a <code>SQLData</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   686
     * implementation.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   687
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   688
     * @return a <code>Clob</code> object representing the SQL
90ce3da70b43 Initial load
duke
parents:
diff changeset
   689
     *         <code>CLOB</code> value at the head of the stream;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   690
     *         if the value is <code>SQL NULL</code>, return
90ce3da70b43 Initial load
duke
parents:
diff changeset
   691
     *         <code>null</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   692
     * @throws SQLException if the read position is located at an invalid
90ce3da70b43 Initial load
duke
parents:
diff changeset
   693
     * position; or if there are no further values in the stream.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   694
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   695
    public Clob readClob() throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   696
90ce3da70b43 Initial load
duke
parents:
diff changeset
   697
        Clob attrib = (Clob)getNextAttribute();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   698
        if (attrib == null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   699
            lastValueWasNull = true;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   700
            return null;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   701
        } else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   702
            lastValueWasNull = false;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   703
            return attrib;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   704
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   705
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   706
90ce3da70b43 Initial load
duke
parents:
diff changeset
   707
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   708
     * Reads an SQL <code>ARRAY</code> value from the stream and
90ce3da70b43 Initial load
duke
parents:
diff changeset
   709
     * returns it as an <code>Array</code> object in the Java programming
90ce3da70b43 Initial load
duke
parents:
diff changeset
   710
     * language.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   711
     * <P>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   712
     * This method does not perform type-safe checking to determine if the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   713
     * returned type is the expected type as this responsibility is delegated
90ce3da70b43 Initial load
duke
parents:
diff changeset
   714
     * to the UDT mapping as implemented by a <code>SQLData</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   715
     * implementation.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   716
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   717
     * @return an <code>Array</code> object representing the SQL
90ce3da70b43 Initial load
duke
parents:
diff changeset
   718
     *         <code>ARRAY</code> value at the head of the stream; *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   719
     *         if the value is <code>SQL NULL</code>, return
90ce3da70b43 Initial load
duke
parents:
diff changeset
   720
     *         <code>null</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   721
     * @throws SQLException if the read position is located at an invalid
90ce3da70b43 Initial load
duke
parents:
diff changeset
   722
     * position; or if there are no further values in the stream.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   723
90ce3da70b43 Initial load
duke
parents:
diff changeset
   724
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   725
    public Array readArray() throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   726
        Array attrib = (Array)getNextAttribute();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   727
90ce3da70b43 Initial load
duke
parents:
diff changeset
   728
        if (attrib == null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   729
            lastValueWasNull = true;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   730
            return null;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   731
        } else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   732
            lastValueWasNull = false;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   733
            return attrib;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   734
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   735
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   736
90ce3da70b43 Initial load
duke
parents:
diff changeset
   737
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   738
     * Ascertains whether the last value read from this
90ce3da70b43 Initial load
duke
parents:
diff changeset
   739
     * <code>SQLInputImpl</code> object was <code>null</code>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   740
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   741
     * @return <code>true</code> if the SQL value read most recently was
90ce3da70b43 Initial load
duke
parents:
diff changeset
   742
     *         <code>null</code>; otherwise, <code>false</code>; by default it
90ce3da70b43 Initial load
duke
parents:
diff changeset
   743
     *         will return false
90ce3da70b43 Initial load
duke
parents:
diff changeset
   744
     * @throws SQLException if an error occurs determining the last value
90ce3da70b43 Initial load
duke
parents:
diff changeset
   745
     *         read was a <code>null</code> value or not;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   746
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   747
    public boolean wasNull() throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   748
        return lastValueWasNull;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   749
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   750
90ce3da70b43 Initial load
duke
parents:
diff changeset
   751
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   752
     * Reads an SQL <code>DATALINK</code> value from the stream and
90ce3da70b43 Initial load
duke
parents:
diff changeset
   753
     * returns it as an <code>URL</code> object in the Java programming
90ce3da70b43 Initial load
duke
parents:
diff changeset
   754
     * language.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   755
     * <P>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   756
     * This method does not perform type-safe checking to determine if the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   757
     * returned type is the expected type as this responsibility is delegated
90ce3da70b43 Initial load
duke
parents:
diff changeset
   758
     * to the UDT mapping as implemented by a <code>SQLData</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   759
     * implementation.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   760
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   761
     * @return an <code>URL</code> object representing the SQL
90ce3da70b43 Initial load
duke
parents:
diff changeset
   762
     *         <code>DATALINK</code> value at the head of the stream; *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   763
     *         if the value is <code>SQL NULL</code>, return
90ce3da70b43 Initial load
duke
parents:
diff changeset
   764
     *         <code>null</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   765
     * @throws SQLException if the read position is located at an invalid
90ce3da70b43 Initial load
duke
parents:
diff changeset
   766
     * position; or if there are no further values in the stream.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   767
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   768
    public java.net.URL readURL() throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   769
        throw new SQLException("Operation not supported");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   770
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   771
90ce3da70b43 Initial load
duke
parents:
diff changeset
   772
    //---------------------------- JDBC 4.0 -------------------------
90ce3da70b43 Initial load
duke
parents:
diff changeset
   773
90ce3da70b43 Initial load
duke
parents:
diff changeset
   774
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   775
     * Reads an SQL <code>NCLOB</code> value from the stream and returns it as a
90ce3da70b43 Initial load
duke
parents:
diff changeset
   776
     * <code>Clob</code> object in the Java programming language.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   777
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   778
     * @return a <code>NClob</code> object representing data of the SQL <code>NCLOB</code> value
90ce3da70b43 Initial load
duke
parents:
diff changeset
   779
     * at the head of the stream; <code>null</code> if the value read is
90ce3da70b43 Initial load
duke
parents:
diff changeset
   780
     * SQL <code>NULL</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   781
     * @exception SQLException if a database access error occurs
90ce3da70b43 Initial load
duke
parents:
diff changeset
   782
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   783
     public NClob readNClob() throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   784
        throw new UnsupportedOperationException("Operation not supported");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   785
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   786
90ce3da70b43 Initial load
duke
parents:
diff changeset
   787
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   788
     * Reads the next attribute in the stream and returns it as a <code>String</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   789
     * in the Java programming language. It is intended for use when
90ce3da70b43 Initial load
duke
parents:
diff changeset
   790
     * accessing  <code>NCHAR</code>,<code>NVARCHAR</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   791
     * and <code>LONGNVARCHAR</code> columns.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   792
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   793
     * @return the attribute; if the value is SQL <code>NULL</code>, returns <code>null</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   794
     * @exception SQLException if a database access error occurs
90ce3da70b43 Initial load
duke
parents:
diff changeset
   795
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   796
    public String readNString() throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   797
        throw new UnsupportedOperationException("Operation not supported");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   798
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   799
90ce3da70b43 Initial load
duke
parents:
diff changeset
   800
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   801
     * Reads an SQL <code>XML</code> value from the stream and returns it as a
90ce3da70b43 Initial load
duke
parents:
diff changeset
   802
     * <code>SQLXML</code> object in the Java programming language.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   803
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   804
     * @return a <code>SQLXML</code> object representing data of the SQL <code>XML</code> value
90ce3da70b43 Initial load
duke
parents:
diff changeset
   805
     * at the head of the stream; <code>null</code> if the value read is
90ce3da70b43 Initial load
duke
parents:
diff changeset
   806
     * SQL <code>NULL</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   807
     * @exception SQLException if a database access error occurs
90ce3da70b43 Initial load
duke
parents:
diff changeset
   808
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   809
    public SQLXML readSQLXML() throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   810
        throw new UnsupportedOperationException("Operation not supported");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   811
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   812
90ce3da70b43 Initial load
duke
parents:
diff changeset
   813
     /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   814
     * Reads an SQL <code>ROWID</code> value from the stream and returns it as a
90ce3da70b43 Initial load
duke
parents:
diff changeset
   815
     * <code>RowId</code> object in the Java programming language.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   816
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   817
     * @return a <code>RowId</code> object representing data of the SQL <code>ROWID</code> value
90ce3da70b43 Initial load
duke
parents:
diff changeset
   818
     * at the head of the stream; <code>null</code> if the value read is
90ce3da70b43 Initial load
duke
parents:
diff changeset
   819
     * SQL <code>NULL</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   820
     * @exception SQLException if a database access error occurs
90ce3da70b43 Initial load
duke
parents:
diff changeset
   821
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   822
    public RowId readRowId() throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   823
        throw new UnsupportedOperationException("Operation not supported");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   824
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   825
90ce3da70b43 Initial load
duke
parents:
diff changeset
   826
90ce3da70b43 Initial load
duke
parents:
diff changeset
   827
}