jdk/src/share/classes/javax/sql/rowset/serial/SerialArray.java
author ohair
Tue, 25 May 2010 15:58:33 -0700
changeset 5506 202f599c92aa
parent 2 90ce3da70b43
child 11129 f9ad1aadf3fa
permissions -rw-r--r--
6943119: Rebrand source copyright notices Reviewed-by: darcy, weijun
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     1
/*
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
     2
 * Copyright (c) 2003, 2006, 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
90ce3da70b43 Initial load
duke
parents:
diff changeset
    26
package javax.sql.rowset.serial;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    27
90ce3da70b43 Initial load
duke
parents:
diff changeset
    28
import java.sql.*;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    29
import java.io.*;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    30
import java.util.Map;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    31
import java.net.URL;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    32
90ce3da70b43 Initial load
duke
parents:
diff changeset
    33
90ce3da70b43 Initial load
duke
parents:
diff changeset
    34
/**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    35
 * A serialized version of an <code>Array</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    36
 * object, which is the mapping in the Java programming language of an SQL
90ce3da70b43 Initial load
duke
parents:
diff changeset
    37
 * <code>ARRAY</code> value.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    38
 * <P>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    39
 * The <code>SerialArray</code> class provides a constructor for creating
90ce3da70b43 Initial load
duke
parents:
diff changeset
    40
 * a <code>SerialArray</code> instance from an <code>Array</code> object,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    41
 * methods for getting the base type and the SQL name for the base type, and
90ce3da70b43 Initial load
duke
parents:
diff changeset
    42
 * methods for copying all or part of a <code>SerialArray</code> object.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    43
 * <P>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    44
 * Note: In order for this class to function correctly, a connection to the
90ce3da70b43 Initial load
duke
parents:
diff changeset
    45
 * data source
90ce3da70b43 Initial load
duke
parents:
diff changeset
    46
 * must be available in order for the SQL <code>Array</code> object to be
90ce3da70b43 Initial load
duke
parents:
diff changeset
    47
 * materialized (have all of its elements brought to the client server)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    48
 * if necessary. At this time, logical pointers to the data in the data source,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    49
 * such as locators, are not currently supported.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    50
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    51
public class SerialArray implements Array, Serializable, Cloneable {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    52
90ce3da70b43 Initial load
duke
parents:
diff changeset
    53
        /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    54
         * A serialized array in which each element is an <code>Object</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    55
         * in the Java programming language that represents an element
90ce3da70b43 Initial load
duke
parents:
diff changeset
    56
         * in the SQL <code>ARRAY</code> value.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    57
         * @serial
90ce3da70b43 Initial load
duke
parents:
diff changeset
    58
         */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    59
    private Object[] elements;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    60
90ce3da70b43 Initial load
duke
parents:
diff changeset
    61
        /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    62
         * The SQL type of the elements in this <code>SerialArray</code> object.  The
90ce3da70b43 Initial load
duke
parents:
diff changeset
    63
         * type is expressed as one of the constants from the class
90ce3da70b43 Initial load
duke
parents:
diff changeset
    64
         * <code>java.sql.Types</code>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    65
         * @serial
90ce3da70b43 Initial load
duke
parents:
diff changeset
    66
         */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    67
    private int baseType;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    68
90ce3da70b43 Initial load
duke
parents:
diff changeset
    69
        /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    70
         * The type name used by the DBMS for the elements in the SQL <code>ARRAY</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    71
         * value that this <code>SerialArray</code> object represents.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    72
         * @serial
90ce3da70b43 Initial load
duke
parents:
diff changeset
    73
         */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    74
    private String baseTypeName;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    75
90ce3da70b43 Initial load
duke
parents:
diff changeset
    76
        /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    77
         * The number of elements in this <code>SerialArray</code> object, which
90ce3da70b43 Initial load
duke
parents:
diff changeset
    78
         * is also the number of elements in the SQL <code>ARRAY</code> value
90ce3da70b43 Initial load
duke
parents:
diff changeset
    79
         * that this <code>SerialArray</code> object represents.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    80
         * @serial
90ce3da70b43 Initial load
duke
parents:
diff changeset
    81
         */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    82
    private int len;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    83
90ce3da70b43 Initial load
duke
parents:
diff changeset
    84
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    85
     * Constructs a new <code>SerialArray</code> object from the given
90ce3da70b43 Initial load
duke
parents:
diff changeset
    86
     * <code>Array</code> object, using the given type map for the custom
90ce3da70b43 Initial load
duke
parents:
diff changeset
    87
     * mapping of each element when the elements are SQL UDTs.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    88
     * <P>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    89
     * This method does custom mapping if the array elements are a UDT
90ce3da70b43 Initial load
duke
parents:
diff changeset
    90
     * and the given type map has an entry for that UDT.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    91
     * Custom mapping is recursive,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    92
     * meaning that if, for instance, an element of an SQL structured type
90ce3da70b43 Initial load
duke
parents:
diff changeset
    93
     * is an SQL structured type that itself has an element that is an SQL
90ce3da70b43 Initial load
duke
parents:
diff changeset
    94
     * structured type, each structured type that has a custom mapping will be
90ce3da70b43 Initial load
duke
parents:
diff changeset
    95
     * mapped according to the given type map.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    96
     * <P>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    97
     * The new <code>SerialArray</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    98
     * object contains the same elements as the <code>Array</code> object
90ce3da70b43 Initial load
duke
parents:
diff changeset
    99
     * from which it is built, except when the base type is the SQL type
90ce3da70b43 Initial load
duke
parents:
diff changeset
   100
     * <code>STRUCT</code>, <code>ARRAY</code>, <code>BLOB</code>,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   101
     * <code>CLOB</code>, <code>DATALINK</code> or <code>JAVA_OBJECT</code>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   102
     * In this case, each element in the new
90ce3da70b43 Initial load
duke
parents:
diff changeset
   103
     * <code>SerialArray</code> object is the appropriate serialized form,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   104
     * that is, a <code>SerialStruct</code>, <code>SerialArray</code>,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   105
     * <code>SerialBlob</code>, <code>SerialClob</code>,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   106
     * <code>SerialDatalink</code>, or <code>SerialJavaObject</code> object.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   107
     * <P>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   108
     * Note: (1) The <code>Array</code> object from which a <code>SerialArray</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   109
     * object is created must have materialized the SQL <code>ARRAY</code> value's
90ce3da70b43 Initial load
duke
parents:
diff changeset
   110
     * data on the client before it is passed to the constructor.  Otherwise,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   111
     * the new <code>SerialArray</code> object will contain no data.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   112
     * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   113
     * Note: (2) If the <code>Array</code> contains <code>java.sql.Types.JAVA_OBJECT</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   114
     * types, the <code>SerialJavaObject</code> constructor is called where checks
90ce3da70b43 Initial load
duke
parents:
diff changeset
   115
     * are made to ensure this object is serializable.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   116
     * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   117
     * Note: (3) The <code>Array</code> object supplied to this constructor cannot
90ce3da70b43 Initial load
duke
parents:
diff changeset
   118
     * return <code>null</code> for any <code>Array.getArray()</code> methods.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   119
     * <code>SerialArray</code> cannot serialize null array values.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   120
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   121
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   122
     * @param array the <code>Array</code> object to be serialized
90ce3da70b43 Initial load
duke
parents:
diff changeset
   123
     * @param map a <code>java.util.Map</code> object in which
90ce3da70b43 Initial load
duke
parents:
diff changeset
   124
     *        each entry consists of 1) a <code>String</code> object
90ce3da70b43 Initial load
duke
parents:
diff changeset
   125
     *        giving the fully qualified name of a UDT (an SQL structured type or
90ce3da70b43 Initial load
duke
parents:
diff changeset
   126
     *        distinct type) and 2) the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   127
     *        <code>Class</code> object for the <code>SQLData</code> implementation
90ce3da70b43 Initial load
duke
parents:
diff changeset
   128
     *        that defines how the UDT is to be mapped. The <i>map</i>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   129
     *        parameter does not have any effect for <code>Blob</code>,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   130
     *        <code>Clob</code>, <code>DATALINK</code>, or
90ce3da70b43 Initial load
duke
parents:
diff changeset
   131
     *        <code>JAVA_OBJECT</code> types.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   132
     * @throws SerialException if an error occurs serializing the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   133
     *        <code>Array</code> object
90ce3da70b43 Initial load
duke
parents:
diff changeset
   134
     * @throws SQLException if a database access error occurs or if the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   135
     *        <i>array</i> or the <i>map</i> values are <code>null</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   136
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   137
     public SerialArray(Array array, Map<String,Class<?>> map)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   138
         throws SerialException, SQLException
90ce3da70b43 Initial load
duke
parents:
diff changeset
   139
     {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   140
90ce3da70b43 Initial load
duke
parents:
diff changeset
   141
        if ((array == null) || (map == null)) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   142
            throw new SQLException("Cannot instantiate a SerialArray " +
90ce3da70b43 Initial load
duke
parents:
diff changeset
   143
            "object with null parameters");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   144
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   145
90ce3da70b43 Initial load
duke
parents:
diff changeset
   146
        if ((elements = (Object[])array.getArray()) == null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   147
             throw new SQLException("Invalid Array object. Calls to Array.getArray() " +
90ce3da70b43 Initial load
duke
parents:
diff changeset
   148
                 "return null value which cannot be serialized");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   149
         }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   150
90ce3da70b43 Initial load
duke
parents:
diff changeset
   151
        elements = (Object[])array.getArray(map);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   152
        baseType = array.getBaseType();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   153
        baseTypeName = array.getBaseTypeName();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   154
        len = elements.length;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   155
90ce3da70b43 Initial load
duke
parents:
diff changeset
   156
        switch (baseType) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   157
            case java.sql.Types.STRUCT:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   158
                for (int i = 0; i < len; i++) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   159
                    elements[i] = new SerialStruct((Struct)elements[i], map);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   160
                }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   161
            break;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   162
90ce3da70b43 Initial load
duke
parents:
diff changeset
   163
            case java.sql.Types.ARRAY:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   164
                for (int i = 0; i < len; i++) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   165
                    elements[i] = new SerialArray((Array)elements[i], map);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   166
                }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   167
            break;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   168
90ce3da70b43 Initial load
duke
parents:
diff changeset
   169
            case java.sql.Types.BLOB:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   170
            for (int i = 0; i < len; i++) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   171
                elements[i] = new SerialBlob((Blob)elements[i]);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   172
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   173
            break;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   174
90ce3da70b43 Initial load
duke
parents:
diff changeset
   175
            case java.sql.Types.CLOB:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   176
                for (int i = 0; i < len; i++) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   177
                    elements[i] = new SerialClob((Clob)elements[i]);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   178
                }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   179
            break;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   180
90ce3da70b43 Initial load
duke
parents:
diff changeset
   181
            case java.sql.Types.DATALINK:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   182
                for (int i = 0; i < len; i++) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   183
                    elements[i] = new SerialDatalink((URL)elements[i]);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   184
                }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   185
            break;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   186
90ce3da70b43 Initial load
duke
parents:
diff changeset
   187
            case java.sql.Types.JAVA_OBJECT:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   188
                for (int i = 0; i < len; i++) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   189
                elements[i] = new SerialJavaObject((Object)elements[i]);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   190
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   191
        default:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   192
            ;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   193
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   194
  }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   195
90ce3da70b43 Initial load
duke
parents:
diff changeset
   196
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   197
     * This method frees the <code>Array</code> object and releases the resources that
90ce3da70b43 Initial load
duke
parents:
diff changeset
   198
     * it holds. The object is invalid once the <code>free</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   199
     * method is called.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   200
     *<p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   201
     * After <code>free</code> has been called, any attempt to invoke a
90ce3da70b43 Initial load
duke
parents:
diff changeset
   202
     * method other than <code>free</code> will result in a <code>SQLException</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   203
     * being thrown.  If <code>free</code> is called multiple times, the subsequent
90ce3da70b43 Initial load
duke
parents:
diff changeset
   204
     * calls to <code>free</code> are treated as a no-op.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   205
     *<p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   206
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   207
     * @throws SQLException if an error occurs releasing
90ce3da70b43 Initial load
duke
parents:
diff changeset
   208
     * the Array's resources
90ce3da70b43 Initial load
duke
parents:
diff changeset
   209
     * @exception SQLFeatureNotSupportedException if the JDBC driver does not support
90ce3da70b43 Initial load
duke
parents:
diff changeset
   210
     * this method
90ce3da70b43 Initial load
duke
parents:
diff changeset
   211
     * @since 1.6
90ce3da70b43 Initial load
duke
parents:
diff changeset
   212
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   213
    public void free() throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   214
         throw new SQLFeatureNotSupportedException("Feature not supported");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   215
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   216
90ce3da70b43 Initial load
duke
parents:
diff changeset
   217
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   218
     * Constructs a new <code>SerialArray</code> object from the given
90ce3da70b43 Initial load
duke
parents:
diff changeset
   219
     * <code>Array</code> object.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   220
     * <P>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   221
     * This constructor does not do custom mapping.  If the base type of the array
90ce3da70b43 Initial load
duke
parents:
diff changeset
   222
     * is an SQL structured type and custom mapping is desired, the constructor
90ce3da70b43 Initial load
duke
parents:
diff changeset
   223
     * <code>SerialArray(Array array, Map map)</code> should be used.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   224
     * <P>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   225
     * The new <code>SerialArray</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   226
     * object contains the same elements as the <code>Array</code> object
90ce3da70b43 Initial load
duke
parents:
diff changeset
   227
     * from which it is built, except when the base type is the SQL type
90ce3da70b43 Initial load
duke
parents:
diff changeset
   228
     * <code>BLOB</code>,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   229
     * <code>CLOB</code>, <code>DATALINK</code> or <code>JAVA_OBJECT</code>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   230
     * In this case, each element in the new
90ce3da70b43 Initial load
duke
parents:
diff changeset
   231
     * <code>SerialArray</code> object is the appropriate serialized form,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   232
     * that is, a <code>SerialBlob</code>, <code>SerialClob</code>,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   233
     * <code>SerialDatalink</code>, or <code>SerialJavaObject</code> object.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   234
     * <P>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   235
     * Note: (1) The <code>Array</code> object from which a <code>SerialArray</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   236
     * object is created must have materialized the SQL <code>ARRAY</code> value's
90ce3da70b43 Initial load
duke
parents:
diff changeset
   237
     * data on the client before it is passed to the constructor.  Otherwise,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   238
     * the new <code>SerialArray</code> object will contain no data.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   239
     * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   240
     * Note: (2) The <code>Array</code> object supplied to this constructor cannot
90ce3da70b43 Initial load
duke
parents:
diff changeset
   241
     * return <code>null</code> for any <code>Array.getArray()</code> methods.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   242
     * <code>SerialArray</code> cannot serialize <code>null</code> array values.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   243
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   244
     * @param array the <code>Array</code> object to be serialized
90ce3da70b43 Initial load
duke
parents:
diff changeset
   245
     * @throws SerialException if an error occurs serializing the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   246
     *     <code>Array</code> object
90ce3da70b43 Initial load
duke
parents:
diff changeset
   247
     * @throws SQLException if a database access error occurs or the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   248
     *     <i>array</i> parameter is <code>null</code>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   249
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   250
     public SerialArray(Array array) throws SerialException, SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   251
         if (array == null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   252
             throw new SQLException("Cannot instantiate a SerialArray " +
90ce3da70b43 Initial load
duke
parents:
diff changeset
   253
                 "object with a null Array object");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   254
         }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   255
90ce3da70b43 Initial load
duke
parents:
diff changeset
   256
         if ((elements = (Object[])array.getArray()) == null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   257
             throw new SQLException("Invalid Array object. Calls to Array.getArray() " +
90ce3da70b43 Initial load
duke
parents:
diff changeset
   258
                 "return null value which cannot be serialized");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   259
         }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   260
90ce3da70b43 Initial load
duke
parents:
diff changeset
   261
         //elements = (Object[])array.getArray();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   262
         baseType = array.getBaseType();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   263
         baseTypeName = array.getBaseTypeName();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   264
         len = elements.length;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   265
90ce3da70b43 Initial load
duke
parents:
diff changeset
   266
        switch (baseType) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   267
90ce3da70b43 Initial load
duke
parents:
diff changeset
   268
        case java.sql.Types.BLOB:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   269
            for (int i = 0; i < len; i++) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   270
                elements[i] = new SerialBlob((Blob)elements[i]);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   271
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   272
            break;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   273
90ce3da70b43 Initial load
duke
parents:
diff changeset
   274
        case java.sql.Types.CLOB:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   275
            for (int i = 0; i < len; i++) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   276
                elements[i] = new SerialClob((Clob)elements[i]);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   277
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   278
            break;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   279
90ce3da70b43 Initial load
duke
parents:
diff changeset
   280
        case java.sql.Types.DATALINK:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   281
            for (int i = 0; i < len; i++) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   282
                elements[i] = new SerialDatalink((URL)elements[i]);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   283
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   284
            break;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   285
90ce3da70b43 Initial load
duke
parents:
diff changeset
   286
        case java.sql.Types.JAVA_OBJECT:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   287
            for (int i = 0; i < len; i++) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   288
                elements[i] = new SerialJavaObject((Object)elements[i]);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   289
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   290
90ce3da70b43 Initial load
duke
parents:
diff changeset
   291
        default:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   292
            ;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   293
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   294
90ce3da70b43 Initial load
duke
parents:
diff changeset
   295
90ce3da70b43 Initial load
duke
parents:
diff changeset
   296
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   297
90ce3da70b43 Initial load
duke
parents:
diff changeset
   298
        /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   299
         * Returns a new array that is a copy of this <code>SerialArray</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   300
         * object.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   301
         *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   302
         * @return a copy of this <code>SerialArray</code> object as an
90ce3da70b43 Initial load
duke
parents:
diff changeset
   303
         *         <code>Object</code> in the Java programming language
90ce3da70b43 Initial load
duke
parents:
diff changeset
   304
         * @throws SerialException if an error occurs retrieving a copy of
90ce3da70b43 Initial load
duke
parents:
diff changeset
   305
     *         this <code>SerialArray</code> object
90ce3da70b43 Initial load
duke
parents:
diff changeset
   306
         */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   307
    public Object getArray() throws SerialException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   308
        Object dst = new Object[len];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   309
        System.arraycopy((Object)elements, 0, dst, 0, len);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   310
        return dst;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   311
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   312
90ce3da70b43 Initial load
duke
parents:
diff changeset
   313
 //[if an error occurstype map used??]
90ce3da70b43 Initial load
duke
parents:
diff changeset
   314
        /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   315
         * Returns a new array that is a copy of this <code>SerialArray</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   316
         * object, using the given type map for the custom
90ce3da70b43 Initial load
duke
parents:
diff changeset
   317
         * mapping of each element when the elements are SQL UDTs.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   318
         * <P>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   319
         * This method does custom mapping if the array elements are a UDT
90ce3da70b43 Initial load
duke
parents:
diff changeset
   320
         * and the given type map has an entry for that UDT.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   321
     * Custom mapping is recursive,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   322
         * meaning that if, for instance, an element of an SQL structured type
90ce3da70b43 Initial load
duke
parents:
diff changeset
   323
         * is an SQL structured type that itself has an element that is an SQL
90ce3da70b43 Initial load
duke
parents:
diff changeset
   324
         * structured type, each structured type that has a custom mapping will be
90ce3da70b43 Initial load
duke
parents:
diff changeset
   325
         * mapped according to the given type map.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   326
         *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   327
     * @param map a <code>java.util.Map</code> object in which
90ce3da70b43 Initial load
duke
parents:
diff changeset
   328
     *        each entry consists of 1) a <code>String</code> object
90ce3da70b43 Initial load
duke
parents:
diff changeset
   329
     *        giving the fully qualified name of a UDT and 2) the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   330
     *        <code>Class</code> object for the <code>SQLData</code> implementation
90ce3da70b43 Initial load
duke
parents:
diff changeset
   331
     *        that defines how the UDT is to be mapped
90ce3da70b43 Initial load
duke
parents:
diff changeset
   332
         * @return a copy of this <code>SerialArray</code> object as an
90ce3da70b43 Initial load
duke
parents:
diff changeset
   333
         *         <code>Object</code> in the Java programming language
90ce3da70b43 Initial load
duke
parents:
diff changeset
   334
         * @throws SerialException if an error occurs
90ce3da70b43 Initial load
duke
parents:
diff changeset
   335
         */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   336
    public Object getArray(Map<String, Class<?>> map) throws SerialException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   337
        Object dst[] = new Object[len];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   338
        System.arraycopy((Object)elements, 0, dst, 0, len);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   339
        return dst;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   340
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   341
90ce3da70b43 Initial load
duke
parents:
diff changeset
   342
        /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   343
         * Returns a new array that is a copy of a slice
90ce3da70b43 Initial load
duke
parents:
diff changeset
   344
         * of this <code>SerialArray</code> object, starting with the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   345
         * element at the given index and containing the given number
90ce3da70b43 Initial load
duke
parents:
diff changeset
   346
         * of consecutive elements.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   347
         *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   348
         * @param index the index into this <code>SerialArray</code> object
90ce3da70b43 Initial load
duke
parents:
diff changeset
   349
         *              of the first element to be copied;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   350
         *              the index of the first element is <code>0</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   351
         * @param count the number of consecutive elements to be copied, starting
90ce3da70b43 Initial load
duke
parents:
diff changeset
   352
         *              at the given index
90ce3da70b43 Initial load
duke
parents:
diff changeset
   353
         * @return a copy of the designated elements in this <code>SerialArray</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   354
         *         object as an <code>Object</code> in the Java programming language
90ce3da70b43 Initial load
duke
parents:
diff changeset
   355
         * @throws SerialException if an error occurs
90ce3da70b43 Initial load
duke
parents:
diff changeset
   356
         */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   357
    public Object getArray(long index, int count) throws SerialException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   358
        Object dst = new Object[count];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   359
        System.arraycopy((Object)elements, (int)index, dst, 0, count);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   360
        return dst;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   361
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   362
90ce3da70b43 Initial load
duke
parents:
diff changeset
   363
        /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   364
         * Returns a new array that is a copy of a slice
90ce3da70b43 Initial load
duke
parents:
diff changeset
   365
         * of this <code>SerialArray</code> object, starting with the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   366
         * element at the given index and containing the given number
90ce3da70b43 Initial load
duke
parents:
diff changeset
   367
         * of consecutive elements.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   368
         * <P>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   369
         * This method does custom mapping if the array elements are a UDT
90ce3da70b43 Initial load
duke
parents:
diff changeset
   370
         * and the given type map has an entry for that UDT.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   371
     * Custom mapping is recursive,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   372
         * meaning that if, for instance, an element of an SQL structured type
90ce3da70b43 Initial load
duke
parents:
diff changeset
   373
         * is an SQL structured type that itself has an element that is an SQL
90ce3da70b43 Initial load
duke
parents:
diff changeset
   374
         * structured type, each structured type that has a custom mapping will be
90ce3da70b43 Initial load
duke
parents:
diff changeset
   375
         * mapped according to the given type map.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   376
         *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   377
         * @param index the index into this <code>SerialArray</code> object
90ce3da70b43 Initial load
duke
parents:
diff changeset
   378
         *              of the first element to be copied; the index of the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   379
         *              first element in the array is <code>0</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   380
         * @param count the number of consecutive elements to be copied, starting
90ce3da70b43 Initial load
duke
parents:
diff changeset
   381
         *              at the given index
90ce3da70b43 Initial load
duke
parents:
diff changeset
   382
     * @param map a <code>java.util.Map</code> object in which
90ce3da70b43 Initial load
duke
parents:
diff changeset
   383
     *        each entry consists of 1) a <code>String</code> object
90ce3da70b43 Initial load
duke
parents:
diff changeset
   384
     *        giving the fully qualified name of a UDT and 2) the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   385
     *        <code>Class</code> object for the <code>SQLData</code> implementation
90ce3da70b43 Initial load
duke
parents:
diff changeset
   386
     *        that defines how the UDT is to be mapped
90ce3da70b43 Initial load
duke
parents:
diff changeset
   387
         * @return a copy of the designated elements in this <code>SerialArray</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   388
         *         object as an <code>Object</code> in the Java programming language
90ce3da70b43 Initial load
duke
parents:
diff changeset
   389
         * @throws SerialException if an error occurs
90ce3da70b43 Initial load
duke
parents:
diff changeset
   390
         */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   391
    public Object getArray(long index, int count, Map<String,Class<?>> map)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   392
        throws SerialException
90ce3da70b43 Initial load
duke
parents:
diff changeset
   393
    {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   394
        Object dst = new Object[count];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   395
        System.arraycopy((Object)elements, (int)index, dst, 0, count);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   396
        return dst;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   397
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   398
90ce3da70b43 Initial load
duke
parents:
diff changeset
   399
        /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   400
         * Retrieves the SQL type of the elements in this <code>SerialArray</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   401
         * object.  The <code>int</code> returned is one of the constants in the class
90ce3da70b43 Initial load
duke
parents:
diff changeset
   402
         * <code>java.sql.Types</code>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   403
         *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   404
         * @return one of the constants in <code>java.sql.Types</code>, indicating
90ce3da70b43 Initial load
duke
parents:
diff changeset
   405
         *         the SQL type of the elements in this <code>SerialArray</code> object
90ce3da70b43 Initial load
duke
parents:
diff changeset
   406
         * @throws SerialException if an error occurs
90ce3da70b43 Initial load
duke
parents:
diff changeset
   407
         */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   408
    public int getBaseType() throws SerialException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   409
        return baseType;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   410
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   411
90ce3da70b43 Initial load
duke
parents:
diff changeset
   412
        /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   413
         * Retrieves the DBMS-specific type name for the elements in this
90ce3da70b43 Initial load
duke
parents:
diff changeset
   414
         * <code>SerialArray</code> object.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   415
         *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   416
         * @return the SQL type name used by the DBMS for the base type of this
90ce3da70b43 Initial load
duke
parents:
diff changeset
   417
     *         <code>SerialArray</code> object
90ce3da70b43 Initial load
duke
parents:
diff changeset
   418
         * @throws SerialException if an error occurs
90ce3da70b43 Initial load
duke
parents:
diff changeset
   419
         */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   420
    public String getBaseTypeName() throws SerialException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   421
        return baseTypeName;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   422
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   423
90ce3da70b43 Initial load
duke
parents:
diff changeset
   424
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   425
     * Retrieves a <code>ResultSet</code> object holding the elements of
90ce3da70b43 Initial load
duke
parents:
diff changeset
   426
     * the subarray that starts at
90ce3da70b43 Initial load
duke
parents:
diff changeset
   427
     * index <i>index</i> and contains up to <i>count</i> successive elements.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   428
     * This method uses the connection's type map to map the elements of
90ce3da70b43 Initial load
duke
parents:
diff changeset
   429
     * the array if the map contains
90ce3da70b43 Initial load
duke
parents:
diff changeset
   430
     * an entry for the base type. Otherwise, the standard mapping is used.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   431
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   432
     * @param index the index into this <code>SerialArray</code> object
90ce3da70b43 Initial load
duke
parents:
diff changeset
   433
     *         of the first element to be copied; the index of the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   434
     *         first element in the array is <code>0</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   435
     * @param count the number of consecutive elements to be copied, starting
90ce3da70b43 Initial load
duke
parents:
diff changeset
   436
     *         at the given index
90ce3da70b43 Initial load
duke
parents:
diff changeset
   437
     * @return a <code>ResultSet</code> object containing the designated
90ce3da70b43 Initial load
duke
parents:
diff changeset
   438
     *         elements in this <code>SerialArray</code> object, with a
90ce3da70b43 Initial load
duke
parents:
diff changeset
   439
     *         separate row for each element
90ce3da70b43 Initial load
duke
parents:
diff changeset
   440
     * @throws SerialException, which in turn throws an
90ce3da70b43 Initial load
duke
parents:
diff changeset
   441
     *         <code>UnsupportedOperationException</code>, if this method is called
90ce3da70b43 Initial load
duke
parents:
diff changeset
   442
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   443
    public ResultSet getResultSet(long index, int count) throws SerialException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   444
        throw new UnsupportedOperationException();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   445
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   446
90ce3da70b43 Initial load
duke
parents:
diff changeset
   447
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   448
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   449
     * Retrieves a <code>ResultSet</code> object that contains all of
90ce3da70b43 Initial load
duke
parents:
diff changeset
   450
     * the elements of the SQL <code>ARRAY</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   451
     * value represented by this <code>SerialArray</code> object. This method uses
90ce3da70b43 Initial load
duke
parents:
diff changeset
   452
     * the specified map for type map customizations unless the base type of the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   453
     * array does not match a user-defined type (UDT) in <i>map</i>, in
90ce3da70b43 Initial load
duke
parents:
diff changeset
   454
     * which case it uses the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   455
     * standard mapping. This version of the method <code>getResultSet</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   456
     * uses either the given type map or the standard mapping; it never uses the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   457
     * type map associated with the connection.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   458
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   459
     * @param map a <code>java.util.Map</code> object in which
90ce3da70b43 Initial load
duke
parents:
diff changeset
   460
     *        each entry consists of 1) a <code>String</code> object
90ce3da70b43 Initial load
duke
parents:
diff changeset
   461
     *        giving the fully qualified name of a UDT and 2) the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   462
     *        <code>Class</code> object for the <code>SQLData</code> implementation
90ce3da70b43 Initial load
duke
parents:
diff changeset
   463
     *        that defines how the UDT is to be mapped
90ce3da70b43 Initial load
duke
parents:
diff changeset
   464
     * @return a <code>ResultSet</code> object containing all of the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   465
     *         elements in this <code>SerialArray</code> object, with a
90ce3da70b43 Initial load
duke
parents:
diff changeset
   466
     *         separate row for each element
90ce3da70b43 Initial load
duke
parents:
diff changeset
   467
     * @throws SerialException, which in turn throws an
90ce3da70b43 Initial load
duke
parents:
diff changeset
   468
     *         <code>UnsupportedOperationException</code>, if this method is called
90ce3da70b43 Initial load
duke
parents:
diff changeset
   469
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   470
    public ResultSet getResultSet(Map<String, Class<?>> map)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   471
        throws SerialException
90ce3da70b43 Initial load
duke
parents:
diff changeset
   472
    {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   473
        throw new UnsupportedOperationException();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   474
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   475
90ce3da70b43 Initial load
duke
parents:
diff changeset
   476
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   477
     * Retrieves a <code>ResultSet</code> object that contains all of
90ce3da70b43 Initial load
duke
parents:
diff changeset
   478
     * the elements in the <code>ARRAY</code> value that this
90ce3da70b43 Initial load
duke
parents:
diff changeset
   479
     * <code>SerialArray</code> object represents.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   480
     * If appropriate, the elements of the array are mapped using the connection's
90ce3da70b43 Initial load
duke
parents:
diff changeset
   481
     * type map; otherwise, the standard mapping is used.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   482
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   483
     * @return a <code>ResultSet</code> object containing all of the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   484
     *         elements in this <code>SerialArray</code> object, with a
90ce3da70b43 Initial load
duke
parents:
diff changeset
   485
     *         separate row for each element
90ce3da70b43 Initial load
duke
parents:
diff changeset
   486
     * @throws SerialException if called, which in turn throws an
90ce3da70b43 Initial load
duke
parents:
diff changeset
   487
     *         <code>UnsupportedOperationException</code>, if this method is called
90ce3da70b43 Initial load
duke
parents:
diff changeset
   488
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   489
    public ResultSet getResultSet() throws SerialException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   490
        throw new UnsupportedOperationException();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   491
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   492
90ce3da70b43 Initial load
duke
parents:
diff changeset
   493
90ce3da70b43 Initial load
duke
parents:
diff changeset
   494
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   495
     * Retrieves a result set holding the elements of the subarray that starts at
90ce3da70b43 Initial load
duke
parents:
diff changeset
   496
     * Retrieves a <code>ResultSet</code> object that contains a subarray of the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   497
     * elements in this <code>SerialArray</code> object, starting at
90ce3da70b43 Initial load
duke
parents:
diff changeset
   498
     * index <i>index</i> and containing up to <i>count</i> successive
90ce3da70b43 Initial load
duke
parents:
diff changeset
   499
     * elements. This method uses
90ce3da70b43 Initial load
duke
parents:
diff changeset
   500
     * the specified map for type map customizations unless the base type of the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   501
     * array does not match a user-defined type (UDT) in <i>map</i>, in
90ce3da70b43 Initial load
duke
parents:
diff changeset
   502
     * which case it uses the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   503
     * standard mapping. This version of the method <code>getResultSet</code> uses
90ce3da70b43 Initial load
duke
parents:
diff changeset
   504
     * either the given type map or the standard mapping; it never uses the type
90ce3da70b43 Initial load
duke
parents:
diff changeset
   505
     * map associated with the connection.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   506
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   507
     * @param index the index into this <code>SerialArray</code> object
90ce3da70b43 Initial load
duke
parents:
diff changeset
   508
     *              of the first element to be copied; the index of the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   509
     *              first element in the array is <code>0</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   510
     * @param count the number of consecutive elements to be copied, starting
90ce3da70b43 Initial load
duke
parents:
diff changeset
   511
     *              at the given index
90ce3da70b43 Initial load
duke
parents:
diff changeset
   512
     * @param map a <code>java.util.Map</code> object in which
90ce3da70b43 Initial load
duke
parents:
diff changeset
   513
     *        each entry consists of 1) a <code>String</code> object
90ce3da70b43 Initial load
duke
parents:
diff changeset
   514
     *        giving the fully qualified name of a UDT and 2) the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   515
     *        <code>Class</code> object for the <code>SQLData</code> implementation
90ce3da70b43 Initial load
duke
parents:
diff changeset
   516
     *        that defines how the UDT is to be mapped
90ce3da70b43 Initial load
duke
parents:
diff changeset
   517
     * @return a <code>ResultSet</code> object containing the designated
90ce3da70b43 Initial load
duke
parents:
diff changeset
   518
     *         elements in this <code>SerialArray</code> object, with a
90ce3da70b43 Initial load
duke
parents:
diff changeset
   519
     *         separate row for each element
90ce3da70b43 Initial load
duke
parents:
diff changeset
   520
     * @throws SerialException if called, which in turn throws an
90ce3da70b43 Initial load
duke
parents:
diff changeset
   521
     *         <code>UnsupportedOperationException</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   522
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   523
    public ResultSet getResultSet(long index, int count,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   524
                                  Map<String,Class<?>> map)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   525
        throws SerialException
90ce3da70b43 Initial load
duke
parents:
diff changeset
   526
    {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   527
        throw new UnsupportedOperationException();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   528
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   529
90ce3da70b43 Initial load
duke
parents:
diff changeset
   530
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   531
     * The identifier that assists in the serialization of this <code>SerialArray</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   532
     * object.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   533
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   534
    static final long serialVersionUID = -8466174297270688520L;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   535
}