jdk/src/share/classes/com/sun/rowset/CachedRowSetImpl.java
author lancea
Thu, 26 Jan 2012 19:41:35 -0500
changeset 11683 5e02efd89af6
parent 11129 f9ad1aadf3fa
child 13012 c4ef809d7fca
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
/*
9257
53e6d7bc31b0 7035615: Address lint warnings for javax.sql.rowset & com.sun.rowset
lancea
parents: 6697
diff changeset
     2
 * Copyright (c) 2003, 2011, 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 com.sun.rowset;
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 javax.sql.*;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    30
import java.io.*;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    31
import java.math.*;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    32
import java.util.*;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    33
import java.text.*;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    34
90ce3da70b43 Initial load
duke
parents:
diff changeset
    35
import javax.sql.rowset.*;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    36
import javax.sql.rowset.spi.*;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    37
import javax.sql.rowset.serial.*;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    38
import com.sun.rowset.internal.*;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    39
import com.sun.rowset.providers.*;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    40
90ce3da70b43 Initial load
duke
parents:
diff changeset
    41
/**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    42
 * The standard implementation of the <code>CachedRowSet</code> interface.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    43
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    44
 * See interface defintion for full behaviour and implementation requirements.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    45
 * This reference implementation has made provision for a one-to-one write back
90ce3da70b43 Initial load
duke
parents:
diff changeset
    46
 * facility and it is curremtly be possible to change the peristence provider
90ce3da70b43 Initial load
duke
parents:
diff changeset
    47
 * during the life-time of any CachedRowSetImpl.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    48
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    49
 * @author Jonathan Bruce, Amit Handa
90ce3da70b43 Initial load
duke
parents:
diff changeset
    50
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    51
90ce3da70b43 Initial load
duke
parents:
diff changeset
    52
public class CachedRowSetImpl extends BaseRowSet implements RowSet, RowSetInternal, Serializable, Cloneable, CachedRowSet {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    53
90ce3da70b43 Initial load
duke
parents:
diff changeset
    54
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    55
     * The <code>SyncProvider</code> used by the CachedRowSet
90ce3da70b43 Initial load
duke
parents:
diff changeset
    56
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    57
    private SyncProvider provider;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    58
90ce3da70b43 Initial load
duke
parents:
diff changeset
    59
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    60
     * The <code>RowSetReaderImpl</code> object that is the reader
90ce3da70b43 Initial load
duke
parents:
diff changeset
    61
     * for this rowset.  The method <code>execute</code> uses this
90ce3da70b43 Initial load
duke
parents:
diff changeset
    62
     * reader as part of its implementation.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    63
     * @serial
90ce3da70b43 Initial load
duke
parents:
diff changeset
    64
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    65
    private RowSetReader rowSetReader;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    66
90ce3da70b43 Initial load
duke
parents:
diff changeset
    67
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    68
     * The <code>RowSetWriterImpl</code> object that is the writer
90ce3da70b43 Initial load
duke
parents:
diff changeset
    69
     * for this rowset.  The method <code>acceptChanges</code> uses
90ce3da70b43 Initial load
duke
parents:
diff changeset
    70
     * this writer as part of its implementation.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    71
     * @serial
90ce3da70b43 Initial load
duke
parents:
diff changeset
    72
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    73
    private RowSetWriter rowSetWriter;
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 <code>Connection</code> object that connects with this
90ce3da70b43 Initial load
duke
parents:
diff changeset
    77
     * <code>CachedRowSetImpl</code> object's current underlying data source.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    78
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    79
    private transient Connection conn;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    80
90ce3da70b43 Initial load
duke
parents:
diff changeset
    81
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    82
     * The <code>ResultSetMetaData</code> object that contains information
90ce3da70b43 Initial load
duke
parents:
diff changeset
    83
     * about the columns in the <code>ResultSet</code> object that is the
90ce3da70b43 Initial load
duke
parents:
diff changeset
    84
     * current source of data for this <code>CachedRowSetImpl</code> object.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    85
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    86
    private transient ResultSetMetaData RSMD;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    87
90ce3da70b43 Initial load
duke
parents:
diff changeset
    88
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    89
     * The <code>RowSetMetaData</code> object that contains information about
90ce3da70b43 Initial load
duke
parents:
diff changeset
    90
     * the columns in this <code>CachedRowSetImpl</code> object.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    91
     * @serial
90ce3da70b43 Initial load
duke
parents:
diff changeset
    92
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    93
    private RowSetMetaDataImpl RowSetMD;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    94
90ce3da70b43 Initial load
duke
parents:
diff changeset
    95
    // Properties of this RowSet
90ce3da70b43 Initial load
duke
parents:
diff changeset
    96
90ce3da70b43 Initial load
duke
parents:
diff changeset
    97
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    98
     * An array containing the columns in this <code>CachedRowSetImpl</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    99
     * object that form a unique identifier for a row. This array
90ce3da70b43 Initial load
duke
parents:
diff changeset
   100
     * is used by the writer.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   101
     * @serial
90ce3da70b43 Initial load
duke
parents:
diff changeset
   102
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   103
    private int keyCols[];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   104
90ce3da70b43 Initial load
duke
parents:
diff changeset
   105
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   106
     * The name of the table in the underlying database to which updates
90ce3da70b43 Initial load
duke
parents:
diff changeset
   107
     * should be written.  This name is needed because most drivers
90ce3da70b43 Initial load
duke
parents:
diff changeset
   108
     * do not return this information in a <code>ResultSetMetaData</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   109
     * object.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   110
     * @serial
90ce3da70b43 Initial load
duke
parents:
diff changeset
   111
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   112
    private String tableName;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   113
90ce3da70b43 Initial load
duke
parents:
diff changeset
   114
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   115
     * A <code>Vector</code> object containing the <code>Row</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   116
     * objects that comprise  this <code>CachedRowSetImpl</code> object.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   117
     * @serial
90ce3da70b43 Initial load
duke
parents:
diff changeset
   118
     */
9257
53e6d7bc31b0 7035615: Address lint warnings for javax.sql.rowset & com.sun.rowset
lancea
parents: 6697
diff changeset
   119
    private Vector<Object> rvh;
53e6d7bc31b0 7035615: Address lint warnings for javax.sql.rowset & com.sun.rowset
lancea
parents: 6697
diff changeset
   120
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   121
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   122
     * The current postion of the cursor in this <code>CachedRowSetImpl</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   123
     * object.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   124
     * @serial
90ce3da70b43 Initial load
duke
parents:
diff changeset
   125
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   126
    private int cursorPos;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   127
90ce3da70b43 Initial load
duke
parents:
diff changeset
   128
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   129
     * The current postion of the cursor in this <code>CachedRowSetImpl</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   130
     * object not counting rows that have been deleted, if any.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   131
     * <P>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   132
     * For example, suppose that the cursor is on the last row of a rowset
90ce3da70b43 Initial load
duke
parents:
diff changeset
   133
     * that started with five rows and subsequently had the second and third
90ce3da70b43 Initial load
duke
parents:
diff changeset
   134
     * rows deleted. The <code>absolutePos</code> would be <code>3</code>,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   135
     * whereas the <code>cursorPos</code> would be <code>5</code>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   136
     * @serial
90ce3da70b43 Initial load
duke
parents:
diff changeset
   137
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   138
    private int absolutePos;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   139
90ce3da70b43 Initial load
duke
parents:
diff changeset
   140
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   141
     * The number of deleted rows currently in this <code>CachedRowSetImpl</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   142
     * object.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   143
     * @serial
90ce3da70b43 Initial load
duke
parents:
diff changeset
   144
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   145
    private int numDeleted;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   146
90ce3da70b43 Initial load
duke
parents:
diff changeset
   147
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   148
     * The total number of rows currently in this <code>CachedRowSetImpl</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   149
     * object.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   150
     * @serial
90ce3da70b43 Initial load
duke
parents:
diff changeset
   151
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   152
    private int numRows;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   153
90ce3da70b43 Initial load
duke
parents:
diff changeset
   154
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   155
     * A special row used for constructing a new row. A new
90ce3da70b43 Initial load
duke
parents:
diff changeset
   156
     * row is constructed by using <code>ResultSet.updateXXX</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   157
     * methods to insert column values into the insert row.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   158
     * @serial
90ce3da70b43 Initial load
duke
parents:
diff changeset
   159
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   160
    private InsertRow insertRow;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   161
90ce3da70b43 Initial load
duke
parents:
diff changeset
   162
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   163
     * A <code>boolean</code> indicating whether the cursor is
90ce3da70b43 Initial load
duke
parents:
diff changeset
   164
     * currently on the insert row.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   165
     * @serial
90ce3da70b43 Initial load
duke
parents:
diff changeset
   166
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   167
    private boolean onInsertRow;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   168
90ce3da70b43 Initial load
duke
parents:
diff changeset
   169
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   170
     * The field that temporarily holds the last position of the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   171
     * cursor before it moved to the insert row, thus preserving
90ce3da70b43 Initial load
duke
parents:
diff changeset
   172
     * the number of the current row to which the cursor may return.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   173
     * @serial
90ce3da70b43 Initial load
duke
parents:
diff changeset
   174
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   175
    private int currentRow;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   176
90ce3da70b43 Initial load
duke
parents:
diff changeset
   177
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   178
     * A <code>boolean</code> indicating whether the last value
90ce3da70b43 Initial load
duke
parents:
diff changeset
   179
     * returned was an SQL <code>NULL</code>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   180
     * @serial
90ce3da70b43 Initial load
duke
parents:
diff changeset
   181
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   182
    private boolean lastValueNull;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   183
90ce3da70b43 Initial load
duke
parents:
diff changeset
   184
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   185
     * A <code>SQLWarning</code> which logs on the warnings
90ce3da70b43 Initial load
duke
parents:
diff changeset
   186
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   187
    private SQLWarning sqlwarn;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   188
90ce3da70b43 Initial load
duke
parents:
diff changeset
   189
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   190
     * Used to track match column for JoinRowSet consumption
90ce3da70b43 Initial load
duke
parents:
diff changeset
   191
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   192
    private String strMatchColumn ="";
90ce3da70b43 Initial load
duke
parents:
diff changeset
   193
90ce3da70b43 Initial load
duke
parents:
diff changeset
   194
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   195
     * Used to track match column for JoinRowSet consumption
90ce3da70b43 Initial load
duke
parents:
diff changeset
   196
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   197
    private int iMatchColumn = -1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   198
90ce3da70b43 Initial load
duke
parents:
diff changeset
   199
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   200
     * A <code>RowSetWarning</code> which logs on the warnings
90ce3da70b43 Initial load
duke
parents:
diff changeset
   201
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   202
    private RowSetWarning rowsetWarning;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   203
90ce3da70b43 Initial load
duke
parents:
diff changeset
   204
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   205
     * The default SyncProvider for the RI CachedRowSetImpl
90ce3da70b43 Initial load
duke
parents:
diff changeset
   206
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   207
    private String DEFAULT_SYNC_PROVIDER = "com.sun.rowset.providers.RIOptimisticProvider";
90ce3da70b43 Initial load
duke
parents:
diff changeset
   208
90ce3da70b43 Initial load
duke
parents:
diff changeset
   209
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   210
     * The boolean variable indicating locatorsUpdateValue
90ce3da70b43 Initial load
duke
parents:
diff changeset
   211
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   212
    private boolean dbmslocatorsUpdateCopy;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   213
90ce3da70b43 Initial load
duke
parents:
diff changeset
   214
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   215
     * The <code>ResultSet</code> object that is used to maintain the data when
90ce3da70b43 Initial load
duke
parents:
diff changeset
   216
     * a ResultSet and start position are passed as parameters to the populate function
90ce3da70b43 Initial load
duke
parents:
diff changeset
   217
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   218
    private transient ResultSet resultSet;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   219
90ce3da70b43 Initial load
duke
parents:
diff changeset
   220
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   221
     * The integer value indicating the end position in the ResultSetwhere the picking
90ce3da70b43 Initial load
duke
parents:
diff changeset
   222
     * up of rows for populating a CachedRowSet object was left off.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   223
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   224
    private int endPos;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   225
90ce3da70b43 Initial load
duke
parents:
diff changeset
   226
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   227
     * The integer value indicating the end position in the ResultSetwhere the picking
90ce3da70b43 Initial load
duke
parents:
diff changeset
   228
     * up of rows for populating a CachedRowSet object was left off.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   229
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   230
    private int prevEndPos;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   231
90ce3da70b43 Initial load
duke
parents:
diff changeset
   232
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   233
     * The integer value indicating the position in the ResultSet, to populate the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   234
     * CachedRowSet object.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   235
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   236
    private int startPos;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   237
90ce3da70b43 Initial load
duke
parents:
diff changeset
   238
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   239
     * The integer value indicating the positon from where the page prior to this
90ce3da70b43 Initial load
duke
parents:
diff changeset
   240
     * was populated.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   241
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   242
    private int startPrev;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   243
90ce3da70b43 Initial load
duke
parents:
diff changeset
   244
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   245
     * The integer value indicating size of the page.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   246
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   247
    private int pageSize;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   248
90ce3da70b43 Initial load
duke
parents:
diff changeset
   249
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   250
     * The integer value indicating number of rows that have been processed so far.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   251
     * Used for checking whether maxRows has been reached or not.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   252
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   253
    private int maxRowsreached;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   254
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   255
     * The boolean value when true signifies that pages are still to follow and a
90ce3da70b43 Initial load
duke
parents:
diff changeset
   256
     * false value indicates that this is the last page.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   257
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   258
    private boolean pagenotend = true;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   259
90ce3da70b43 Initial load
duke
parents:
diff changeset
   260
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   261
     * The boolean value indicating whether this is the first page or not.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   262
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   263
    private boolean onFirstPage;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   264
90ce3da70b43 Initial load
duke
parents:
diff changeset
   265
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   266
     * The boolean value indicating whether this is the last page or not.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   267
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   268
    private boolean onLastPage;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   269
90ce3da70b43 Initial load
duke
parents:
diff changeset
   270
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   271
     * The integer value indicating how many times the populate function has been called.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   272
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   273
    private int populatecallcount;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   274
90ce3da70b43 Initial load
duke
parents:
diff changeset
   275
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   276
     * The integer value indicating the total number of rows to be processed in the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   277
     * ResultSet object passed to the populate function.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   278
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   279
    private int totalRows;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   280
90ce3da70b43 Initial load
duke
parents:
diff changeset
   281
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   282
     * The boolean value indicating how the CahedRowSet object has been populated for
90ce3da70b43 Initial load
duke
parents:
diff changeset
   283
     * paging purpose. True indicates that connection parameter is passed.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   284
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   285
    private boolean callWithCon;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   286
90ce3da70b43 Initial load
duke
parents:
diff changeset
   287
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   288
     * CachedRowSet reader object to read the data from the ResultSet when a connection
90ce3da70b43 Initial load
duke
parents:
diff changeset
   289
     * parameter is passed to populate the CachedRowSet object for paging.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   290
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   291
    private CachedRowSetReader crsReader;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   292
90ce3da70b43 Initial load
duke
parents:
diff changeset
   293
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   294
     * The Vector holding the Match Columns
90ce3da70b43 Initial load
duke
parents:
diff changeset
   295
     */
9257
53e6d7bc31b0 7035615: Address lint warnings for javax.sql.rowset & com.sun.rowset
lancea
parents: 6697
diff changeset
   296
    private Vector<Integer> iMatchColumns;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   297
90ce3da70b43 Initial load
duke
parents:
diff changeset
   298
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   299
     * The Vector that will hold the Match Column names.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   300
     */
9257
53e6d7bc31b0 7035615: Address lint warnings for javax.sql.rowset & com.sun.rowset
lancea
parents: 6697
diff changeset
   301
    private Vector<String> strMatchColumns;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   302
90ce3da70b43 Initial load
duke
parents:
diff changeset
   303
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   304
     * Trigger that indicates whether the active SyncProvider is exposes the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   305
     * additional TransactionalWriter method
90ce3da70b43 Initial load
duke
parents:
diff changeset
   306
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   307
    private boolean tXWriter = false;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   308
90ce3da70b43 Initial load
duke
parents:
diff changeset
   309
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   310
     * The field object for a transactional RowSet writer
90ce3da70b43 Initial load
duke
parents:
diff changeset
   311
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   312
    private TransactionalWriter tWriter = null;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   313
90ce3da70b43 Initial load
duke
parents:
diff changeset
   314
    protected transient JdbcRowSetResourceBundle resBundle;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   315
90ce3da70b43 Initial load
duke
parents:
diff changeset
   316
    private boolean updateOnInsert;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   317
90ce3da70b43 Initial load
duke
parents:
diff changeset
   318
90ce3da70b43 Initial load
duke
parents:
diff changeset
   319
90ce3da70b43 Initial load
duke
parents:
diff changeset
   320
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   321
     * Constructs a new default <code>CachedRowSetImpl</code> object with
90ce3da70b43 Initial load
duke
parents:
diff changeset
   322
     * the capacity to hold 100 rows. This new object has no metadata
90ce3da70b43 Initial load
duke
parents:
diff changeset
   323
     * and has the following default values:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   324
     * <pre>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   325
     *     onInsertRow = false
90ce3da70b43 Initial load
duke
parents:
diff changeset
   326
     *     insertRow = null
90ce3da70b43 Initial load
duke
parents:
diff changeset
   327
     *     cursorPos = 0
90ce3da70b43 Initial load
duke
parents:
diff changeset
   328
     *     numRows = 0
90ce3da70b43 Initial load
duke
parents:
diff changeset
   329
     *     showDeleted = false
90ce3da70b43 Initial load
duke
parents:
diff changeset
   330
     *     queryTimeout = 0
90ce3da70b43 Initial load
duke
parents:
diff changeset
   331
     *     maxRows = 0
90ce3da70b43 Initial load
duke
parents:
diff changeset
   332
     *     maxFieldSize = 0
90ce3da70b43 Initial load
duke
parents:
diff changeset
   333
     *     rowSetType = ResultSet.TYPE_SCROLL_INSENSITIVE
90ce3da70b43 Initial load
duke
parents:
diff changeset
   334
     *     concurrency = ResultSet.CONCUR_UPDATABLE
90ce3da70b43 Initial load
duke
parents:
diff changeset
   335
     *     readOnly = false
90ce3da70b43 Initial load
duke
parents:
diff changeset
   336
     *     isolation = Connection.TRANSACTION_READ_COMMITTED
90ce3da70b43 Initial load
duke
parents:
diff changeset
   337
     *     escapeProcessing = true
90ce3da70b43 Initial load
duke
parents:
diff changeset
   338
     *     onInsertRow = false
90ce3da70b43 Initial load
duke
parents:
diff changeset
   339
     *     insertRow = null
90ce3da70b43 Initial load
duke
parents:
diff changeset
   340
     *     cursorPos = 0
90ce3da70b43 Initial load
duke
parents:
diff changeset
   341
     *     absolutePos = 0
90ce3da70b43 Initial load
duke
parents:
diff changeset
   342
     *     numRows = 0
90ce3da70b43 Initial load
duke
parents:
diff changeset
   343
     * </pre>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   344
     * A <code>CachedRowSetImpl</code> object is configured to use the default
90ce3da70b43 Initial load
duke
parents:
diff changeset
   345
     * <code>RIOptimisticProvider</code> implementation to provide connectivity
90ce3da70b43 Initial load
duke
parents:
diff changeset
   346
     * and synchronization capabilities to the set data source.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   347
     * <P>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   348
     * @throws SQLException if an error occurs
90ce3da70b43 Initial load
duke
parents:
diff changeset
   349
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   350
    public CachedRowSetImpl() throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   351
90ce3da70b43 Initial load
duke
parents:
diff changeset
   352
        try {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   353
           resBundle = JdbcRowSetResourceBundle.getJdbcRowSetResourceBundle();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   354
        } catch(IOException ioe) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   355
            throw new RuntimeException(ioe);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   356
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   357
90ce3da70b43 Initial load
duke
parents:
diff changeset
   358
        // set the Reader, this maybe overridden latter
90ce3da70b43 Initial load
duke
parents:
diff changeset
   359
        provider =
11129
f9ad1aadf3fa 7116445: Miscellaneous warnings in the JDBC/RowSet classes
lancea
parents: 9537
diff changeset
   360
        SyncFactory.getInstance(DEFAULT_SYNC_PROVIDER);
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   361
90ce3da70b43 Initial load
duke
parents:
diff changeset
   362
        if (!(provider instanceof RIOptimisticProvider)) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   363
            throw new SQLException(resBundle.handleGetObject("cachedrowsetimpl.invalidp").toString());
90ce3da70b43 Initial load
duke
parents:
diff changeset
   364
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   365
90ce3da70b43 Initial load
duke
parents:
diff changeset
   366
        rowSetReader = (CachedRowSetReader)provider.getRowSetReader();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   367
        rowSetWriter = (CachedRowSetWriter)provider.getRowSetWriter();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   368
90ce3da70b43 Initial load
duke
parents:
diff changeset
   369
        // allocate the parameters collection
90ce3da70b43 Initial load
duke
parents:
diff changeset
   370
        initParams();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   371
90ce3da70b43 Initial load
duke
parents:
diff changeset
   372
        initContainer();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   373
90ce3da70b43 Initial load
duke
parents:
diff changeset
   374
        // set up some default values
90ce3da70b43 Initial load
duke
parents:
diff changeset
   375
        initProperties();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   376
90ce3da70b43 Initial load
duke
parents:
diff changeset
   377
        // insert row setup
90ce3da70b43 Initial load
duke
parents:
diff changeset
   378
        onInsertRow = false;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   379
        insertRow = null;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   380
90ce3da70b43 Initial load
duke
parents:
diff changeset
   381
        // set the warninings
90ce3da70b43 Initial load
duke
parents:
diff changeset
   382
        sqlwarn = new SQLWarning();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   383
        rowsetWarning = new RowSetWarning();
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
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   388
     * Provides a <code>CachedRowSetImpl</code> instance with the same default properties as
90ce3da70b43 Initial load
duke
parents:
diff changeset
   389
     * as the zero parameter constructor.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   390
     * <pre>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   391
     *     onInsertRow = false
90ce3da70b43 Initial load
duke
parents:
diff changeset
   392
     *     insertRow = null
90ce3da70b43 Initial load
duke
parents:
diff changeset
   393
     *     cursorPos = 0
90ce3da70b43 Initial load
duke
parents:
diff changeset
   394
     *     numRows = 0
90ce3da70b43 Initial load
duke
parents:
diff changeset
   395
     *     showDeleted = false
90ce3da70b43 Initial load
duke
parents:
diff changeset
   396
     *     queryTimeout = 0
90ce3da70b43 Initial load
duke
parents:
diff changeset
   397
     *     maxRows = 0
90ce3da70b43 Initial load
duke
parents:
diff changeset
   398
     *     maxFieldSize = 0
90ce3da70b43 Initial load
duke
parents:
diff changeset
   399
     *     rowSetType = ResultSet.TYPE_SCROLL_INSENSITIVE
90ce3da70b43 Initial load
duke
parents:
diff changeset
   400
     *     concurrency = ResultSet.CONCUR_UPDATABLE
90ce3da70b43 Initial load
duke
parents:
diff changeset
   401
     *     readOnly = false
90ce3da70b43 Initial load
duke
parents:
diff changeset
   402
     *     isolation = Connection.TRANSACTION_READ_COMMITTED
90ce3da70b43 Initial load
duke
parents:
diff changeset
   403
     *     escapeProcessing = true
90ce3da70b43 Initial load
duke
parents:
diff changeset
   404
     *     onInsertRow = false
90ce3da70b43 Initial load
duke
parents:
diff changeset
   405
     *     insertRow = null
90ce3da70b43 Initial load
duke
parents:
diff changeset
   406
     *     cursorPos = 0
90ce3da70b43 Initial load
duke
parents:
diff changeset
   407
     *     absolutePos = 0
90ce3da70b43 Initial load
duke
parents:
diff changeset
   408
     *     numRows = 0
90ce3da70b43 Initial load
duke
parents:
diff changeset
   409
     * </pre>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   410
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   411
     * However, applications will have the means to specify at runtime the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   412
     * desired <code>SyncProvider</code> object.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   413
     * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   414
     * For example, creating a <code>CachedRowSetImpl</code> object as follows ensures
90ce3da70b43 Initial load
duke
parents:
diff changeset
   415
     * that a it is established with the <code>com.foo.provider.Impl</code> synchronization
90ce3da70b43 Initial load
duke
parents:
diff changeset
   416
     * implementation providing the synchronization mechanism for this disconnected
90ce3da70b43 Initial load
duke
parents:
diff changeset
   417
     * <code>RowSet</code> object.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   418
     * <pre>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   419
     *     Hashtable env = new Hashtable();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   420
     *     env.put(javax.sql.rowset.spi.SyncFactory.ROWSET_PROVIDER_NAME,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   421
     *         "com.foo.provider.Impl");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   422
     *     CachedRowSetImpl crs = new CachedRowSet(env);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   423
     * </pre>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   424
     * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   425
     * Calling this constructor with a <code>null</code> parameter will
90ce3da70b43 Initial load
duke
parents:
diff changeset
   426
     * cause the <code>SyncFactory</code> to provide the reference
90ce3da70b43 Initial load
duke
parents:
diff changeset
   427
     * optimistic provider <code>com.sun.rowset.providers.RIOptimisticProvider</code>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   428
     * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   429
     * In addition, the following properties can be associated with the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   430
     * provider to assist in determining the choice of the synchronizaton
90ce3da70b43 Initial load
duke
parents:
diff changeset
   431
     * provider such as:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   432
     * <ul>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   433
     * <li><code>ROWSET_SYNC_PROVIDER</code> - the property specifying the the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   434
     * <code>SyncProvider</code> class name to be instantiated by the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   435
     * <code>SyncFacttory</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   436
     * <li><code>ROWSET_SYNC_VENDOR</code> - the property specifying the software
90ce3da70b43 Initial load
duke
parents:
diff changeset
   437
     * vendor associated with a <code>SyncProvider</code> implementation.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   438
     * <li><code>ROWSET_SYNC_PROVIDER_VER</code> - the property specifying the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   439
     * version of the <code>SyncProvider</code> implementation provided by the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   440
     * software vendor.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   441
     * </ul>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   442
     * More specific detailes are available in the <code>SyncFactory</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   443
     * and <code>SyncProvider</code> specificiations later in this document.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   444
     * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   445
     * @param env a <code>Hashtable</code> object with a list of desired
90ce3da70b43 Initial load
duke
parents:
diff changeset
   446
     *        synchronization providers
90ce3da70b43 Initial load
duke
parents:
diff changeset
   447
     * @throws SQLException if the requested provider cannot be found by the
11129
f9ad1aadf3fa 7116445: Miscellaneous warnings in the JDBC/RowSet classes
lancea
parents: 9537
diff changeset
   448
     * synchronization factory
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   449
     * @see SyncProvider
90ce3da70b43 Initial load
duke
parents:
diff changeset
   450
     */
11129
f9ad1aadf3fa 7116445: Miscellaneous warnings in the JDBC/RowSet classes
lancea
parents: 9537
diff changeset
   451
    public CachedRowSetImpl(@SuppressWarnings("rawtypes") Hashtable env) throws SQLException {
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   452
90ce3da70b43 Initial load
duke
parents:
diff changeset
   453
90ce3da70b43 Initial load
duke
parents:
diff changeset
   454
        try {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   455
           resBundle = JdbcRowSetResourceBundle.getJdbcRowSetResourceBundle();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   456
        } catch(IOException ioe) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   457
            throw new RuntimeException(ioe);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   458
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   459
90ce3da70b43 Initial load
duke
parents:
diff changeset
   460
        if (env == null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   461
            throw new SQLException(resBundle.handleGetObject("cachedrowsetimpl.nullhash").toString());
90ce3da70b43 Initial load
duke
parents:
diff changeset
   462
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   463
90ce3da70b43 Initial load
duke
parents:
diff changeset
   464
        String providerName = (String)env.get(
90ce3da70b43 Initial load
duke
parents:
diff changeset
   465
        javax.sql.rowset.spi.SyncFactory.ROWSET_SYNC_PROVIDER);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   466
90ce3da70b43 Initial load
duke
parents:
diff changeset
   467
        // set the Reader, this maybe overridden latter
90ce3da70b43 Initial load
duke
parents:
diff changeset
   468
        provider =
11129
f9ad1aadf3fa 7116445: Miscellaneous warnings in the JDBC/RowSet classes
lancea
parents: 9537
diff changeset
   469
        SyncFactory.getInstance(providerName);
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   470
90ce3da70b43 Initial load
duke
parents:
diff changeset
   471
        rowSetReader = provider.getRowSetReader();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   472
        rowSetWriter = provider.getRowSetWriter();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   473
90ce3da70b43 Initial load
duke
parents:
diff changeset
   474
        initParams(); // allocate the parameters collection
90ce3da70b43 Initial load
duke
parents:
diff changeset
   475
        initContainer();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   476
        initProperties(); // set up some default values
90ce3da70b43 Initial load
duke
parents:
diff changeset
   477
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   478
90ce3da70b43 Initial load
duke
parents:
diff changeset
   479
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   480
     * Sets the <code>rvh</code> field to a new <code>Vector</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   481
     * object with a capacity of 100 and sets the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   482
     * <code>cursorPos</code> and <code>numRows</code> fields to zero.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   483
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   484
    private void initContainer() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   485
9257
53e6d7bc31b0 7035615: Address lint warnings for javax.sql.rowset & com.sun.rowset
lancea
parents: 6697
diff changeset
   486
        rvh = new Vector<Object>(100);
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   487
        cursorPos = 0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   488
        absolutePos = 0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   489
        numRows = 0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   490
        numDeleted = 0;
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
     * Sets the properties for this <code>CachedRowSetImpl</code> object to
90ce3da70b43 Initial load
duke
parents:
diff changeset
   495
     * their default values. This method is called internally by the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   496
     * default constructor.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   497
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   498
90ce3da70b43 Initial load
duke
parents:
diff changeset
   499
    private void initProperties() throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   500
90ce3da70b43 Initial load
duke
parents:
diff changeset
   501
        if(resBundle == null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   502
            try {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   503
               resBundle = JdbcRowSetResourceBundle.getJdbcRowSetResourceBundle();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   504
            } catch(IOException ioe) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   505
                throw new RuntimeException(ioe);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   506
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   507
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   508
        setShowDeleted(false);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   509
        setQueryTimeout(0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   510
        setMaxRows(0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   511
        setMaxFieldSize(0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   512
        setType(ResultSet.TYPE_SCROLL_INSENSITIVE);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   513
        setConcurrency(ResultSet.CONCUR_UPDATABLE);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   514
        if((rvh.size() > 0) && (isReadOnly() == false))
90ce3da70b43 Initial load
duke
parents:
diff changeset
   515
            setReadOnly(false);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   516
        else
90ce3da70b43 Initial load
duke
parents:
diff changeset
   517
            setReadOnly(true);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   518
        setTransactionIsolation(Connection.TRANSACTION_READ_COMMITTED);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   519
        setEscapeProcessing(true);
6530
bfb7b294dd14 6680198: UnmarshalException caused by incompatible serialVersionUID
lancea
parents: 5506
diff changeset
   520
        //setTypeMap(null);
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   521
        checkTransactionalWriter();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   522
90ce3da70b43 Initial load
duke
parents:
diff changeset
   523
        //Instantiating the vector for MatchColumns
90ce3da70b43 Initial load
duke
parents:
diff changeset
   524
9257
53e6d7bc31b0 7035615: Address lint warnings for javax.sql.rowset & com.sun.rowset
lancea
parents: 6697
diff changeset
   525
        iMatchColumns = new Vector<Integer>(10);
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   526
        for(int i = 0; i < 10 ; i++) {
11129
f9ad1aadf3fa 7116445: Miscellaneous warnings in the JDBC/RowSet classes
lancea
parents: 9537
diff changeset
   527
           iMatchColumns.add(i, -1);
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   528
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   529
9257
53e6d7bc31b0 7035615: Address lint warnings for javax.sql.rowset & com.sun.rowset
lancea
parents: 6697
diff changeset
   530
        strMatchColumns = new Vector<String>(10);
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   531
        for(int j = 0; j < 10; j++) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   532
           strMatchColumns.add(j,null);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   533
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   534
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   535
90ce3da70b43 Initial load
duke
parents:
diff changeset
   536
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   537
     * Determine whether the SyncProvider's writer implements the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   538
     * <code>TransactionalWriter<code> interface
90ce3da70b43 Initial load
duke
parents:
diff changeset
   539
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   540
    private void checkTransactionalWriter() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   541
        if (rowSetWriter != null) {
11129
f9ad1aadf3fa 7116445: Miscellaneous warnings in the JDBC/RowSet classes
lancea
parents: 9537
diff changeset
   542
            Class<?> c = rowSetWriter.getClass();
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   543
            if (c != null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   544
                Class[] theInterfaces = c.getInterfaces();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   545
                for (int i = 0; i < theInterfaces.length; i++) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   546
                    if ((theInterfaces[i].getName()).indexOf("TransactionalWriter") > 0) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   547
                        tXWriter = true;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   548
                        establishTransactionalWriter();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   549
                    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   550
                }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   551
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   552
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   553
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   554
90ce3da70b43 Initial load
duke
parents:
diff changeset
   555
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   556
     * Sets an private field to all transaction bounddaries to be set
90ce3da70b43 Initial load
duke
parents:
diff changeset
   557
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   558
    private void establishTransactionalWriter() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   559
        tWriter = (TransactionalWriter)provider.getRowSetWriter();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   560
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   561
90ce3da70b43 Initial load
duke
parents:
diff changeset
   562
    //-----------------------------------------------------------------------
90ce3da70b43 Initial load
duke
parents:
diff changeset
   563
    // Properties
90ce3da70b43 Initial load
duke
parents:
diff changeset
   564
    //-----------------------------------------------------------------------
90ce3da70b43 Initial load
duke
parents:
diff changeset
   565
90ce3da70b43 Initial load
duke
parents:
diff changeset
   566
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   567
     * Sets this <code>CachedRowSetImpl</code> object's command property
90ce3da70b43 Initial load
duke
parents:
diff changeset
   568
     * to the given <code>String</code> object and clears the parameters,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   569
     * if any, that were set for the previous command.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   570
     * <P>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   571
     * The command property may not be needed
90ce3da70b43 Initial load
duke
parents:
diff changeset
   572
     * if the rowset is produced by a data source, such as a spreadsheet,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   573
     * that does not support commands. Thus, this property is optional
90ce3da70b43 Initial load
duke
parents:
diff changeset
   574
     * and may be <code>null</code>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   575
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   576
     * @param cmd a <code>String</code> object containing an SQL query
90ce3da70b43 Initial load
duke
parents:
diff changeset
   577
     *            that will be set as the command; may be <code>null</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   578
     * @throws SQLException if an error occurs
90ce3da70b43 Initial load
duke
parents:
diff changeset
   579
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   580
    public void setCommand(String cmd) throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   581
90ce3da70b43 Initial load
duke
parents:
diff changeset
   582
        super.setCommand(cmd);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   583
90ce3da70b43 Initial load
duke
parents:
diff changeset
   584
        if(!buildTableName(cmd).equals("")) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   585
            this.setTableName(buildTableName(cmd));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   586
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   587
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   588
90ce3da70b43 Initial load
duke
parents:
diff changeset
   589
90ce3da70b43 Initial load
duke
parents:
diff changeset
   590
    //---------------------------------------------------------------------
90ce3da70b43 Initial load
duke
parents:
diff changeset
   591
    // Reading and writing data
90ce3da70b43 Initial load
duke
parents:
diff changeset
   592
    //---------------------------------------------------------------------
90ce3da70b43 Initial load
duke
parents:
diff changeset
   593
90ce3da70b43 Initial load
duke
parents:
diff changeset
   594
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   595
     * Populates this <code>CachedRowSetImpl</code> object with data from
90ce3da70b43 Initial load
duke
parents:
diff changeset
   596
     * the given <code>ResultSet</code> object.  This
90ce3da70b43 Initial load
duke
parents:
diff changeset
   597
     * method is an alternative to the method <code>execute</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   598
     * for filling the rowset with data.  The method <code>populate</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   599
     * does not require that the properties needed by the method
90ce3da70b43 Initial load
duke
parents:
diff changeset
   600
     * <code>execute</code>, such as the <code>command</code> property,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   601
     * be set. This is true because the method <code>populate</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   602
     * is given the <code>ResultSet</code> object from
90ce3da70b43 Initial load
duke
parents:
diff changeset
   603
     * which to get data and thus does not need to use the properties
90ce3da70b43 Initial load
duke
parents:
diff changeset
   604
     * required for setting up a connection and executing this
90ce3da70b43 Initial load
duke
parents:
diff changeset
   605
     * <code>CachedRowSetImpl</code> object's command.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   606
     * <P>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   607
     * After populating this rowset with data, the method
90ce3da70b43 Initial load
duke
parents:
diff changeset
   608
     * <code>populate</code> sets the rowset's metadata and
90ce3da70b43 Initial load
duke
parents:
diff changeset
   609
     * then sends a <code>RowSetChangedEvent</code> object
90ce3da70b43 Initial load
duke
parents:
diff changeset
   610
     * to all registered listeners prior to returning.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   611
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   612
     * @param data the <code>ResultSet</code> object containing the data
90ce3da70b43 Initial load
duke
parents:
diff changeset
   613
     *             to be read into this <code>CachedRowSetImpl</code> object
90ce3da70b43 Initial load
duke
parents:
diff changeset
   614
     * @throws SQLException if an error occurs; or the max row setting is
90ce3da70b43 Initial load
duke
parents:
diff changeset
   615
     *          violated while populating the RowSet
90ce3da70b43 Initial load
duke
parents:
diff changeset
   616
     * @see #execute
90ce3da70b43 Initial load
duke
parents:
diff changeset
   617
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   618
90ce3da70b43 Initial load
duke
parents:
diff changeset
   619
     public void populate(ResultSet data) throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   620
        int rowsFetched;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   621
        Row currentRow;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   622
        int numCols;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   623
        int i;
9257
53e6d7bc31b0 7035615: Address lint warnings for javax.sql.rowset & com.sun.rowset
lancea
parents: 6697
diff changeset
   624
        Map<String, Class<?>> map = getTypeMap();
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   625
        Object obj;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   626
        int mRows;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   627
90ce3da70b43 Initial load
duke
parents:
diff changeset
   628
        if (data == null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   629
            throw new SQLException(resBundle.handleGetObject("cachedrowsetimpl.populate").toString());
90ce3da70b43 Initial load
duke
parents:
diff changeset
   630
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   631
        this.resultSet = data;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   632
90ce3da70b43 Initial load
duke
parents:
diff changeset
   633
        // get the meta data for this ResultSet
90ce3da70b43 Initial load
duke
parents:
diff changeset
   634
        RSMD = data.getMetaData();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   635
90ce3da70b43 Initial load
duke
parents:
diff changeset
   636
        // set up the metadata
90ce3da70b43 Initial load
duke
parents:
diff changeset
   637
        RowSetMD = new RowSetMetaDataImpl();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   638
        initMetaData(RowSetMD, RSMD);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   639
90ce3da70b43 Initial load
duke
parents:
diff changeset
   640
        // release the meta-data so that aren't tempted to use it.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   641
        RSMD = null;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   642
        numCols = RowSetMD.getColumnCount();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   643
        mRows = this.getMaxRows();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   644
        rowsFetched = 0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   645
        currentRow = null;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   646
90ce3da70b43 Initial load
duke
parents:
diff changeset
   647
        while ( data.next()) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   648
90ce3da70b43 Initial load
duke
parents:
diff changeset
   649
            currentRow = new Row(numCols);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   650
90ce3da70b43 Initial load
duke
parents:
diff changeset
   651
            if ( rowsFetched > mRows && mRows > 0) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   652
                rowsetWarning.setNextWarning(new RowSetWarning("Populating rows "
90ce3da70b43 Initial load
duke
parents:
diff changeset
   653
                + "setting has exceeded max row setting"));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   654
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   655
            for ( i = 1; i <= numCols; i++) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   656
                /*
90ce3da70b43 Initial load
duke
parents:
diff changeset
   657
                 * check if the user has set a map. If no map
90ce3da70b43 Initial load
duke
parents:
diff changeset
   658
                 * is set then use plain getObject. This lets
90ce3da70b43 Initial load
duke
parents:
diff changeset
   659
                 * us work with drivers that do not support
90ce3da70b43 Initial load
duke
parents:
diff changeset
   660
                 * getObject with a map in fairly sensible way
90ce3da70b43 Initial load
duke
parents:
diff changeset
   661
                 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   662
                if (map == null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   663
                    obj = data.getObject(i);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   664
                } else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   665
                    obj = data.getObject(i, map);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   666
                }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   667
                /*
90ce3da70b43 Initial load
duke
parents:
diff changeset
   668
                 * the following block checks for the various
90ce3da70b43 Initial load
duke
parents:
diff changeset
   669
                 * types that we have to serialize in order to
90ce3da70b43 Initial load
duke
parents:
diff changeset
   670
                 * store - right now only structs have been tested
90ce3da70b43 Initial load
duke
parents:
diff changeset
   671
                 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   672
                if (obj instanceof Struct) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   673
                    obj = new SerialStruct((Struct)obj, map);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   674
                } else if (obj instanceof SQLData) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   675
                    obj = new SerialStruct((SQLData)obj, map);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   676
                } else if (obj instanceof Blob) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   677
                    obj = new SerialBlob((Blob)obj);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   678
                } else if (obj instanceof Clob) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   679
                    obj = new SerialClob((Clob)obj);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   680
                } else if (obj instanceof java.sql.Array) {
6530
bfb7b294dd14 6680198: UnmarshalException caused by incompatible serialVersionUID
lancea
parents: 5506
diff changeset
   681
                    if(map != null)
bfb7b294dd14 6680198: UnmarshalException caused by incompatible serialVersionUID
lancea
parents: 5506
diff changeset
   682
                        obj = new SerialArray((java.sql.Array)obj, map);
bfb7b294dd14 6680198: UnmarshalException caused by incompatible serialVersionUID
lancea
parents: 5506
diff changeset
   683
                    else
bfb7b294dd14 6680198: UnmarshalException caused by incompatible serialVersionUID
lancea
parents: 5506
diff changeset
   684
                        obj = new SerialArray((java.sql.Array)obj);
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   685
                }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   686
11129
f9ad1aadf3fa 7116445: Miscellaneous warnings in the JDBC/RowSet classes
lancea
parents: 9537
diff changeset
   687
                currentRow.initColumnObject(i, obj);
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   688
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   689
            rowsFetched++;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   690
            rvh.add(currentRow);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   691
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   692
90ce3da70b43 Initial load
duke
parents:
diff changeset
   693
        numRows = rowsFetched ;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   694
        // Also rowsFetched should be equal to rvh.size()
90ce3da70b43 Initial load
duke
parents:
diff changeset
   695
90ce3da70b43 Initial load
duke
parents:
diff changeset
   696
        // notify any listeners that the rowset has changed
90ce3da70b43 Initial load
duke
parents:
diff changeset
   697
        notifyRowSetChanged();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   698
90ce3da70b43 Initial load
duke
parents:
diff changeset
   699
90ce3da70b43 Initial load
duke
parents:
diff changeset
   700
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   701
90ce3da70b43 Initial load
duke
parents:
diff changeset
   702
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   703
     * Initializes the given <code>RowSetMetaData</code> object with the values
90ce3da70b43 Initial load
duke
parents:
diff changeset
   704
     * in the given <code>ResultSetMetaData</code> object.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   705
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   706
     * @param md the <code>RowSetMetaData</code> object for this
90ce3da70b43 Initial load
duke
parents:
diff changeset
   707
     *           <code>CachedRowSetImpl</code> object, which will be set with
90ce3da70b43 Initial load
duke
parents:
diff changeset
   708
     *           values from rsmd
90ce3da70b43 Initial load
duke
parents:
diff changeset
   709
     * @param rsmd the <code>ResultSetMetaData</code> object from which new
90ce3da70b43 Initial load
duke
parents:
diff changeset
   710
     *             values for md will be read
90ce3da70b43 Initial load
duke
parents:
diff changeset
   711
     * @throws SQLException if an error occurs
90ce3da70b43 Initial load
duke
parents:
diff changeset
   712
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   713
    private void initMetaData(RowSetMetaDataImpl md, ResultSetMetaData rsmd) throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   714
        int numCols = rsmd.getColumnCount();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   715
90ce3da70b43 Initial load
duke
parents:
diff changeset
   716
        md.setColumnCount(numCols);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   717
        for (int col=1; col <= numCols; col++) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   718
            md.setAutoIncrement(col, rsmd.isAutoIncrement(col));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   719
            if(rsmd.isAutoIncrement(col))
90ce3da70b43 Initial load
duke
parents:
diff changeset
   720
                updateOnInsert = true;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   721
            md.setCaseSensitive(col, rsmd.isCaseSensitive(col));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   722
            md.setCurrency(col, rsmd.isCurrency(col));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   723
            md.setNullable(col, rsmd.isNullable(col));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   724
            md.setSigned(col, rsmd.isSigned(col));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   725
            md.setSearchable(col, rsmd.isSearchable(col));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   726
             /*
90ce3da70b43 Initial load
duke
parents:
diff changeset
   727
             * The PostgreSQL drivers sometimes return negative columnDisplaySize,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   728
             * which causes an exception to be thrown.  Check for it.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   729
             */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   730
            int size = rsmd.getColumnDisplaySize(col);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   731
            if (size < 0) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   732
                size = 0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   733
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   734
            md.setColumnDisplaySize(col, size);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   735
            md.setColumnLabel(col, rsmd.getColumnLabel(col));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   736
            md.setColumnName(col, rsmd.getColumnName(col));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   737
            md.setSchemaName(col, rsmd.getSchemaName(col));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   738
            /*
90ce3da70b43 Initial load
duke
parents:
diff changeset
   739
             * Drivers return some strange values for precision, for non-numeric data, including reports of
90ce3da70b43 Initial load
duke
parents:
diff changeset
   740
             * non-integer values; maybe we should check type, & set to 0 for non-numeric types.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   741
             */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   742
            int precision = rsmd.getPrecision(col);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   743
            if (precision < 0) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   744
                precision = 0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   745
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   746
            md.setPrecision(col, precision);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   747
90ce3da70b43 Initial load
duke
parents:
diff changeset
   748
            /*
90ce3da70b43 Initial load
duke
parents:
diff changeset
   749
             * It seems, from a bug report, that a driver can sometimes return a negative
90ce3da70b43 Initial load
duke
parents:
diff changeset
   750
             * value for scale.  javax.sql.rowset.RowSetMetaDataImpl will throw an exception
90ce3da70b43 Initial load
duke
parents:
diff changeset
   751
             * if we attempt to set a negative value.  As such, we'll check for this case.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   752
             */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   753
            int scale = rsmd.getScale(col);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   754
            if (scale < 0) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   755
                scale = 0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   756
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   757
            md.setScale(col, scale);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   758
            md.setTableName(col, rsmd.getTableName(col));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   759
            md.setCatalogName(col, rsmd.getCatalogName(col));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   760
            md.setColumnType(col, rsmd.getColumnType(col));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   761
            md.setColumnTypeName(col, rsmd.getColumnTypeName(col));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   762
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   763
90ce3da70b43 Initial load
duke
parents:
diff changeset
   764
        if( conn != null){
90ce3da70b43 Initial load
duke
parents:
diff changeset
   765
           // JDBC 4.0 mandates as does the Java EE spec that all DataBaseMetaData methods
90ce3da70b43 Initial load
duke
parents:
diff changeset
   766
           // must be implemented, therefore, the previous fix for 5055528 is being backed out
6530
bfb7b294dd14 6680198: UnmarshalException caused by incompatible serialVersionUID
lancea
parents: 5506
diff changeset
   767
            dbmslocatorsUpdateCopy = conn.getMetaData().locatorsUpdateCopy();
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   768
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   769
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   770
90ce3da70b43 Initial load
duke
parents:
diff changeset
   771
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   772
     * Populates this <code>CachedRowSetImpl</code> object with data,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   773
     * using the given connection to produce the result set from
90ce3da70b43 Initial load
duke
parents:
diff changeset
   774
     * which data will be read.  A second form of this method,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   775
     * which takes no arguments, uses the values from this rowset's
90ce3da70b43 Initial load
duke
parents:
diff changeset
   776
     * user, password, and either url or data source properties to
90ce3da70b43 Initial load
duke
parents:
diff changeset
   777
     * create a new database connection. The form of <code>execute</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   778
     * that is given a connection ignores these properties.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   779
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   780
     * @param conn A standard JDBC <code>Connection</code> object that this
90ce3da70b43 Initial load
duke
parents:
diff changeset
   781
     * <code>CachedRowSet</code> object can pass to a synchronization provider
90ce3da70b43 Initial load
duke
parents:
diff changeset
   782
     * to establish a connection to the data source
90ce3da70b43 Initial load
duke
parents:
diff changeset
   783
     * @throws SQLException if an invalid <code>Connection</code> is supplied
90ce3da70b43 Initial load
duke
parents:
diff changeset
   784
     *           or an error occurs in establishing the connection to the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   785
     *           data source
90ce3da70b43 Initial load
duke
parents:
diff changeset
   786
     * @see #populate
90ce3da70b43 Initial load
duke
parents:
diff changeset
   787
     * @see java.sql.Connection
90ce3da70b43 Initial load
duke
parents:
diff changeset
   788
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   789
    public void execute(Connection conn) throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   790
        // store the connection so the reader can find it.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   791
        setConnection(conn);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   792
90ce3da70b43 Initial load
duke
parents:
diff changeset
   793
        if(getPageSize() != 0){
90ce3da70b43 Initial load
duke
parents:
diff changeset
   794
            crsReader = (CachedRowSetReader)provider.getRowSetReader();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   795
            crsReader.setStartPosition(1);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   796
            callWithCon = true;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   797
            crsReader.readData((RowSetInternal)this);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   798
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   799
90ce3da70b43 Initial load
duke
parents:
diff changeset
   800
        // Now call the current reader's readData method
90ce3da70b43 Initial load
duke
parents:
diff changeset
   801
        else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   802
           rowSetReader.readData((RowSetInternal)this);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   803
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   804
        RowSetMD = (RowSetMetaDataImpl)this.getMetaData();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   805
90ce3da70b43 Initial load
duke
parents:
diff changeset
   806
        if(conn != null){
90ce3da70b43 Initial load
duke
parents:
diff changeset
   807
            // JDBC 4.0 mandates as does the Java EE spec that all DataBaseMetaData methods
90ce3da70b43 Initial load
duke
parents:
diff changeset
   808
            // must be implemented, therefore, the previous fix for 5055528 is being backed out
90ce3da70b43 Initial load
duke
parents:
diff changeset
   809
            dbmslocatorsUpdateCopy = conn.getMetaData().locatorsUpdateCopy();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   810
        }
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
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   815
     * Sets this <code>CachedRowSetImpl</code> object's connection property
90ce3da70b43 Initial load
duke
parents:
diff changeset
   816
     * to the given <code>Connection</code> object.  This method is called
90ce3da70b43 Initial load
duke
parents:
diff changeset
   817
     * internally by the version of the method <code>execute</code> that takes a
90ce3da70b43 Initial load
duke
parents:
diff changeset
   818
     * <code>Connection</code> object as an argument. The reader for this
90ce3da70b43 Initial load
duke
parents:
diff changeset
   819
     * <code>CachedRowSetImpl</code> object can retrieve the connection stored
90ce3da70b43 Initial load
duke
parents:
diff changeset
   820
     * in the rowset's connection property by calling its
90ce3da70b43 Initial load
duke
parents:
diff changeset
   821
     * <code>getConnection</code> method.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   822
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   823
     * @param connection the <code>Connection</code> object that was passed in
90ce3da70b43 Initial load
duke
parents:
diff changeset
   824
     *                   to the method <code>execute</code> and is to be stored
90ce3da70b43 Initial load
duke
parents:
diff changeset
   825
     *                   in this <code>CachedRowSetImpl</code> object's connection
90ce3da70b43 Initial load
duke
parents:
diff changeset
   826
     *                   property
90ce3da70b43 Initial load
duke
parents:
diff changeset
   827
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   828
    private void setConnection (Connection connection) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   829
        conn = connection;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   830
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   831
90ce3da70b43 Initial load
duke
parents:
diff changeset
   832
90ce3da70b43 Initial load
duke
parents:
diff changeset
   833
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   834
     * Propagates all row update, insert, and delete changes to the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   835
     * underlying data source backing this <code>CachedRowSetImpl</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   836
     * object.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   837
     * <P>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   838
     * <b>Note</b>In the reference implementation an optimistic concurrency implementation
90ce3da70b43 Initial load
duke
parents:
diff changeset
   839
     * is provided as a sample implementation of a the <code>SyncProvider</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   840
     * abstract class.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   841
     * <P>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   842
     * This method fails if any of the updates cannot be propagated back
90ce3da70b43 Initial load
duke
parents:
diff changeset
   843
     * to the data source.  When it fails, the caller can assume that
90ce3da70b43 Initial load
duke
parents:
diff changeset
   844
     * none of the updates are reflected in the data source.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   845
     * When an exception is thrown, the current row
90ce3da70b43 Initial load
duke
parents:
diff changeset
   846
     * is set to the first "updated" row that resulted in an exception
90ce3da70b43 Initial load
duke
parents:
diff changeset
   847
     * unless the row that caused the exception is a "deleted" row.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   848
     * In that case, when deleted rows are not shown, which is usually true,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   849
     * the current row is not affected.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   850
     * <P>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   851
     * If no <code>SyncProvider</code> is configured, the reference implementation
90ce3da70b43 Initial load
duke
parents:
diff changeset
   852
     * leverages the <code>RIOptimisticProvider</code> available which provides the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   853
     * default and reference synchronization capabilities for disconnected
90ce3da70b43 Initial load
duke
parents:
diff changeset
   854
     * <code>RowSets</code>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   855
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   856
     * @throws SQLException if the cursor is on the insert row or the underlying
90ce3da70b43 Initial load
duke
parents:
diff changeset
   857
     *          reference synchronization provider fails to commit the updates
90ce3da70b43 Initial load
duke
parents:
diff changeset
   858
     *          to the datasource
90ce3da70b43 Initial load
duke
parents:
diff changeset
   859
     * @throws SyncProviderException if an internal error occurs within the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   860
     *          <code>SyncProvider</code> instance during either during the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   861
     *          process or at any time when the <code>SyncProvider</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   862
     *          instance touches the data source.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   863
     * @see #acceptChanges(java.sql.Connection)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   864
     * @see javax.sql.RowSetWriter
90ce3da70b43 Initial load
duke
parents:
diff changeset
   865
     * @see javax.sql.rowset.spi.SyncProvider
90ce3da70b43 Initial load
duke
parents:
diff changeset
   866
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   867
    public void acceptChanges() throws SyncProviderException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   868
        if (onInsertRow == true) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   869
            throw new SyncProviderException(resBundle.handleGetObject("cachedrowsetimpl.invalidop").toString());
90ce3da70b43 Initial load
duke
parents:
diff changeset
   870
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   871
90ce3da70b43 Initial load
duke
parents:
diff changeset
   872
        int saveCursorPos = cursorPos;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   873
        boolean success = false;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   874
        boolean conflict = false;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   875
90ce3da70b43 Initial load
duke
parents:
diff changeset
   876
        try {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   877
            if (rowSetWriter != null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   878
                saveCursorPos = cursorPos;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   879
                conflict = rowSetWriter.writeData((RowSetInternal)this);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   880
                cursorPos = saveCursorPos;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   881
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   882
11129
f9ad1aadf3fa 7116445: Miscellaneous warnings in the JDBC/RowSet classes
lancea
parents: 9537
diff changeset
   883
            if (tXWriter) {
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   884
                // do commit/rollback's here
90ce3da70b43 Initial load
duke
parents:
diff changeset
   885
                if (!conflict) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   886
                    tWriter = (TransactionalWriter)rowSetWriter;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   887
                    tWriter.rollback();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   888
                    success = false;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   889
                } else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   890
                    tWriter = (TransactionalWriter)rowSetWriter;
6664
979f457afd3a 6983452: SyncProvider issue for JoinRowSet implementation
lancea
parents: 6540
diff changeset
   891
                    if (tWriter instanceof CachedRowSetWriter) {
979f457afd3a 6983452: SyncProvider issue for JoinRowSet implementation
lancea
parents: 6540
diff changeset
   892
                        ((CachedRowSetWriter)tWriter).commit(this, updateOnInsert);
979f457afd3a 6983452: SyncProvider issue for JoinRowSet implementation
lancea
parents: 6540
diff changeset
   893
                    } else {
979f457afd3a 6983452: SyncProvider issue for JoinRowSet implementation
lancea
parents: 6540
diff changeset
   894
                        tWriter.commit();
979f457afd3a 6983452: SyncProvider issue for JoinRowSet implementation
lancea
parents: 6540
diff changeset
   895
                    }
979f457afd3a 6983452: SyncProvider issue for JoinRowSet implementation
lancea
parents: 6540
diff changeset
   896
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   897
                    success = true;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   898
                }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   899
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   900
90ce3da70b43 Initial load
duke
parents:
diff changeset
   901
            if (success == true) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   902
                setOriginal();
11129
f9ad1aadf3fa 7116445: Miscellaneous warnings in the JDBC/RowSet classes
lancea
parents: 9537
diff changeset
   903
            } else if (!(success) ) {
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   904
                throw new SyncProviderException(resBundle.handleGetObject("cachedrowsetimpl.accfailed").toString());
90ce3da70b43 Initial load
duke
parents:
diff changeset
   905
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   906
90ce3da70b43 Initial load
duke
parents:
diff changeset
   907
        } catch (SyncProviderException spe) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   908
               throw spe;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   909
        } catch (SQLException e) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   910
            e.printStackTrace();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   911
            throw new SyncProviderException(e.getMessage());
90ce3da70b43 Initial load
duke
parents:
diff changeset
   912
        } catch (SecurityException e) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   913
            throw new SyncProviderException(e.getMessage());
90ce3da70b43 Initial load
duke
parents:
diff changeset
   914
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   915
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   916
90ce3da70b43 Initial load
duke
parents:
diff changeset
   917
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   918
     * Propagates all row update, insert, and delete changes to the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   919
     * data source backing this <code>CachedRowSetImpl</code> object
90ce3da70b43 Initial load
duke
parents:
diff changeset
   920
     * using the given <code>Connection</code> object.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   921
     * <P>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   922
     * The reference implementation <code>RIOptimisticProvider</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   923
     * modifies its synchronization to a write back function given
90ce3da70b43 Initial load
duke
parents:
diff changeset
   924
     * the updated connection
90ce3da70b43 Initial load
duke
parents:
diff changeset
   925
     * The reference implementation modifies its synchronization behaviour
90ce3da70b43 Initial load
duke
parents:
diff changeset
   926
     * via the <code>SyncProvider</code> to ensure the synchronization
90ce3da70b43 Initial load
duke
parents:
diff changeset
   927
     * occurs according to the updated JDBC <code>Connection</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   928
     * properties.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   929
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   930
     * @param con a standard JDBC <code>Connection</code> object
90ce3da70b43 Initial load
duke
parents:
diff changeset
   931
     * @throws SQLException if the cursor is on the insert row or the underlying
90ce3da70b43 Initial load
duke
parents:
diff changeset
   932
     *                   synchronization provider fails to commit the updates
90ce3da70b43 Initial load
duke
parents:
diff changeset
   933
     *                   back to the data source
90ce3da70b43 Initial load
duke
parents:
diff changeset
   934
     * @see #acceptChanges
90ce3da70b43 Initial load
duke
parents:
diff changeset
   935
     * @see javax.sql.RowSetWriter
90ce3da70b43 Initial load
duke
parents:
diff changeset
   936
     * @see javax.sql.rowset.spi.SyncFactory
90ce3da70b43 Initial load
duke
parents:
diff changeset
   937
     * @see javax.sql.rowset.spi.SyncProvider
90ce3da70b43 Initial load
duke
parents:
diff changeset
   938
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   939
    public void acceptChanges(Connection con) throws SyncProviderException{
9257
53e6d7bc31b0 7035615: Address lint warnings for javax.sql.rowset & com.sun.rowset
lancea
parents: 6697
diff changeset
   940
      setConnection(con);
53e6d7bc31b0 7035615: Address lint warnings for javax.sql.rowset & com.sun.rowset
lancea
parents: 6697
diff changeset
   941
      acceptChanges();
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   942
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   943
90ce3da70b43 Initial load
duke
parents:
diff changeset
   944
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   945
     * Restores this <code>CachedRowSetImpl</code> object to its original state,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   946
     * that is, its state before the last set of changes.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   947
     * <P>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   948
     * Before returning, this method moves the cursor before the first row
90ce3da70b43 Initial load
duke
parents:
diff changeset
   949
     * and sends a <code>rowSetChanged</code> event to all registered
90ce3da70b43 Initial load
duke
parents:
diff changeset
   950
     * listeners.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   951
     * @throws SQLException if an error is occurs rolling back the RowSet
90ce3da70b43 Initial load
duke
parents:
diff changeset
   952
     *           state to the definied original value.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   953
     * @see javax.sql.RowSetListener#rowSetChanged
90ce3da70b43 Initial load
duke
parents:
diff changeset
   954
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   955
    public void restoreOriginal() throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   956
        Row currentRow;
11129
f9ad1aadf3fa 7116445: Miscellaneous warnings in the JDBC/RowSet classes
lancea
parents: 9537
diff changeset
   957
        for (Iterator<?> i = rvh.iterator(); i.hasNext();) {
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   958
            currentRow = (Row)i.next();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   959
            if (currentRow.getInserted() == true) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   960
                i.remove();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   961
                --numRows;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   962
            } else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   963
                if (currentRow.getDeleted() == true) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   964
                    currentRow.clearDeleted();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   965
                }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   966
                if (currentRow.getUpdated() == true) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   967
                    currentRow.clearUpdated();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   968
                }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   969
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   970
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   971
        // move to before the first
90ce3da70b43 Initial load
duke
parents:
diff changeset
   972
        cursorPos = 0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   973
90ce3da70b43 Initial load
duke
parents:
diff changeset
   974
        // notify any listeners
90ce3da70b43 Initial load
duke
parents:
diff changeset
   975
        notifyRowSetChanged();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   976
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   977
90ce3da70b43 Initial load
duke
parents:
diff changeset
   978
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   979
     * Releases the current contents of this <code>CachedRowSetImpl</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   980
     * object and sends a <code>rowSetChanged</code> event object to all
90ce3da70b43 Initial load
duke
parents:
diff changeset
   981
     * registered listeners.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   982
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   983
     * @throws SQLException if an error occurs flushing the contents of
90ce3da70b43 Initial load
duke
parents:
diff changeset
   984
     *           RowSet.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   985
     * @see javax.sql.RowSetListener#rowSetChanged
90ce3da70b43 Initial load
duke
parents:
diff changeset
   986
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   987
    public void release() throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   988
        initContainer();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   989
        notifyRowSetChanged();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   990
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   991
90ce3da70b43 Initial load
duke
parents:
diff changeset
   992
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   993
     * Cancels deletion of the current row and notifies listeners that
90ce3da70b43 Initial load
duke
parents:
diff changeset
   994
     * a row has changed.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   995
     * <P>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   996
     * Note:  This method can be ignored if deleted rows are not being shown,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   997
     * which is the normal case.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   998
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   999
     * @throws SQLException if the cursor is not on a valid row
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1000
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1001
    public void undoDelete() throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1002
        if (getShowDeleted() == false) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1003
            return;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1004
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1005
        // make sure we are on a row
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1006
        checkCursor();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1007
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1008
        // don't want this to happen...
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1009
        if (onInsertRow == true) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1010
            throw new SQLException(resBundle.handleGetObject("cachedrowsetimpl.invalidcp").toString());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1011
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1012
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1013
        Row currentRow = (Row)getCurrentRow();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1014
        if (currentRow.getDeleted() == true) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1015
            currentRow.clearDeleted();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1016
            --numDeleted;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1017
            notifyRowChanged();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1018
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1019
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1020
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1021
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1022
     * Immediately removes the current row from this
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1023
     * <code>CachedRowSetImpl</code> object if the row has been inserted, and
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1024
     * also notifies listeners the a row has changed.  An exception is thrown
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1025
     * if the row is not a row that has been inserted or the cursor is before
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1026
     * the first row, after the last row, or on the insert row.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1027
     * <P>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1028
     * This operation cannot be undone.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1029
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1030
     * @throws SQLException if an error occurs,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1031
     *                         the cursor is not on a valid row,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1032
     *                         or the row has not been inserted
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1033
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1034
    public void undoInsert() throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1035
        // make sure we are on a row
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1036
        checkCursor();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1037
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1038
        // don't want this to happen...
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1039
        if (onInsertRow == true) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1040
            throw new SQLException(resBundle.handleGetObject("cachedrowsetimpl.invalidcp").toString());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1041
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1042
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1043
        Row currentRow = (Row)getCurrentRow();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1044
        if (currentRow.getInserted() == true) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1045
            rvh.remove(cursorPos-1);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1046
            --numRows;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1047
            notifyRowChanged();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1048
        } else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1049
            throw new SQLException(resBundle.handleGetObject("cachedrowsetimpl.illegalop").toString());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1050
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1051
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1052
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1053
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1054
     * Immediately reverses the last update operation if the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1055
     * row has been modified. This method can be
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1056
     * called to reverse updates on a all columns until all updates in a row have
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1057
     * been rolled back to their originating state since the last synchronization
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1058
     * (<code>acceptChanges</code>) or population. This method may also be called
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1059
     * while performing updates to the insert row.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1060
     * <P>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1061
     * <code>undoUpdate</code may be called at any time during the life-time of a
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1062
     * rowset, however after a synchronization has occurs this method has no
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1063
     * affect until further modification to the RowSet data occurs.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1064
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1065
     * @throws SQLException if cursor is before the first row, after the last
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1066
     *     row in rowset.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1067
     * @see #undoDelete
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1068
     * @see #undoInsert
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1069
     * @see java.sql.ResultSet#cancelRowUpdates
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1070
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1071
    public void undoUpdate() throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1072
        // if on insert row, cancel the insert row
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1073
        // make the insert row flag,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1074
        // cursorPos back to the current row
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1075
        moveToCurrentRow();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1076
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1077
        // else if not on insert row
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1078
        // call undoUpdate or undoInsert
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1079
        undoDelete();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1080
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1081
        undoInsert();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1082
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1083
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1084
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1085
    //--------------------------------------------------------------------
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1086
    // Views
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1087
    //--------------------------------------------------------------------
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1088
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1089
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1090
     * Returns a new <code>RowSet</code> object backed by the same data as
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1091
     * that of this <code>CachedRowSetImpl</code> object and sharing a set of cursors
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1092
     * with it. This allows cursors to interate over a shared set of rows, providing
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1093
     * multiple views of the underlying data.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1094
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1095
     * @return a <code>RowSet</code> object that is a copy of this <code>CachedRowSetImpl</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1096
     * object and shares a set of cursors with it
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1097
     * @throws SQLException if an error occurs or cloning is
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1098
     *                         not supported
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1099
     * @see javax.sql.RowSetEvent
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1100
     * @see javax.sql.RowSetListener
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1101
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1102
    public RowSet createShared() throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1103
        RowSet clone;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1104
        try {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1105
            clone = (RowSet)clone();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1106
        } catch (CloneNotSupportedException ex) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1107
            throw new SQLException(ex.getMessage());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1108
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1109
        return clone;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1110
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1111
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1112
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1113
     * Returns a new <code>RowSet</code> object containing by the same data
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1114
     * as this <code>CachedRowSetImpl</code> object.  This method
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1115
     * differs from the method <code>createCopy</code> in that it throws a
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1116
     * <code>CloneNotSupportedException</code> object instead of an
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1117
     * <code>SQLException</code> object, as the method <code>createShared</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1118
     * does.  This <code>clone</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1119
     * method is called internally by the method <code>createShared</code>,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1120
     * which catches the <code>CloneNotSupportedException</code> object
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1121
     * and in turn throws a new <code>SQLException</code> object.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1122
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1123
     * @return a copy of this <code>CachedRowSetImpl</code> object
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1124
     * @throws CloneNotSupportedException if an error occurs when
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1125
     * attempting to clone this <code>CachedRowSetImpl</code> object
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1126
     * @see #createShared
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1127
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1128
    protected Object clone() throws CloneNotSupportedException  {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1129
        return (super.clone());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1130
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1131
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1132
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1133
     * Creates a <code>RowSet</code> object that is a deep copy of
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1134
     * this <code>CachedRowSetImpl</code> object's data, including
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1135
     * constraints.  Updates made
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1136
     * on a copy are not visible to the original rowset;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1137
     * a copy of a rowset is completely independent from the original.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1138
     * <P>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1139
     * Making a copy saves the cost of creating an identical rowset
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1140
     * from first principles, which can be quite expensive.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1141
     * For example, it can eliminate the need to query a
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1142
     * remote database server.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1143
     * @return a new <code>CachedRowSet</code> object that is a deep copy
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1144
     *           of this <code>CachedRowSet</code> object and is
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1145
     *           completely independent from this <code>CachedRowSetImpl</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1146
     *           object.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1147
     * @throws SQLException if an error occurs in generating the copy of this
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1148
     *           of the <code>CachedRowSetImpl</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1149
     * @see #createShared
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1150
     * @see javax.sql.RowSetEvent
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1151
     * @see javax.sql.RowSetListener
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1152
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1153
    public CachedRowSet createCopy() throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1154
        ObjectOutputStream out;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1155
        ByteArrayOutputStream bOut = new ByteArrayOutputStream();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1156
        try {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1157
            out = new ObjectOutputStream(bOut);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1158
            out.writeObject(this);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1159
        } catch (IOException ex) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1160
            throw new SQLException(MessageFormat.format(resBundle.handleGetObject("cachedrowsetimpl.clonefail").toString() , ex.getMessage()));
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1161
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1162
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1163
        ObjectInputStream in;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1164
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1165
        try {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1166
            ByteArrayInputStream bIn = new ByteArrayInputStream(bOut.toByteArray());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1167
            in = new ObjectInputStream(bIn);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1168
        } catch (StreamCorruptedException ex) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1169
            throw new SQLException(MessageFormat.format(resBundle.handleGetObject("cachedrowsetimpl.clonefail").toString() , ex.getMessage()));
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1170
        } catch (IOException ex) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1171
            throw new SQLException(MessageFormat.format(resBundle.handleGetObject("cachedrowsetimpl.clonefail").toString() , ex.getMessage()));
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1172
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1173
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1174
        try {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1175
            //return ((CachedRowSet)(in.readObject()));
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1176
            CachedRowSetImpl crsTemp = (CachedRowSetImpl)in.readObject();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1177
            crsTemp.resBundle = this.resBundle;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1178
            return ((CachedRowSet)crsTemp);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1179
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1180
        } catch (ClassNotFoundException ex) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1181
            throw new SQLException(MessageFormat.format(resBundle.handleGetObject("cachedrowsetimpl.clonefail").toString() , ex.getMessage()));
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1182
        } catch (OptionalDataException ex) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1183
            throw new SQLException(MessageFormat.format(resBundle.handleGetObject("cachedrowsetimpl.clonefail").toString() , ex.getMessage()));
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1184
        } catch (IOException ex) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1185
            throw new SQLException(MessageFormat.format(resBundle.handleGetObject("cachedrowsetimpl.clonefail").toString() , ex.getMessage()));
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1186
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1187
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1188
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1189
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1190
     * Creates a <code>RowSet</code> object that is a copy of
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1191
     * this <code>CachedRowSetImpl</code> object's table structure
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1192
     * and the constraints only.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1193
     * There will be no data in the object being returned.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1194
     * Updates made on a copy are not visible to the original rowset.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1195
     * <P>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1196
     * This helps in getting the underlying XML schema which can
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1197
     * be used as the basis for populating a <code>WebRowSet</code>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1198
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1199
     * @return a new <code>CachedRowSet</code> object that is a copy
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1200
     * of this <code>CachedRowSetImpl</code> object's schema and
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1201
     * retains all the constraints on the original rowset but contains
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1202
     * no data
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1203
     * @throws SQLException if an error occurs in generating the copy
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1204
     * of the <code>CachedRowSet</code> object
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1205
     * @see #createShared
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1206
     * @see #createCopy
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1207
     * @see #createCopyNoConstraints
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1208
     * @see javax.sql.RowSetEvent
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1209
     * @see javax.sql.RowSetListener
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1210
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1211
    public CachedRowSet createCopySchema() throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1212
        // Copy everything except data i.e all constraints
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1213
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1214
        // Store the number of rows of "this"
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1215
        // and make numRows equals zero.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1216
        // and make data also zero.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1217
        int nRows = numRows;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1218
        numRows = 0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1219
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1220
        CachedRowSet crs = this.createCopy();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1221
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1222
        // reset this object back to number of rows.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1223
        numRows = nRows;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1224
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1225
        return crs;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1226
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1227
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1228
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1229
     * Creates a <code>CachedRowSet</code> object that is a copy of
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1230
     * this <code>CachedRowSetImpl</code> object's data only.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1231
     * All constraints set in this object will not be there
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1232
     * in the returning object.  Updates made
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1233
     * on a copy are not visible to the original rowset.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1234
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1235
     * @return a new <code>CachedRowSet</code> object that is a deep copy
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1236
     * of this <code>CachedRowSetImpl</code> object and is
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1237
     * completely independent from this <code>CachedRowSetImpl</code> object
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1238
     * @throws SQLException if an error occurs in generating the copy of the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1239
     * of the <code>CachedRowSet</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1240
     * @see #createShared
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1241
     * @see #createCopy
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1242
     * @see #createCopySchema
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1243
     * @see javax.sql.RowSetEvent
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1244
     * @see javax.sql.RowSetListener
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1245
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1246
    public CachedRowSet createCopyNoConstraints() throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1247
        // Copy the whole data ONLY without any constraints.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1248
        CachedRowSetImpl crs;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1249
        crs = (CachedRowSetImpl)this.createCopy();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1250
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1251
        crs.initProperties();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1252
        try {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1253
            crs.unsetMatchColumn(crs.getMatchColumnIndexes());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1254
        } catch(SQLException sqle) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1255
            //do nothing, if the setMatchColumn is not set.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1256
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1257
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1258
        try {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1259
            crs.unsetMatchColumn(crs.getMatchColumnNames());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1260
        } catch(SQLException sqle) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1261
            //do nothing, if the setMatchColumn is not set.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1262
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1263
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1264
        return crs;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1265
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1266
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1267
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1268
     * Converts this <code>CachedRowSetImpl</code> object to a collection
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1269
     * of tables. The sample implementation utilitizes the <code>TreeMap</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1270
     * collection type.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1271
     * This class guarantees that the map will be in ascending key order,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1272
     * sorted according to the natural order for the key's class.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1273
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1274
     * @return a <code>Collection</code> object consisting of tables,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1275
     *         each of which is a copy of a row in this
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1276
     *         <code>CachedRowSetImpl</code> object
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1277
     * @throws SQLException if an error occurs in generating the collection
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1278
     * @see #toCollection(int)
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1279
     * @see #toCollection(String)
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1280
     * @see java.util.TreeMap
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1281
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1282
    public Collection<?> toCollection() throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1283
9257
53e6d7bc31b0 7035615: Address lint warnings for javax.sql.rowset & com.sun.rowset
lancea
parents: 6697
diff changeset
  1284
        TreeMap<Integer, Object> tMap = new TreeMap<>();
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1285
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1286
        for (int i = 0; i<numRows; i++) {
11129
f9ad1aadf3fa 7116445: Miscellaneous warnings in the JDBC/RowSet classes
lancea
parents: 9537
diff changeset
  1287
            tMap.put(i, rvh.get(i));
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1288
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1289
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1290
        return (tMap.values());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1291
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1292
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1293
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1294
     * Returns the specified column of this <code>CachedRowSetImpl</code> object
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1295
     * as a <code>Collection</code> object.  This method makes a copy of the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1296
     * column's data and utilitizes the <code>Vector</code> to establish the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1297
     * collection. The <code>Vector</code> class implements a growable array
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1298
     * objects allowing the individual components to be accessed using an
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1299
     * an integer index similar to that of an array.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1300
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1301
     * @return a <code>Collection</code> object that contains the value(s)
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1302
     *         stored in the specified column of this
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1303
     *         <code>CachedRowSetImpl</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1304
     *         object
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1305
     * @throws SQLException if an error occurs generated the collection; or
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1306
     *          an invalid column is provided.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1307
     * @see #toCollection()
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1308
     * @see #toCollection(String)
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1309
     * @see java.util.Vector
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1310
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1311
    public Collection<?> toCollection(int column) throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1312
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1313
        int nRows = numRows;
9257
53e6d7bc31b0 7035615: Address lint warnings for javax.sql.rowset & com.sun.rowset
lancea
parents: 6697
diff changeset
  1314
        Vector<Object> vec = new Vector<>(nRows);
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1315
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1316
        // create a copy
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1317
        CachedRowSetImpl crsTemp;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1318
        crsTemp = (CachedRowSetImpl) this.createCopy();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1319
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1320
        while(nRows!=0) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1321
            crsTemp.next();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1322
            vec.add(crsTemp.getObject(column));
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1323
            nRows--;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1324
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1325
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1326
        return (Collection)vec;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1327
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1328
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1329
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1330
     * Returns the specified column of this <code>CachedRowSetImpl</code> object
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1331
     * as a <code>Collection</code> object.  This method makes a copy of the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1332
     * column's data and utilitizes the <code>Vector</code> to establish the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1333
     * collection. The <code>Vector</code> class implements a growable array
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1334
     * objects allowing the individual components to be accessed using an
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1335
     * an integer index similar to that of an array.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1336
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1337
     * @return a <code>Collection</code> object that contains the value(s)
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1338
     *         stored in the specified column of this
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1339
     *         <code>CachedRowSetImpl</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1340
     *         object
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1341
     * @throws SQLException if an error occurs generated the collection; or
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1342
     *          an invalid column is provided.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1343
     * @see #toCollection()
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1344
     * @see #toCollection(int)
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1345
     * @see java.util.Vector
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1346
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1347
    public Collection<?> toCollection(String column) throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1348
        return toCollection(getColIdxByName(column));
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1349
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1350
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1351
    //--------------------------------------------------------------------
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1352
    // Advanced features
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1353
    //--------------------------------------------------------------------
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1354
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1355
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1356
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1357
     * Returns the <code>SyncProvider</code> implementation being used
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1358
     * with this <code>CachedRowSetImpl</code> implementation rowset.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1359
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1360
     * @return the SyncProvider used by the rowset. If not provider was
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1361
     *          set when the rowset was instantiated, the reference
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1362
     *          implementation (default) provider is returned.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1363
     * @throws SQLException if error occurs while return the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1364
     *          <code>SyncProvider</code> instance.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1365
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1366
    public SyncProvider getSyncProvider() throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1367
        return provider;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1368
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1369
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1370
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1371
     * Sets the active <code>SyncProvider</code> and attempts to load
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1372
     * load the new provider using the <code>SyncFactory</code> SPI.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1373
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1374
     * @throws SQLException if an error occurs while resetting the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1375
     *          <code>SyncProvider</code>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1376
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1377
    public void setSyncProvider(String providerStr) throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1378
        provider =
11129
f9ad1aadf3fa 7116445: Miscellaneous warnings in the JDBC/RowSet classes
lancea
parents: 9537
diff changeset
  1379
        SyncFactory.getInstance(providerStr);
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1380
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1381
        rowSetReader = provider.getRowSetReader();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1382
        rowSetWriter = provider.getRowSetWriter();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1383
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1384
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1385
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1386
    //-----------------
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1387
    // methods inherited from RowSet
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1388
    //-----------------
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1389
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1390
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1391
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1392
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1393
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1394
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1395
    //---------------------------------------------------------------------
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1396
    // Reading and writing data
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1397
    //---------------------------------------------------------------------
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1398
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1399
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1400
     * Populates this <code>CachedRowSetImpl</code> object with data.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1401
     * This form of the method uses the rowset's user, password, and url or
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1402
     * data source name properties to create a database
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1403
     * connection.  If properties that are needed
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1404
     * have not been set, this method will throw an exception.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1405
     * <P>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1406
     * Another form of this method uses an existing JDBC <code>Connection</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1407
     * object instead of creating a new one; therefore, it ignores the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1408
     * properties used for establishing a new connection.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1409
     * <P>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1410
     * The query specified by the command property is executed to create a
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1411
     * <code>ResultSet</code> object from which to retrieve data.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1412
     * The current contents of the rowset are discarded, and the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1413
     * rowset's metadata is also (re)set.  If there are outstanding updates,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1414
     * they are also ignored.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1415
     * <P>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1416
     * The method <code>execute</code> closes any database connections that it
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1417
     * creates.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1418
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1419
     * @throws SQLException if an error occurs or the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1420
     *                         necessary properties have not been set
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1421
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1422
    public void execute() throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1423
        execute(null);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1424
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1425
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1426
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1427
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1428
    //-----------------------------------
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1429
    // Methods inherited from ResultSet
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1430
    //-----------------------------------
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1431
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1432
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1433
     * Moves the cursor down one row from its current position and
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1434
     * returns <code>true</code> if the new cursor position is a
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1435
     * valid row.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1436
     * The cursor for a new <code>ResultSet</code> object is initially
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1437
     * positioned before the first row. The first call to the method
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1438
     * <code>next</code> moves the cursor to the first row, making it
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1439
     * the current row; the second call makes the second row the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1440
     * current row, and so on.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1441
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1442
     * <P>If an input stream from the previous row is open, it is
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1443
     * implicitly closed. The <code>ResultSet</code> object's warning
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1444
     * chain is cleared when a new row is read.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1445
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1446
     * @return <code>true</code> if the new current row is valid;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1447
     *         <code>false</code> if there are no more rows
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1448
     * @throws SQLException if an error occurs or
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1449
     *            the cursor is not positioned in the rowset, before
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1450
     *            the first row, or after the last row
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1451
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1452
    public boolean next() throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1453
        /*
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1454
         * make sure things look sane. The cursor must be
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1455
         * positioned in the rowset or before first (0) or
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1456
         * after last (numRows + 1)
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1457
         */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1458
        if (cursorPos < 0 || cursorPos >= numRows + 1) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1459
            throw new SQLException(resBundle.handleGetObject("cachedrowsetimpl.invalidcp").toString());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1460
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1461
        // now move and notify
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1462
        boolean ret = this.internalNext();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1463
        notifyCursorMoved();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1464
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1465
        return ret;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1466
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1467
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1468
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1469
     * Moves this <code>CachedRowSetImpl</code> object's cursor to the next
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1470
     * row and returns <code>true</code> if the cursor is still in the rowset;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1471
     * returns <code>false</code> if the cursor has moved to the position after
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1472
     * the last row.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1473
     * <P>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1474
     * This method handles the cases where the cursor moves to a row that
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1475
     * has been deleted.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1476
     * If this rowset shows deleted rows and the cursor moves to a row
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1477
     * that has been deleted, this method moves the cursor to the next
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1478
     * row until the cursor is on a row that has not been deleted.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1479
     * <P>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1480
     * The method <code>internalNext</code> is called by methods such as
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1481
     * <code>next</code>, <code>absolute</code>, and <code>relative</code>,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1482
     * and, as its name implies, is only called internally.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1483
     * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1484
     * This is a implementation only method and is not required as a standard
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1485
     * implementation of the <code>CachedRowSet</code> interface.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1486
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1487
     * @return <code>true</code> if the cursor is on a valid row in this
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1488
     *         rowset; <code>false</code> if it is after the last row
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1489
     * @throws SQLException if an error occurs
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1490
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1491
    protected boolean internalNext() throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1492
        boolean ret = false;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1493
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1494
        do {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1495
            if (cursorPos < numRows) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1496
                ++cursorPos;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1497
                ret = true;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1498
            } else if (cursorPos == numRows) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1499
                // increment to after last
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1500
                ++cursorPos;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1501
                ret = false;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1502
                break;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1503
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1504
        } while ((getShowDeleted() == false) && (rowDeleted() == true));
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1505
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1506
        /* each call to internalNext may increment cursorPos multiple
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1507
         * times however, the absolutePos only increments once per call.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1508
         */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1509
        if (ret == true)
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1510
            absolutePos++;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1511
        else
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1512
            absolutePos = 0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1513
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1514
        return ret;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1515
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1516
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1517
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1518
     * Closes this <code>CachedRowSetImpl</code> objecy and releases any resources
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1519
     * it was using.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1520
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1521
     * @throws SQLException if an error occurs when releasing any resources in use
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1522
     * by this <code>CachedRowSetImpl</code> object
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1523
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1524
    public void close() throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1525
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1526
        // close all data structures holding
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1527
        // the disconnected rowset
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1528
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1529
        cursorPos = 0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1530
        absolutePos = 0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1531
        numRows = 0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1532
        numDeleted = 0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1533
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1534
        // set all insert(s), update(s) & delete(s),
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1535
        // if at all, to their initial values.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1536
        initProperties();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1537
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1538
        // clear the vector of it's present contents
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1539
        rvh.clear();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1540
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1541
        // this will make it eligible for gc
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1542
        // rvh = null;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1543
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1544
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1545
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1546
     * Reports whether the last column read was SQL <code>NULL</code>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1547
     * Note that you must first call the method <code>getXXX</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1548
     * on a column to try to read its value and then call the method
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1549
     * <code>wasNull</code> to determine whether the value was
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1550
     * SQL <code>NULL</code>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1551
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1552
     * @return <code>true</code> if the value in the last column read
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1553
     *         was SQL <code>NULL</code>; <code>false</code> otherwise
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1554
     * @throws SQLException if an error occurs
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1555
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1556
    public boolean wasNull() throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1557
        return lastValueNull;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1558
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1559
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1560
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1561
     * Sets the field <code>lastValueNull</code> to the given
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1562
     * <code>boolean</code> value.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1563
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1564
     * @param value <code>true</code> to indicate that the value of
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1565
     *        the last column read was SQL <code>NULL</code>;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1566
     *        <code>false</code> to indicate that it was not
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1567
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1568
    private void setLastValueNull(boolean value) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1569
        lastValueNull = value;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1570
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1571
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1572
    // Methods for accessing results by column index
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1573
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1574
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1575
     * Checks to see whether the given index is a valid column number
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1576
     * in this <code>CachedRowSetImpl</code> object and throws
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1577
     * an <code>SQLException</code> if it is not. The index is out of bounds
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1578
     * if it is less than <code>1</code> or greater than the number of
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1579
     * columns in this rowset.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1580
     * <P>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1581
     * This method is called internally by the <code>getXXX</code> and
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1582
     * <code>updateXXX</code> methods.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1583
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1584
     * @param idx the number of a column in this <code>CachedRowSetImpl</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1585
     *            object; must be between <code>1</code> and the number of
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1586
     *            rows in this rowset
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1587
     * @throws SQLException if the given index is out of bounds
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1588
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1589
    private void checkIndex(int idx) throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1590
        if (idx < 1 || idx > RowSetMD.getColumnCount()) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1591
            throw new SQLException(resBundle.handleGetObject("cachedrowsetimpl.invalidcol").toString());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1592
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1593
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1594
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1595
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1596
     * Checks to see whether the cursor for this <code>CachedRowSetImpl</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1597
     * object is on a row in the rowset and throws an
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1598
     * <code>SQLException</code> if it is not.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1599
     * <P>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1600
     * This method is called internally by <code>getXXX</code> methods, by
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1601
     * <code>updateXXX</code> methods, and by methods that update, insert,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1602
     * or delete a row or that cancel a row update, insert, or delete.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1603
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1604
     * @throws SQLException if the cursor for this <code>CachedRowSetImpl</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1605
     *         object is not on a valid row
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1606
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1607
    private void checkCursor() throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1608
        if (isAfterLast() == true || isBeforeFirst() == true) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1609
            throw new SQLException(resBundle.handleGetObject("cachedrowsetimpl.invalidcp").toString());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1610
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1611
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1612
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1613
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1614
     * Returns the column number of the column with the given name in this
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1615
     * <code>CachedRowSetImpl</code> object.  This method throws an
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1616
     * <code>SQLException</code> if the given name is not the name of
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1617
     * one of the columns in this rowset.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1618
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1619
     * @param name a <code>String</code> object that is the name of a column in
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1620
     *              this <code>CachedRowSetImpl</code> object
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1621
     * @throws SQLException if the given name does not match the name of one of
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1622
     *         the columns in this rowset
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1623
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1624
    private int getColIdxByName(String name) throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1625
        RowSetMD = (RowSetMetaDataImpl)this.getMetaData();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1626
        int cols = RowSetMD.getColumnCount();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1627
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1628
        for (int i=1; i <= cols; ++i) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1629
            String colName = RowSetMD.getColumnName(i);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1630
            if (colName != null)
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1631
                if (name.equalsIgnoreCase(colName))
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1632
                    return (i);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1633
                else
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1634
                    continue;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1635
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1636
        throw new SQLException(resBundle.handleGetObject("cachedrowsetimpl.invalcolnm").toString());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1637
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1638
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1639
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1640
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1641
     * Returns the insert row or the current row of this
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1642
     * <code>CachedRowSetImpl</code>object.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1643
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1644
     * @return the <code>Row</code> object on which this <code>CachedRowSetImpl</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1645
     * objects's cursor is positioned
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1646
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1647
    protected BaseRow getCurrentRow() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1648
        if (onInsertRow == true) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1649
            return (BaseRow)insertRow;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1650
        } else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1651
            return (BaseRow)(rvh.get(cursorPos - 1));
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1652
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1653
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1654
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1655
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1656
     * Removes the row on which the cursor is positioned.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1657
     * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1658
     * This is a implementation only method and is not required as a standard
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1659
     * implementation of the <code>CachedRowSet</code> interface.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1660
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1661
     * @throws SQLException if the cursor is positioned on the insert
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1662
     *            row
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1663
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1664
    protected void removeCurrentRow() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1665
        ((Row)getCurrentRow()).setDeleted();
9537
bfddc73b74b9 7040150: Indexing Error in CachedRowSetImpl.removeCurrentRow
lancea
parents: 9257
diff changeset
  1666
        rvh.remove(cursorPos - 1);
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1667
        --numRows;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1668
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1669
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1670
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1671
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1672
     * Retrieves the value of the designated column in the current row
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1673
     * of this <code>CachedRowSetImpl</code> object as a
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1674
     * <code>String</code> object.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1675
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1676
     * @param columnIndex the first column is <code>1</code>, the second
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1677
     *        is <code>2</code>, and so on; must be <code>1</code> or larger
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1678
     *        and equal to or less than the number of columns in the rowset
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1679
     * @return the column value; if the value is SQL <code>NULL</code>, the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1680
     *         result is <code>null</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1681
     * @throws SQLException if (1) the given column index is out of bounds,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1682
     * (2) the cursor is not on one of this rowset's rows or its
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1683
     * insert row, or (3) the designated column does not store an
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1684
     * SQL <code>TINYINT, SMALLINT, INTEGER, BIGINT, REAL,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1685
     * FLOAT, DOUBLE, DECIMAL, NUMERIC, BIT, <b>CHAR</b>, <b>VARCHAR</b></code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1686
     * or <code>LONGVARCHAR</code> value. The bold SQL type designates the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1687
     * recommended return type.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1688
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1689
    public String getString(int columnIndex) throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1690
        Object value;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1691
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1692
        // sanity check.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1693
        checkIndex(columnIndex);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1694
        // make sure the cursor is on a valid row
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1695
        checkCursor();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1696
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1697
        setLastValueNull(false);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1698
        value = getCurrentRow().getColumnObject(columnIndex);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1699
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1700
        // check for SQL NULL
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1701
        if (value == null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1702
            setLastValueNull(true);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1703
            return null;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1704
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1705
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1706
        return value.toString();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1707
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1708
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1709
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1710
     * Retrieves the value of the designated column in the current row
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1711
     * of this <code>CachedRowSetImpl</code> object as a
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1712
     * <code>boolean</code> value.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1713
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1714
     * @param columnIndex the first column is <code>1</code>, the second
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1715
     *        is <code>2</code>, and so on; must be <code>1</code> or larger
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1716
     *        and equal to or less than the number of columns in the rowset
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1717
     * @return the column value as a <code>boolean</code> in the Java progamming language;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1718
     *        if the value is SQL <code>NULL</code>, the result is <code>false</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1719
     * @throws SQLException if (1) the given column index is out of bounds,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1720
     *            (2) the cursor is not on one of this rowset's rows or its
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1721
     *            insert row, or (3) the designated column does not store an
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1722
     *            SQL <code>BOOLEAN</code> value
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1723
     * @see #getBoolean(String)
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1724
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1725
    public boolean getBoolean(int columnIndex) throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1726
        Object value;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1727
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1728
        // sanity check.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1729
        checkIndex(columnIndex);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1730
        // make sure the cursor is on a valid row
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1731
        checkCursor();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1732
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1733
        setLastValueNull(false);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1734
        value = getCurrentRow().getColumnObject(columnIndex);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1735
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1736
        // check for SQL NULL
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1737
        if (value == null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1738
            setLastValueNull(true);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1739
            return false;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1740
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1741
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1742
        // check for Boolean...
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1743
        if (value instanceof Boolean) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1744
            return ((Boolean)value).booleanValue();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1745
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1746
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1747
        // convert to a Double and compare to zero
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1748
        try {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1749
            Double d = new Double(value.toString());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1750
            if (d.compareTo(new Double((double)0)) == 0) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1751
                return false;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1752
            } else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1753
                return true;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1754
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1755
        } catch (NumberFormatException ex) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1756
            throw new SQLException(MessageFormat.format(resBundle.handleGetObject("cachedrowsetimpl.boolfail").toString(),
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1757
                  new Object[] {value.toString().trim(), columnIndex}));
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1758
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1759
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1760
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1761
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1762
     * Retrieves the value of the designated column in the current row
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1763
     * of this <code>CachedRowSetImpl</code> object as a
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1764
     * <code>byte</code> value.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1765
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1766
     * @param columnIndex the first column is <code>1</code>, the second
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1767
     *        is <code>2</code>, and so on; must be <code>1</code> or larger
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1768
     *        and equal to or less than the number of columns in the rowset
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1769
     * @return the column value as a <code>byte</code> in the Java programming
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1770
     * language; if the value is SQL <code>NULL</code>, the result is <code>0</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1771
     * @throws SQLException if (1) the given column index is out of bounds,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1772
     *            (2) the cursor is not on one of this rowset's rows or its
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1773
     *            insert row, or (3) the designated column does not store an
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1774
     *            SQL <code><b>TINYINT</b>, SMALLINT, INTEGER, BIGINT, REAL,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1775
     *            FLOAT, DOUBLE, DECIMAL, NUMERIC, BIT, CHAR, VARCHAR</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1776
     *            or <code>LONGVARCHAR</code> value. The bold SQL type
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1777
     *            designates the recommended return type.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1778
     * @see #getByte(String)
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1779
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1780
    public byte getByte(int columnIndex) throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1781
        Object value;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1782
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1783
        // sanity check.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1784
        checkIndex(columnIndex);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1785
        // make sure the cursor is on a valid row
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1786
        checkCursor();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1787
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1788
        setLastValueNull(false);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1789
        value = getCurrentRow().getColumnObject(columnIndex);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1790
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1791
        // check for SQL NULL
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1792
        if (value == null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1793
            setLastValueNull(true);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1794
            return (byte)0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1795
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1796
        try {
6697
39929804f9d4 6989139: Address JDBC Findbugs where Number type Constructor are used
lancea
parents: 6692
diff changeset
  1797
            return ((Byte.valueOf(value.toString())).byteValue());
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1798
        } catch (NumberFormatException ex) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1799
            throw new SQLException(MessageFormat.format(resBundle.handleGetObject("cachedrowsetimpl.bytefail").toString(),
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1800
                  new Object[] {value.toString().trim(), columnIndex}));
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1801
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1802
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1803
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1804
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1805
     * Retrieves the value of the designated column in the current row
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1806
     * of this <code>CachedRowSetImpl</code> object as a
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1807
     * <code>short</code> value.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1808
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1809
     * @param columnIndex the first column is <code>1</code>, the second
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1810
     *        is <code>2</code>, and so on; must be <code>1</code> or larger
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1811
     *        and equal to or less than the number of columns in the rowset
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1812
     * @return the column value; if the value is SQL <code>NULL</code>, the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1813
     *         result is <code>0</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1814
     * @throws SQLException if (1) the given column index is out of bounds,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1815
     * (2) the cursor is not on one of this rowset's rows or its
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1816
     * insert row, or (3) the designated column does not store an
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1817
     * SQL <code>TINYINT, <b>SMALLINT</b>, INTEGER, BIGINT, REAL
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1818
     * FLOAT, DOUBLE, DECIMAL, NUMERIC, BIT, CHAR, VARCHAR</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1819
     * or <code>LONGVARCHAR</code> value. The bold SQL type designates the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1820
     * recommended return type.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1821
     * @see #getShort(String)
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1822
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1823
    public short getShort(int columnIndex) throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1824
        Object value;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1825
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1826
        // sanity check.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1827
        checkIndex(columnIndex);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1828
        // make sure the cursor is on a valid row
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1829
        checkCursor();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1830
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1831
        setLastValueNull(false);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1832
        value = getCurrentRow().getColumnObject(columnIndex);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1833
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1834
        // check for SQL NULL
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1835
        if (value == null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1836
            setLastValueNull(true);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1837
            return (short)0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1838
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1839
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1840
        try {
6697
39929804f9d4 6989139: Address JDBC Findbugs where Number type Constructor are used
lancea
parents: 6692
diff changeset
  1841
            return ((Short.valueOf(value.toString().trim())).shortValue());
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1842
        } catch (NumberFormatException ex) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1843
            throw new SQLException(MessageFormat.format(resBundle.handleGetObject("cachedrowsetimpl.shortfail").toString(),
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1844
                  new Object[] {value.toString().trim(), columnIndex}));
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1845
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1846
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1847
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1848
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1849
     * Retrieves the value of the designated column in the current row
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1850
     * of this <code>CachedRowSetImpl</code> object as an
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1851
     * <code>int</code> value.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1852
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1853
     * @param columnIndex the first column is <code>1</code>, the second
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1854
     *        is <code>2</code>, and so on; must be <code>1</code> or larger
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1855
     *        and equal to or less than the number of columns in the rowset
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1856
     * @return the column value; if the value is SQL <code>NULL</code>, the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1857
     *         result is <code>0</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1858
     * @throws SQLException if (1) the given column index is out of bounds,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1859
     * (2) the cursor is not on one of this rowset's rows or its
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1860
     * insert row, or (3) the designated column does not store an
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1861
     * SQL <code>TINYINT, SMALLINT, <b>INTEGER</b>, BIGINT, REAL
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1862
     * FLOAT, DOUBLE, DECIMAL, NUMERIC, BIT, CHAR, VARCHAR</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1863
     * or <code>LONGVARCHAR</code> value. The bold SQL type designates the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1864
     * recommended return type.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1865
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1866
    public int getInt(int columnIndex) throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1867
        Object value;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1868
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1869
        // sanity check.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1870
        checkIndex(columnIndex);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1871
        // make sure the cursor is on a valid row
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1872
        checkCursor();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1873
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1874
        setLastValueNull(false);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1875
        value = getCurrentRow().getColumnObject(columnIndex);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1876
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1877
        // check for SQL NULL
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1878
        if (value == null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1879
            setLastValueNull(true);
11129
f9ad1aadf3fa 7116445: Miscellaneous warnings in the JDBC/RowSet classes
lancea
parents: 9537
diff changeset
  1880
            return 0;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1881
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1882
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1883
        try {
6697
39929804f9d4 6989139: Address JDBC Findbugs where Number type Constructor are used
lancea
parents: 6692
diff changeset
  1884
            return ((Integer.valueOf(value.toString().trim())).intValue());
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1885
        } catch (NumberFormatException ex) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1886
            throw new SQLException(MessageFormat.format(resBundle.handleGetObject("cachedrowsetimpl.intfail").toString(),
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1887
                  new Object[] {value.toString().trim(), columnIndex}));
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1888
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1889
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1890
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1891
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1892
     * Retrieves the value of the designated column in the current row
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1893
     * of this <code>CachedRowSetImpl</code> object as a
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1894
     * <code>long</code> value.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1895
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1896
     * @param columnIndex the first column is <code>1</code>, the second
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1897
     *        is <code>2</code>, and so on; must be <code>1</code> or larger
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1898
     *        and equal to or less than the number of columns in the rowset
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1899
     * @return the column value; if the value is SQL <code>NULL</code>, the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1900
     *         result is <code>0</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1901
     * @throws SQLException if (1) the given column index is out of bounds,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1902
     * (2) the cursor is not on one of this rowset's rows or its
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1903
     * insert row, or (3) the designated column does not store an
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1904
     * SQL <code>TINYINT, SMALLINT, INTEGER, <b>BIGINT</b>, REAL
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1905
     * FLOAT, DOUBLE, DECIMAL, NUMERIC, BIT, CHAR, VARCHAR</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1906
     * or <code>LONGVARCHAR</code> value. The bold SQL type designates the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1907
     * recommended return type.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1908
     * @see #getLong(String)
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1909
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1910
    public long getLong(int columnIndex) throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1911
        Object value;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1912
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1913
        // sanity check.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1914
        checkIndex(columnIndex);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1915
        // make sure the cursor is on a valid row
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1916
        checkCursor();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1917
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1918
        setLastValueNull(false);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1919
        value = getCurrentRow().getColumnObject(columnIndex);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1920
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1921
        // check for SQL NULL
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1922
        if (value == null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1923
            setLastValueNull(true);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1924
            return (long)0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1925
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1926
        try {
6697
39929804f9d4 6989139: Address JDBC Findbugs where Number type Constructor are used
lancea
parents: 6692
diff changeset
  1927
            return ((Long.valueOf(value.toString().trim())).longValue());
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1928
        } catch (NumberFormatException ex) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1929
            throw new SQLException(MessageFormat.format(resBundle.handleGetObject("cachedrowsetimpl.longfail").toString(),
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1930
                  new Object[] {value.toString().trim(), columnIndex}));
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1931
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1932
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1933
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1934
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1935
     * Retrieves the value of the designated column in the current row
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1936
     * of this <code>CachedRowSetImpl</code> object as a
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1937
     * <code>float</code> value.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1938
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1939
     * @param columnIndex the first column is <code>1</code>, the second
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1940
     *        is <code>2</code>, and so on; must be <code>1</code> or larger
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1941
     *        and equal to or less than the number of columns in the rowset
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1942
     * @return the column value; if the value is SQL <code>NULL</code>, the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1943
     *         result is <code>0</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1944
     * @throws SQLException if (1) the given column index is out of bounds,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1945
     * (2) the cursor is not on one of this rowset's rows or its
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1946
     * insert row, or (3) the designated column does not store an
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1947
     * SQL <code>TINYINT, SMALLINT, INTEGER, BIGINT, <b>REAL</b>,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1948
     * FLOAT, DOUBLE, DECIMAL, NUMERIC, BIT, CHAR, VARCHAR</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1949
     * or <code>LONGVARCHAR</code> value. The bold SQL type designates the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1950
     * recommended return type.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1951
     * @see #getFloat(String)
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1952
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1953
    public float getFloat(int columnIndex) throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1954
        Object value;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1955
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1956
        // sanity check.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1957
        checkIndex(columnIndex);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1958
        // make sure the cursor is on a valid row
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1959
        checkCursor();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1960
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1961
        setLastValueNull(false);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1962
        value = getCurrentRow().getColumnObject(columnIndex);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1963
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1964
        // check for SQL NULL
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1965
        if (value == null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1966
            setLastValueNull(true);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1967
            return (float)0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1968
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1969
        try {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1970
            return ((new Float(value.toString())).floatValue());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1971
        } catch (NumberFormatException ex) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1972
            throw new SQLException(MessageFormat.format(resBundle.handleGetObject("cachedrowsetimpl.floatfail").toString(),
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1973
                  new Object[] {value.toString().trim(), columnIndex}));
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1974
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1975
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1976
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1977
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1978
     * Retrieves the value of the designated column in the current row
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1979
     * of this <code>CachedRowSetImpl</code> object as a
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1980
     * <code>double</code> value.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1981
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1982
     * @param columnIndex the first column is <code>1</code>, the second
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1983
     *        is <code>2</code>, and so on; must be <code>1</code> or larger
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1984
     *        and equal to or less than the number of columns in the rowset
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1985
     * @return the column value; if the value is SQL <code>NULL</code>, the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1986
     *         result is <code>0</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1987
     * @throws SQLException if (1) the given column index is out of bounds,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1988
     * (2) the cursor is not on one of this rowset's rows or its
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1989
     * insert row, or (3) the designated column does not store an
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1990
     * SQL <code>TINYINT, SMALLINT, INTEGER, BIGINT, REAL,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1991
     * <b>FLOAT</b>, <b>DOUBLE</b>, DECIMAL, NUMERIC, BIT, CHAR, VARCHAR</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1992
     * or <code>LONGVARCHAR</code> value. The bold SQL type designates the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1993
     * recommended return type.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1994
     * @see #getDouble(String)
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1995
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1996
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1997
    public double getDouble(int columnIndex) throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1998
        Object value;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1999
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2000
        // sanity check.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2001
        checkIndex(columnIndex);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2002
        // make sure the cursor is on a valid row
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2003
        checkCursor();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2004
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2005
        setLastValueNull(false);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2006
        value = getCurrentRow().getColumnObject(columnIndex);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2007
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2008
        // check for SQL NULL
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2009
        if (value == null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2010
            setLastValueNull(true);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2011
            return (double)0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2012
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2013
        try {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2014
            return ((new Double(value.toString().trim())).doubleValue());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2015
        } catch (NumberFormatException ex) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2016
            throw new SQLException(MessageFormat.format(resBundle.handleGetObject("cachedrowsetimpl.doublefail").toString(),
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2017
                  new Object[] {value.toString().trim(), columnIndex}));
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2018
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2019
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2020
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2021
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2022
     * Retrieves the value of the designated column in the current row
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2023
     * of this <code>CachedRowSetImpl</code> object as a
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2024
     * <code>java.math.BigDecimal</code> object.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2025
     * <P>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2026
     * This method is deprecated; use the version of <code>getBigDecimal</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2027
     * that does not take a scale parameter and returns a value with full
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2028
     * precision.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2029
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2030
     * @param columnIndex the first column is <code>1</code>, the second
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2031
     *        is <code>2</code>, and so on; must be <code>1</code> or larger
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2032
     *        and equal to or less than the number of columns in the rowset
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2033
     * @param scale the number of digits to the right of the decimal point in the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2034
     *        value returned
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2035
     * @return the column value with the specified number of digits to the right
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2036
     *         of the decimal point; if the value is SQL <code>NULL</code>, the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2037
     *         result is <code>null</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2038
     * @throws SQLException if the given column index is out of bounds,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2039
     *            the cursor is not on a valid row, or this method fails
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2040
     * @deprecated
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2041
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2042
    public BigDecimal getBigDecimal(int columnIndex, int scale) throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2043
        Object value;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2044
        BigDecimal bDecimal, retVal;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2045
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2046
        // sanity check.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2047
        checkIndex(columnIndex);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2048
        // make sure the cursor is on a valid row
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2049
        checkCursor();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2050
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2051
        setLastValueNull(false);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2052
        value = getCurrentRow().getColumnObject(columnIndex);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2053
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2054
        // check for SQL NULL
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2055
        if (value == null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2056
            setLastValueNull(true);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2057
            return (new BigDecimal(0));
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2058
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2059
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2060
        bDecimal = this.getBigDecimal(columnIndex);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2061
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2062
        retVal = bDecimal.setScale(scale);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2063
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2064
        return retVal;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2065
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2066
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2067
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2068
     * Retrieves the value of the designated column in the current row
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2069
     * of this <code>CachedRowSetImpl</code> object as a
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2070
     * <code>byte</code> array value.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2071
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2072
     * @param columnIndex the first column is <code>1</code>, the second
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2073
     *        is <code>2</code>, and so on; must be <code>1</code> or larger
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2074
     *        and equal to or less than the number of columns in the rowset
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2075
     * @return the column value as a <code>byte</code> array in the Java programming
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2076
     * language; if the value is SQL <code>NULL</code>, the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2077
     * result is <code>null</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2078
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2079
     * @throws SQLException if (1) the given column index is out of bounds,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2080
     * (2) the cursor is not on one of this rowset's rows or its
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2081
     * insert row, or (3) the designated column does not store an
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2082
     * SQL <code><b>BINARY</b>, <b>VARBINARY</b> or
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2083
     * LONGVARBINARY</code> value.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2084
     * The bold SQL type designates the recommended return type.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2085
     * @see #getBytes(String)
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2086
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2087
    public byte[] getBytes(int columnIndex) throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2088
        // sanity check.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2089
        checkIndex(columnIndex);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2090
        // make sure the cursor is on a valid row
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2091
        checkCursor();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2092
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2093
        if (isBinary(RowSetMD.getColumnType(columnIndex)) == false) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2094
            throw new SQLException(resBundle.handleGetObject("cachedrowsetimpl.dtypemismt").toString());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2095
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2096
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2097
        return (byte[])(getCurrentRow().getColumnObject(columnIndex));
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2098
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2099
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2100
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2101
     * Retrieves the value of the designated column in the current row
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2102
     * of this <code>CachedRowSetImpl</code> object as a
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2103
     * <code>java.sql.Date</code> object.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2104
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2105
     * @param columnIndex the first column is <code>1</code>, the second
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2106
     *        is <code>2</code>, and so on; must be <code>1</code> or larger
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2107
     *        and equal to or less than the number of columns in the rowset
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2108
     * @return the column value as a <code>java.sql.Data</code> object; if
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2109
     *        the value is SQL <code>NULL</code>, the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2110
     *        result is <code>null</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2111
     * @throws SQLException if the given column index is out of bounds,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2112
     *            the cursor is not on a valid row, or this method fails
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2113
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2114
    public java.sql.Date getDate(int columnIndex) throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2115
        Object value;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2116
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2117
        // sanity check.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2118
        checkIndex(columnIndex);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2119
        // make sure the cursor is on a valid row
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2120
        checkCursor();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2121
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2122
        setLastValueNull(false);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2123
        value = getCurrentRow().getColumnObject(columnIndex);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2124
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2125
        // check for SQL NULL
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2126
        if (value == null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2127
            setLastValueNull(true);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2128
            return null;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2129
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2130
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2131
        /*
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2132
         * The object coming back from the db could be
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2133
         * a date, a timestamp, or a char field variety.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2134
         * If it's a date type return it, a timestamp
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2135
         * we turn into a long and then into a date,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2136
         * char strings we try to parse. Yuck.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2137
         */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2138
        switch (RowSetMD.getColumnType(columnIndex)) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2139
            case java.sql.Types.DATE: {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2140
                long sec = ((java.sql.Date)value).getTime();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2141
                return new java.sql.Date(sec);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2142
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2143
            case java.sql.Types.TIMESTAMP: {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2144
                long sec = ((java.sql.Timestamp)value).getTime();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2145
                return new java.sql.Date(sec);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2146
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2147
            case java.sql.Types.CHAR:
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2148
            case java.sql.Types.VARCHAR:
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2149
            case java.sql.Types.LONGVARCHAR: {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2150
                try {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2151
                    DateFormat df = DateFormat.getDateInstance();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2152
                    return ((java.sql.Date)(df.parse(value.toString())));
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2153
                } catch (ParseException ex) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2154
                    throw new SQLException(MessageFormat.format(resBundle.handleGetObject("cachedrowsetimpl.datefail").toString(),
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2155
                        new Object[] {value.toString().trim(), columnIndex}));
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2156
                }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2157
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2158
            default: {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2159
                throw new SQLException(MessageFormat.format(resBundle.handleGetObject("cachedrowsetimpl.datefail").toString(),
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2160
                        new Object[] {value.toString().trim(), columnIndex}));
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2161
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2162
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2163
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2164
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2165
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2166
     * Retrieves the value of the designated column in the current row
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2167
     * of this <code>CachedRowSetImpl</code> object as a
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2168
     * <code>java.sql.Time</code> object.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2169
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2170
     * @param columnIndex the first column is <code>1</code>, the second
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2171
     *        is <code>2</code>, and so on; must be <code>1</code> or larger
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2172
     *        and equal to or less than the number of columns in the rowset
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2173
     * @return the column value; if the value is SQL <code>NULL</code>, the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2174
     *         result is <code>null</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2175
     * @throws SQLException if the given column index is out of bounds,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2176
     *         the cursor is not on a valid row, or this method fails
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2177
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2178
    public java.sql.Time getTime(int columnIndex) throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2179
        Object value;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2180
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2181
        // sanity check.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2182
        checkIndex(columnIndex);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2183
        // make sure the cursor is on a valid row
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2184
        checkCursor();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2185
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2186
        setLastValueNull(false);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2187
        value = getCurrentRow().getColumnObject(columnIndex);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2188
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2189
        // check for SQL NULL
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2190
        if (value == null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2191
            setLastValueNull(true);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2192
            return null;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2193
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2194
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2195
        /*
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2196
         * The object coming back from the db could be
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2197
         * a date, a timestamp, or a char field variety.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2198
         * If it's a date type return it, a timestamp
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2199
         * we turn into a long and then into a date,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2200
         * char strings we try to parse. Yuck.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2201
         */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2202
        switch (RowSetMD.getColumnType(columnIndex)) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2203
            case java.sql.Types.TIME: {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2204
                return (java.sql.Time)value;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2205
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2206
            case java.sql.Types.TIMESTAMP: {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2207
                long sec = ((java.sql.Timestamp)value).getTime();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2208
                return new java.sql.Time(sec);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2209
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2210
            case java.sql.Types.CHAR:
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2211
            case java.sql.Types.VARCHAR:
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2212
            case java.sql.Types.LONGVARCHAR: {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2213
                try {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2214
                    DateFormat tf = DateFormat.getTimeInstance();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2215
                    return ((java.sql.Time)(tf.parse(value.toString())));
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2216
                } catch (ParseException ex) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2217
                    throw new SQLException(MessageFormat.format(resBundle.handleGetObject("cachedrowsetimpl.timefail").toString(),
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2218
                        new Object[] {value.toString().trim(), columnIndex}));
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2219
                }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2220
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2221
            default: {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2222
                throw new SQLException(MessageFormat.format(resBundle.handleGetObject("cachedrowsetimpl.timefail").toString(),
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2223
                        new Object[] {value.toString().trim(), columnIndex}));
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2224
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2225
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2226
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2227
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2228
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2229
     * Retrieves the value of the designated column in the current row
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2230
     * of this <code>CachedRowSetImpl</code> object as a
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2231
     * <code>java.sql.Timestamp</code> object.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2232
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2233
     * @param columnIndex the first column is <code>1</code>, the second
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2234
     *        is <code>2</code>, and so on; must be <code>1</code> or larger
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2235
     *        and equal to or less than the number of columns in the rowset
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2236
     * @return the column value; if the value is SQL <code>NULL</code>, the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2237
     *         result is <code>null</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2238
     * @throws SQLException if the given column index is out of bounds,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2239
     *            the cursor is not on a valid row, or this method fails
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2240
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2241
    public java.sql.Timestamp getTimestamp(int columnIndex) throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2242
        Object value;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2243
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2244
        // sanity check.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2245
        checkIndex(columnIndex);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2246
        // make sure the cursor is on a valid row
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2247
        checkCursor();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2248
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2249
        setLastValueNull(false);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2250
        value = getCurrentRow().getColumnObject(columnIndex);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2251
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2252
        // check for SQL NULL
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2253
        if (value == null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2254
            setLastValueNull(true);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2255
            return null;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2256
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2257
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2258
        /*
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2259
         * The object coming back from the db could be
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2260
         * a date, a timestamp, or a char field variety.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2261
         * If it's a date type return it; a timestamp
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2262
         * we turn into a long and then into a date;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2263
         * char strings we try to parse. Yuck.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2264
         */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2265
        switch (RowSetMD.getColumnType(columnIndex)) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2266
            case java.sql.Types.TIMESTAMP: {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2267
                return (java.sql.Timestamp)value;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2268
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2269
            case java.sql.Types.TIME: {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2270
                long sec = ((java.sql.Time)value).getTime();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2271
                return new java.sql.Timestamp(sec);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2272
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2273
            case java.sql.Types.DATE: {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2274
                long sec = ((java.sql.Date)value).getTime();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2275
                return new java.sql.Timestamp(sec);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2276
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2277
            case java.sql.Types.CHAR:
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2278
            case java.sql.Types.VARCHAR:
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2279
            case java.sql.Types.LONGVARCHAR: {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2280
                try {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2281
                    DateFormat tf = DateFormat.getTimeInstance();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2282
                    return ((java.sql.Timestamp)(tf.parse(value.toString())));
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2283
                } catch (ParseException ex) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2284
                    throw new SQLException(MessageFormat.format(resBundle.handleGetObject("cachedrowsetimpl.timefail").toString(),
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2285
                        new Object[] {value.toString().trim(), columnIndex}));
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2286
                }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2287
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2288
            default: {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2289
                throw new SQLException(MessageFormat.format(resBundle.handleGetObject("cachedrowsetimpl.timefail").toString(),
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2290
                        new Object[] {value.toString().trim(), columnIndex}));
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2291
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2292
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2293
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2294
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2295
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2296
     * Retrieves the value of the designated column in the current row of this
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2297
     * <code>CachedRowSetImpl</code> object as a <code>java.io.InputStream</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2298
     * object.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2299
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2300
     * A column value can be retrieved as a stream of ASCII characters
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2301
     * and then read in chunks from the stream.  This method is particularly
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2302
     * suitable for retrieving large <code>LONGVARCHAR</code> values.  The JDBC
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2303
     * driver will do any necessary conversion from the database format into ASCII.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2304
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2305
     * <P><B>Note:</B> All the data in the returned stream must be
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2306
     * read prior to getting the value of any other column. The next
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2307
     * call to a get method implicitly closes the stream. . Also, a
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2308
     * stream may return <code>0</code> for <code>CachedRowSetImpl.available()</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2309
     * whether there is data available or not.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2310
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2311
     * @param columnIndex the first column is <code>1</code>, the second
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2312
     *        is <code>2</code>, and so on; must be <code>1</code> or larger
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2313
     *        and equal to or less than the number of columns in this rowset
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2314
     * @return a Java input stream that delivers the database column value
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2315
     *         as a stream of one-byte ASCII characters.  If the value is SQL
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2316
     *         <code>NULL</code>, the result is <code>null</code>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2317
     * @throws SQLException if (1) the given column index is out of bounds,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2318
     * (2) the cursor is not on one of this rowset's rows or its
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2319
     * insert row, or (3) the designated column does not store an
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2320
     * SQL <code>CHAR, VARCHAR</code>, <code><b>LONGVARCHAR</b></code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2321
     * <code>BINARY, VARBINARY</code> or <code>LONGVARBINARY</code> value. The
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2322
     * bold SQL type designates the recommended return types that this method is
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2323
     * used to retrieve.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2324
     * @see #getAsciiStream(String)
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2325
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2326
    public java.io.InputStream getAsciiStream(int columnIndex) throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2327
        Object value;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2328
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2329
        // always free an old stream
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2330
        asciiStream = null;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2331
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2332
        // sanity check
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2333
        checkIndex(columnIndex);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2334
        //make sure the cursor is on a vlid row
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2335
        checkCursor();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2336
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2337
        value =  getCurrentRow().getColumnObject(columnIndex);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2338
        if (value == null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2339
            lastValueNull = true;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2340
            return null;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2341
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2342
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2343
        try {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2344
            if (isString(RowSetMD.getColumnType(columnIndex))) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2345
                asciiStream = new ByteArrayInputStream(((String)value).getBytes("ASCII"));
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2346
            } else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2347
                throw new SQLException(resBundle.handleGetObject("cachedrowsetimpl.dtypemismt").toString());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2348
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2349
        } catch (java.io.UnsupportedEncodingException ex) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2350
            throw new SQLException(ex.getMessage());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2351
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2352
11129
f9ad1aadf3fa 7116445: Miscellaneous warnings in the JDBC/RowSet classes
lancea
parents: 9537
diff changeset
  2353
        return asciiStream;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2354
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2355
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2356
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2357
     * A column value can be retrieved as a stream of Unicode characters
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2358
     * and then read in chunks from the stream.  This method is particularly
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2359
     * suitable for retrieving large LONGVARCHAR values.  The JDBC driver will
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2360
     * do any necessary conversion from the database format into Unicode.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2361
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2362
     * <P><B>Note:</B> All the data in the returned stream must be
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2363
     * read prior to getting the value of any other column. The next
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2364
     * call to a get method implicitly closes the stream. . Also, a
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2365
     * stream may return 0 for available() whether there is data
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2366
     * available or not.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2367
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2368
     * @param columnIndex the first column is <code>1</code>, the second
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2369
     *        is <code>2</code>, and so on; must be <code>1</code> or larger
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2370
     *        and equal to or less than the number of columns in this rowset
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2371
     * @return a Java input stream that delivers the database column value
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2372
     * as a stream of two byte Unicode characters.  If the value is SQL NULL
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2373
     * then the result is null.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2374
     * @throws SQLException if an error occurs
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2375
     * @deprecated
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2376
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2377
    public java.io.InputStream getUnicodeStream(int columnIndex) throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2378
        // always free an old stream
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2379
        unicodeStream = null;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2380
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2381
        // sanity check.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2382
        checkIndex(columnIndex);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2383
        // make sure the cursor is on a valid row
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2384
        checkCursor();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2385
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2386
        if (isBinary(RowSetMD.getColumnType(columnIndex)) == false &&
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2387
        isString(RowSetMD.getColumnType(columnIndex)) == false) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2388
            throw new SQLException(resBundle.handleGetObject("cachedrowsetimpl.dtypemismt").toString());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2389
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2390
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2391
        Object value = getCurrentRow().getColumnObject(columnIndex);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2392
        if (value == null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2393
            lastValueNull = true;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2394
            return null;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2395
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2396
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2397
        unicodeStream = new StringBufferInputStream(value.toString());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2398
11129
f9ad1aadf3fa 7116445: Miscellaneous warnings in the JDBC/RowSet classes
lancea
parents: 9537
diff changeset
  2399
        return unicodeStream;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2400
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2401
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2402
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2403
     * Retrieves the value of the designated column in the current row of this
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2404
     * <code>CachedRowSetImpl</code> object as a <code>java.io.InputStream</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2405
     * object.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2406
     * <P>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2407
     * A column value can be retrieved as a stream of uninterpreted bytes
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2408
     * and then read in chunks from the stream.  This method is particularly
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2409
     * suitable for retrieving large <code>LONGVARBINARY</code> values.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2410
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2411
     * <P><B>Note:</B> All the data in the returned stream must be
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2412
     * read prior to getting the value of any other column. The next
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2413
     * call to a get method implicitly closes the stream. Also, a
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2414
     * stream may return <code>0</code> for
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2415
     * <code>CachedRowSetImpl.available()</code> whether there is data
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2416
     * available or not.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2417
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2418
     * @param columnIndex the first column is <code>1</code>, the second
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2419
     * is <code>2</code>, and so on; must be <code>1</code> or larger
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2420
     * and equal to or less than the number of columns in the rowset
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2421
     * @return a Java input stream that delivers the database column value
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2422
     * as a stream of uninterpreted bytes.  If the value is SQL <code>NULL</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2423
     * then the result is <code>null</code>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2424
     * @throws SQLException if (1) the given column index is out of bounds,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2425
     * (2) the cursor is not on one of this rowset's rows or its
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2426
     * insert row, or (3) the designated column does not store an
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2427
     * SQL <code>BINARY, VARBINARY</code> or <code><b>LONGVARBINARY</b></code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2428
     * The bold type indicates the SQL type that this method is recommened
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2429
     * to retrieve.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2430
     * @see #getBinaryStream(String)
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2431
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2432
    public java.io.InputStream getBinaryStream(int columnIndex) throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2433
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2434
        // always free an old stream
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2435
        binaryStream = null;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2436
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2437
        // sanity check.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2438
        checkIndex(columnIndex);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2439
        // make sure the cursor is on a valid row
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2440
        checkCursor();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2441
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2442
        if (isBinary(RowSetMD.getColumnType(columnIndex)) == false) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2443
            throw new SQLException(resBundle.handleGetObject("cachedrowsetimpl.dtypemismt").toString());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2444
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2445
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2446
        Object value = getCurrentRow().getColumnObject(columnIndex);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2447
        if (value == null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2448
            lastValueNull = true;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2449
            return null;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2450
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2451
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2452
        binaryStream = new ByteArrayInputStream((byte[])value);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2453
11129
f9ad1aadf3fa 7116445: Miscellaneous warnings in the JDBC/RowSet classes
lancea
parents: 9537
diff changeset
  2454
        return binaryStream;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2455
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2456
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2457
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2458
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2459
    // Methods for accessing results by column name
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2460
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2461
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2462
     * Retrieves the value stored in the designated column
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2463
     * of the current row as a <code>String</code> object.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2464
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2465
     * @param columnName a <code>String</code> object giving the SQL name of
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2466
     *        a column in this <code>CachedRowSetImpl</code> object
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2467
     * @return the column value; if the value is SQL <code>NULL</code>,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2468
     *         the result is <code>null</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2469
     * @throws SQLException if (1) the given column name is not the name of
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2470
     * a column in this rowset, (2) the cursor is not on one of
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2471
     * this rowset's rows or its insert row, or (3) the designated
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2472
     * column does not store an SQL <code>TINYINT, SMALLINT, INTEGER
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2473
     * BIGINT, REAL, FLOAT, DOUBLE, DECIMAL, NUMERIC, BIT, <b>CHAR</b>,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2474
     * <b>VARCHAR</b></code> or <code>LONGVARCHAR<</code> value. The bold SQL type
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2475
     * designates the recommended return type.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2476
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2477
    public String getString(String columnName) throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2478
        return getString(getColIdxByName(columnName));
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2479
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2480
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2481
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2482
     * Retrieves the value stored in the designated column
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2483
     * of the current row as a <code>boolean</code> value.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2484
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2485
     * @param columnName a <code>String</code> object giving the SQL name of
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2486
     *        a column in this <code>CachedRowSetImpl</code> object
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2487
     * @return the column value as a <code>boolean</code> in the Java programming
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2488
     *        language; if the value is SQL <code>NULL</code>,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2489
     *        the result is <code>false</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2490
     * @throws SQLException if (1) the given column name is not the name of
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2491
     *            a column in this rowset, (2) the cursor is not on one of
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2492
     *            this rowset's rows or its insert row, or (3) the designated
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2493
     *            column does not store an SQL <code>BOOLEAN</code> value
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2494
     * @see #getBoolean(int)
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2495
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2496
    public boolean getBoolean(String columnName) throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2497
        return getBoolean(getColIdxByName(columnName));
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2498
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2499
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2500
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2501
     * Retrieves the value stored in the designated column
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2502
     * of the current row as a <code>byte</code> value.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2503
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2504
     * @param columnName a <code>String</code> object giving the SQL name of
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2505
     *        a column in this <code>CachedRowSetImpl</code> object
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2506
     * @return the column value as a <code>byte</code> in the Java programming
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2507
     * language; if the value is SQL <code>NULL</code>, the result is <code>0</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2508
     * @throws SQLException if (1) the given column name is not the name of
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2509
     * a column in this rowset, (2) the cursor is not on one of
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2510
     * this rowset's rows or its insert row, or (3) the designated
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2511
     * column does not store an SQL <code><B>TINYINT</B>, SMALLINT, INTEGER,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2512
     * BIGINT, REAL, FLOAT, DOUBLE, DECIMAL, NUMERIC, BIT, CHAR,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2513
     * VARCHAR</code> or <code>LONGVARCHAR</code> value. The
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2514
     * bold type designates the recommended return type
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2515
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2516
    public byte getByte(String columnName) throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2517
        return getByte(getColIdxByName(columnName));
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2518
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2519
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2520
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2521
     * Retrieves the value stored in the designated column
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2522
     * of the current row as a <code>short</code> value.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2523
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2524
     * @param columnName a <code>String</code> object giving the SQL name of
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2525
     *        a column in this <code>CachedRowSetImpl</code> object
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2526
     * @return the column value; if the value is SQL <code>NULL</code>,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2527
     *         the result is <code>0</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2528
     * @throws SQLException if (1) the given column name is not the name of
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2529
     * a column in this rowset, (2) the cursor is not on one of
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2530
     * this rowset's rows or its insert row, or (3) the designated
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2531
     * column does not store an SQL <code>TINYINT, <b>SMALLINT</b>, INTEGER
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2532
     * BIGINT, REAL, FLOAT, DOUBLE, DECIMAL, NUMERIC, BIT, CHAR,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2533
     * VARCHAR</code> or <code>LONGVARCHAR</code> value. The bold SQL type
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2534
     * designates the recommended return type.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2535
     * @see #getShort(int)
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2536
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2537
    public short getShort(String columnName) throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2538
        return getShort(getColIdxByName(columnName));
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2539
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2540
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2541
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2542
     * Retrieves the value stored in the designated column
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2543
     * of the current row as an <code>int</code> value.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2544
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2545
     * @param columnName a <code>String</code> object giving the SQL name of
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2546
     *        a column in this <code>CachedRowSetImpl</code> object
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2547
     * @return the column value; if the value is SQL <code>NULL</code>,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2548
     *         the result is <code>0</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2549
     * @throws SQLException if (1) the given column name is not the name
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2550
     * of a column in this rowset,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2551
     * (2) the cursor is not on one of this rowset's rows or its
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2552
     * insert row, or (3) the designated column does not store an
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2553
     * SQL <code>TINYINT, SMALLINT, <b>INTEGER</b>, BIGINT, REAL
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2554
     * FLOAT, DOUBLE, DECIMAL, NUMERIC, BIT, CHAR, VARCHAR</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2555
     * or <code>LONGVARCHAR</code> value. The bold SQL type designates the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2556
     * recommended return type.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2557
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2558
    public int getInt(String columnName) throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2559
        return getInt(getColIdxByName(columnName));
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2560
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2561
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2562
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2563
     * Retrieves the value stored in the designated column
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2564
     * of the current row as a <code>long</code> value.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2565
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2566
     * @param columnName a <code>String</code> object giving the SQL name of
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2567
     *        a column in this <code>CachedRowSetImpl</code> object
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2568
     * @return the column value; if the value is SQL <code>NULL</code>,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2569
     *         the result is <code>0</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2570
     * @throws SQLException if (1) the given column name is not the name of
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2571
     * a column in this rowset, (2) the cursor is not on one of
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2572
     * this rowset's rows or its insert row, or (3) the designated
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2573
     * column does not store an SQL <code>TINYINT, SMALLINT, INTEGER
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2574
     * <b>BIGINT</b>, REAL, FLOAT, DOUBLE, DECIMAL, NUMERIC, BIT, CHAR,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2575
     * VARCHAR</code> or <code>LONGVARCHAR</code> value. The bold SQL type
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2576
     * designates the recommended return type.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2577
     * @see #getLong(int)
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2578
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2579
    public long getLong(String columnName) throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2580
        return getLong(getColIdxByName(columnName));
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2581
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2582
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2583
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2584
     * Retrieves the value stored in the designated column
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2585
     * of the current row as a <code>float</code> value.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2586
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2587
     * @param columnName a <code>String</code> object giving the SQL name of
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2588
     *        a column in this <code>CachedRowSetImpl</code> object
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2589
     * @return the column value; if the value is SQL <code>NULL</code>,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2590
     *         the result is <code>0</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2591
     * @throws SQLException if (1) the given column name is not the name of
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2592
     * a column in this rowset, (2) the cursor is not on one of
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2593
     * this rowset's rows or its insert row, or (3) the designated
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2594
     * column does not store an SQL <code>TINYINT, SMALLINT, INTEGER
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2595
     * BIGINT, <b>REAL</b>, FLOAT, DOUBLE, DECIMAL, NUMERIC, BIT, CHAR,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2596
     * VARCHAR</code> or <code>LONGVARCHAR</code> value. The bold SQL type
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2597
     * designates the recommended return type.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2598
     * @see #getFloat(String)
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2599
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2600
    public float getFloat(String columnName) throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2601
        return getFloat(getColIdxByName(columnName));
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2602
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2603
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2604
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2605
     * Retrieves the value stored in the designated column
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2606
     * of the current row of this <code>CachedRowSetImpl</code> object
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2607
     * as a <code>double</code> value.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2608
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2609
     * @param columnName a <code>String</code> object giving the SQL name of
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2610
     *        a column in this <code>CachedRowSetImpl</code> object
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2611
     * @return the column value; if the value is SQL <code>NULL</code>,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2612
     *         the result is <code>0</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2613
     * @throws SQLException if (1) the given column name is not the name of
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2614
     * a column in this rowset, (2) the cursor is not on one of
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2615
     * this rowset's rows or its insert row, or (3) the designated
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2616
     * column does not store an SQL <code>TINYINT, SMALLINT, INTEGER
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2617
     * BIGINT, REAL, <b>FLOAT</b>, <b>DOUBLE</b>, DECIMAL, NUMERIC, BIT, CHAR,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2618
     * VARCHAR</code> or <code>LONGVARCHAR</code> value. The bold SQL type
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2619
     * designates the recommended return types.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2620
     * @see #getDouble(int)
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2621
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2622
    public double getDouble(String columnName) throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2623
        return getDouble(getColIdxByName(columnName));
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2624
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2625
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2626
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2627
     * Retrieves the value stored in the designated column
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2628
     * of the current row as a <code>java.math.BigDecimal</code> object.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2629
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2630
     * @param columnName a <code>String</code> object giving the SQL name of
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2631
     *        a column in this <code>CachedRowSetImpl</code> object
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2632
     * @param scale the number of digits to the right of the decimal point
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2633
     * @return a java.math.BugDecimal object with <code><i>scale</i></code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2634
     * number of digits to the right of the decimal point.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2635
     * @throws SQLException if (1) the given column name is not the name of
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2636
     * a column in this rowset, (2) the cursor is not on one of
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2637
     * this rowset's rows or its insert row, or (3) the designated
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2638
     * column does not store an SQL <code>TINYINT, SMALLINT, INTEGER
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2639
     * BIGINT, REAL, FLOAT, DOUBLE, <b>DECIMAL</b>, <b>NUMERIC</b>, BIT CHAR,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2640
     * VARCHAR</code> or <code>LONGVARCHAR</code> value. The bold SQL type
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2641
     * designates the recommended return type that this method is used to
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2642
     * retrieve.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2643
     * @deprecated Use the <code>getBigDecimal(String columnName)</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2644
     *             method instead
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2645
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2646
    public BigDecimal getBigDecimal(String columnName, int scale) throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2647
        return getBigDecimal(getColIdxByName(columnName), scale);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2648
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2649
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2650
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2651
     * Retrieves the value stored in the designated column
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2652
     * of the current row as a <code>byte</code> array.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2653
     * The bytes represent the raw values returned by the driver.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2654
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2655
     * @param columnName a <code>String</code> object giving the SQL name of
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2656
     *        a column in this <code>CachedRowSetImpl</code> object
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2657
     * @return the column value as a <code>byte</code> array in the Java programming
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2658
     * language; if the value is SQL <code>NULL</code>, the result is <code>null</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2659
     * @throws SQLException if (1) the given column name is not the name of
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2660
     * a column in this rowset, (2) the cursor is not on one of
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2661
     * this rowset's rows or its insert row, or (3) the designated
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2662
     * column does not store an SQL <code><b>BINARY</b>, <b>VARBINARY</b>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2663
     * </code> or <code>LONGVARBINARY</code> values
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2664
     * The bold SQL type designates the recommended return type.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2665
     * @see #getBytes(int)
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2666
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2667
    public byte[] getBytes(String columnName) throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2668
        return getBytes(getColIdxByName(columnName));
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2669
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2670
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2671
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2672
     * Retrieves the value stored in the designated column
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2673
     * of the current row as a <code>java.sql.Date</code> object.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2674
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2675
     * @param columnName a <code>String</code> object giving the SQL name of
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2676
     *        a column in this <code>CachedRowSetImpl</code> object
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2677
     * @return the column value; if the value is SQL <code>NULL</code>,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2678
     *         the result is <code>null</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2679
     * @throws SQLException if (1) the given column name is not the name of
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2680
     *            a column in this rowset, (2) the cursor is not on one of
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2681
     *            this rowset's rows or its insert row, or (3) the designated
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2682
     *            column does not store an SQL <code>DATE</code> or
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2683
     *            <code>TIMESTAMP</code> value
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2684
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2685
    public java.sql.Date getDate(String columnName) throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2686
        return getDate(getColIdxByName(columnName));
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2687
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2688
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2689
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2690
     * Retrieves the value stored in the designated column
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2691
     * of the current row as a <code>java.sql.Time</code> object.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2692
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2693
     * @param columnName a <code>String</code> object giving the SQL name of
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2694
     *        a column in this <code>CachedRowSetImpl</code> object
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2695
     * @return the column value; if the value is SQL <code>NULL</code>,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2696
     *         the result is <code>null</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2697
     * @throws SQLException if the given column name does not match one of
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2698
     *            this rowset's column names or the cursor is not on one of
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2699
     *            this rowset's rows or its insert row
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2700
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2701
    public java.sql.Time getTime(String columnName) throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2702
        return getTime(getColIdxByName(columnName));
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2703
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2704
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2705
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2706
     * Retrieves the value stored in the designated column
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2707
     * of the current row as a <code>java.sql.Timestamp</code> object.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2708
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2709
     * @param columnName a <code>String</code> object giving the SQL name of
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2710
     *        a column in this <code>CachedRowSetImpl</code> object
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2711
     * @return the column value; if the value is SQL <code>NULL</code>,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2712
     *         the result is <code>null</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2713
     * @throws SQLException if the given column name does not match one of
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2714
     *            this rowset's column names or the cursor is not on one of
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2715
     *            this rowset's rows or its insert row
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2716
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2717
    public java.sql.Timestamp getTimestamp(String columnName) throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2718
        return getTimestamp(getColIdxByName(columnName));
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2719
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2720
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2721
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2722
     * Retrieves the value of the designated column in the current row of this
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2723
     * <code>CachedRowSetImpl</code> object as a <code>java.io.InputStream</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2724
     * object.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2725
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2726
     * A column value can be retrieved as a stream of ASCII characters
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2727
     * and then read in chunks from the stream. This method is particularly
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2728
     * suitable for retrieving large <code>LONGVARCHAR</code> values. The
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2729
     * <code>SyncProvider</code> will rely on the JDBC driver to do any necessary
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2730
     * conversion from the database format into ASCII format.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2731
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2732
     * <P><B>Note:</B> All the data in the returned stream must
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2733
     * be read prior to getting the value of any other column. The
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2734
     * next call to a <code>getXXX</code> method implicitly closes the stream.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2735
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2736
     * @param columnName a <code>String</code> object giving the SQL name of
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2737
     *        a column in this <code>CachedRowSetImpl</code> object
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2738
     * @return a Java input stream that delivers the database column value
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2739
     *         as a stream of one-byte ASCII characters.  If the value is SQL
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2740
     *         <code>NULL</code>, the result is <code>null</code>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2741
     * @throws SQLException if (1) the given column name is not the name of
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2742
     * a column in this rowset
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2743
     * (2) the cursor is not on one of this rowset's rows or its
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2744
     * insert row, or (3) the designated column does not store an
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2745
     * SQL <code>CHAR, VARCHAR</code>, <code><b>LONGVARCHAR</b></code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2746
     * <code>BINARY, VARBINARY</code> or <code>LONGVARBINARY</code> value. The
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2747
     * bold SQL type designates the recommended return types that this method is
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2748
     * used to retrieve.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2749
     * @see #getAsciiStream(int)
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2750
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2751
    public java.io.InputStream getAsciiStream(String columnName) throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2752
        return getAsciiStream(getColIdxByName(columnName));
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2753
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2754
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2755
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2756
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2757
     * A column value can be retrieved as a stream of Unicode characters
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2758
     * and then read in chunks from the stream.  This method is particularly
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2759
     * suitable for retrieving large <code>LONGVARCHAR</code> values.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2760
     * The JDBC driver will do any necessary conversion from the database
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2761
     * format into Unicode.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2762
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2763
     * <P><B>Note:</B> All the data in the returned stream must
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2764
     * be read prior to getting the value of any other column. The
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2765
     * next call to a <code>getXXX</code> method implicitly closes the stream.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2766
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2767
     * @param columnName a <code>String</code> object giving the SQL name of
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2768
     *        a column in this <code>CachedRowSetImpl</code> object
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2769
     * @return a Java input stream that delivers the database column value
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2770
     *         as a stream of two-byte Unicode characters.  If the value is
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2771
     *         SQL <code>NULL</code>, the result is <code>null</code>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2772
     * @throws SQLException if the given column name does not match one of
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2773
     *            this rowset's column names or the cursor is not on one of
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2774
     *            this rowset's rows or its insert row
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2775
     * @deprecated use the method <code>getCharacterStream</code> instead
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2776
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2777
    public java.io.InputStream getUnicodeStream(String columnName) throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2778
        return getUnicodeStream(getColIdxByName(columnName));
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2779
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2780
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2781
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2782
     * Retrieves the value of the designated column in the current row of this
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2783
     * <code>CachedRowSetImpl</code> object as a <code>java.io.InputStream</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2784
     * object.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2785
     * <P>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2786
     * A column value can be retrieved as a stream of uninterpreted bytes
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2787
     * and then read in chunks from the stream.  This method is particularly
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2788
     * suitable for retrieving large <code>LONGVARBINARY</code> values.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2789
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2790
     * <P><B>Note:</B> All the data in the returned stream must be
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2791
     * read prior to getting the value of any other column. The next
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2792
     * call to a get method implicitly closes the stream. Also, a
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2793
     * stream may return <code>0</code> for <code>CachedRowSetImpl.available()</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2794
     * whether there is data available or not.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2795
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2796
     * @param columnName a <code>String</code> object giving the SQL name of
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2797
     *        a column in this <code>CachedRowSetImpl</code> object
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2798
     * @return a Java input stream that delivers the database column value
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2799
     *         as a stream of uninterpreted bytes.  If the value is SQL
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2800
     *         <code>NULL</code>, the result is <code>null</code>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2801
     * @throws SQLException if (1) the given column name is unknown,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2802
     * (2) the cursor is not on one of this rowset's rows or its
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2803
     * insert row, or (3) the designated column does not store an
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2804
     * SQL <code>BINARY, VARBINARY</code> or <code><b>LONGVARBINARY</b></code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2805
     * The bold type indicates the SQL type that this method is recommened
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2806
     * to retrieve.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2807
     * @see #getBinaryStream(int)
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2808
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2809
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2810
    public java.io.InputStream getBinaryStream(String columnName) throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2811
        return getBinaryStream(getColIdxByName(columnName));
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2812
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2813
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2814
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2815
    // Advanced features:
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2816
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2817
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2818
     * The first warning reported by calls on this <code>CachedRowSetImpl</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2819
     * object is returned. Subsequent <code>CachedRowSetImpl</code> warnings will
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2820
     * be chained to this <code>SQLWarning</code>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2821
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2822
     * <P>The warning chain is automatically cleared each time a new
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2823
     * row is read.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2824
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2825
     * <P><B>Note:</B> This warning chain only covers warnings caused
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2826
     * by <code>ResultSet</code> methods.  Any warning caused by statement
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2827
     * methods (such as reading OUT parameters) will be chained on the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2828
     * <code>Statement</code> object.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2829
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2830
     * @return the first SQLWarning or null
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2831
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2832
    public SQLWarning getWarnings() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2833
        return sqlwarn;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2834
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2835
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2836
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2837
     * Clears all the warnings reporeted for the <code>CachedRowSetImpl</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2838
     * object. After a call to this method, the <code>getWarnings</code> method
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2839
     * returns <code>null</code> until a new warning is reported for this
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2840
     * <code>CachedRowSetImpl</code> object.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2841
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2842
    public void clearWarnings() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2843
        sqlwarn = null;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2844
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2845
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2846
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2847
     * Retrieves the name of the SQL cursor used by this
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2848
     * <code>CachedRowSetImpl</code> object.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2849
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2850
     * <P>In SQL, a result table is retrieved through a cursor that is
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2851
     * named. The current row of a <code>ResultSet</code> can be updated or deleted
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2852
     * using a positioned update/delete statement that references the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2853
     * cursor name. To ensure that the cursor has the proper isolation
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2854
     * level to support an update operation, the cursor's <code>SELECT</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2855
     * statement should be of the form <code>select for update</code>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2856
     * If the <code>for update</code> clause
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2857
     * is omitted, positioned updates may fail.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2858
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2859
     * <P>JDBC supports this SQL feature by providing the name of the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2860
     * SQL cursor used by a <code>ResultSet</code> object. The current row
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2861
     * of a result set is also the current row of this SQL cursor.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2862
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2863
     * <P><B>Note:</B> If positioned updates are not supported, an
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2864
     * <code>SQLException</code> is thrown.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2865
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2866
     * @return the SQL cursor name for this <code>CachedRowSetImpl</code> object's
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2867
     *         cursor
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2868
     * @throws SQLException if an error occurs
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2869
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2870
    public String getCursorName() throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2871
        throw new SQLException(resBundle.handleGetObject("cachedrowsetimpl.posupdate").toString());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2872
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2873
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2874
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2875
     * Retrieves a <code>ResultSetMetaData</code> object instance that
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2876
     * contains information about the <code>CachedRowSet</code> object.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2877
     * However, applications should cast the returned object to a
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2878
     * <code>RowSetMetaData</code> interface implementation. In the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2879
     * reference implementation, this cast can be done on the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2880
     * <code>RowSetMetaDataImpl</code> class.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2881
     * <P>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2882
     * For example:
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2883
     * <pre>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2884
     * CachedRowSet crs = new CachedRowSetImpl();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2885
     * RowSetMetaDataImpl metaData =
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2886
     *     (RowSetMetaDataImpl)crs.getMetaData();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2887
     * // Set the number of columns in the RowSet object for
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2888
     * // which this RowSetMetaDataImpl object was created to the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2889
     * // given number.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2890
     * metaData.setColumnCount(3);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2891
     * crs.setMetaData(metaData);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2892
     * </pre>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2893
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2894
     * @return the <code>ResultSetMetaData</code> object that describes this
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2895
     *         <code>CachedRowSetImpl</code> object's columns
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2896
     * @throws SQLException if an error occurs in generating the RowSet
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2897
     * meta data; or if the <code>CachedRowSetImpl</code> is empty.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2898
     * @see javax.sql.RowSetMetaData
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2899
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2900
    public ResultSetMetaData getMetaData() throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2901
        return (ResultSetMetaData)RowSetMD;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2902
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2903
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2904
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2905
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2906
     * Retrieves the value of the designated column in the current row
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2907
     * of this <code>CachedRowSetImpl</code> object as an
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2908
     * <code>Object</code> value.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2909
     * <P>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2910
     * The type of the <code>Object</code> will be the default
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2911
     * Java object type corresponding to the column's SQL type,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2912
     * following the mapping for built-in types specified in the JDBC 3.0
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2913
     * specification.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2914
     * <P>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2915
     * This method may also be used to read datatabase-specific
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2916
     * abstract data types.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2917
     * <P>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2918
     * This implementation of the method <code>getObject</code> extends its
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2919
     * behavior so that it gets the attributes of an SQL structured type
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2920
     * as an array of <code>Object</code> values.  This method also custom
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2921
     * maps SQL user-defined types to classes in the Java programming language.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2922
     * When the specified column contains
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2923
     * a structured or distinct value, the behavior of this method is as
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2924
     * if it were a call to the method <code>getObject(columnIndex,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2925
     * this.getStatement().getConnection().getTypeMap())</code>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2926
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2927
     * @param columnIndex the first column is <code>1</code>, the second
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2928
     *        is <code>2</code>, and so on; must be <code>1</code> or larger
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2929
     *        and equal to or less than the number of columns in the rowset
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2930
     * @return a <code>java.lang.Object</code> holding the column value;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2931
     *         if the value is SQL <code>NULL</code>, the result is <code>null</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2932
     * @throws SQLException if the given column index is out of bounds,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2933
     *            the cursor is not on a valid row, or there is a problem getting
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2934
     *            the <code>Class</code> object for a custom mapping
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2935
     * @see #getObject(String)
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2936
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2937
    public Object getObject(int columnIndex) throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2938
        Object value;
9257
53e6d7bc31b0 7035615: Address lint warnings for javax.sql.rowset & com.sun.rowset
lancea
parents: 6697
diff changeset
  2939
        Map<String, Class<?>> map;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2940
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2941
        // sanity check.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2942
        checkIndex(columnIndex);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2943
        // make sure the cursor is on a valid row
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2944
        checkCursor();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2945
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2946
        setLastValueNull(false);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2947
        value = getCurrentRow().getColumnObject(columnIndex);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2948
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2949
        // check for SQL NULL
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2950
        if (value == null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2951
            setLastValueNull(true);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2952
            return null;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2953
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2954
        if (value instanceof Struct) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2955
            Struct s = (Struct)value;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2956
            map = getTypeMap();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2957
            // look up the class in the map
11129
f9ad1aadf3fa 7116445: Miscellaneous warnings in the JDBC/RowSet classes
lancea
parents: 9537
diff changeset
  2958
            Class<?> c = map.get(s.getSQLTypeName());
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2959
            if (c != null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2960
                // create new instance of the class
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2961
                SQLData obj = null;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2962
                try {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2963
                    obj = (SQLData)c.newInstance();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2964
                } catch (java.lang.InstantiationException ex) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2965
                    throw new SQLException(MessageFormat.format(resBundle.handleGetObject("cachedrowsetimpl.unableins").toString(),
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2966
                    ex.getMessage()));
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2967
                } catch (java.lang.IllegalAccessException ex) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2968
                    throw new SQLException(MessageFormat.format(resBundle.handleGetObject("cachedrowsetimpl.unableins").toString(),
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2969
                    ex.getMessage()));
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2970
                }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2971
                // get the attributes from the struct
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2972
                Object attribs[] = s.getAttributes(map);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2973
                // create the SQLInput "stream"
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2974
                SQLInputImpl sqlInput = new SQLInputImpl(attribs, map);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2975
                // read the values...
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2976
                obj.readSQL(sqlInput, s.getSQLTypeName());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2977
                return (Object)obj;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2978
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2979
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2980
        return value;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2981
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2982
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2983
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2984
     * Retrieves the value of the designated column in the current row
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2985
     * of this <code>CachedRowSetImpl</code> object as an
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2986
     * <code>Object</code> value.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2987
     * <P>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2988
     * The type of the <code>Object</code> will be the default
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2989
     * Java object type corresponding to the column's SQL type,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2990
     * following the mapping for built-in types specified in the JDBC 3.0
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2991
     * specification.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2992
     * <P>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2993
     * This method may also be used to read datatabase-specific
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2994
     * abstract data types.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2995
     * <P>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2996
     * This implementation of the method <code>getObject</code> extends its
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2997
     * behavior so that it gets the attributes of an SQL structured type
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2998
     * as an array of <code>Object</code> values.  This method also custom
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2999
     * maps SQL user-defined types to classes
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3000
     * in the Java programming language. When the specified column contains
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3001
     * a structured or distinct value, the behavior of this method is as
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3002
     * if it were a call to the method <code>getObject(columnIndex,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3003
     * this.getStatement().getConnection().getTypeMap())</code>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3004
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3005
     * @param columnName a <code>String</code> object that must match the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3006
     *        SQL name of a column in this rowset, ignoring case
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3007
     * @return a <code>java.lang.Object</code> holding the column value;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3008
     *         if the value is SQL <code>NULL</code>, the result is <code>null</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3009
     * @throws SQLException if (1) the given column name does not match one of
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3010
     *            this rowset's column names, (2) the cursor is not
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3011
     *            on a valid row, or (3) there is a problem getting
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3012
     *            the <code>Class</code> object for a custom mapping
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3013
     * @see #getObject(int)
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3014
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3015
    public Object getObject(String columnName) throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3016
        return getObject(getColIdxByName(columnName));
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3017
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3018
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3019
    //----------------------------------------------------------------
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3020
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3021
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3022
     * Maps the given column name for one of this <code>CachedRowSetImpl</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3023
     * object's columns to its column number.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3024
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3025
     * @param columnName a <code>String</code> object that must match the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3026
     *        SQL name of a column in this rowset, ignoring case
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3027
     * @return the column index of the given column name
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3028
     * @throws SQLException if the given column name does not match one
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3029
     *            of this rowset's column names
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3030
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3031
    public int findColumn(String columnName) throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3032
        return getColIdxByName(columnName);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3033
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3034
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3035
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3036
    //--------------------------JDBC 2.0-----------------------------------
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3037
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3038
    //---------------------------------------------------------------------
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3039
    // Getter's and Setter's
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3040
    //---------------------------------------------------------------------
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3041
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3042
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3043
     * Retrieves the value stored in the designated column
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3044
     * of the current row as a <code>java.io.Reader</code> object.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3045
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3046
     * <P><B>Note:</B> All the data in the returned stream must
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3047
     * be read prior to getting the value of any other column. The
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3048
     * next call to a <code>getXXX</code> method implicitly closes the stream.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3049
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3050
     * @param columnIndex the first column is <code>1</code>, the second
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3051
     *        is <code>2</code>, and so on; must be <code>1</code> or larger
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3052
     *        and equal to or less than the number of columns in the rowset
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3053
     * @return a Java character stream that delivers the database column value
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3054
     * as a stream of two-byte unicode characters in a
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3055
     * <code>java.io.Reader</code> object.  If the value is
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3056
     * SQL <code>NULL</code>, the result is <code>null</code>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3057
     * @throws SQLException if (1) the given column index is out of bounds,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3058
     * (2) the cursor is not on one of this rowset's rows or its
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3059
     * insert row, or (3) the designated column does not store an
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3060
     * SQL <code>CHAR, VARCHAR, <b>LONGVARCHAR</b>, BINARY, VARBINARY</code> or
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3061
     * <code>LONGVARBINARY</code> value.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3062
     * The bold SQL type designates the recommended return type.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3063
     * @see #getCharacterStream(String)
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3064
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3065
    public java.io.Reader getCharacterStream(int columnIndex) throws SQLException{
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3066
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3067
        // sanity check.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3068
        checkIndex(columnIndex);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3069
        // make sure the cursor is on a valid row
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3070
        checkCursor();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3071
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3072
        if (isBinary(RowSetMD.getColumnType(columnIndex))) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3073
            Object value = getCurrentRow().getColumnObject(columnIndex);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3074
            if (value == null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3075
                lastValueNull = true;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3076
                return null;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3077
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3078
            charStream = new InputStreamReader
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3079
            (new ByteArrayInputStream((byte[])value));
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3080
        } else if (isString(RowSetMD.getColumnType(columnIndex))) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3081
            Object value = getCurrentRow().getColumnObject(columnIndex);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3082
            if (value == null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3083
                lastValueNull = true;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3084
                return null;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3085
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3086
            charStream = new StringReader(value.toString());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3087
        } else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3088
            throw new SQLException(resBundle.handleGetObject("cachedrowsetimpl.dtypemismt").toString());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3089
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3090
11129
f9ad1aadf3fa 7116445: Miscellaneous warnings in the JDBC/RowSet classes
lancea
parents: 9537
diff changeset
  3091
        return charStream;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3092
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3093
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3094
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3095
     * Retrieves the value stored in the designated column
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3096
     * of the current row as a <code>java.io.Reader</code> object.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3097
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3098
     * <P><B>Note:</B> All the data in the returned stream must
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3099
     * be read prior to getting the value of any other column. The
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3100
     * next call to a <code>getXXX</code> method implicitly closes the stream.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3101
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3102
     * @param columnName a <code>String</code> object giving the SQL name of
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3103
     *        a column in this <code>CachedRowSetImpl</code> object
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3104
     * @return a Java input stream that delivers the database column value
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3105
     *         as a stream of two-byte Unicode characters.  If the value is
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3106
     *         SQL <code>NULL</code>, the result is <code>null</code>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3107
     * @throws SQLException if (1) the given column name is not the name of
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3108
     * a column in this rowset, (2) the cursor is not on one of
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3109
     * this rowset's rows or its insert row, or (3) the designated
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3110
     * column does not store an SQL <code>CHAR, VARCHAR, <b>LONGVARCHAR</b>,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3111
     * BINARY, VARYBINARY</code> or <code>LONGVARBINARY</code> value.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3112
     * The bold SQL type designates the recommended return type.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3113
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3114
    public java.io.Reader getCharacterStream(String columnName) throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3115
        return getCharacterStream(getColIdxByName(columnName));
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3116
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3117
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3118
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3119
     * Retrieves the value of the designated column in the current row
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3120
     * of this <code>CachedRowSetImpl</code> object as a
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3121
     * <code>java.math.BigDecimal</code> object.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3122
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3123
     * @param columnIndex the first column is <code>1</code>, the second
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3124
     *        is <code>2</code>, and so on; must be <code>1</code> or larger
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3125
     *        and equal to or less than the number of columns in the rowset
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3126
     * @return a <code>java.math.BigDecimal</code> value with full precision;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3127
     *         if the value is SQL <code>NULL</code>, the result is <code>null</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3128
     * @throws SQLException if (1) the given column index is out of bounds,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3129
     * (2) the cursor is not on one of this rowset's rows or its
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3130
     * insert row, or (3) the designated column does not store an
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3131
     * SQL <code>TINYINT, SMALLINT, INTEGER, BIGINT, REAL,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3132
     * FLOAT, DOUBLE, <b>DECIMAL</b>, <b>NUMERIC</b>, BIT, CHAR, VARCHAR</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3133
     * or <code>LONGVARCHAR</code> value. The bold SQL type designates the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3134
     * recommended return types that this method is used to retrieve.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3135
     * @see #getBigDecimal(String)
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3136
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3137
    public BigDecimal getBigDecimal(int columnIndex) throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3138
        Object value;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3139
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3140
        // sanity check.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3141
        checkIndex(columnIndex);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3142
        // make sure the cursor is on a valid row
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3143
        checkCursor();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3144
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3145
        setLastValueNull(false);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3146
        value = getCurrentRow().getColumnObject(columnIndex);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3147
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3148
        // check for SQL NULL
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3149
        if (value == null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3150
            setLastValueNull(true);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3151
            return null;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3152
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3153
        try {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3154
            return (new BigDecimal(value.toString().trim()));
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3155
        } catch (NumberFormatException ex) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3156
            throw new SQLException(MessageFormat.format(resBundle.handleGetObject("cachedrowsetimpl.doublefail").toString(),
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3157
                new Object[] {value.toString().trim(), columnIndex}));
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3158
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3159
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3160
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3161
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3162
     * Retrieves the value of the designated column in the current row
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3163
     * of this <code>CachedRowSetImpl</code> object as a
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3164
     * <code>java.math.BigDecimal</code> object.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3165
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3166
     * @param columnName a <code>String</code> object that must match the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3167
     *        SQL name of a column in this rowset, ignoring case
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3168
     * @return a <code>java.math.BigDecimal</code> value with full precision;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3169
     *         if the value is SQL <code>NULL</code>, the result is <code>null</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3170
     * @throws SQLException if (1) the given column name is not the name of
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3171
     * a column in this rowset, (2) the cursor is not on one of
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3172
     * this rowset's rows or its insert row, or (3) the designated
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3173
     * column does not store an SQL <code>TINYINT, SMALLINT, INTEGER
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3174
     * BIGINT, REAL, FLOAT, DOUBLE, <b>DECIMAL</b>, <b>NUMERIC</b>, BIT CHAR,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3175
     * VARCHAR</code> or <code>LONGVARCHAR</code> value. The bold SQL type
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3176
     * designates the recommended return type that this method is used to
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3177
     * retrieve
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3178
     * @see #getBigDecimal(int)
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3179
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3180
    public BigDecimal getBigDecimal(String columnName) throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3181
        return getBigDecimal(getColIdxByName(columnName));
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3182
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3183
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3184
    //---------------------------------------------------------------------
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3185
    // Traversal/Positioning
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3186
    //---------------------------------------------------------------------
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3187
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3188
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3189
     * Returns the number of rows in this <code>CachedRowSetImpl</code> object.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3190
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3191
     * @return number of rows in the rowset
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3192
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3193
    public int size() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3194
        return numRows;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3195
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3196
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3197
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3198
     * Indicates whether the cursor is before the first row in this
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3199
     * <code>CachedRowSetImpl</code> object.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3200
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3201
     * @return <code>true</code> if the cursor is before the first row;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3202
     *         <code>false</code> otherwise or if the rowset contains no rows
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3203
     * @throws SQLException if an error occurs
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3204
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3205
    public boolean isBeforeFirst() throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3206
        if (cursorPos == 0 && numRows > 0) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3207
            return true;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3208
        } else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3209
            return false;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3210
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3211
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3212
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3213
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3214
     * Indicates whether the cursor is after the last row in this
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3215
     * <code>CachedRowSetImpl</code> object.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3216
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3217
     * @return <code>true</code> if the cursor is after the last row;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3218
     *         <code>false</code> otherwise or if the rowset contains no rows
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3219
     * @throws SQLException if an error occurs
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3220
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3221
    public boolean isAfterLast() throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3222
        if (cursorPos == numRows+1 && numRows > 0) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3223
            return true;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3224
        } else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3225
            return false;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3226
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3227
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3228
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3229
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3230
     * Indicates whether the cursor is on the first row in this
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3231
     * <code>CachedRowSetImpl</code> object.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3232
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3233
     * @return <code>true</code> if the cursor is on the first row;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3234
     *         <code>false</code> otherwise or if the rowset contains no rows
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3235
     * @throws SQLException if an error occurs
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3236
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3237
    public boolean isFirst() throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3238
        // this becomes nasty because of deletes.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3239
        int saveCursorPos = cursorPos;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3240
        int saveAbsoluteCursorPos = absolutePos;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3241
        internalFirst();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3242
        if (cursorPos == saveCursorPos) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3243
            return true;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3244
        } else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3245
            cursorPos = saveCursorPos;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3246
            absolutePos = saveAbsoluteCursorPos;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3247
            return false;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3248
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3249
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3250
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3251
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3252
     * Indicates whether the cursor is on the last row in this
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3253
     * <code>CachedRowSetImpl</code> object.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3254
     * <P>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3255
     * Note: Calling the method <code>isLast</code> may be expensive
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3256
     * because the JDBC driver might need to fetch ahead one row in order
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3257
     * to determine whether the current row is the last row in this rowset.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3258
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3259
     * @return <code>true</code> if the cursor is on the last row;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3260
     *         <code>false</code> otherwise or if this rowset contains no rows
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3261
     * @throws SQLException if an error occurs
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3262
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3263
    public boolean isLast() throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3264
        int saveCursorPos = cursorPos;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3265
        int saveAbsoluteCursorPos = absolutePos;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3266
        boolean saveShowDeleted = getShowDeleted();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3267
        setShowDeleted(true);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3268
        internalLast();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3269
        if (cursorPos == saveCursorPos) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3270
            setShowDeleted(saveShowDeleted);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3271
            return true;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3272
        } else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3273
            setShowDeleted(saveShowDeleted);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3274
            cursorPos = saveCursorPos;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3275
            absolutePos = saveAbsoluteCursorPos;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3276
            return false;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3277
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3278
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3279
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3280
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3281
     * Moves this <code>CachedRowSetImpl</code> object's cursor to the front of
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3282
     * the rowset, just before the first row. This method has no effect if
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3283
     * this rowset contains no rows.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3284
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3285
     * @throws SQLException if an error occurs or the type of this rowset
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3286
     *            is <code>ResultSet.TYPE_FORWARD_ONLY</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3287
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3288
    public void beforeFirst() throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3289
       if (getType() == ResultSet.TYPE_FORWARD_ONLY) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3290
            throw new SQLException(resBundle.handleGetObject("cachedrowsetimpl.beforefirst").toString());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3291
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3292
        cursorPos = 0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3293
        absolutePos = 0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3294
        notifyCursorMoved();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3295
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3296
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3297
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3298
     * Moves this <code>CachedRowSetImpl</code> object's cursor to the end of
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3299
     * the rowset, just after the last row. This method has no effect if
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3300
     * this rowset contains no rows.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3301
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3302
     * @throws SQLException if an error occurs
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3303
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3304
    public void afterLast() throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3305
        if (numRows > 0) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3306
            cursorPos = numRows + 1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3307
            absolutePos = 0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3308
            notifyCursorMoved();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3309
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3310
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3311
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3312
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3313
     * Moves this <code>CachedRowSetImpl</code> object's cursor to the first row
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3314
     * and returns <code>true</code> if the operation was successful.  This
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3315
     * method also notifies registered listeners that the cursor has moved.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3316
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3317
     * @return <code>true</code> if the cursor is on a valid row;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3318
     *         <code>false</code> otherwise or if there are no rows in this
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3319
     *         <code>CachedRowSetImpl</code> object
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3320
     * @throws SQLException if the type of this rowset
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3321
     *            is <code>ResultSet.TYPE_FORWARD_ONLY</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3322
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3323
    public boolean first() throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3324
        if(getType() == ResultSet.TYPE_FORWARD_ONLY) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3325
            throw new SQLException(resBundle.handleGetObject("cachedrowsetimpl.first").toString());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3326
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3327
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3328
        // move and notify
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3329
        boolean ret = this.internalFirst();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3330
        notifyCursorMoved();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3331
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3332
        return ret;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3333
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3334
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3335
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3336
     * Moves this <code>CachedRowSetImpl</code> object's cursor to the first
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3337
     * row and returns <code>true</code> if the operation is successful.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3338
     * <P>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3339
     * This method is called internally by the methods <code>first</code>,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3340
     * <code>isFirst</code>, and <code>absolute</code>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3341
     * It in turn calls the method <code>internalNext</code> in order to
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3342
     * handle the case where the first row is a deleted row that is not visible.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3343
     * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3344
     * This is a implementation only method and is not required as a standard
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3345
     * implementation of the <code>CachedRowSet</code> interface.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3346
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3347
     * @return <code>true</code> if the cursor moved to the first row;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3348
     *         <code>false</code> otherwise
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3349
     * @throws SQLException if an error occurs
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3350
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3351
    protected boolean internalFirst() throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3352
        boolean ret = false;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3353
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3354
        if (numRows > 0) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3355
            cursorPos = 1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3356
            if ((getShowDeleted() == false) && (rowDeleted() == true)) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3357
                ret = internalNext();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3358
            } else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3359
                ret = true;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3360
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3361
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3362
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3363
        if (ret == true)
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3364
            absolutePos = 1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3365
        else
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3366
            absolutePos = 0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3367
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3368
        return ret;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3369
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3370
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3371
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3372
     * Moves this <code>CachedRowSetImpl</code> object's cursor to the last row
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3373
     * and returns <code>true</code> if the operation was successful.  This
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3374
     * method also notifies registered listeners that the cursor has moved.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3375
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3376
     * @return <code>true</code> if the cursor is on a valid row;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3377
     *         <code>false</code> otherwise or if there are no rows in this
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3378
     *         <code>CachedRowSetImpl</code> object
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3379
     * @throws SQLException if the type of this rowset
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3380
     *            is <code>ResultSet.TYPE_FORWARD_ONLY</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3381
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3382
    public boolean last() throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3383
        if (getType() == ResultSet.TYPE_FORWARD_ONLY) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3384
            throw new SQLException(resBundle.handleGetObject("cachedrowsetimpl.last").toString());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3385
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3386
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3387
        // move and notify
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3388
        boolean ret = this.internalLast();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3389
        notifyCursorMoved();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3390
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3391
        return ret;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3392
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3393
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3394
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3395
     * Moves this <code>CachedRowSetImpl</code> object's cursor to the last
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3396
     * row and returns <code>true</code> if the operation is successful.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3397
     * <P>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3398
     * This method is called internally by the method <code>last</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3399
     * when rows have been deleted and the deletions are not visible.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3400
     * The method <code>internalLast</code> handles the case where the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3401
     * last row is a deleted row that is not visible by in turn calling
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3402
     * the method <code>internalPrevious</code>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3403
     * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3404
     * This is a implementation only method and is not required as a standard
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3405
     * implementation of the <code>CachedRowSet</code> interface.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3406
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3407
     * @return <code>true</code> if the cursor moved to the last row;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3408
     *         <code>false</code> otherwise
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3409
     * @throws SQLException if an error occurs
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3410
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3411
    protected boolean internalLast() throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3412
        boolean ret = false;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3413
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3414
        if (numRows > 0) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3415
            cursorPos = numRows;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3416
            if ((getShowDeleted() == false) && (rowDeleted() == true)) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3417
                ret = internalPrevious();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3418
            } else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3419
                ret = true;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3420
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3421
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3422
        if (ret == true)
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3423
            absolutePos = numRows - numDeleted;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3424
        else
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3425
            absolutePos = 0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3426
        return ret;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3427
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3428
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3429
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3430
     * Returns the number of the current row in this <code>CachedRowSetImpl</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3431
     * object. The first row is number 1, the second number 2, and so on.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3432
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3433
     * @return the number of the current row;  <code>0</code> if there is no
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3434
     *         current row
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3435
     * @throws SQLException if an error occurs; or if the <code>CacheRowSetImpl</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3436
     *         is empty
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3437
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3438
    public int getRow() throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3439
        // are we on a valid row? Valid rows are between first and last
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3440
        if (numRows > 0 &&
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3441
        cursorPos > 0 &&
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3442
        cursorPos < (numRows + 1) &&
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3443
        (getShowDeleted() == false && rowDeleted() == false)) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3444
            return absolutePos;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3445
        } else if (getShowDeleted() == true) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3446
            return cursorPos;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3447
        } else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3448
            return 0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3449
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3450
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3451
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3452
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3453
     * Moves this <code>CachedRowSetImpl</code> object's cursor to the row number
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3454
     * specified.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3455
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3456
     * <p>If the number is positive, the cursor moves to an absolute row with
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3457
     * respect to the beginning of the rowset.  The first row is row 1, the second
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3458
     * is row 2, and so on.  For example, the following command, in which
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3459
     * <code>crs</code> is a <code>CachedRowSetImpl</code> object, moves the cursor
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3460
     * to the fourth row, starting from the beginning of the rowset.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3461
     * <PRE><code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3462
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3463
     *    crs.absolute(4);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3464
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3465
     * </code> </PRE>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3466
     * <P>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3467
     * If the number is negative, the cursor moves to an absolute row position
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3468
     * with respect to the end of the rowset.  For example, calling
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3469
     * <code>absolute(-1)</code> positions the cursor on the last row,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3470
     * <code>absolute(-2)</code> moves it on the next-to-last row, and so on.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3471
     * If the <code>CachedRowSetImpl</code> object <code>crs</code> has five rows,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3472
     * the following command moves the cursor to the fourth-to-last row, which
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3473
     * in the case of a  rowset with five rows, is also the second row, counting
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3474
     * from the beginning.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3475
     * <PRE><code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3476
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3477
     *    crs.absolute(-4);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3478
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3479
     * </code> </PRE>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3480
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3481
     * If the number specified is larger than the number of rows, the cursor
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3482
     * will move to the position after the last row. If the number specified
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3483
     * would move the cursor one or more rows before the first row, the cursor
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3484
     * moves to the position before the first row.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3485
     * <P>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3486
     * Note: Calling <code>absolute(1)</code> is the same as calling the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3487
     * method <code>first()</code>.  Calling <code>absolute(-1)</code> is the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3488
     * same as calling <code>last()</code>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3489
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3490
     * @param row a positive number to indicate the row, starting row numbering from
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3491
     *        the first row, which is <code>1</code>; a negative number to indicate
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3492
     *        the row, starting row numbering from the last row, which is
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3493
     *        <code>-1</code>; it must not be <code>0</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3494
     * @return <code>true</code> if the cursor is on the rowset; <code>false</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3495
     *         otherwise
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3496
     * @throws SQLException if the given cursor position is <code>0</code> or the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3497
     *            type of this rowset is <code>ResultSet.TYPE_FORWARD_ONLY</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3498
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3499
    public boolean absolute( int row ) throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3500
        if (row == 0 || getType() == ResultSet.TYPE_FORWARD_ONLY) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3501
            throw new SQLException(resBundle.handleGetObject("cachedrowsetimpl.absolute").toString());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3502
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3503
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3504
        if (row > 0) { // we are moving foward
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3505
            if (row > numRows) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3506
                // fell off the end
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3507
                afterLast();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3508
                return false;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3509
            } else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3510
                if (absolutePos <= 0)
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3511
                    internalFirst();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3512
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3513
        } else { // we are moving backward
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3514
            if (cursorPos + row < 0) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3515
                // fell off the front
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3516
                beforeFirst();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3517
                return false;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3518
            } else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3519
                if (absolutePos >= 0)
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3520
                    internalLast();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3521
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3522
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3523
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3524
        // Now move towards the absolute row that we're looking for
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3525
        while (absolutePos != row) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3526
            if (absolutePos < row) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3527
                if (!internalNext())
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3528
                    break;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3529
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3530
            else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3531
                if (!internalPrevious())
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3532
                    break;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3533
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3534
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3535
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3536
        notifyCursorMoved();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3537
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3538
        if (isAfterLast() || isBeforeFirst()) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3539
            return false;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3540
        } else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3541
            return true;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3542
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3543
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3544
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3545
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3546
     * Moves the cursor the specified number of rows from the current
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3547
     * position, with a positive number moving it forward and a
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3548
     * negative number moving it backward.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3549
     * <P>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3550
     * If the number is positive, the cursor moves the specified number of
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3551
     * rows toward the end of the rowset, starting at the current row.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3552
     * For example, the following command, in which
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3553
     * <code>crs</code> is a <code>CachedRowSetImpl</code> object with 100 rows,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3554
     * moves the cursor forward four rows from the current row.  If the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3555
     * current row is 50, the cursor would move to row 54.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3556
     * <PRE><code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3557
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3558
     *    crs.relative(4);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3559
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3560
     * </code> </PRE>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3561
     * <P>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3562
     * If the number is negative, the cursor moves back toward the beginning
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3563
     * the specified number of rows, starting at the current row.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3564
     * For example, calling the method
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3565
     * <code>absolute(-1)</code> positions the cursor on the last row,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3566
     * <code>absolute(-2)</code> moves it on the next-to-last row, and so on.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3567
     * If the <code>CachedRowSetImpl</code> object <code>crs</code> has five rows,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3568
     * the following command moves the cursor to the fourth-to-last row, which
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3569
     * in the case of a  rowset with five rows, is also the second row
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3570
     * from the beginning.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3571
     * <PRE><code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3572
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3573
     *    crs.absolute(-4);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3574
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3575
     * </code> </PRE>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3576
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3577
     * If the number specified is larger than the number of rows, the cursor
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3578
     * will move to the position after the last row. If the number specified
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3579
     * would move the cursor one or more rows before the first row, the cursor
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3580
     * moves to the position before the first row. In both cases, this method
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3581
     * throws an <code>SQLException</code>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3582
     * <P>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3583
     * Note: Calling <code>absolute(1)</code> is the same as calling the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3584
     * method <code>first()</code>.  Calling <code>absolute(-1)</code> is the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3585
     * same as calling <code>last()</code>.  Calling <code>relative(0)</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3586
     * is valid, but it does not change the cursor position.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3587
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3588
     * @param rows an <code>int</code> indicating the number of rows to move
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3589
     *             the cursor, starting at the current row; a positive number
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3590
     *             moves the cursor forward; a negative number moves the cursor
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3591
     *             backward; must not move the cursor past the valid
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3592
     *             rows
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3593
     * @return <code>true</code> if the cursor is on a row in this
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3594
     *         <code>CachedRowSetImpl</code> object; <code>false</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3595
     *         otherwise
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3596
     * @throws SQLException if there are no rows in this rowset, the cursor is
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3597
     *         positioned either before the first row or after the last row, or
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3598
     *         the rowset is type <code>ResultSet.TYPE_FORWARD_ONLY</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3599
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3600
    public boolean relative(int rows) throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3601
        if (numRows == 0 || isBeforeFirst() ||
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3602
        isAfterLast() || getType() == ResultSet.TYPE_FORWARD_ONLY) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3603
            throw new SQLException(resBundle.handleGetObject("cachedrowsetimpl.relative").toString());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3604
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3605
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3606
        if (rows == 0) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3607
            return true;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3608
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3609
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3610
        if (rows > 0) { // we are moving forward
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3611
            if (cursorPos + rows > numRows) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3612
                // fell off the end
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3613
                afterLast();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3614
            } else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3615
                for (int i=0; i < rows; i++) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3616
                    if (!internalNext())
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3617
                        break;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3618
                }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3619
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3620
        } else { // we are moving backward
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3621
            if (cursorPos + rows < 0) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3622
                // fell off the front
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3623
                beforeFirst();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3624
            } else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3625
                for (int i=rows; i < 0; i++) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3626
                    if (!internalPrevious())
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3627
                        break;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3628
                }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3629
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3630
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3631
        notifyCursorMoved();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3632
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3633
        if (isAfterLast() || isBeforeFirst()) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3634
            return false;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3635
        } else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3636
            return true;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3637
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3638
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3639
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3640
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3641
     * Moves this <code>CachedRowSetImpl</code> object's cursor to the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3642
     * previous row and returns <code>true</code> if the cursor is on
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3643
     * a valid row or <code>false</code> if it is not.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3644
     * This method also notifies all listeners registered with this
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3645
     * <code>CachedRowSetImpl</code> object that its cursor has moved.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3646
     * <P>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3647
     * Note: calling the method <code>previous()</code> is not the same
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3648
     * as calling the method <code>relative(-1)</code>.  This is true
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3649
     * because it is possible to call <code>previous()</code> from the insert
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3650
     * row, from after the last row, or from the current row, whereas
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3651
     * <code>relative</code> may only be called from the current row.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3652
     * <P>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3653
     * The method <code>previous</code> may used in a <code>while</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3654
     * loop to iterate through a rowset starting after the last row
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3655
     * and moving toward the beginning. The loop ends when <code>previous</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3656
     * returns <code>false</code>, meaning that there are no more rows.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3657
     * For example, the following code fragment retrieves all the data in
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3658
     * the <code>CachedRowSetImpl</code> object <code>crs</code>, which has
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3659
     * three columns.  Note that the cursor must initially be positioned
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3660
     * after the last row so that the first call to the method
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3661
     * <code>previous</code> places the cursor on the last line.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3662
     * <PRE> <code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3663
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3664
     *     crs.afterLast();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3665
     *     while (previous()) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3666
     *         String name = crs.getString(1);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3667
     *         int age = crs.getInt(2);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3668
     *         short ssn = crs.getShort(3);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3669
     *         System.out.println(name + "   " + age + "   " + ssn);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3670
     *     }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3671
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3672
     * </code> </PRE>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3673
     * This method throws an <code>SQLException</code> if the cursor is not
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3674
     * on a row in the rowset, before the first row, or after the last row.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3675
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3676
     * @return <code>true</code> if the cursor is on a valid row;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3677
     *         <code>false</code> if it is before the first row or after the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3678
     *         last row
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3679
     * @throws SQLException if the cursor is not on a valid position or the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3680
     *           type of this rowset is <code>ResultSet.TYPE_FORWARD_ONLY</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3681
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3682
    public boolean previous() throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3683
        if (getType() == ResultSet.TYPE_FORWARD_ONLY) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3684
            throw new SQLException(resBundle.handleGetObject("cachedrowsetimpl.last").toString());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3685
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3686
        /*
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3687
         * make sure things look sane. The cursor must be
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3688
         * positioned in the rowset or before first (0) or
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3689
         * after last (numRows + 1)
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3690
         */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3691
        if (cursorPos < 0 || cursorPos > numRows + 1) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3692
            throw new SQLException(resBundle.handleGetObject("cachedrowsetimpl.invalidcp").toString());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3693
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3694
        // move and notify
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3695
        boolean ret = this.internalPrevious();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3696
        notifyCursorMoved();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3697
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3698
        return ret;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3699
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3700
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3701
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3702
     * Moves the cursor to the previous row in this <code>CachedRowSetImpl</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3703
     * object, skipping past deleted rows that are not visible; returns
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3704
     * <code>true</code> if the cursor is on a row in this rowset and
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3705
     * <code>false</code> when the cursor goes before the first row.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3706
     * <P>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3707
     * This method is called internally by the method <code>previous</code>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3708
     * <P>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3709
     * This is a implementation only method and is not required as a standard
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3710
     * implementation of the <code>CachedRowSet</code> interface.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3711
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3712
     * @return <code>true</code> if the cursor is on a row in this rowset;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3713
     *         <code>false</code> when the cursor reaches the position before
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3714
     *         the first row
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3715
     * @throws SQLException if an error occurs
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3716
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3717
    protected boolean internalPrevious() throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3718
        boolean ret = false;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3719
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3720
        do {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3721
            if (cursorPos > 1) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3722
                --cursorPos;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3723
                ret = true;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3724
            } else if (cursorPos == 1) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3725
                // decrement to before first
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3726
                --cursorPos;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3727
                ret = false;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3728
                break;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3729
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3730
        } while ((getShowDeleted() == false) && (rowDeleted() == true));
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3731
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3732
        /*
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3733
         * Each call to internalPrevious may move the cursor
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3734
         * over multiple rows, the absolute postion moves one one row
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3735
         */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3736
        if (ret == true)
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3737
            --absolutePos;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3738
        else
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3739
            absolutePos = 0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3740
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3741
        return ret;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3742
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3743
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3744
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3745
    //---------------------------------------------------------------------
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3746
    // Updates
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3747
    //---------------------------------------------------------------------
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3748
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3749
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3750
     * Indicates whether the current row of this <code>CachedRowSetImpl</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3751
     * object has been updated.  The value returned
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3752
     * depends on whether this rowset can detect updates: <code>false</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3753
     * will always be returned if it does not detect updates.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3754
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3755
     * @return <code>true</code> if the row has been visibly updated
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3756
     *         by the owner or another and updates are detected;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3757
     *         <code>false</code> otherwise
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3758
     * @throws SQLException if the cursor is on the insert row or not
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3759
     *            not on a valid row
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3760
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3761
     * @see DatabaseMetaData#updatesAreDetected
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3762
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3763
    public boolean rowUpdated() throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3764
        // make sure the cursor is on a valid row
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3765
        checkCursor();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3766
        if (onInsertRow == true) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3767
            throw new SQLException(resBundle.handleGetObject("cachedrowsetimpl.invalidop").toString());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3768
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3769
        return(((Row)getCurrentRow()).getUpdated());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3770
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3771
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3772
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3773
     * Indicates whether the designated column of the current row of
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3774
     * this <code>CachedRowSetImpl</code> object has been updated. The
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3775
     * value returned depends on whether this rowset can detcted updates:
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3776
     * <code>false</code> will always be returned if it does not detect updates.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3777
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3778
     * @param idx the index identifier of the column that may be have been updated.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3779
     * @return <code>true</code> is the designated column has been updated
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3780
     * and the rowset detects updates; <code>false</code> if the rowset has not
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3781
     * been updated or the rowset does not detect updates
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3782
     * @throws SQLException if the cursor is on the insert row or not
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3783
     *          on a valid row
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3784
     * @see DatabaseMetaData#updatesAreDetected
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3785
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3786
    public boolean columnUpdated(int idx) throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3787
        // make sure the cursor is on a valid row
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3788
        checkCursor();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3789
        if (onInsertRow == true) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3790
            throw new SQLException(resBundle.handleGetObject("cachedrowsetimpl.invalidop").toString());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3791
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3792
        return (((Row)getCurrentRow()).getColUpdated(idx - 1));
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3793
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3794
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3795
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3796
     * Indicates whether the designated column of the current row of
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3797
     * this <code>CachedRowSetImpl</code> object has been updated. The
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3798
     * value returned depends on whether this rowset can detcted updates:
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3799
     * <code>false</code> will always be returned if it does not detect updates.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3800
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3801
     * @param columnName the <code>String</code> column name column that may be have
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3802
     * been updated.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3803
     * @return <code>true</code> is the designated column has been updated
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3804
     * and the rowset detects updates; <code>false</code> if the rowset has not
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3805
     * been updated or the rowset does not detect updates
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3806
     * @throws SQLException if the cursor is on the insert row or not
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3807
     *          on a valid row
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3808
     * @see DatabaseMetaData#updatesAreDetected
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3809
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3810
    public boolean columnUpdated(String columnName) throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3811
        return columnUpdated(getColIdxByName(columnName));
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3812
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3813
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3814
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3815
     * Indicates whether the current row has been inserted.  The value returned
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3816
     * depends on whether or not the rowset can detect visible inserts.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3817
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3818
     * @return <code>true</code> if a row has been inserted and inserts are detected;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3819
     *         <code>false</code> otherwise
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3820
     * @throws SQLException if the cursor is on the insert row or not
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3821
     *            not on a valid row
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3822
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3823
     * @see DatabaseMetaData#insertsAreDetected
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3824
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3825
    public boolean rowInserted() throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3826
        // make sure the cursor is on a valid row
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3827
        checkCursor();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3828
        if (onInsertRow == true) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3829
            throw new SQLException(resBundle.handleGetObject("cachedrowsetimpl.invalidop").toString());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3830
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3831
        return(((Row)getCurrentRow()).getInserted());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3832
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3833
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3834
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3835
     * Indicates whether the current row has been deleted.  A deleted row
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3836
     * may leave a visible "hole" in a rowset.  This method can be used to
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3837
     * detect such holes if the rowset can detect deletions. This method
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3838
     * will always return <code>false</code> if this rowset cannot detect
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3839
     * deletions.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3840
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3841
     * @return <code>true</code> if (1)the current row is blank, indicating that
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3842
     *         the row has been deleted, and (2)deletions are detected;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3843
     *         <code>false</code> otherwise
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3844
     * @throws SQLException if the cursor is on a valid row in this rowset
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3845
     * @see DatabaseMetaData#deletesAreDetected
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3846
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3847
    public boolean rowDeleted() throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3848
        // make sure the cursor is on a valid row
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3849
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3850
        if (isAfterLast() == true ||
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3851
        isBeforeFirst() == true ||
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3852
        onInsertRow == true) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3853
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3854
            throw new SQLException(resBundle.handleGetObject("cachedrowsetimpl.invalidcp").toString());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3855
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3856
        return(((Row)getCurrentRow()).getDeleted());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3857
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3858
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3859
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3860
     * Indicates whether the given SQL data type is a numberic type.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3861
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3862
     * @param type one of the constants from <code>java.sql.Types</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3863
     * @return <code>true</code> if the given type is <code>NUMERIC</code>,'
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3864
     *         <code>DECIMAL</code>, <code>BIT</code>, <code>TINYINT</code>,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3865
     *         <code>SMALLINT</code>, <code>INTEGER</code>, <code>BIGINT</code>,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3866
     *         <code>REAL</code>, <code>DOUBLE</code>, or <code>FLOAT</code>;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3867
     *         <code>false</code> otherwise
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3868
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3869
    private boolean isNumeric(int type) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3870
        switch (type) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3871
            case java.sql.Types.NUMERIC:
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3872
            case java.sql.Types.DECIMAL:
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3873
            case java.sql.Types.BIT:
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3874
            case java.sql.Types.TINYINT:
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3875
            case java.sql.Types.SMALLINT:
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3876
            case java.sql.Types.INTEGER:
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3877
            case java.sql.Types.BIGINT:
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3878
            case java.sql.Types.REAL:
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3879
            case java.sql.Types.DOUBLE:
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3880
            case java.sql.Types.FLOAT:
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3881
                return true;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3882
            default:
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3883
                return false;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3884
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3885
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3886
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3887
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3888
     * Indicates whether the given SQL data type is a string type.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3889
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3890
     * @param type one of the constants from <code>java.sql.Types</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3891
     * @return <code>true</code> if the given type is <code>CHAR</code>,'
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3892
     *         <code>VARCHAR</code>, or <code>LONGVARCHAR</code>;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3893
     *         <code>false</code> otherwise
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3894
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3895
    private boolean isString(int type) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3896
        switch (type) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3897
            case java.sql.Types.CHAR:
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3898
            case java.sql.Types.VARCHAR:
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3899
            case java.sql.Types.LONGVARCHAR:
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3900
                return true;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3901
            default:
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3902
                return false;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3903
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3904
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3905
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3906
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3907
     * Indicates whether the given SQL data type is a binary type.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3908
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3909
     * @param type one of the constants from <code>java.sql.Types</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3910
     * @return <code>true</code> if the given type is <code>BINARY</code>,'
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3911
     *         <code>VARBINARY</code>, or <code>LONGVARBINARY</code>;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3912
     *         <code>false</code> otherwise
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3913
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3914
    private boolean isBinary(int type) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3915
        switch (type) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3916
            case java.sql.Types.BINARY:
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3917
            case java.sql.Types.VARBINARY:
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3918
            case java.sql.Types.LONGVARBINARY:
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3919
                return true;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3920
            default:
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3921
                return false;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3922
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3923
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3924
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3925
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3926
     * Indicates whether the given SQL data type is a temporal type.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3927
     * This method is called internally by the conversion methods
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3928
     * <code>convertNumeric</code> and <code>convertTemporal</code>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3929
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3930
     * @param type one of the constants from <code>java.sql.Types</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3931
     * @return <code>true</code> if the given type is <code>DATE</code>,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3932
     *         <code>TIME</code>, or <code>TIMESTAMP</code>;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3933
     *         <code>false</code> otherwise
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3934
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3935
    private boolean isTemporal(int type) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3936
        switch (type) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3937
            case java.sql.Types.DATE:
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3938
            case java.sql.Types.TIME:
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3939
            case java.sql.Types.TIMESTAMP:
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3940
                return true;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3941
            default:
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3942
                return false;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3943
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3944
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3945
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3946
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3947
     * Indicates whether the given SQL data type is a boolean type.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3948
     * This method is called internally by the conversion methods
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3949
     * <code>convertNumeric</code> and <code>convertBoolean</code>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3950
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3951
     * @param type one of the constants from <code>java.sql.Types</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3952
     * @return <code>true</code> if the given type is <code>BIT</code>,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3953
     *         , or <code>BOOLEAN</code>;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3954
     *         <code>false</code> otherwise
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3955
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3956
    private boolean isBoolean(int type) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3957
        switch (type) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3958
            case java.sql.Types.BIT:
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3959
            case java.sql.Types.BOOLEAN:
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3960
                return true;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3961
            default:
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3962
                return false;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3963
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3964
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3965
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3966
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3967
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3968
     * Converts the given <code>Object</code> in the Java programming language
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3969
     * to the standard mapping for the specified SQL target data type.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3970
     * The conversion must be to a string or numeric type, but there are no
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3971
     * restrictions on the type to be converted.  If the source type and target
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3972
     * type are the same, the given object is simply returned.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3973
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3974
     * @param srcObj the <code>Object</code> in the Java programming language
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3975
     *               that is to be converted to the target type
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3976
     * @param srcType the data type that is the standard mapping in SQL of the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3977
     *                object to be converted; must be one of the constants in
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3978
     *                <code>java.sql.Types</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3979
     * @param trgType the SQL data type to which to convert the given object;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3980
     *                must be one of the following constants in
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3981
     *                <code>java.sql.Types</code>: <code>NUMERIC</code>,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3982
     *         <code>DECIMAL</code>, <code>BIT</code>, <code>TINYINT</code>,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3983
     *         <code>SMALLINT</code>, <code>INTEGER</code>, <code>BIGINT</code>,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3984
     *         <code>REAL</code>, <code>DOUBLE</code>, <code>FLOAT</code>,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3985
     *         <code>VARCHAR</code>, <code>LONGVARCHAR</code>, or <code>CHAR</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3986
     * @return an <code>Object</code> value.that is
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3987
     *         the standard object mapping for the target SQL type
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3988
     * @throws SQLException if the given target type is not one of the string or
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3989
     *         numeric types in <code>java.sql.Types</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3990
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3991
    private Object convertNumeric(Object srcObj, int srcType,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3992
    int trgType) throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3993
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3994
        if (srcType == trgType) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3995
            return srcObj;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3996
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3997
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3998
        if (isNumeric(trgType) == false && isString(trgType) == false) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3999
            throw new SQLException(resBundle.handleGetObject("cachedrowsetimpl.dtypemismt").toString() + trgType);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4000
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4001
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4002
        try {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4003
            switch (trgType) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4004
                case java.sql.Types.BIT:
6697
39929804f9d4 6989139: Address JDBC Findbugs where Number type Constructor are used
lancea
parents: 6692
diff changeset
  4005
                    Integer i = Integer.valueOf(srcObj.toString().trim());
11129
f9ad1aadf3fa 7116445: Miscellaneous warnings in the JDBC/RowSet classes
lancea
parents: 9537
diff changeset
  4006
                    return i.equals(0) ?
6697
39929804f9d4 6989139: Address JDBC Findbugs where Number type Constructor are used
lancea
parents: 6692
diff changeset
  4007
                    Boolean.valueOf(false) :
39929804f9d4 6989139: Address JDBC Findbugs where Number type Constructor are used
lancea
parents: 6692
diff changeset
  4008
                        Boolean.valueOf(true);
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4009
                case java.sql.Types.TINYINT:
6697
39929804f9d4 6989139: Address JDBC Findbugs where Number type Constructor are used
lancea
parents: 6692
diff changeset
  4010
                    return Byte.valueOf(srcObj.toString().trim());
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4011
                case java.sql.Types.SMALLINT:
6697
39929804f9d4 6989139: Address JDBC Findbugs where Number type Constructor are used
lancea
parents: 6692
diff changeset
  4012
                    return Short.valueOf(srcObj.toString().trim());
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4013
                case java.sql.Types.INTEGER:
6697
39929804f9d4 6989139: Address JDBC Findbugs where Number type Constructor are used
lancea
parents: 6692
diff changeset
  4014
                    return Integer.valueOf(srcObj.toString().trim());
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4015
                case java.sql.Types.BIGINT:
6697
39929804f9d4 6989139: Address JDBC Findbugs where Number type Constructor are used
lancea
parents: 6692
diff changeset
  4016
                    return Long.valueOf(srcObj.toString().trim());
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4017
                case java.sql.Types.NUMERIC:
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4018
                case java.sql.Types.DECIMAL:
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4019
                    return new BigDecimal(srcObj.toString().trim());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4020
                case java.sql.Types.REAL:
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4021
                case java.sql.Types.FLOAT:
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4022
                    return new Float(srcObj.toString().trim());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4023
                case java.sql.Types.DOUBLE:
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4024
                    return new Double(srcObj.toString().trim());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4025
                case java.sql.Types.CHAR:
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4026
                case java.sql.Types.VARCHAR:
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4027
                case java.sql.Types.LONGVARCHAR:
6692
aef4e294026f 6988993: Address Findbugs warnings for the use of String Constructor
lancea
parents: 6664
diff changeset
  4028
                    return srcObj.toString();
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4029
                default:
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4030
                    throw new SQLException(resBundle.handleGetObject("cachedrowsetimpl.dtypemismt").toString()+ trgType);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4031
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4032
        } catch (NumberFormatException ex) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4033
            throw new SQLException(resBundle.handleGetObject("cachedrowsetimpl.dtypemismt").toString() + trgType);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4034
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4035
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4036
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4037
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4038
     * Converts the given <code>Object</code> in the Java programming language
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4039
     * to the standard object mapping for the specified SQL target data type.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4040
     * The conversion must be to a string or temporal type, and there are also
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4041
     * restrictions on the type to be converted.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4042
     * <P>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4043
     * <TABLE ALIGN="CENTER" BORDER CELLPADDING=10 BORDERCOLOR="#0000FF"
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4044
     * <CAPTION ALIGN="CENTER"><B>Parameters and Return Values</B></CAPTION>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4045
     * <TR>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4046
     *   <TD><B>Source SQL Type</B>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4047
     *   <TD><B>Target SQL Type</B>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4048
     *   <TD><B>Object Returned</B>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4049
     * </TR>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4050
     * <TR>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4051
     *   <TD><code>TIMESTAMP</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4052
     *   <TD><code>DATE</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4053
     *   <TD><code>java.sql.Date</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4054
     * </TR>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4055
     * <TR>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4056
     *   <TD><code>TIMESTAMP</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4057
     *   <TD><code>TIME</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4058
     *   <TD><code>java.sql.Time</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4059
     * </TR>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4060
     * <TR>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4061
     *   <TD><code>TIME</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4062
     *   <TD><code>TIMESTAMP</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4063
     *   <TD><code>java.sql.Timestamp</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4064
     * </TR>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4065
     * <TR>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4066
     *   <TD><code>DATE</code>, <code>TIME</code>, or <code>TIMESTAMP</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4067
     *   <TD><code>CHAR</code>, <code>VARCHAR</code>, or <code>LONGVARCHAR</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4068
     *   <TD><code>java.lang.String</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4069
     * </TR>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4070
     * </TABLE>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4071
     * <P>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4072
     * If the source type and target type are the same,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4073
     * the given object is simply returned.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4074
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4075
     * @param srcObj the <code>Object</code> in the Java programming language
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4076
     *               that is to be converted to the target type
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4077
     * @param srcType the data type that is the standard mapping in SQL of the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4078
     *                object to be converted; must be one of the constants in
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4079
     *                <code>java.sql.Types</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4080
     * @param trgType the SQL data type to which to convert the given object;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4081
     *                must be one of the following constants in
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4082
     *                <code>java.sql.Types</code>: <code>DATE</code>,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4083
     *         <code>TIME</code>, <code>TIMESTAMP</code>, <code>CHAR</code>,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4084
     *         <code>VARCHAR</code>, or <code>LONGVARCHAR</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4085
     * @return an <code>Object</code> value.that is
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4086
     *         the standard object mapping for the target SQL type
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4087
     * @throws SQLException if the given target type is not one of the string or
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4088
     *         temporal types in <code>java.sql.Types</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4089
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4090
    private Object convertTemporal(Object srcObj,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4091
    int srcType, int trgType) throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4092
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4093
        if (srcType == trgType) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4094
            return srcObj;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4095
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4096
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4097
        if (isNumeric(trgType) == true ||
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4098
        (isString(trgType) == false && isTemporal(trgType) == false)) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4099
            throw new SQLException(resBundle.handleGetObject("cachedrowsetimpl.dtypemismt").toString());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4100
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4101
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4102
        try {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4103
            switch (trgType) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4104
                case java.sql.Types.DATE:
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4105
                    if (srcType == java.sql.Types.TIMESTAMP) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4106
                        return new java.sql.Date(((java.sql.Timestamp)srcObj).getTime());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4107
                    } else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4108
                        throw new SQLException(resBundle.handleGetObject("cachedrowsetimpl.dtypemismt").toString());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4109
                    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4110
                case java.sql.Types.TIMESTAMP:
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4111
                    if (srcType == java.sql.Types.TIME) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4112
                        return new Timestamp(((java.sql.Time)srcObj).getTime());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4113
                    } else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4114
                        return new Timestamp(((java.sql.Date)srcObj).getTime());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4115
                    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4116
                case java.sql.Types.TIME:
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4117
                    if (srcType == java.sql.Types.TIMESTAMP) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4118
                        return new Time(((java.sql.Timestamp)srcObj).getTime());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4119
                    } else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4120
                        throw new SQLException(resBundle.handleGetObject("cachedrowsetimpl.dtypemismt").toString());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4121
                    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4122
                case java.sql.Types.CHAR:
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4123
                case java.sql.Types.VARCHAR:
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4124
                case java.sql.Types.LONGVARCHAR:
6692
aef4e294026f 6988993: Address Findbugs warnings for the use of String Constructor
lancea
parents: 6664
diff changeset
  4125
                    return srcObj.toString();
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4126
                default:
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4127
                    throw new SQLException(resBundle.handleGetObject("cachedrowsetimpl.dtypemismt").toString());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4128
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4129
        } catch (NumberFormatException ex) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4130
            throw new SQLException(resBundle.handleGetObject("cachedrowsetimpl.dtypemismt").toString());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4131
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4132
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4133
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4134
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4135
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4136
     * Converts the given <code>Object</code> in the Java programming language
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4137
     * to the standard mapping for the specified SQL target data type.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4138
     * The conversion must be to a string or numeric type, but there are no
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4139
     * restrictions on the type to be converted.  If the source type and target
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4140
     * type are the same, the given object is simply returned.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4141
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4142
     * @param srcObj the <code>Object</code> in the Java programming language
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4143
     *               that is to be converted to the target type
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4144
     * @param srcType the data type that is the standard mapping in SQL of the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4145
     *                object to be converted; must be one of the constants in
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4146
     *                <code>java.sql.Types</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4147
     * @param trgType the SQL data type to which to convert the given object;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4148
     *                must be one of the following constants in
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4149
     *                <code>java.sql.Types</code>: <code>BIT</code>,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4150
     *         or <code>BOOLEAN</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4151
     * @return an <code>Object</code> value.that is
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4152
     *         the standard object mapping for the target SQL type
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4153
     * @throws SQLException if the given target type is not one of the Boolean
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4154
     *         types in <code>java.sql.Types</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4155
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4156
    private Object convertBoolean(Object srcObj, int srcType,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4157
    int trgType) throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4158
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4159
        if (srcType == trgType) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4160
            return srcObj;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4161
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4162
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4163
        if (isNumeric(trgType) == true ||
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4164
        (isString(trgType) == false && isBoolean(trgType) == false)) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4165
            throw new SQLException(resBundle.handleGetObject("cachedrowsetimpl.dtypemismt").toString());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4166
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4167
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4168
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4169
        try {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4170
            switch (trgType) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4171
                case java.sql.Types.BIT:
6697
39929804f9d4 6989139: Address JDBC Findbugs where Number type Constructor are used
lancea
parents: 6692
diff changeset
  4172
                    Integer i = Integer.valueOf(srcObj.toString().trim());
11129
f9ad1aadf3fa 7116445: Miscellaneous warnings in the JDBC/RowSet classes
lancea
parents: 9537
diff changeset
  4173
                    return i.equals(0) ?
6697
39929804f9d4 6989139: Address JDBC Findbugs where Number type Constructor are used
lancea
parents: 6692
diff changeset
  4174
                    Boolean.valueOf(false) :
39929804f9d4 6989139: Address JDBC Findbugs where Number type Constructor are used
lancea
parents: 6692
diff changeset
  4175
                        Boolean.valueOf(true);
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4176
                case java.sql.Types.BOOLEAN:
6697
39929804f9d4 6989139: Address JDBC Findbugs where Number type Constructor are used
lancea
parents: 6692
diff changeset
  4177
                    return Boolean.valueOf(srcObj.toString().trim());
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4178
                default:
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4179
                    throw new SQLException(resBundle.handleGetObject("cachedrowsetimpl.dtypemismt").toString()+ trgType);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4180
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4181
        } catch (NumberFormatException ex) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4182
            throw new SQLException(resBundle.handleGetObject("cachedrowsetimpl.dtypemismt").toString() + trgType);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4183
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4184
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4185
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4186
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4187
     * Sets the designated nullable column in the current row or the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4188
     * insert row of this <code>CachedRowSetImpl</code> object with
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4189
     * <code>null</code> value.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4190
     * <P>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4191
     * This method updates a column value in the current row or the insert
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4192
     * row of this rowset; however, another method must be called to complete
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4193
     * the update process. If the cursor is on a row in the rowset, the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4194
     * method {@link #updateRow} must be called to mark the row as updated
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4195
     * and to notify listeners that the row has changed.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4196
     * If the cursor is on the insert row, the method {@link #insertRow}
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4197
     * must be called to insert the new row into this rowset and to notify
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4198
     * listeners that a row has changed.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4199
     * <P>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4200
     * In order to propagate updates in this rowset to the underlying
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4201
     * data source, an application must call the method {@link #acceptChanges}
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4202
     * after it calls either <code>updateRow</code> or <code>insertRow</code>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4203
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4204
     * @param columnIndex the first column is <code>1</code>, the second
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4205
     *        is <code>2</code>, and so on; must be <code>1</code> or larger
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4206
     *        and equal to or less than the number of columns in this rowset
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4207
     * @throws SQLException if (1) the given column index is out of bounds,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4208
     *            (2) the cursor is not on one of this rowset's rows or its
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4209
     *            insert row, or (3) this rowset is
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4210
     *            <code>ResultSet.CONCUR_READ_ONLY</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4211
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4212
    public void updateNull(int columnIndex) throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4213
        // sanity check.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4214
        checkIndex(columnIndex);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4215
        // make sure the cursor is on a valid row
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4216
        checkCursor();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4217
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4218
        BaseRow row = getCurrentRow();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4219
        row.setColumnObject(columnIndex, null);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4220
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4221
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4222
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4223
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4224
     * Sets the designated column in either the current row or the insert
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4225
     * row of this <code>CachedRowSetImpl</code> object with the given
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4226
     * <code>boolean</code> value.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4227
     * <P>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4228
     * This method updates a column value in the current row or the insert
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4229
     * row of this rowset, but it does not update the database.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4230
     * If the cursor is on a row in the rowset, the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4231
     * method {@link #updateRow} must be called to update the database.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4232
     * If the cursor is on the insert row, the method {@link #insertRow}
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4233
     * must be called, which will insert the new row into both this rowset
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4234
     * and the database. Both of these methods must be called before the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4235
     * cursor moves to another row.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4236
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4237
     * @param columnIndex the first column is <code>1</code>, the second
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4238
     *        is <code>2</code>, and so on; must be <code>1</code> or larger
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4239
     *        and equal to or less than the number of columns in this rowset
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4240
     * @param x the new column value
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4241
     * @throws SQLException if (1) the given column index is out of bounds,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4242
     *            (2) the cursor is not on one of this rowset's rows or its
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4243
     *            insert row, or (3) this rowset is
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4244
     *            <code>ResultSet.CONCUR_READ_ONLY</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4245
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4246
    public void updateBoolean(int columnIndex, boolean x) throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4247
        // sanity check.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4248
        checkIndex(columnIndex);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4249
        // make sure the cursor is on a valid row
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4250
        checkCursor();
6697
39929804f9d4 6989139: Address JDBC Findbugs where Number type Constructor are used
lancea
parents: 6692
diff changeset
  4251
        Object obj = convertBoolean(Boolean.valueOf(x),
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4252
        java.sql.Types.BIT,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4253
        RowSetMD.getColumnType(columnIndex));
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4254
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4255
        getCurrentRow().setColumnObject(columnIndex, obj);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4256
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4257
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4258
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4259
     * Sets the designated column in either the current row or the insert
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4260
     * row of this <code>CachedRowSetImpl</code> object with the given
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4261
     * <code>byte</code> value.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4262
     * <P>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4263
     * This method updates a column value in the current row or the insert
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4264
     * row of this rowset, but it does not update the database.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4265
     * If the cursor is on a row in the rowset, the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4266
     * method {@link #updateRow} must be called to update the database.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4267
     * If the cursor is on the insert row, the method {@link #insertRow}
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4268
     * must be called, which will insert the new row into both this rowset
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4269
     * and the database. Both of these methods must be called before the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4270
     * cursor moves to another row.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4271
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4272
     * @param columnIndex the first column is <code>1</code>, the second
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4273
     *        is <code>2</code>, and so on; must be <code>1</code> or larger
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4274
     *        and equal to or less than the number of columns in this rowset
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4275
     * @param x the new column value
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4276
     * @throws SQLException if (1) the given column index is out of bounds,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4277
     *            (2) the cursor is not on one of this rowset's rows or its
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4278
     *            insert row, or (3) this rowset is
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4279
     *            <code>ResultSet.CONCUR_READ_ONLY</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4280
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4281
    public void updateByte(int columnIndex, byte x) throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4282
        // sanity check.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4283
        checkIndex(columnIndex);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4284
        // make sure the cursor is on a valid row
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4285
        checkCursor();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4286
6697
39929804f9d4 6989139: Address JDBC Findbugs where Number type Constructor are used
lancea
parents: 6692
diff changeset
  4287
        Object obj = convertNumeric(Byte.valueOf(x),
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4288
        java.sql.Types.TINYINT,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4289
        RowSetMD.getColumnType(columnIndex));
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4290
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4291
        getCurrentRow().setColumnObject(columnIndex, obj);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4292
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4293
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4294
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4295
     * Sets the designated column in either the current row or the insert
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4296
     * row of this <code>CachedRowSetImpl</code> object with the given
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4297
     * <code>short</code> value.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4298
     * <P>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4299
     * This method updates a column value in the current row or the insert
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4300
     * row of this rowset, but it does not update the database.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4301
     * If the cursor is on a row in the rowset, the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4302
     * method {@link #updateRow} must be called to update the database.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4303
     * If the cursor is on the insert row, the method {@link #insertRow}
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4304
     * must be called, which will insert the new row into both this rowset
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4305
     * and the database. Both of these methods must be called before the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4306
     * cursor moves to another row.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4307
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4308
     * @param columnIndex the first column is <code>1</code>, the second
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4309
     *        is <code>2</code>, and so on; must be <code>1</code> or larger
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4310
     *        and equal to or less than the number of columns in this rowset
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4311
     * @param x the new column value
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4312
     * @throws SQLException if (1) the given column index is out of bounds,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4313
     *            (2) the cursor is not on one of this rowset's rows or its
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4314
     *            insert row, or (3) this rowset is
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4315
     *            <code>ResultSet.CONCUR_READ_ONLY</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4316
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4317
    public void updateShort(int columnIndex, short x) throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4318
        // sanity check.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4319
        checkIndex(columnIndex);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4320
        // make sure the cursor is on a valid row
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4321
        checkCursor();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4322
6697
39929804f9d4 6989139: Address JDBC Findbugs where Number type Constructor are used
lancea
parents: 6692
diff changeset
  4323
        Object obj = convertNumeric(Short.valueOf(x),
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4324
        java.sql.Types.SMALLINT,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4325
        RowSetMD.getColumnType(columnIndex));
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4326
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4327
        getCurrentRow().setColumnObject(columnIndex, obj);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4328
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4329
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4330
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4331
     * Sets the designated column in either the current row or the insert
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4332
     * row of this <code>CachedRowSetImpl</code> object with the given
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4333
     * <code>int</code> value.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4334
     * <P>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4335
     * This method updates a column value in the current row or the insert
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4336
     * row of this rowset, but it does not update the database.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4337
     * If the cursor is on a row in the rowset, the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4338
     * method {@link #updateRow} must be called to update the database.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4339
     * If the cursor is on the insert row, the method {@link #insertRow}
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4340
     * must be called, which will insert the new row into both this rowset
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4341
     * and the database. Both of these methods must be called before the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4342
     * cursor moves to another row.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4343
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4344
     * @param columnIndex the first column is <code>1</code>, the second
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4345
     *        is <code>2</code>, and so on; must be <code>1</code> or larger
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4346
     *        and equal to or less than the number of columns in this rowset
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4347
     * @param x the new column value
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4348
     * @throws SQLException if (1) the given column index is out of bounds,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4349
     *            (2) the cursor is not on one of this rowset's rows or its
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4350
     *            insert row, or (3) this rowset is
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4351
     *            <code>ResultSet.CONCUR_READ_ONLY</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4352
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4353
    public void updateInt(int columnIndex, int x) throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4354
        // sanity check.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4355
        checkIndex(columnIndex);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4356
        // make sure the cursor is on a valid row
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4357
        checkCursor();
11129
f9ad1aadf3fa 7116445: Miscellaneous warnings in the JDBC/RowSet classes
lancea
parents: 9537
diff changeset
  4358
        Object obj = convertNumeric(x,
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4359
        java.sql.Types.INTEGER,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4360
        RowSetMD.getColumnType(columnIndex));
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4361
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4362
        getCurrentRow().setColumnObject(columnIndex, obj);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4363
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4364
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4365
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4366
     * Sets the designated column in either the current row or the insert
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4367
     * row of this <code>CachedRowSetImpl</code> object with the given
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4368
     * <code>long</code> value.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4369
     * <P>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4370
     * This method updates a column value in the current row or the insert
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4371
     * row of this rowset, but it does not update the database.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4372
     * If the cursor is on a row in the rowset, the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4373
     * method {@link #updateRow} must be called to update the database.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4374
     * If the cursor is on the insert row, the method {@link #insertRow}
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4375
     * must be called, which will insert the new row into both this rowset
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4376
     * and the database. Both of these methods must be called before the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4377
     * cursor moves to another row.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4378
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4379
     * @param columnIndex the first column is <code>1</code>, the second
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4380
     *        is <code>2</code>, and so on; must be <code>1</code> or larger
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4381
     *        and equal to or less than the number of columns in this rowset
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4382
     * @param x the new column value
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4383
     * @throws SQLException if (1) the given column index is out of bounds,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4384
     *            (2) the cursor is not on one of this rowset's rows or its
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4385
     *            insert row, or (3) this rowset is
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4386
     *            <code>ResultSet.CONCUR_READ_ONLY</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4387
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4388
    public void updateLong(int columnIndex, long x) throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4389
        // sanity check.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4390
        checkIndex(columnIndex);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4391
        // make sure the cursor is on a valid row
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4392
        checkCursor();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4393
6697
39929804f9d4 6989139: Address JDBC Findbugs where Number type Constructor are used
lancea
parents: 6692
diff changeset
  4394
        Object obj = convertNumeric(Long.valueOf(x),
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4395
        java.sql.Types.BIGINT,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4396
        RowSetMD.getColumnType(columnIndex));
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4397
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4398
        getCurrentRow().setColumnObject(columnIndex, obj);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4399
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4400
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4401
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4402
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4403
     * Sets the designated column in either the current row or the insert
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4404
     * row of this <code>CachedRowSetImpl</code> object with the given
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4405
     * <code>float</code> value.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4406
     * <P>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4407
     * This method updates a column value in the current row or the insert
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4408
     * row of this rowset, but it does not update the database.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4409
     * If the cursor is on a row in the rowset, the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4410
     * method {@link #updateRow} must be called to update the database.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4411
     * If the cursor is on the insert row, the method {@link #insertRow}
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4412
     * must be called, which will insert the new row into both this rowset
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4413
     * and the database. Both of these methods must be called before the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4414
     * cursor moves to another row.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4415
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4416
     * @param columnIndex the first column is <code>1</code>, the second
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4417
     *        is <code>2</code>, and so on; must be <code>1</code> or larger
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4418
     *        and equal to or less than the number of columns in this rowset
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4419
     * @param x the new column value
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4420
     * @throws SQLException if (1) the given column index is out of bounds,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4421
     *            (2) the cursor is not on one of this rowset's rows or its
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4422
     *            insert row, or (3) this rowset is
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4423
     *            <code>ResultSet.CONCUR_READ_ONLY</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4424
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4425
    public void updateFloat(int columnIndex, float x) throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4426
        // sanity check.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4427
        checkIndex(columnIndex);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4428
        // make sure the cursor is on a valid row
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4429
        checkCursor();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4430
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4431
        Object obj = convertNumeric(new Float(x),
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4432
        java.sql.Types.REAL,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4433
        RowSetMD.getColumnType(columnIndex));
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4434
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4435
        getCurrentRow().setColumnObject(columnIndex, obj);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4436
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4437
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4438
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4439
     * Sets the designated column in either the current row or the insert
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4440
     * row of this <code>CachedRowSetImpl</code> object with the given
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4441
     * <code>double</code> value.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4442
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4443
     * This method updates a column value in either the current row or
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4444
     * the insert row of this rowset, but it does not update the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4445
     * database.  If the cursor is on a row in the rowset, the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4446
     * method {@link #updateRow} must be called to update the database.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4447
     * If the cursor is on the insert row, the method {@link #insertRow}
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4448
     * must be called, which will insert the new row into both this rowset
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4449
     * and the database. Both of these methods must be called before the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4450
     * cursor moves to another row.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4451
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4452
     * @param columnIndex the first column is <code>1</code>, the second
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4453
     *        is <code>2</code>, and so on; must be <code>1</code> or larger
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4454
     *        and equal to or less than the number of columns in this rowset
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4455
     * @param x the new column value
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4456
     * @throws SQLException if (1) the given column index is out of bounds,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4457
     *            (2) the cursor is not on one of this rowset's rows or its
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4458
     *            insert row, or (3) this rowset is
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4459
     *            <code>ResultSet.CONCUR_READ_ONLY</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4460
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4461
    public void updateDouble(int columnIndex, double x) throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4462
        // sanity check.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4463
        checkIndex(columnIndex);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4464
        // make sure the cursor is on a valid row
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4465
        checkCursor();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4466
        Object obj = convertNumeric(new Double(x),
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4467
        java.sql.Types.DOUBLE,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4468
        RowSetMD.getColumnType(columnIndex));
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4469
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4470
        getCurrentRow().setColumnObject(columnIndex, obj);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4471
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4472
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4473
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4474
     * Sets the designated column in either the current row or the insert
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4475
     * row of this <code>CachedRowSetImpl</code> object with the given
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4476
     * <code>java.math.BigDecimal</code> object.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4477
     * <P>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4478
     * This method updates a column value in the current row or the insert
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4479
     * row of this rowset, but it does not update the database.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4480
     * If the cursor is on a row in the rowset, the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4481
     * method {@link #updateRow} must be called to update the database.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4482
     * If the cursor is on the insert row, the method {@link #insertRow}
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4483
     * must be called, which will insert the new row into both this rowset
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4484
     * and the database. Both of these methods must be called before the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4485
     * cursor moves to another row.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4486
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4487
     * @param columnIndex the first column is <code>1</code>, the second
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4488
     *        is <code>2</code>, and so on; must be <code>1</code> or larger
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4489
     *        and equal to or less than the number of columns in this rowset
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4490
     * @param x the new column value
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4491
     * @throws SQLException if (1) the given column index is out of bounds,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4492
     *            (2) the cursor is not on one of this rowset's rows or its
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4493
     *            insert row, or (3) this rowset is
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4494
     *            <code>ResultSet.CONCUR_READ_ONLY</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4495
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4496
    public void updateBigDecimal(int columnIndex, BigDecimal x) throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4497
        // sanity check.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4498
        checkIndex(columnIndex);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4499
        // make sure the cursor is on a valid row
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4500
        checkCursor();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4501
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4502
        Object obj = convertNumeric(x,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4503
        java.sql.Types.NUMERIC,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4504
        RowSetMD.getColumnType(columnIndex));
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4505
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4506
        getCurrentRow().setColumnObject(columnIndex, obj);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4507
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4508
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4509
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4510
     * Sets the designated column in either the current row or the insert
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4511
     * row of this <code>CachedRowSetImpl</code> object with the given
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4512
     * <code>String</code> object.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4513
     * <P>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4514
     * This method updates a column value in either the current row or
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4515
     * the insert row of this rowset, but it does not update the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4516
     * database.  If the cursor is on a row in the rowset, the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4517
     * method {@link #updateRow} must be called to mark the row as updated.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4518
     * If the cursor is on the insert row, the method {@link #insertRow}
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4519
     * must be called to insert the new row into this rowset and mark it
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4520
     * as inserted. Both of these methods must be called before the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4521
     * cursor moves to another row.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4522
     * <P>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4523
     * The method <code>acceptChanges</code> must be called if the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4524
     * updated values are to be written back to the underlying database.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4525
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4526
     * @param columnIndex the first column is <code>1</code>, the second
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4527
     *        is <code>2</code>, and so on; must be <code>1</code> or larger
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4528
     *        and equal to or less than the number of columns in this rowset
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4529
     * @param x the new column value
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4530
     * @throws SQLException if (1) the given column index is out of bounds,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4531
     *            (2) the cursor is not on one of this rowset's rows or its
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4532
     *            insert row, or (3) this rowset is
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4533
     *            <code>ResultSet.CONCUR_READ_ONLY</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4534
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4535
    public void updateString(int columnIndex, String x) throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4536
        // sanity check.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4537
        checkIndex(columnIndex);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4538
        // make sure the cursor is on a valid row
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4539
        checkCursor();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4540
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4541
        getCurrentRow().setColumnObject(columnIndex, x);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4542
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4543
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4544
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4545
     * Sets the designated column in either the current row or the insert
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4546
     * row of this <code>CachedRowSetImpl</code> object with the given
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4547
     * <code>byte</code> array.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4548
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4549
     * This method updates a column value in either the current row or
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4550
     * the insert row of this rowset, but it does not update the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4551
     * database.  If the cursor is on a row in the rowset, the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4552
     * method {@link #updateRow} must be called to update the database.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4553
     * If the cursor is on the insert row, the method {@link #insertRow}
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4554
     * must be called, which will insert the new row into both this rowset
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4555
     * and the database. Both of these methods must be called before the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4556
     * cursor moves to another row.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4557
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4558
     * @param columnIndex the first column is <code>1</code>, the second
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4559
     *        is <code>2</code>, and so on; must be <code>1</code> or larger
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4560
     *        and equal to or less than the number of columns in this rowset
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4561
     * @param x the new column value
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4562
     * @throws SQLException if (1) the given column index is out of bounds,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4563
     *            (2) the cursor is not on one of this rowset's rows or its
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4564
     *            insert row, or (3) this rowset is
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4565
     *            <code>ResultSet.CONCUR_READ_ONLY</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4566
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4567
    public void updateBytes(int columnIndex, byte x[]) throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4568
        // sanity check.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4569
        checkIndex(columnIndex);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4570
        // make sure the cursor is on a valid row
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4571
        checkCursor();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4572
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4573
        if (isBinary(RowSetMD.getColumnType(columnIndex)) == false) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4574
            throw new SQLException(resBundle.handleGetObject("cachedrowsetimpl.dtypemismt").toString());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4575
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4576
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4577
        getCurrentRow().setColumnObject(columnIndex, x);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4578
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4579
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4580
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4581
     * Sets the designated column in either the current row or the insert
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4582
     * row of this <code>CachedRowSetImpl</code> object with the given
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4583
     * <code>Date</code> object.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4584
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4585
     * This method updates a column value in either the current row or
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4586
     * the insert row of this rowset, but it does not update the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4587
     * database.  If the cursor is on a row in the rowset, the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4588
     * method {@link #updateRow} must be called to update the database.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4589
     * If the cursor is on the insert row, the method {@link #insertRow}
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4590
     * must be called, which will insert the new row into both this rowset
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4591
     * and the database. Both of these methods must be called before the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4592
     * cursor moves to another row.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4593
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4594
     * @param columnIndex the first column is <code>1</code>, the second
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4595
     *        is <code>2</code>, and so on; must be <code>1</code> or larger
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4596
     *        and equal to or less than the number of columns in this rowset
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4597
     * @param x the new column value
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4598
     * @throws SQLException if (1) the given column index is out of bounds,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4599
     *            (2) the cursor is not on one of this rowset's rows or its
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4600
     *            insert row, (3) the type of the designated column is not
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4601
     *            an SQL <code>DATE</code> or <code>TIMESTAMP</code>, or
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4602
     *            (4) this rowset is <code>ResultSet.CONCUR_READ_ONLY</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4603
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4604
    public void updateDate(int columnIndex, java.sql.Date x) throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4605
        // sanity check.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4606
        checkIndex(columnIndex);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4607
        // make sure the cursor is on a valid row
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4608
        checkCursor();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4609
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4610
        Object obj = convertTemporal(x,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4611
        java.sql.Types.DATE,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4612
        RowSetMD.getColumnType(columnIndex));
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4613
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4614
        getCurrentRow().setColumnObject(columnIndex, obj);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4615
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4616
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4617
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4618
     * Sets the designated column in either the current row or the insert
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4619
     * row of this <code>CachedRowSetImpl</code> object with the given
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4620
     * <code>Time</code> object.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4621
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4622
     * This method updates a column value in either the current row or
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4623
     * the insert row of this rowset, but it does not update the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4624
     * database.  If the cursor is on a row in the rowset, the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4625
     * method {@link #updateRow} must be called to update the database.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4626
     * If the cursor is on the insert row, the method {@link #insertRow}
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4627
     * must be called, which will insert the new row into both this rowset
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4628
     * and the database. Both of these methods must be called before the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4629
     * cursor moves to another row.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4630
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4631
     * @param columnIndex the first column is <code>1</code>, the second
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4632
     *        is <code>2</code>, and so on; must be <code>1</code> or larger
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4633
     *        and equal to or less than the number of columns in this rowset
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4634
     * @param x the new column value
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4635
     * @throws SQLException if (1) the given column index is out of bounds,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4636
     *            (2) the cursor is not on one of this rowset's rows or its
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4637
     *            insert row, (3) the type of the designated column is not
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4638
     *            an SQL <code>TIME</code> or <code>TIMESTAMP</code>, or
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4639
     *            (4) this rowset is <code>ResultSet.CONCUR_READ_ONLY</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4640
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4641
    public void updateTime(int columnIndex, java.sql.Time x) throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4642
        // sanity check.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4643
        checkIndex(columnIndex);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4644
        // make sure the cursor is on a valid row
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4645
        checkCursor();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4646
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4647
        Object obj = convertTemporal(x,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4648
        java.sql.Types.TIME,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4649
        RowSetMD.getColumnType(columnIndex));
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4650
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4651
        getCurrentRow().setColumnObject(columnIndex, obj);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4652
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4653
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4654
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4655
     * Sets the designated column in either the current row or the insert
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4656
     * row of this <code>CachedRowSetImpl</code> object with the given
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4657
     * <code>Timestamp</code> object.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4658
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4659
     * This method updates a column value in either the current row or
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4660
     * the insert row of this rowset, but it does not update the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4661
     * database.  If the cursor is on a row in the rowset, the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4662
     * method {@link #updateRow} must be called to update the database.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4663
     * If the cursor is on the insert row, the method {@link #insertRow}
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4664
     * must be called, which will insert the new row into both this rowset
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4665
     * and the database. Both of these methods must be called before the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4666
     * cursor moves to another row.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4667
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4668
     * @param columnIndex the first column is <code>1</code>, the second
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4669
     *        is <code>2</code>, and so on; must be <code>1</code> or larger
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4670
     *        and equal to or less than the number of columns in this rowset
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4671
     * @param x the new column value
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4672
     * @throws SQLException if (1) the given column index is out of bounds,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4673
     *            (2) the cursor is not on one of this rowset's rows or its
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4674
     *            insert row, (3) the type of the designated column is not
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4675
     *            an SQL <code>DATE</code>, <code>TIME</code>, or
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4676
     *            <code>TIMESTAMP</code>, or (4) this rowset is
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4677
     *            <code>ResultSet.CONCUR_READ_ONLY</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4678
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4679
    public void updateTimestamp(int columnIndex, java.sql.Timestamp x) throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4680
        // sanity check.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4681
        checkIndex(columnIndex);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4682
        // make sure the cursor is on a valid row
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4683
        checkCursor();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4684
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4685
        Object obj = convertTemporal(x,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4686
        java.sql.Types.TIMESTAMP,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4687
        RowSetMD.getColumnType(columnIndex));
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4688
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4689
        getCurrentRow().setColumnObject(columnIndex, obj);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4690
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4691
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4692
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4693
     * Sets the designated column in either the current row or the insert
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4694
     * row of this <code>CachedRowSetImpl</code> object with the given
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4695
     * ASCII stream value.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4696
     * <P>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4697
     * This method updates a column value in either the current row or
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4698
     * the insert row of this rowset, but it does not update the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4699
     * database.  If the cursor is on a row in the rowset, the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4700
     * method {@link #updateRow} must be called to update the database.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4701
     * If the cursor is on the insert row, the method {@link #insertRow}
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4702
     * must be called, which will insert the new row into both this rowset
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4703
     * and the database. Both of these methods must be called before the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4704
     * cursor moves to another row.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4705
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4706
     * @param columnIndex the first column is <code>1</code>, the second
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4707
     *        is <code>2</code>, and so on; must be <code>1</code> or larger
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4708
     *        and equal to or less than the number of columns in this rowset
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4709
     * @param x the new column value
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4710
     * @param length the number of one-byte ASCII characters in the stream
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4711
     * @throws SQLException if this method is invoked
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4712
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4713
    public void updateAsciiStream(int columnIndex, java.io.InputStream x, int length) throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4714
        // sanity Check
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4715
        checkIndex(columnIndex);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4716
        // make sure the cursor is on a valid row
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4717
        checkCursor();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4718
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4719
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4720
        if (isString(RowSetMD.getColumnType(columnIndex)) == false &&
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4721
        isBinary(RowSetMD.getColumnType(columnIndex)) == false) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4722
            throw new SQLException(resBundle.handleGetObject("cachedrowsetimpl.dtypemismt").toString());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4723
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4724
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4725
        byte buf[] = new byte[length];
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4726
        try {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4727
            int charsRead = 0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4728
            do {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4729
                charsRead += x.read(buf, charsRead, length - charsRead);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4730
            } while (charsRead != length);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4731
            //Changed the condition check to check for length instead of -1
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4732
        } catch (java.io.IOException ex) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4733
            throw new SQLException(resBundle.handleGetObject("cachedrowsetimpl.asciistream").toString());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4734
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4735
        String str = new String(buf);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4736
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4737
        getCurrentRow().setColumnObject(columnIndex, str);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4738
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4739
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4740
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4741
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4742
     * Sets the designated column in either the current row or the insert
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4743
     * row of this <code>CachedRowSetImpl</code> object with the given
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4744
     * <code>java.io.InputStream</code> object.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4745
     * <P>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4746
     * This method updates a column value in either the current row or
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4747
     * the insert row of this rowset, but it does not update the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4748
     * database.  If the cursor is on a row in the rowset, the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4749
     * method {@link #updateRow} must be called to update the database.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4750
     * If the cursor is on the insert row, the method {@link #insertRow}
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4751
     * must be called, which will insert the new row into both this rowset
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4752
     * and the database. Both of these methods must be called before the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4753
     * cursor moves to another row.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4754
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4755
     * @param columnIndex the first column is <code>1</code>, the second
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4756
     *        is <code>2</code>, and so on; must be <code>1</code> or larger
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4757
     *        and equal to or less than the number of columns in this rowset
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4758
     * @param x the new column value; must be a <code>java.io.InputStream</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4759
     *          containing <code>BINARY</code>, <code>VARBINARY</code>, or
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4760
     *          <code>LONGVARBINARY</code> data
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4761
     * @param length the length of the stream in bytes
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4762
     * @throws SQLException if (1) the given column index is out of bounds,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4763
     *            (2) the cursor is not on one of this rowset's rows or its
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4764
     *            insert row, (3) the data in the stream is not binary, or
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4765
     *            (4) this rowset is <code>ResultSet.CONCUR_READ_ONLY</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4766
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4767
    public void updateBinaryStream(int columnIndex, java.io.InputStream x,int length) throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4768
        // sanity Check
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4769
        checkIndex(columnIndex);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4770
        // make sure the cursor is on a valid row
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4771
        checkCursor();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4772
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4773
        if (isBinary(RowSetMD.getColumnType(columnIndex)) == false) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4774
            throw new SQLException(resBundle.handleGetObject("cachedrowsetimpl.dtypemismt").toString());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4775
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4776
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4777
        byte buf[] = new byte[length];
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4778
        try {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4779
            int bytesRead = 0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4780
            do {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4781
                bytesRead += x.read(buf, bytesRead, length - bytesRead);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4782
            } while (bytesRead != -1);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4783
        } catch (java.io.IOException ex) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4784
            throw new SQLException(resBundle.handleGetObject("cachedrowsetimpl.binstream").toString());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4785
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4786
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4787
        getCurrentRow().setColumnObject(columnIndex, buf);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4788
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4789
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4790
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4791
     * Sets the designated column in either the current row or the insert
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4792
     * row of this <code>CachedRowSetImpl</code> object with the given
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4793
     * <code>java.io.Reader</code> object.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4794
     * <P>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4795
     * This method updates a column value in either the current row or
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4796
     * the insert row of this rowset, but it does not update the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4797
     * database.  If the cursor is on a row in the rowset, the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4798
     * method {@link #updateRow} must be called to update the database.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4799
     * If the cursor is on the insert row, the method {@link #insertRow}
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4800
     * must be called, which will insert the new row into both this rowset
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4801
     * and the database. Both of these methods must be called before the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4802
     * cursor moves to another row.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4803
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4804
     * @param columnIndex the first column is <code>1</code>, the second
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4805
     *        is <code>2</code>, and so on; must be <code>1</code> or larger
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4806
     *        and equal to or less than the number of columns in this rowset
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4807
     * @param x the new column value; must be a <code>java.io.Reader</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4808
     *          containing <code>BINARY</code>, <code>VARBINARY</code>,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4809
     *          <code>LONGVARBINARY</code>, <code>CHAR</code>, <code>VARCHAR</code>,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4810
     *          or <code>LONGVARCHAR</code> data
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4811
     * @param length the length of the stream in characters
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4812
     * @throws SQLException if (1) the given column index is out of bounds,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4813
     *            (2) the cursor is not on one of this rowset's rows or its
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4814
     *            insert row, (3) the data in the stream is not a binary or
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4815
     *            character type, or (4) this rowset is
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4816
     *            <code>ResultSet.CONCUR_READ_ONLY</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4817
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4818
    public void updateCharacterStream(int columnIndex, java.io.Reader x, int length) throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4819
        // sanity Check
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4820
        checkIndex(columnIndex);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4821
        // make sure the cursor is on a valid row
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4822
        checkCursor();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4823
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4824
        if (isString(RowSetMD.getColumnType(columnIndex)) == false &&
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4825
        isBinary(RowSetMD.getColumnType(columnIndex)) == false) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4826
            throw new SQLException(resBundle.handleGetObject("cachedrowsetimpl.dtypemismt").toString());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4827
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4828
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4829
        char buf[] = new char[length];
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4830
        try {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4831
            int charsRead = 0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4832
            do {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4833
                charsRead += x.read(buf, charsRead, length - charsRead);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4834
            } while (charsRead != length);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4835
            //Changed the condition checking to check for length instead of -1
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4836
        } catch (java.io.IOException ex) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4837
            throw new SQLException(resBundle.handleGetObject("cachedrowsetimpl.binstream").toString());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4838
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4839
        String str = new String(buf);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4840
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4841
        getCurrentRow().setColumnObject(columnIndex, str);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4842
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4843
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4844
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4845
     * Sets the designated column in either the current row or the insert
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4846
     * row of this <code>CachedRowSetImpl</code> object with the given
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4847
     * <code>Object</code> value.  The <code>scale</code> parameter indicates
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4848
     * the number of digits to the right of the decimal point and is ignored
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4849
     * if the new column value is not a type that will be mapped to an SQL
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4850
     * <code>DECIMAL</code> or <code>NUMERIC</code> value.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4851
     * <P>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4852
     * This method updates a column value in either the current row or
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4853
     * the insert row of this rowset, but it does not update the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4854
     * database.  If the cursor is on a row in the rowset, the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4855
     * method {@link #updateRow} must be called to update the database.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4856
     * If the cursor is on the insert row, the method {@link #insertRow}
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4857
     * must be called, which will insert the new row into both this rowset
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4858
     * and the database. Both of these methods must be called before the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4859
     * cursor moves to another row.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4860
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4861
     * @param columnIndex the first column is <code>1</code>, the second
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4862
     *        is <code>2</code>, and so on; must be <code>1</code> or larger
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4863
     *        and equal to or less than the number of columns in this rowset
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4864
     * @param x the new column value
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4865
     * @param scale the number of digits to the right of the decimal point (for
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4866
     *              <code>DECIMAL</code> and <code>NUMERIC</code> types only)
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4867
     * @throws SQLException if (1) the given column index is out of bounds,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4868
     *            (2) the cursor is not on one of this rowset's rows or its
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4869
     *            insert row, or (3) this rowset is
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4870
     *            <code>ResultSet.CONCUR_READ_ONLY</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4871
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4872
    public void updateObject(int columnIndex, Object x, int scale) throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4873
        // sanity check.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4874
        checkIndex(columnIndex);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4875
        // make sure the cursor is on a valid row
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4876
        checkCursor();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4877
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4878
        int type = RowSetMD.getColumnType(columnIndex);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4879
        if (type == Types.DECIMAL || type == Types.NUMERIC) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4880
            ((java.math.BigDecimal)x).setScale(scale);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4881
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4882
        getCurrentRow().setColumnObject(columnIndex, x);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4883
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4884
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4885
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4886
     * Sets the designated column in either the current row or the insert
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4887
     * row of this <code>CachedRowSetImpl</code> object with the given
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4888
     * <code>Object</code> value.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4889
     * <P>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4890
     * This method updates a column value in either the current row or
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4891
     * the insert row of this rowset, but it does not update the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4892
     * database.  If the cursor is on a row in the rowset, the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4893
     * method {@link #updateRow} must be called to update the database.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4894
     * If the cursor is on the insert row, the method {@link #insertRow}
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4895
     * must be called, which will insert the new row into both this rowset
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4896
     * and the database. Both of these methods must be called before the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4897
     * cursor moves to another row.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4898
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4899
     * @param columnIndex the first column is <code>1</code>, the second
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4900
     *        is <code>2</code>, and so on; must be <code>1</code> or larger
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4901
     *        and equal to or less than the number of columns in this rowset
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4902
     * @param x the new column value
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4903
     * @throws SQLException if (1) the given column index is out of bounds,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4904
     *            (2) the cursor is not on one of this rowset's rows or its
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4905
     *            insert row, or (3) this rowset is
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4906
     *            <code>ResultSet.CONCUR_READ_ONLY</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4907
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4908
    public void updateObject(int columnIndex, Object x) throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4909
        // sanity check.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4910
        checkIndex(columnIndex);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4911
        // make sure the cursor is on a valid row
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4912
        checkCursor();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4913
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4914
        getCurrentRow().setColumnObject(columnIndex, x);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4915
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4916
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4917
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4918
     * Sets the designated nullable column in the current row or the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4919
     * insert row of this <code>CachedRowSetImpl</code> object with
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4920
     * <code>null</code> value.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4921
     * <P>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4922
     * This method updates a column value in the current row or the insert
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4923
     * row of this rowset, but it does not update the database.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4924
     * If the cursor is on a row in the rowset, the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4925
     * method {@link #updateRow} must be called to update the database.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4926
     * If the cursor is on the insert row, the method {@link #insertRow}
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4927
     * must be called, which will insert the new row into both this rowset
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4928
     * and the database.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4929
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4930
     * @param columnName a <code>String</code> object that must match the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4931
     *        SQL name of a column in this rowset, ignoring case
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4932
     * @throws SQLException if (1) the given column name does not match the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4933
     *            name of a column in this rowset, (2) the cursor is not on
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4934
     *            one of this rowset's rows or its insert row, or (3) this
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4935
     *            rowset is <code>ResultSet.CONCUR_READ_ONLY</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4936
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4937
    public void updateNull(String columnName) throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4938
        updateNull(getColIdxByName(columnName));
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4939
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4940
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4941
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4942
     * Sets the designated column in either the current row or the insert
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4943
     * row of this <code>CachedRowSetImpl</code> object with the given
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4944
     * <code>boolean</code> value.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4945
     * <P>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4946
     * This method updates a column value in the current row or the insert
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4947
     * row of this rowset, but it does not update the database.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4948
     * If the cursor is on a row in the rowset, the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4949
     * method {@link #updateRow} must be called to update the database.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4950
     * If the cursor is on the insert row, the method {@link #insertRow}
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4951
     * must be called, which will insert the new row into both this rowset
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4952
     * and the database. Both of these methods must be called before the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4953
     * cursor moves to another row.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4954
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4955
     * @param columnName a <code>String</code> object that must match the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4956
     *        SQL name of a column in this rowset, ignoring case
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4957
     * @param x the new column value
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4958
     * @throws SQLException if (1) the given column name does not match the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4959
     *            name of a column in this rowset, (2) the cursor is not on
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4960
     *            one of this rowset's rows or its insert row, or (3) this
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4961
     *            rowset is <code>ResultSet.CONCUR_READ_ONLY</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4962
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4963
    public void updateBoolean(String columnName, boolean x) throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4964
        updateBoolean(getColIdxByName(columnName), x);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4965
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4966
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4967
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4968
     * Sets the designated column in either the current row or the insert
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4969
     * row of this <code>CachedRowSetImpl</code> object with the given
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4970
     * <code>byte</code> value.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4971
     * <P>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4972
     * This method updates a column value in the current row or the insert
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4973
     * row of this rowset, but it does not update the database.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4974
     * If the cursor is on a row in the rowset, the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4975
     * method {@link #updateRow} must be called to update the database.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4976
     * If the cursor is on the insert row, the method {@link #insertRow}
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4977
     * must be called, which will insert the new row into both this rowset
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4978
     * and the database. Both of these methods must be called before the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4979
     * cursor moves to another row.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4980
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4981
     * @param columnName a <code>String</code> object that must match the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4982
     *        SQL name of a column in this rowset, ignoring case
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4983
     * @param x the new column value
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4984
     * @throws SQLException if (1) the given column name does not match the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4985
     *            name of a column in this rowset, (2) the cursor is not on
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4986
     *            one of this rowset's rows or its insert row, or (3) this
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4987
     *            rowset is <code>ResultSet.CONCUR_READ_ONLY</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4988
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4989
    public void updateByte(String columnName, byte x) throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4990
        updateByte(getColIdxByName(columnName), x);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4991
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4992
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4993
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4994
     * Sets the designated column in either the current row or the insert
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4995
     * row of this <code>CachedRowSetImpl</code> object with the given
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4996
     * <code>short</code> value.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4997
     * <P>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4998
     * This method updates a column value in the current row or the insert
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4999
     * row of this rowset, but it does not update the database.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5000
     * If the cursor is on a row in the rowset, the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5001
     * method {@link #updateRow} must be called to update the database.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5002
     * If the cursor is on the insert row, the method {@link #insertRow}
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5003
     * must be called, which will insert the new row into both this rowset
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5004
     * and the database. Both of these methods must be called before the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5005
     * cursor moves to another row.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5006
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5007
     * @param columnName a <code>String</code> object that must match the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5008
     *        SQL name of a column in this rowset, ignoring case
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5009
     * @param x the new column value
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5010
     * @throws SQLException if (1) the given column name does not match the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5011
     *            name of a column in this rowset, (2) the cursor is not on
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5012
     *            one of this rowset's rows or its insert row, or (3) this
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5013
     *            rowset is <code>ResultSet.CONCUR_READ_ONLY</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5014
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5015
    public void updateShort(String columnName, short x) throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5016
        updateShort(getColIdxByName(columnName), x);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5017
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5018
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5019
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5020
     * Sets the designated column in either the current row or the insert
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5021
     * row of this <code>CachedRowSetImpl</code> object with the given
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5022
     * <code>int</code> value.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5023
     * <P>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5024
     * This method updates a column value in the current row or the insert
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5025
     * row of this rowset, but it does not update the database.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5026
     * If the cursor is on a row in the rowset, the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5027
     * method {@link #updateRow} must be called to update the database.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5028
     * If the cursor is on the insert row, the method {@link #insertRow}
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5029
     * must be called, which will insert the new row into both this rowset
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5030
     * and the database. Both of these methods must be called before the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5031
     * cursor moves to another row.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5032
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5033
     * @param columnName a <code>String</code> object that must match the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5034
     *        SQL name of a column in this rowset, ignoring case
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5035
     * @param x the new column value
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5036
     * @throws SQLException if (1) the given column name does not match the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5037
     *            name of a column in this rowset, (2) the cursor is not on
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5038
     *            one of this rowset's rows or its insert row, or (3) this
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5039
     *            rowset is <code>ResultSet.CONCUR_READ_ONLY</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5040
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5041
    public void updateInt(String columnName, int x) throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5042
        updateInt(getColIdxByName(columnName), x);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5043
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5044
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5045
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5046
     * Sets the designated column in either the current row or the insert
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5047
     * row of this <code>CachedRowSetImpl</code> object with the given
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5048
     * <code>long</code> value.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5049
     * <P>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5050
     * This method updates a column value in the current row or the insert
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5051
     * row of this rowset, but it does not update the database.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5052
     * If the cursor is on a row in the rowset, the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5053
     * method {@link #updateRow} must be called to update the database.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5054
     * If the cursor is on the insert row, the method {@link #insertRow}
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5055
     * must be called, which will insert the new row into both this rowset
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5056
     * and the database. Both of these methods must be called before the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5057
     * cursor moves to another row.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5058
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5059
     * @param columnName a <code>String</code> object that must match the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5060
     *        SQL name of a column in this rowset, ignoring case
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5061
     * @param x the new column value
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5062
     * @throws SQLException if (1) the given column name does not match the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5063
     *            name of a column in this rowset, (2) the cursor is not on
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5064
     *            one of this rowset's rows or its insert row, or (3) this
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5065
     *            rowset is <code>ResultSet.CONCUR_READ_ONLY</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5066
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5067
    public void updateLong(String columnName, long x) throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5068
        updateLong(getColIdxByName(columnName), x);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5069
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5070
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5071
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5072
     * Sets the designated column in either the current row or the insert
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5073
     * row of this <code>CachedRowSetImpl</code> object with the given
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5074
     * <code>float</code> value.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5075
     * <P>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5076
     * This method updates a column value in the current row or the insert
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5077
     * row of this rowset, but it does not update the database.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5078
     * If the cursor is on a row in the rowset, the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5079
     * method {@link #updateRow} must be called to update the database.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5080
     * If the cursor is on the insert row, the method {@link #insertRow}
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5081
     * must be called, which will insert the new row into both this rowset
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5082
     * and the database. Both of these methods must be called before the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5083
     * cursor moves to another row.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5084
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5085
     * @param columnName a <code>String</code> object that must match the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5086
     *        SQL name of a column in this rowset, ignoring case
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5087
     * @param x the new column value
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5088
     * @throws SQLException if (1) the given column name does not match the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5089
     *            name of a column in this rowset, (2) the cursor is not on
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5090
     *            one of this rowset's rows or its insert row, or (3) this
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5091
     *            rowset is <code>ResultSet.CONCUR_READ_ONLY</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5092
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5093
    public void updateFloat(String columnName, float x) throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5094
        updateFloat(getColIdxByName(columnName), x);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5095
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5096
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5097
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5098
     * Sets the designated column in either the current row or the insert
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5099
     * row of this <code>CachedRowSetImpl</code> object with the given
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5100
     * <code>double</code> value.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5101
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5102
     * This method updates a column value in either the current row or
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5103
     * the insert row of this rowset, but it does not update the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5104
     * database.  If the cursor is on a row in the rowset, the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5105
     * method {@link #updateRow} must be called to update the database.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5106
     * If the cursor is on the insert row, the method {@link #insertRow}
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5107
     * must be called, which will insert the new row into both this rowset
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5108
     * and the database. Both of these methods must be called before the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5109
     * cursor moves to another row.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5110
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5111
     * @param columnName a <code>String</code> object that must match the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5112
     *        SQL name of a column in this rowset, ignoring case
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5113
     * @param x the new column value
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5114
     * @throws SQLException if (1) the given column name does not match the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5115
     *            name of a column in this rowset, (2) the cursor is not on
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5116
     *            one of this rowset's rows or its insert row, or (3) this
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5117
     *            rowset is <code>ResultSet.CONCUR_READ_ONLY</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5118
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5119
    public void updateDouble(String columnName, double x) throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5120
        updateDouble(getColIdxByName(columnName), x);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5121
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5122
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5123
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5124
     * Sets the designated column in either the current row or the insert
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5125
     * row of this <code>CachedRowSetImpl</code> object with the given
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5126
     * <code>java.math.BigDecimal</code> object.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5127
     * <P>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5128
     * This method updates a column value in the current row or the insert
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5129
     * row of this rowset, but it does not update the database.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5130
     * If the cursor is on a row in the rowset, the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5131
     * method {@link #updateRow} must be called to update the database.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5132
     * If the cursor is on the insert row, the method {@link #insertRow}
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5133
     * must be called, which will insert the new row into both this rowset
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5134
     * and the database. Both of these methods must be called before the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5135
     * cursor moves to another row.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5136
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5137
     * @param columnName a <code>String</code> object that must match the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5138
     *        SQL name of a column in this rowset, ignoring case
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5139
     * @param x the new column value
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5140
     * @throws SQLException if (1) the given column name does not match the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5141
     *            name of a column in this rowset, (2) the cursor is not on
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5142
     *            one of this rowset's rows or its insert row, or (3) this
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5143
     *            rowset is <code>ResultSet.CONCUR_READ_ONLY</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5144
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5145
    public void updateBigDecimal(String columnName, BigDecimal x) throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5146
        updateBigDecimal(getColIdxByName(columnName), x);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5147
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5148
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5149
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5150
     * Sets the designated column in either the current row or the insert
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5151
     * row of this <code>CachedRowSetImpl</code> object with the given
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5152
     * <code>String</code> object.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5153
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5154
     * This method updates a column value in either the current row or
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5155
     * the insert row of this rowset, but it does not update the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5156
     * database.  If the cursor is on a row in the rowset, the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5157
     * method {@link #updateRow} must be called to update the database.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5158
     * If the cursor is on the insert row, the method {@link #insertRow}
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5159
     * must be called, which will insert the new row into both this rowset
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5160
     * and the database. Both of these methods must be called before the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5161
     * cursor moves to another row.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5162
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5163
     * @param columnName a <code>String</code> object that must match the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5164
     *        SQL name of a column in this rowset, ignoring case
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5165
     * @param x the new column value
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5166
     * @throws SQLException if (1) the given column name does not match the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5167
     *            name of a column in this rowset, (2) the cursor is not on
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5168
     *            one of this rowset's rows or its insert row, or (3) this
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5169
     *            rowset is <code>ResultSet.CONCUR_READ_ONLY</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5170
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5171
    public void updateString(String columnName, String x) throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5172
        updateString(getColIdxByName(columnName), x);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5173
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5174
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5175
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5176
     * Sets the designated column in either the current row or the insert
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5177
     * row of this <code>CachedRowSetImpl</code> object with the given
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5178
     * <code>byte</code> array.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5179
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5180
     * This method updates a column value in either the current row or
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5181
     * the insert row of this rowset, but it does not update the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5182
     * database.  If the cursor is on a row in the rowset, the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5183
     * method {@link #updateRow} must be called to update the database.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5184
     * If the cursor is on the insert row, the method {@link #insertRow}
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5185
     * must be called, which will insert the new row into both this rowset
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5186
     * and the database. Both of these methods must be called before the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5187
     * cursor moves to another row.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5188
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5189
     * @param columnName a <code>String</code> object that must match the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5190
     *        SQL name of a column in this rowset, ignoring case
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5191
     * @param x the new column value
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5192
     * @throws SQLException if (1) the given column name does not match the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5193
     *            name of a column in this rowset, (2) the cursor is not on
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5194
     *            one of this rowset's rows or its insert row, or (3) this
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5195
     *            rowset is <code>ResultSet.CONCUR_READ_ONLY</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5196
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5197
    public void updateBytes(String columnName, byte x[]) throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5198
        updateBytes(getColIdxByName(columnName), x);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5199
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5200
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5201
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5202
     * Sets the designated column in either the current row or the insert
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5203
     * row of this <code>CachedRowSetImpl</code> object with the given
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5204
     * <code>Date</code> object.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5205
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5206
     * This method updates a column value in either the current row or
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5207
     * the insert row of this rowset, but it does not update the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5208
     * database.  If the cursor is on a row in the rowset, the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5209
     * method {@link #updateRow} must be called to update the database.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5210
     * If the cursor is on the insert row, the method {@link #insertRow}
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5211
     * must be called, which will insert the new row into both this rowset
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5212
     * and the database. Both of these methods must be called before the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5213
     * cursor moves to another row.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5214
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5215
     * @param columnName a <code>String</code> object that must match the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5216
     *        SQL name of a column in this rowset, ignoring case
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5217
     * @param x the new column value
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5218
     * @throws SQLException if (1) the given column name does not match the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5219
     *            name of a column in this rowset, (2) the cursor is not on
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5220
     *            one of this rowset's rows or its insert row, (3) the type
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5221
     *            of the designated column is not an SQL <code>DATE</code> or
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5222
     *            <code>TIMESTAMP</code>, or (4) this rowset is
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5223
     *            <code>ResultSet.CONCUR_READ_ONLY</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5224
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5225
    public void updateDate(String columnName, java.sql.Date x) throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5226
        updateDate(getColIdxByName(columnName), x);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5227
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5228
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5229
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5230
     * Sets the designated column in either the current row or the insert
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5231
     * row of this <code>CachedRowSetImpl</code> object with the given
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5232
     * <code>Time</code> object.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5233
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5234
     * This method updates a column value in either the current row or
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5235
     * the insert row of this rowset, but it does not update the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5236
     * database.  If the cursor is on a row in the rowset, the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5237
     * method {@link #updateRow} must be called to update the database.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5238
     * If the cursor is on the insert row, the method {@link #insertRow}
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5239
     * must be called, which will insert the new row into both this rowset
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5240
     * and the database. Both of these methods must be called before the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5241
     * cursor moves to another row.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5242
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5243
     * @param columnName a <code>String</code> object that must match the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5244
     *        SQL name of a column in this rowset, ignoring case
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5245
     * @param x the new column value
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5246
     * @throws SQLException if (1) the given column name does not match the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5247
     *            name of a column in this rowset, (2) the cursor is not on
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5248
     *            one of this rowset's rows or its insert row, (3) the type
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5249
     *            of the designated column is not an SQL <code>TIME</code> or
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5250
     *            <code>TIMESTAMP</code>, or (4) this rowset is
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5251
     *            <code>ResultSet.CONCUR_READ_ONLY</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5252
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5253
    public void updateTime(String columnName, java.sql.Time x) throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5254
        updateTime(getColIdxByName(columnName), x);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5255
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5256
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5257
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5258
     * Sets the designated column in either the current row or the insert
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5259
     * row of this <code>CachedRowSetImpl</code> object with the given
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5260
     * <code>Timestamp</code> object.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5261
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5262
     * This method updates a column value in either the current row or
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5263
     * the insert row of this rowset, but it does not update the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5264
     * database.  If the cursor is on a row in the rowset, the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5265
     * method {@link #updateRow} must be called to update the database.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5266
     * If the cursor is on the insert row, the method {@link #insertRow}
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5267
     * must be called, which will insert the new row into both this rowset
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5268
     * and the database. Both of these methods must be called before the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5269
     * cursor moves to another row.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5270
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5271
     * @param columnName a <code>String</code> object that must match the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5272
     *        SQL name of a column in this rowset, ignoring case
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5273
     * @param x the new column value
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5274
     * @throws SQLException if the given column index is out of bounds or
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5275
     *            the cursor is not on one of this rowset's rows or its
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5276
     *            insert row
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5277
     * @throws SQLException if (1) the given column name does not match the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5278
     *            name of a column in this rowset, (2) the cursor is not on
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5279
     *            one of this rowset's rows or its insert row, (3) the type
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5280
     *            of the designated column is not an SQL <code>DATE</code>,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5281
     *            <code>TIME</code>, or <code>TIMESTAMP</code>, or (4) this
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5282
     *            rowset is <code>ResultSet.CONCUR_READ_ONLY</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5283
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5284
    public void updateTimestamp(String columnName, java.sql.Timestamp x) throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5285
        updateTimestamp(getColIdxByName(columnName), x);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5286
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5287
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5288
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5289
     * Sets the designated column in either the current row or the insert
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5290
     * row of this <code>CachedRowSetImpl</code> object with the given
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5291
     * ASCII stream value.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5292
     * <P>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5293
     * This method updates a column value in either the current row or
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5294
     * the insert row of this rowset, but it does not update the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5295
     * database.  If the cursor is on a row in the rowset, the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5296
     * method {@link #updateRow} must be called to update the database.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5297
     * If the cursor is on the insert row, the method {@link #insertRow}
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5298
     * must be called, which will insert the new row into both this rowset
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5299
     * and the database. Both of these methods must be called before the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5300
     * cursor moves to another row.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5301
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5302
     * @param columnName a <code>String</code> object that must match the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5303
     *        SQL name of a column in this rowset, ignoring case
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5304
     * @param x the new column value
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5305
     * @param length the number of one-byte ASCII characters in the stream
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5306
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5307
    public void updateAsciiStream(String columnName,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5308
    java.io.InputStream x,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5309
    int length) throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5310
        updateAsciiStream(getColIdxByName(columnName), x, length);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5311
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5312
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5313
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5314
     * Sets the designated column in either the current row or the insert
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5315
     * row of this <code>CachedRowSetImpl</code> object with the given
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5316
     * <code>java.io.InputStream</code> object.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5317
     * <P>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5318
     * This method updates a column value in either the current row or
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5319
     * the insert row of this rowset, but it does not update the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5320
     * database.  If the cursor is on a row in the rowset, the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5321
     * method {@link #updateRow} must be called to update the database.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5322
     * If the cursor is on the insert row, the method {@link #insertRow}
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5323
     * must be called, which will insert the new row into both this rowset
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5324
     * and the database. Both of these methods must be called before the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5325
     * cursor moves to another row.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5326
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5327
     * @param columnName a <code>String</code> object that must match the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5328
     *        SQL name of a column in this rowset, ignoring case
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5329
     * @param x the new column value; must be a <code>java.io.InputStream</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5330
     *          containing <code>BINARY</code>, <code>VARBINARY</code>, or
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5331
     *          <code>LONGVARBINARY</code> data
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5332
     * @param length the length of the stream in bytes
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5333
     * @throws SQLException if (1) the given column name does not match the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5334
     *            name of a column in this rowset, (2) the cursor is not on
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5335
     *            one of this rowset's rows or its insert row, (3) the data
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5336
     *            in the stream is not binary, or (4) this rowset is
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5337
     *            <code>ResultSet.CONCUR_READ_ONLY</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5338
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5339
    public void updateBinaryStream(String columnName, java.io.InputStream x, int length) throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5340
        updateBinaryStream(getColIdxByName(columnName), x, length);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5341
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5342
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5343
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5344
     * Sets the designated column in either the current row or the insert
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5345
     * row of this <code>CachedRowSetImpl</code> object with the given
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5346
     * <code>java.io.Reader</code> object.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5347
     * <P>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5348
     * This method updates a column value in either the current row or
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5349
     * the insert row of this rowset, but it does not update the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5350
     * database.  If the cursor is on a row in the rowset, the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5351
     * method {@link #updateRow} must be called to update the database.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5352
     * If the cursor is on the insert row, the method {@link #insertRow}
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5353
     * must be called, which will insert the new row into both this rowset
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5354
     * and the database. Both of these methods must be called before the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5355
     * cursor moves to another row.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5356
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5357
     * @param columnName a <code>String</code> object that must match the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5358
     *        SQL name of a column in this rowset, ignoring case
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5359
     * @param reader the new column value; must be a
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5360
     * <code>java.io.Reader</code> containing <code>BINARY</code>,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5361
     * <code>VARBINARY</code>, <code>LONGVARBINARY</code>, <code>CHAR</code>,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5362
     * <code>VARCHAR</code>, or <code>LONGVARCHAR</code> data
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5363
     * @param length the length of the stream in characters
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5364
     * @throws SQLException if (1) the given column name does not match the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5365
     *            name of a column in this rowset, (2) the cursor is not on
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5366
     *            one of this rowset's rows or its insert row, (3) the data
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5367
     *            in the stream is not a binary or character type, or (4) this
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5368
     *            rowset is <code>ResultSet.CONCUR_READ_ONLY</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5369
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5370
    public void updateCharacterStream(String columnName,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5371
    java.io.Reader reader,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5372
    int length) throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5373
        updateCharacterStream(getColIdxByName(columnName), reader, length);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5374
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5375
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5376
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5377
     * Sets the designated column in either the current row or the insert
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5378
     * row of this <code>CachedRowSetImpl</code> object with the given
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5379
     * <code>Object</code> value.  The <code>scale</code> parameter
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5380
     * indicates the number of digits to the right of the decimal point
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5381
     * and is ignored if the new column value is not a type that will be
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5382
     *  mapped to an SQL <code>DECIMAL</code> or <code>NUMERIC</code> value.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5383
     * <P>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5384
     * This method updates a column value in either the current row or
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5385
     * the insert row of this rowset, but it does not update the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5386
     * database.  If the cursor is on a row in the rowset, the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5387
     * method {@link #updateRow} must be called to update the database.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5388
     * If the cursor is on the insert row, the method {@link #insertRow}
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5389
     * must be called, which will insert the new row into both this rowset
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5390
     * and the database. Both of these methods must be called before the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5391
     * cursor moves to another row.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5392
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5393
     * @param columnName a <code>String</code> object that must match the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5394
     *        SQL name of a column in this rowset, ignoring case
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5395
     * @param x the new column value
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5396
     * @param scale the number of digits to the right of the decimal point (for
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5397
     *              <code>DECIMAL</code> and <code>NUMERIC</code> types only)
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5398
     * @throws SQLException if (1) the given column name does not match the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5399
     *            name of a column in this rowset, (2) the cursor is not on
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5400
     *            one of this rowset's rows or its insert row, or (3) this
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5401
     *            rowset is <code>ResultSet.CONCUR_READ_ONLY</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5402
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5403
    public void updateObject(String columnName, Object x, int scale) throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5404
        updateObject(getColIdxByName(columnName), x, scale);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5405
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5406
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5407
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5408
     * Sets the designated column in either the current row or the insert
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5409
     * row of this <code>CachedRowSetImpl</code> object with the given
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5410
     * <code>Object</code> value.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5411
     * <P>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5412
     * This method updates a column value in either the current row or
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5413
     * the insert row of this rowset, but it does not update the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5414
     * database.  If the cursor is on a row in the rowset, the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5415
     * method {@link #updateRow} must be called to update the database.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5416
     * If the cursor is on the insert row, the method {@link #insertRow}
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5417
     * must be called, which will insert the new row into both this rowset
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5418
     * and the database. Both of these methods must be called before the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5419
     * cursor moves to another row.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5420
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5421
     * @param columnName a <code>String</code> object that must match the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5422
     *        SQL name of a column in this rowset, ignoring case
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5423
     * @param x the new column value
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5424
     * @throws SQLException if (1) the given column name does not match the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5425
     *            name of a column in this rowset, (2) the cursor is not on
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5426
     *            one of this rowset's rows or its insert row, or (3) this
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5427
     *            rowset is <code>ResultSet.CONCUR_READ_ONLY</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5428
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5429
    public void updateObject(String columnName, Object x) throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5430
        updateObject(getColIdxByName(columnName), x);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5431
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5432
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5433
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5434
     * Inserts the contents of this <code>CachedRowSetImpl</code> object's insert
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5435
     * row into this rowset immediately following the current row.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5436
     * If the current row is the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5437
     * position after the last row or before the first row, the new row will
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5438
     * be inserted at the end of the rowset.  This method also notifies
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5439
     * listeners registered with this rowset that the row has changed.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5440
     * <P>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5441
     * The cursor must be on the insert row when this method is called.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5442
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5443
     * @throws SQLException if (1) the cursor is not on the insert row,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5444
     *            (2) one or more of the non-nullable columns in the insert
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5445
     *            row has not been given a value, or (3) this rowset is
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5446
     *            <code>ResultSet.CONCUR_READ_ONLY</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5447
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5448
    public void insertRow() throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5449
        int pos;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5450
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5451
        if (onInsertRow == false ||
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5452
            insertRow.isCompleteRow(RowSetMD) == false) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5453
                throw new SQLException(resBundle.handleGetObject("cachedrowsetimpl.failedins").toString());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5454
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5455
        // Added the setting of parameters that are passed
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5456
        // to setXXX methods after an empty CRS Object is
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5457
        // created through RowSetMetaData object
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5458
        Object [] toInsert = getParams();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5459
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5460
        for(int i = 0;i < toInsert.length; i++) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5461
          insertRow.setColumnObject(i+1,toInsert[i]);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5462
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5463
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5464
        Row insRow = new Row(RowSetMD.getColumnCount(),
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5465
        insertRow.getOrigRow());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5466
        insRow.setInserted();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5467
        /*
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5468
         * The new row is inserted into the RowSet
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5469
         * immediately following the current row.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5470
         *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5471
         * If we are afterlast then the rows are
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5472
         * inserted at the end.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5473
         */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5474
        if (currentRow >= numRows || currentRow < 0) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5475
            pos = numRows;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5476
        } else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5477
            pos = currentRow;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5478
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5479
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5480
        rvh.add(pos, insRow);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5481
        ++numRows;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5482
        // notify the listeners that the row changed.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5483
        notifyRowChanged();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5484
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5485
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5486
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5487
     * Marks the current row of this <code>CachedRowSetImpl</code> object as
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5488
     * updated and notifies listeners registered with this rowset that the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5489
     * row has changed.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5490
     * <P>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5491
     * This method  cannot be called when the cursor is on the insert row, and
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5492
     * it should be called before the cursor moves to another row.  If it is
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5493
     * called after the cursor moves to another row, this method has no effect,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5494
     * and the updates made before the cursor moved will be lost.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5495
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5496
     * @throws SQLException if the cursor is on the insert row or this
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5497
     *            rowset is <code>ResultSet.CONCUR_READ_ONLY</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5498
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5499
    public void updateRow() throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5500
        // make sure we aren't on the insert row
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5501
        if (onInsertRow == true) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5502
            throw new SQLException(resBundle.handleGetObject("cachedrowsetimpl.updateins").toString());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5503
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5504
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5505
        ((Row)getCurrentRow()).setUpdated();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5506
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5507
        // notify the listeners that the row changed.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5508
        notifyRowChanged();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5509
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5510
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5511
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5512
     * Deletes the current row from this <code>CachedRowSetImpl</code> object and
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5513
     * notifies listeners registered with this rowset that a row has changed.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5514
     * This method cannot be called when the cursor is on the insert row.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5515
     * <P>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5516
     * This method marks the current row as deleted, but it does not delete
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5517
     * the row from the underlying data source.  The method
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5518
     * <code>acceptChanges</code> must be called to delete the row in
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5519
     * the data source.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5520
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5521
     * @throws SQLException if (1) this method is called when the cursor
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5522
     *            is on the insert row, before the first row, or after the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5523
     *            last row or (2) this rowset is
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5524
     *            <code>ResultSet.CONCUR_READ_ONLY</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5525
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5526
    public void deleteRow() throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5527
        // make sure the cursor is on a valid row
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5528
        checkCursor();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5529
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5530
        ((Row)getCurrentRow()).setDeleted();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5531
        ++numDeleted;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5532
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5533
        // notify the listeners that the row changed.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5534
        notifyRowChanged();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5535
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5536
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5537
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5538
     * Sets the current row with its original value and marks the row as
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5539
     * not updated, thus undoing any changes made to the row since the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5540
     * last call to the methods <code>updateRow</code> or <code>deleteRow</code>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5541
     * This method should be called only when the cursor is on a row in
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5542
     * this rowset.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5543
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5544
     * @throws SQLException if the cursor is on the insert row, before the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5545
     *            first row, or after the last row
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5546
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5547
    public void refreshRow() throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5548
        // make sure we are on a row
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5549
        checkCursor();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5550
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5551
        // don't want this to happen...
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5552
        if (onInsertRow == true) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5553
            throw new SQLException(resBundle.handleGetObject("cachedrowsetimpl.invalidcp").toString());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5554
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5555
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5556
        Row currentRow = (Row)getCurrentRow();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5557
        // just undo any changes made to this row.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5558
        currentRow.clearUpdated();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5559
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5560
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5561
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5562
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5563
     * Rolls back any updates made to the current row of this
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5564
     * <code>CachedRowSetImpl</code> object and notifies listeners that
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5565
     * a row has changed.  To have an effect, this method
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5566
     * must be called after an <code>updateXXX</code> method has been
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5567
     * called and before the method <code>updateRow</code> has been called.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5568
     * If no updates have been made or the method <code>updateRow</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5569
     * has already been called, this method has no effect.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5570
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5571
     * @throws SQLException if the cursor is on the insert row, before the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5572
     *            first row, or after the last row
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5573
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5574
    public void cancelRowUpdates() throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5575
        // make sure we are on a row
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5576
        checkCursor();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5577
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5578
        // don't want this to happen...
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5579
        if (onInsertRow == true) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5580
            throw new SQLException(resBundle.handleGetObject("cachedrowsetimpl.invalidcp").toString());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5581
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5582
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5583
        Row currentRow = (Row)getCurrentRow();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5584
        if (currentRow.getUpdated() == true) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5585
            currentRow.clearUpdated();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5586
            notifyRowChanged();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5587
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5588
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5589
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5590
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5591
     * Moves the cursor for this <code>CachedRowSetImpl</code> object
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5592
     * to the insert row.  The current row in the rowset is remembered
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5593
     * while the cursor is on the insert row.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5594
     * <P>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5595
     * The insert row is a special row associated with an updatable
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5596
     * rowset.  It is essentially a buffer where a new row may
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5597
     * be constructed by calling the appropriate <code>updateXXX</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5598
     * methods to assign a value to each column in the row.  A complete
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5599
     * row must be constructed; that is, every column that is not nullable
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5600
     * must be assigned a value.  In order for the new row to become part
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5601
     * of this rowset, the method <code>insertRow</code> must be called
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5602
     * before the cursor is moved back to the rowset.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5603
     * <P>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5604
     * Only certain methods may be invoked while the cursor is on the insert
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5605
     * row; many methods throw an exception if they are called while the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5606
     * cursor is there.  In addition to the <code>updateXXX</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5607
     * and <code>insertRow</code> methods, only the <code>getXXX</code> methods
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5608
     * may be called when the cursor is on the insert row.  A <code>getXXX</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5609
     * method should be called on a column only after an <code>updateXXX</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5610
     * method has been called on that column; otherwise, the value returned is
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5611
     * undetermined.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5612
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5613
     * @throws SQLException if this <code>CachedRowSetImpl</code> object is
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5614
     *            <code>ResultSet.CONCUR_READ_ONLY</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5615
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5616
    public void moveToInsertRow() throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5617
        if (getConcurrency() == ResultSet.CONCUR_READ_ONLY) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5618
            throw new SQLException(resBundle.handleGetObject("cachedrowsetimpl.movetoins").toString());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5619
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5620
        if (insertRow == null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5621
            if (RowSetMD == null)
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5622
                throw new SQLException(resBundle.handleGetObject("cachedrowsetimpl.movetoins1").toString());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5623
            int numCols = RowSetMD.getColumnCount();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5624
            if (numCols > 0) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5625
                insertRow = new InsertRow(numCols);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5626
            } else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5627
                throw new SQLException(resBundle.handleGetObject("cachedrowsetimpl.movetoins2").toString());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5628
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5629
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5630
        onInsertRow = true;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5631
        // %%% setCurrentRow called in BaseRow
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5632
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5633
        currentRow = cursorPos;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5634
        cursorPos = -1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5635
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5636
        insertRow.initInsertRow();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5637
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5638
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5639
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5640
     * Moves the cursor for this <code>CachedRowSetImpl</code> object to
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5641
     * the current row.  The current row is the row the cursor was on
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5642
     * when the method <code>moveToInsertRow</code> was called.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5643
     * <P>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5644
     * Calling this method has no effect unless it is called while the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5645
     * cursor is on the insert row.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5646
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5647
     * @throws SQLException if an error occurs
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5648
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5649
    public void moveToCurrentRow() throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5650
        if (onInsertRow == false) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5651
            return;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5652
        } else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5653
            cursorPos = currentRow;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5654
            onInsertRow = false;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5655
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5656
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5657
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5658
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5659
     * Returns <code>null</code>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5660
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5661
     * @return <code>null</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5662
     * @throws SQLException if an error occurs
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5663
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5664
    public Statement getStatement() throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5665
        return null;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5666
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5667
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5668
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5669
     * Retrieves the value of the designated column in this
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5670
     * <code>CachedRowSetImpl</code> object as an <code>Object</code> in
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5671
     * the Java programming language, using the given
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5672
     * <code>java.util.Map</code> object to custom map the value if
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5673
     * appropriate.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5674
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5675
     * @param columnIndex the first column is <code>1</code>, the second
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5676
     *        is <code>2</code>, and so on; must be <code>1</code> or larger
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5677
     *        and equal to or less than the number of columns in this rowset
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5678
     * @param map a <code>java.util.Map</code> object showing the mapping
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5679
     *            from SQL type names to classes in the Java programming
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5680
     *            language
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5681
     * @return an <code>Object</code> representing the SQL value
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5682
     * @throws SQLException if the given column index is out of bounds or
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5683
     *            the cursor is not on one of this rowset's rows or its
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5684
     *            insert row
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5685
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5686
     public Object getObject(int columnIndex,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5687
                             java.util.Map<String,Class<?>> map)
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5688
         throws SQLException
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5689
     {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5690
        Object value;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5691
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5692
        // sanity check.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5693
        checkIndex(columnIndex);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5694
        // make sure the cursor is on a valid row
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5695
        checkCursor();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5696
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5697
        setLastValueNull(false);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5698
        value = getCurrentRow().getColumnObject(columnIndex);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5699
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5700
        // check for SQL NULL
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5701
        if (value == null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5702
            setLastValueNull(true);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5703
            return null;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5704
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5705
        if (value instanceof Struct) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5706
            Struct s = (Struct)value;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5707
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5708
            // look up the class in the map
11129
f9ad1aadf3fa 7116445: Miscellaneous warnings in the JDBC/RowSet classes
lancea
parents: 9537
diff changeset
  5709
            Class<?> c = map.get(s.getSQLTypeName());
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5710
            if (c != null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5711
                // create new instance of the class
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5712
                SQLData obj = null;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5713
                try {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5714
                    obj = (SQLData)c.newInstance();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5715
                } catch (java.lang.InstantiationException ex) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5716
                    throw new SQLException(MessageFormat.format(resBundle.handleGetObject("cachedrowsetimpl.unableins").toString(),
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5717
                    ex.getMessage()));
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5718
                } catch (java.lang.IllegalAccessException ex) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5719
                    throw new SQLException(MessageFormat.format(resBundle.handleGetObject("cachedrowsetimpl.unableins").toString(),
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5720
                    ex.getMessage()));
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5721
                }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5722
                // get the attributes from the struct
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5723
                Object attribs[] = s.getAttributes(map);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5724
                // create the SQLInput "stream"
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5725
                SQLInputImpl sqlInput = new SQLInputImpl(attribs, map);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5726
                // read the values...
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5727
                obj.readSQL(sqlInput, s.getSQLTypeName());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5728
                return (Object)obj;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5729
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5730
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5731
        return value;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5732
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5733
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5734
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5735
     * Retrieves the value of the designated column in this
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5736
     * <code>CachedRowSetImpl</code> object as a <code>Ref</code> object
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5737
     * in the Java programming language.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5738
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5739
     * @param columnIndex the first column is <code>1</code>, the second
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5740
     *        is <code>2</code>, and so on; must be <code>1</code> or larger
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5741
     *        and equal to or less than the number of columns in this rowset
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5742
     * @return a <code>Ref</code> object representing an SQL<code> REF</code> value
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5743
     * @throws SQLException if (1) the given column index is out of bounds,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5744
     *            (2) the cursor is not on one of this rowset's rows or its
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5745
     *            insert row, or (3) the designated column does not store an
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5746
     *            SQL <code>REF</code> value
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5747
     * @see #getRef(String)
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5748
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5749
    public Ref getRef(int columnIndex) throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5750
        Ref value;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5751
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5752
        // sanity check.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5753
        checkIndex(columnIndex);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5754
        // make sure the cursor is on a valid row
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5755
        checkCursor();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5756
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5757
        if (RowSetMD.getColumnType(columnIndex) != java.sql.Types.REF) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5758
            throw new SQLException(resBundle.handleGetObject("cachedrowsetimpl.dtypemismt").toString());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5759
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5760
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5761
        setLastValueNull(false);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5762
        value = (Ref)(getCurrentRow().getColumnObject(columnIndex));
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5763
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5764
        // check for SQL NULL
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5765
        if (value == null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5766
            setLastValueNull(true);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5767
            return null;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5768
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5769
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5770
        return value;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5771
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5772
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5773
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5774
     * Retrieves the value of the designated column in this
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5775
     * <code>CachedRowSetImpl</code> object as a <code>Blob</code> object
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5776
     * in the Java programming language.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5777
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5778
     * @param columnIndex the first column is <code>1</code>, the second
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5779
     *        is <code>2</code>, and so on; must be <code>1</code> or larger
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5780
     *        and equal to or less than the number of columns in this rowset
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5781
     * @return a <code>Blob</code> object representing an SQL <code>BLOB</code> value
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5782
     * @throws SQLException if (1) the given column index is out of bounds,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5783
     *            (2) the cursor is not on one of this rowset's rows or its
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5784
     *            insert row, or (3) the designated column does not store an
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5785
     *            SQL <code>BLOB</code> value
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5786
     * @see #getBlob(String)
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5787
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5788
    public Blob getBlob(int columnIndex) throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5789
        Blob value;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5790
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5791
        // sanity check.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5792
        checkIndex(columnIndex);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5793
        // make sure the cursor is on a valid row
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5794
        checkCursor();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5795
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5796
        if (RowSetMD.getColumnType(columnIndex) != java.sql.Types.BLOB) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5797
            System.out.println(MessageFormat.format(resBundle.handleGetObject("cachedrowsetimpl.type").toString(), RowSetMD.getColumnType(columnIndex)));
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5798
            throw new SQLException(resBundle.handleGetObject("cachedrowsetimpl.dtypemismt").toString());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5799
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5800
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5801
        setLastValueNull(false);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5802
        value = (Blob)(getCurrentRow().getColumnObject(columnIndex));
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5803
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5804
        // check for SQL NULL
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5805
        if (value == null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5806
            setLastValueNull(true);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5807
            return null;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5808
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5809
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5810
        return value;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5811
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5812
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5813
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5814
     * Retrieves the value of the designated column in this
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5815
     * <code>CachedRowSetImpl</code> object as a <code>Clob</code> object
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5816
     * in the Java programming language.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5817
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5818
     * @param columnIndex the first column is <code>1</code>, the second
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5819
     *        is <code>2</code>, and so on; must be <code>1</code> or larger
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5820
     *        and equal to or less than the number of columns in this rowset
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5821
     * @return a <code>Clob</code> object representing an SQL <code>CLOB</code> value
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5822
     * @throws SQLException if (1) the given column index is out of bounds,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5823
     *            (2) the cursor is not on one of this rowset's rows or its
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5824
     *            insert row, or (3) the designated column does not store an
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5825
     *            SQL <code>CLOB</code> value
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5826
     * @see #getClob(String)
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5827
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5828
    public Clob getClob(int columnIndex) throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5829
        Clob value;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5830
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5831
        // sanity check.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5832
        checkIndex(columnIndex);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5833
        // make sure the cursor is on a valid row
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5834
        checkCursor();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5835
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5836
        if (RowSetMD.getColumnType(columnIndex) != java.sql.Types.CLOB) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5837
            System.out.println(MessageFormat.format(resBundle.handleGetObject("cachedrowsetimpl.type").toString(), RowSetMD.getColumnType(columnIndex)));
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5838
            throw new SQLException(resBundle.handleGetObject("cachedrowsetimpl.dtypemismt").toString());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5839
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5840
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5841
        setLastValueNull(false);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5842
        value = (Clob)(getCurrentRow().getColumnObject(columnIndex));
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5843
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5844
        // check for SQL NULL
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5845
        if (value == null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5846
            setLastValueNull(true);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5847
            return null;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5848
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5849
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5850
        return value;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5851
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5852
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5853
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5854
     * Retrieves the value of the designated column in this
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5855
     * <code>CachedRowSetImpl</code> object as an <code>Array</code> object
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5856
     * in the Java programming language.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5857
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5858
     * @param columnIndex the first column is <code>1</code>, the second
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5859
     *        is <code>2</code>, and so on; must be <code>1</code> or larger
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5860
     *        and equal to or less than the number of columns in this rowset
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5861
     * @return an <code>Array</code> object representing an SQL
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5862
     *         <code>ARRAY</code> value
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5863
     * @throws SQLException if (1) the given column index is out of bounds,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5864
     *            (2) the cursor is not on one of this rowset's rows or its
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5865
     *            insert row, or (3) the designated column does not store an
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5866
     *            SQL <code>ARRAY</code> value
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5867
     * @see #getArray(String)
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5868
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5869
    public Array getArray(int columnIndex) throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5870
        java.sql.Array value;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5871
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5872
        // sanity check.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5873
        checkIndex(columnIndex);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5874
        // make sure the cursor is on a valid row
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5875
        checkCursor();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5876
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5877
        if (RowSetMD.getColumnType(columnIndex) != java.sql.Types.ARRAY) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5878
            throw new SQLException(resBundle.handleGetObject("cachedrowsetimpl.dtypemismt").toString());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5879
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5880
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5881
        setLastValueNull(false);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5882
        value = (java.sql.Array)(getCurrentRow().getColumnObject(columnIndex));
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5883
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5884
        // check for SQL NULL
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5885
        if (value == null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5886
            setLastValueNull(true);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5887
            return null;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5888
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5889
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5890
        return value;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5891
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5892
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5893
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5894
     * Retrieves the value of the designated column in this
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5895
     * <code>CachedRowSetImpl</code> object as an <code>Object</code> in
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5896
     * the Java programming language, using the given
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5897
     * <code>java.util.Map</code> object to custom map the value if
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5898
     * appropriate.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5899
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5900
     * @param columnName a <code>String</code> object that must match the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5901
     *        SQL name of a column in this rowset, ignoring case
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5902
     * @param map a <code>java.util.Map</code> object showing the mapping
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5903
     *        from SQL type names to classes in the Java programming
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5904
     *        language
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5905
     * @return an <code>Object</code> representing the SQL value
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5906
     * @throws SQLException if the given column name is not the name of
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5907
     *         a column in this rowset or the cursor is not on one of
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5908
     *         this rowset's rows or its insert row
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5909
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5910
    public Object getObject(String columnName,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5911
                            java.util.Map<String,Class<?>> map)
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5912
    throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5913
        return getObject(getColIdxByName(columnName), map);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5914
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5915
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5916
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5917
     * Retrieves the value of the designated column in this
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5918
     * <code>CachedRowSetImpl</code> object as a <code>Ref</code> object
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5919
     * in the Java programming language.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5920
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5921
     * @param colName a <code>String</code> object that must match the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5922
     *        SQL name of a column in this rowset, ignoring case
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5923
     * @return a <code>Ref</code> object representing an SQL<code> REF</code> value
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5924
     * @throws SQLException  if (1) the given column name is not the name of
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5925
     *            a column in this rowset, (2) the cursor is not on one of
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5926
     *            this rowset's rows or its insert row, or (3) the column value
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5927
     *            is not an SQL <code>REF</code> value
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5928
     * @see #getRef(int)
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5929
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5930
    public Ref getRef(String colName) throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5931
        return getRef(getColIdxByName(colName));
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5932
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5933
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5934
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5935
     * Retrieves the value of the designated column in this
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5936
     * <code>CachedRowSetImpl</code> object as a <code>Blob</code> object
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5937
     * in the Java programming language.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5938
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5939
     * @param colName a <code>String</code> object that must match the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5940
     *        SQL name of a column in this rowset, ignoring case
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5941
     * @return a <code>Blob</code> object representing an SQL <code>BLOB</code> value
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5942
     * @throws SQLException if (1) the given column name is not the name of
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5943
     *            a column in this rowset, (2) the cursor is not on one of
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5944
     *            this rowset's rows or its insert row, or (3) the designated
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5945
     *            column does not store an SQL <code>BLOB</code> value
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5946
     * @see #getBlob(int)
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5947
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5948
    public Blob getBlob(String colName) throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5949
        return getBlob(getColIdxByName(colName));
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5950
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5951
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5952
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5953
     * Retrieves the value of the designated column in this
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5954
     * <code>CachedRowSetImpl</code> object as a <code>Clob</code> object
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5955
     * in the Java programming language.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5956
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5957
     * @param colName a <code>String</code> object that must match the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5958
     *        SQL name of a column in this rowset, ignoring case
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5959
     * @return a <code>Clob</code> object representing an SQL
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5960
     *         <code>CLOB</code> value
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5961
     * @throws SQLException if (1) the given column name is not the name of
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5962
     *            a column in this rowset, (2) the cursor is not on one of
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5963
     *            this rowset's rows or its insert row, or (3) the designated
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5964
     *            column does not store an SQL <code>CLOB</code> value
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5965
     * @see #getClob(int)
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5966
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5967
    public Clob getClob(String colName) throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5968
        return getClob(getColIdxByName(colName));
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5969
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5970
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5971
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5972
     * Retrieves the value of the designated column in this
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5973
     * <code>CachedRowSetImpl</code> object as an <code>Array</code> object
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5974
     * in the Java programming langugage.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5975
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5976
     * @param colName a <code>String</code> object that must match the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5977
     *        SQL name of a column in this rowset, ignoring case
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5978
     * @return an <code>Array</code> object representing an SQL
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5979
     *         <code>ARRAY</code> value
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5980
     * @throws SQLException if (1) the given column name is not the name of
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5981
     *            a column in this rowset, (2) the cursor is not on one of
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5982
     *            this rowset's rows or its insert row, or (3) the designated
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5983
     *            column does not store an SQL <code>ARRAY</code> value
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5984
     * @see #getArray(int)
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5985
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5986
    public Array getArray(String colName) throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5987
        return getArray(getColIdxByName(colName));
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5988
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5989
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5990
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5991
     * Retrieves the value of the designated column in the current row
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5992
     * of this <code>CachedRowSetImpl</code> object as a <code>java.sql.Date</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5993
     * object, using the given <code>Calendar</code> object to construct an
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5994
     * appropriate millisecond value for the date.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5995
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5996
     * @param columnIndex the first column is <code>1</code>, the second
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5997
     *        is <code>2</code>, and so on; must be <code>1</code> or larger
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5998
     *        and equal to or less than the number of columns in the rowset
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5999
     * @param cal the <code>java.util.Calendar</code> object to use in
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6000
     *            constructing the date
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6001
     * @return the column value; if the value is SQL <code>NULL</code>,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6002
     *         the result is <code>null</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6003
     * @throws SQLException if (1) the given column name is not the name of
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6004
     *            a column in this rowset, (2) the cursor is not on one of
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6005
     *            this rowset's rows or its insert row, or (3) the designated
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6006
     *            column does not store an SQL <code>DATE</code> or
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6007
     *            <code>TIMESTAMP</code> value
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6008
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6009
    public java.sql.Date getDate(int columnIndex, Calendar cal) throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6010
        Object value;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6011
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6012
        // sanity check.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6013
        checkIndex(columnIndex);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6014
        // make sure the cursor is on a valid row
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6015
        checkCursor();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6016
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6017
        setLastValueNull(false);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6018
        value = getCurrentRow().getColumnObject(columnIndex);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6019
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6020
        // check for SQL NULL
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6021
        if (value == null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6022
            setLastValueNull(true);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6023
            return null;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6024
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6025
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6026
        value = convertTemporal(value,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6027
        RowSetMD.getColumnType(columnIndex),
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6028
        java.sql.Types.DATE);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6029
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6030
        // create a default calendar
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6031
        Calendar defaultCal = Calendar.getInstance();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6032
        // set this Calendar to the time we have
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6033
        defaultCal.setTime((java.util.Date)value);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6034
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6035
        /*
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6036
         * Now we can pull the pieces of the date out
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6037
         * of the default calendar and put them into
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6038
         * the user provided calendar
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6039
         */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6040
        cal.set(Calendar.YEAR, defaultCal.get(Calendar.YEAR));
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6041
        cal.set(Calendar.MONTH, defaultCal.get(Calendar.MONTH));
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6042
        cal.set(Calendar.DAY_OF_MONTH, defaultCal.get(Calendar.DAY_OF_MONTH));
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6043
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6044
        /*
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6045
         * This looks a little odd but it is correct -
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6046
         * Calendar.getTime() returns a Date...
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6047
         */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6048
        return new java.sql.Date(cal.getTime().getTime());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6049
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6050
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6051
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6052
     * Retrieves the value of the designated column in the current row
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6053
     * of this <code>CachedRowSetImpl</code> object as a <code>java.sql.Date</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6054
     * object, using the given <code>Calendar</code> object to construct an
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6055
     * appropriate millisecond value for the date.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6056
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6057
     * @param columnName a <code>String</code> object that must match the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6058
     *        SQL name of a column in this rowset, ignoring case
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6059
     * @param cal the <code>java.util.Calendar</code> object to use in
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6060
     *            constructing the date
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6061
     * @return the column value; if the value is SQL <code>NULL</code>,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6062
     *         the result is <code>null</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6063
     * @throws SQLException if (1) the given column name is not the name of
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6064
     *            a column in this rowset, (2) the cursor is not on one of
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6065
     *            this rowset's rows or its insert row, or (3) the designated
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6066
     *            column does not store an SQL <code>DATE</code> or
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6067
     *            <code>TIMESTAMP</code> value
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6068
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6069
    public java.sql.Date getDate(String columnName, Calendar cal) throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6070
        return getDate(getColIdxByName(columnName), cal);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6071
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6072
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6073
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6074
     * Retrieves the value of the designated column in the current row
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6075
     * of this <code>CachedRowSetImpl</code> object as a <code>java.sql.Time</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6076
     * object, using the given <code>Calendar</code> object to construct an
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6077
     * appropriate millisecond value for the date.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6078
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6079
     * @param columnIndex the first column is <code>1</code>, the second
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6080
     *        is <code>2</code>, and so on; must be <code>1</code> or larger
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6081
     *        and equal to or less than the number of columns in the rowset
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6082
     * @param cal the <code>java.util.Calendar</code> object to use in
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6083
     *            constructing the date
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6084
     * @return the column value; if the value is SQL <code>NULL</code>,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6085
     *         the result is <code>null</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6086
     * @throws SQLException if (1) the given column name is not the name of
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6087
     *            a column in this rowset, (2) the cursor is not on one of
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6088
     *            this rowset's rows or its insert row, or (3) the designated
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6089
     *            column does not store an SQL <code>TIME</code> or
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6090
     *            <code>TIMESTAMP</code> value
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6091
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6092
    public java.sql.Time getTime(int columnIndex, Calendar cal) throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6093
        Object value;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6094
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6095
        // sanity check.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6096
        checkIndex(columnIndex);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6097
        // make sure the cursor is on a valid row
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6098
        checkCursor();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6099
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6100
        setLastValueNull(false);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6101
        value = getCurrentRow().getColumnObject(columnIndex);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6102
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6103
        // check for SQL NULL
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6104
        if (value == null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6105
            setLastValueNull(true);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6106
            return null;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6107
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6108
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6109
        value = convertTemporal(value,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6110
        RowSetMD.getColumnType(columnIndex),
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6111
        java.sql.Types.TIME);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6112
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6113
        // create a default calendar
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6114
        Calendar defaultCal = Calendar.getInstance();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6115
        // set the time in the default calendar
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6116
        defaultCal.setTime((java.util.Date)value);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6117
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6118
        /*
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6119
         * Now we can pull the pieces of the date out
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6120
         * of the default calendar and put them into
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6121
         * the user provided calendar
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6122
         */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6123
        cal.set(Calendar.HOUR_OF_DAY, defaultCal.get(Calendar.HOUR_OF_DAY));
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6124
        cal.set(Calendar.MINUTE, defaultCal.get(Calendar.MINUTE));
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6125
        cal.set(Calendar.SECOND, defaultCal.get(Calendar.SECOND));
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6126
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6127
        return new java.sql.Time(cal.getTime().getTime());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6128
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6129
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6130
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6131
     * Retrieves the value of the designated column in the current row
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6132
     * of this <code>CachedRowSetImpl</code> object as a <code>java.sql.Time</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6133
     * object, using the given <code>Calendar</code> object to construct an
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6134
     * appropriate millisecond value for the date.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6135
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6136
     * @param columnName a <code>String</code> object that must match the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6137
     *        SQL name of a column in this rowset, ignoring case
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6138
     * @param cal the <code>java.util.Calendar</code> object to use in
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6139
     *            constructing the date
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6140
     * @return the column value; if the value is SQL <code>NULL</code>,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6141
     *         the result is <code>null</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6142
     * @throws SQLException if (1) the given column name is not the name of
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6143
     *            a column in this rowset, (2) the cursor is not on one of
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6144
     *            this rowset's rows or its insert row, or (3) the designated
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6145
     *            column does not store an SQL <code>TIME</code> or
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6146
     *            <code>TIMESTAMP</code> value
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6147
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6148
    public java.sql.Time getTime(String columnName, Calendar cal) throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6149
        return getTime(getColIdxByName(columnName), cal);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6150
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6151
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6152
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6153
     * Retrieves the value of the designated column in the current row
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6154
     * of this <code>CachedRowSetImpl</code> object as a <code>java.sql.Timestamp</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6155
     * object, using the given <code>Calendar</code> object to construct an
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6156
     * appropriate millisecond value for the date.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6157
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6158
     * @param columnIndex the first column is <code>1</code>, the second
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6159
     *        is <code>2</code>, and so on; must be <code>1</code> or larger
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6160
     *        and equal to or less than the number of columns in the rowset
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6161
     * @param cal the <code>java.util.Calendar</code> object to use in
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6162
     *            constructing the date
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6163
     * @return the column value; if the value is SQL <code>NULL</code>,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6164
     *         the result is <code>null</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6165
     * @throws SQLException if (1) the given column name is not the name of
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6166
     *            a column in this rowset, (2) the cursor is not on one of
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6167
     *            this rowset's rows or its insert row, or (3) the designated
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6168
     *            column does not store an SQL <code>TIME</code> or
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6169
     *            <code>TIMESTAMP</code> value
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6170
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6171
    public java.sql.Timestamp getTimestamp(int columnIndex, Calendar cal) throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6172
        Object value;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6173
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6174
        // sanity check.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6175
        checkIndex(columnIndex);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6176
        // make sure the cursor is on a valid row
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6177
        checkCursor();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6178
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6179
        setLastValueNull(false);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6180
        value = getCurrentRow().getColumnObject(columnIndex);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6181
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6182
        // check for SQL NULL
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6183
        if (value == null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6184
            setLastValueNull(true);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6185
            return null;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6186
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6187
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6188
        value = convertTemporal(value,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6189
        RowSetMD.getColumnType(columnIndex),
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6190
        java.sql.Types.TIMESTAMP);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6191
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6192
        // create a default calendar
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6193
        Calendar defaultCal = Calendar.getInstance();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6194
        // set the time in the default calendar
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6195
        defaultCal.setTime((java.util.Date)value);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6196
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6197
        /*
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6198
         * Now we can pull the pieces of the date out
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6199
         * of the default calendar and put them into
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6200
         * the user provided calendar
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6201
         */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6202
        cal.set(Calendar.YEAR, defaultCal.get(Calendar.YEAR));
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6203
        cal.set(Calendar.MONTH, defaultCal.get(Calendar.MONTH));
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6204
        cal.set(Calendar.DAY_OF_MONTH, defaultCal.get(Calendar.DAY_OF_MONTH));
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6205
        cal.set(Calendar.HOUR_OF_DAY, defaultCal.get(Calendar.HOUR_OF_DAY));
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6206
        cal.set(Calendar.MINUTE, defaultCal.get(Calendar.MINUTE));
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6207
        cal.set(Calendar.SECOND, defaultCal.get(Calendar.SECOND));
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6208
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6209
        return new java.sql.Timestamp(cal.getTime().getTime());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6210
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6211
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6212
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6213
     * Retrieves the value of the designated column in the current row
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6214
     * of this <code>CachedRowSetImpl</code> object as a
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6215
     * <code>java.sql.Timestamp</code> object, using the given
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6216
     * <code>Calendar</code> object to construct an appropriate
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6217
     * millisecond value for the date.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6218
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6219
     * @param columnName a <code>String</code> object that must match the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6220
     *        SQL name of a column in this rowset, ignoring case
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6221
     * @param cal the <code>java.util.Calendar</code> object to use in
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6222
     *            constructing the date
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6223
     * @return the column value; if the value is SQL <code>NULL</code>,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6224
     *         the result is <code>null</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6225
     * @throws SQLException if (1) the given column name is not the name of
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6226
     *            a column in this rowset, (2) the cursor is not on one of
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6227
     *            this rowset's rows or its insert row, or (3) the designated
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6228
     *            column does not store an SQL <code>DATE</code>,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6229
     *            <code>TIME</code>, or <code>TIMESTAMP</code> value
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6230
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6231
    public java.sql.Timestamp getTimestamp(String columnName, Calendar cal) throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6232
        return getTimestamp(getColIdxByName(columnName), cal);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6233
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6234
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6235
    /*
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6236
     * RowSetInternal Interface
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6237
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6238
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6239
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6240
     * Retrieves the <code>Connection</code> object passed to this
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6241
     * <code>CachedRowSetImpl</code> object.  This connection may be
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6242
     * used to populate this rowset with data or to write data back
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6243
     * to its underlying data source.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6244
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6245
     * @return the <code>Connection</code> object passed to this rowset;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6246
     *         may be <code>null</code> if there is no connection
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6247
     * @throws SQLException if an error occurs
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6248
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6249
    public Connection getConnection() throws SQLException{
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6250
        return conn;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6251
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6252
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6253
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6254
     * Sets the metadata for this <code>CachedRowSetImpl</code> object
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6255
     * with the given <code>RowSetMetaData</code> object.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6256
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6257
     * @param md a <code>RowSetMetaData</code> object instance containing
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6258
     *            metadata about the columsn in the rowset
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6259
     * @throws SQLException if invalid meta data is supplied to the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6260
     *            rowset
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6261
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6262
    public void setMetaData(RowSetMetaData md) throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6263
        RowSetMD =(RowSetMetaDataImpl) md;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6264
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6265
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6266
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6267
     * Returns a result set containing the original value of the rowset. The
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6268
     * original value is the state of the <code>CachedRowSetImpl</code> after the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6269
     * last population or synchronization (whichever occured most recently) with
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6270
     * the data source.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6271
     * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6272
     * The cursor is positioned before the first row in the result set.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6273
     * Only rows contained in the result set returned by <code>getOriginal()</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6274
     * are said to have an original value.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6275
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6276
     * @return the original result set of the rowset
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6277
     * @throws SQLException if an error occurs produce the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6278
     *           <code>ResultSet</code> object
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6279
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6280
    public ResultSet getOriginal() throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6281
        CachedRowSetImpl crs = new CachedRowSetImpl();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6282
        crs.RowSetMD = RowSetMD;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6283
        crs.numRows = numRows;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6284
        crs.cursorPos = 0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6285
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6286
        // make sure we don't get someone playing with these
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6287
        // %%% is this now necessary ???
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6288
        //crs.setReader(null);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6289
        //crs.setWriter(null);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6290
        int colCount = RowSetMD.getColumnCount();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6291
        Row orig;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6292
11129
f9ad1aadf3fa 7116445: Miscellaneous warnings in the JDBC/RowSet classes
lancea
parents: 9537
diff changeset
  6293
        for (Iterator<?> i = rvh.iterator(); i.hasNext();) {
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6294
            orig = new Row(colCount, ((Row)i.next()).getOrigRow());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6295
            crs.rvh.add(orig);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6296
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6297
        return (ResultSet)crs;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6298
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6299
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6300
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6301
     * Returns a result set containing the original value of the current
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6302
     * row only.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6303
     * The original value is the state of the <code>CachedRowSetImpl</code> after
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6304
     * the last population or synchronization (whichever occured most recently)
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6305
     * with the data source.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6306
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6307
     * @return the original result set of the row
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6308
     * @throws SQLException if there is no current row
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6309
     * @see #setOriginalRow
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6310
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6311
    public ResultSet getOriginalRow() throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6312
        CachedRowSetImpl crs = new CachedRowSetImpl();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6313
        crs.RowSetMD = RowSetMD;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6314
        crs.numRows = 1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6315
        crs.cursorPos = 0;
6530
bfb7b294dd14 6680198: UnmarshalException caused by incompatible serialVersionUID
lancea
parents: 5506
diff changeset
  6316
        crs.setTypeMap(this.getTypeMap());
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6317
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6318
        // make sure we don't get someone playing with these
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6319
        // %%% is this now necessary ???
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6320
        //crs.setReader(null);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6321
        //crs.setWriter(null);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6322
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6323
        Row orig = new Row(RowSetMD.getColumnCount(),
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6324
        getCurrentRow().getOrigRow());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6325
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6326
        crs.rvh.add(orig);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6327
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6328
        return (ResultSet)crs;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6329
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6330
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6331
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6332
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6333
     * Marks the current row in this rowset as being an original row.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6334
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6335
     * @throws SQLException if there is no current row
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6336
     * @see #getOriginalRow
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6337
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6338
    public void setOriginalRow() throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6339
        if (onInsertRow == true) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6340
            throw new SQLException(resBundle.handleGetObject("cachedrowsetimpl.invalidop").toString());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6341
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6342
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6343
        Row row = (Row)getCurrentRow();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6344
        makeRowOriginal(row);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6345
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6346
        // this can happen if deleted rows are being shown
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6347
        if (row.getDeleted() == true) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6348
            removeCurrentRow();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6349
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6350
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6351
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6352
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6353
     * Makes the given row of this rowset the original row by clearing any
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6354
     * settings that mark the row as having been inserted, deleted, or updated.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6355
     * This method is called internally by the methods
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6356
     * <code>setOriginalRow</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6357
     * and <code>setOriginal</code>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6358
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6359
     * @param row the row to be made the original row
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6360
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6361
    private void makeRowOriginal(Row row) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6362
        if (row.getInserted() == true) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6363
            row.clearInserted();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6364
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6365
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6366
        if (row.getUpdated() == true) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6367
            row.moveCurrentToOrig();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6368
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6369
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6370
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6371
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6372
     * Marks all rows in this rowset as being original rows. Any updates
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6373
     * made to the rows become the original values for the rowset.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6374
     * Calls to the method <code>setOriginal</code> connot be reversed.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6375
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6376
     * @throws SQLException if an error occurs
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6377
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6378
    public void setOriginal() throws SQLException {
11129
f9ad1aadf3fa 7116445: Miscellaneous warnings in the JDBC/RowSet classes
lancea
parents: 9537
diff changeset
  6379
        for (Iterator<?> i = rvh.iterator(); i.hasNext();) {
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6380
            Row row = (Row)i.next();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6381
            makeRowOriginal(row);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6382
            // remove deleted rows from the collection.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6383
            if (row.getDeleted() == true) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6384
                i.remove();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6385
                --numRows;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6386
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6387
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6388
        numDeleted = 0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6389
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6390
        // notify any listeners that the rowset has changed
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6391
        notifyRowSetChanged();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6392
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6393
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6394
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6395
     * Returns an identifier for the object (table) that was used to create this
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6396
     * rowset.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6397
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6398
     * @return a <code>String</code> object that identifies the table from
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6399
     *         which this <code>CachedRowSetImpl</code> object was derived
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6400
     * @throws SQLException if an error occurs
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6401
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6402
    public String getTableName() throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6403
        return tableName;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6404
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6405
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6406
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6407
     * Sets the identifier for the table from which this rowset was derived
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6408
     * to the given table name.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6409
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6410
     * @param tabName a <code>String</code> object that identifies the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6411
     *          table from which this <code>CachedRowSetImpl</code> object
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6412
     *          was derived
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6413
     * @throws SQLException if an error occurs
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6414
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6415
    public void setTableName(String tabName) throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6416
        if (tabName == null)
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6417
            throw new SQLException(resBundle.handleGetObject("cachedrowsetimpl.tablename").toString());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6418
        else
6692
aef4e294026f 6988993: Address Findbugs warnings for the use of String Constructor
lancea
parents: 6664
diff changeset
  6419
            tableName = tabName;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6420
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6421
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6422
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6423
     * Returns the columns that make a key to uniquely identify a
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6424
     * row in this <code>CachedRowSetImpl</code> object.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6425
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6426
     * @return an array of column numbers that constitutes a primary
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6427
     *           key for this rowset. This array should be empty
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6428
     *           if no column is representitive of a primary key
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6429
     * @throws SQLException if the rowset is empty or no columns
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6430
     *           are designated as primary keys
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6431
     * @see #setKeyColumns
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6432
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6433
    public int[] getKeyColumns() throws SQLException {
11683
5e02efd89af6 7133815: address the findbug errors in CachedRowSetImpl, SerialStruct, BaseRow, SerialInputImpl, SerialOutputImpl
lancea
parents: 11129
diff changeset
  6434
        int[]keyColumns  = this.keyCols;
5e02efd89af6 7133815: address the findbug errors in CachedRowSetImpl, SerialStruct, BaseRow, SerialInputImpl, SerialOutputImpl
lancea
parents: 11129
diff changeset
  6435
        return (keyColumns == null) ? null : Arrays.copyOf(keyColumns, keyColumns.length);
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6436
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6437
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6438
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6439
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6440
     * Sets this <code>CachedRowSetImpl</code> object's
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6441
     * <code>keyCols</code> field with the given array of column
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6442
     * numbers, which forms a key for uniquely identifying a row
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6443
     * in this rowset.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6444
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6445
     * @param keys an array of <code>int</code> indicating the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6446
     *        columns that form a primary key for this
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6447
     *        <code>CachedRowSetImpl</code> object; every
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6448
     *        element in the array must be greater than
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6449
     *        <code>0</code> and less than or equal to the number
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6450
     *        of columns in this rowset
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6451
     * @throws SQLException if any of the numbers in the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6452
     *            given array is not valid for this rowset
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6453
     * @see #getKeyColumns
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6454
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6455
    public void setKeyColumns(int [] keys) throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6456
        int numCols = 0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6457
        if (RowSetMD != null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6458
            numCols = RowSetMD.getColumnCount();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6459
            if (keys.length > numCols)
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6460
                throw new SQLException(resBundle.handleGetObject("cachedrowsetimpl.keycols").toString());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6461
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6462
        keyCols = new int[keys.length];
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6463
        for (int i = 0; i < keys.length; i++) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6464
            if (RowSetMD != null && (keys[i] <= 0 ||
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6465
            keys[i] > numCols)) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6466
                throw new SQLException(resBundle.handleGetObject("cachedrowsetimpl.invalidcol").toString() +
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6467
                keys[i]);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6468
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6469
            keyCols[i] = keys[i];
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6470
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6471
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6472
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6473
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6474
     * Sets the designated column in either the current row or the insert
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6475
     * row of this <code>CachedRowSetImpl</code> object with the given
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6476
     * <code>Ref</code> value.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6477
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6478
     * This method updates a column value in either the current row or
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6479
     * the insert row of this rowset, but it does not update the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6480
     * database.  If the cursor is on a row in the rowset, the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6481
     * method {@link #updateRow} must be called to update the database.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6482
     * If the cursor is on the insert row, the method {@link #insertRow}
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6483
     * must be called, which will insert the new row into both this rowset
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6484
     * and the database. Both of these methods must be called before the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6485
     * cursor moves to another row.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6486
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6487
     * @param columnIndex the first column is <code>1</code>, the second
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6488
     *        is <code>2</code>, and so on; must be <code>1</code> or larger
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6489
     *        and equal to or less than the number of columns in this rowset
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6490
     * @param ref the new column <code>java.sql.Ref</code> value
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6491
     * @throws SQLException if (1) the given column index is out of bounds,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6492
     *        (2) the cursor is not on one of this rowset's rows or its
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6493
     *        insert row, or (3) this rowset is
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6494
     *        <code>ResultSet.CONCUR_READ_ONLY</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6495
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6496
    public void updateRef(int columnIndex, java.sql.Ref ref) throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6497
        // sanity check.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6498
        checkIndex(columnIndex);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6499
        // make sure the cursor is on a valid row
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6500
        checkCursor();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6501
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6502
        // SerialClob will help in getting the byte array and storing it.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6503
        // We need to be checking DatabaseMetaData.locatorsUpdatorCopy()
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6504
        // or through RowSetMetaData.locatorsUpdatorCopy()
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6505
        getCurrentRow().setColumnObject(columnIndex, new SerialRef(ref));
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6506
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6507
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6508
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6509
     * Sets the designated column in either the current row or the insert
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6510
     * row of this <code>CachedRowSetImpl</code> object with the given
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6511
     * <code>double</code> value.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6512
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6513
     * This method updates a column value in either the current row or
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6514
     * the insert row of this rowset, but it does not update the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6515
     * database.  If the cursor is on a row in the rowset, the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6516
     * method {@link #updateRow} must be called to update the database.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6517
     * If the cursor is on the insert row, the method {@link #insertRow}
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6518
     * must be called, which will insert the new row into both this rowset
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6519
     * and the database. Both of these methods must be called before the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6520
     * cursor moves to another row.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6521
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6522
     * @param columnName a <code>String</code> object that must match the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6523
     *        SQL name of a column in this rowset, ignoring case
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6524
     * @param ref the new column <code>java.sql.Ref</code> value
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6525
     * @throws SQLException if (1) the given column name does not match the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6526
     *        name of a column in this rowset, (2) the cursor is not on
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6527
     *        one of this rowset's rows or its insert row, or (3) this
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6528
     *        rowset is <code>ResultSet.CONCUR_READ_ONLY</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6529
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6530
    public void updateRef(String columnName, java.sql.Ref ref) throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6531
        updateRef(getColIdxByName(columnName), ref);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6532
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6533
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6534
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6535
     * Sets the designated column in either the current row or the insert
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6536
     * row of this <code>CachedRowSetImpl</code> object with the given
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6537
     * <code>double</code> value.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6538
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6539
     * This method updates a column value in either the current row or
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6540
     * the insert row of this rowset, but it does not update the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6541
     * database.  If the cursor is on a row in the rowset, the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6542
     * method {@link #updateRow} must be called to update the database.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6543
     * If the cursor is on the insert row, the method {@link #insertRow}
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6544
     * must be called, which will insert the new row into both this rowset
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6545
     * and the database. Both of these methods must be called before the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6546
     * cursor moves to another row.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6547
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6548
     * @param columnIndex the first column is <code>1</code>, the second
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6549
     *        is <code>2</code>, and so on; must be <code>1</code> or larger
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6550
     *        and equal to or less than the number of columns in this rowset
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6551
     * @param c the new column <code>Clob</code> value
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6552
     * @throws SQLException if (1) the given column index is out of bounds,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6553
     *        (2) the cursor is not on one of this rowset's rows or its
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6554
     *        insert row, or (3) this rowset is
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6555
     *        <code>ResultSet.CONCUR_READ_ONLY</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6556
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6557
    public void updateClob(int columnIndex, Clob c) throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6558
        // sanity check.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6559
        checkIndex(columnIndex);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6560
        // make sure the cursor is on a valid row
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6561
        checkCursor();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6562
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6563
        // SerialClob will help in getting the byte array and storing it.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6564
        // We need to be checking DatabaseMetaData.locatorsUpdatorCopy()
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6565
        // or through RowSetMetaData.locatorsUpdatorCopy()
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6566
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6567
        if(dbmslocatorsUpdateCopy){
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6568
           getCurrentRow().setColumnObject(columnIndex, new SerialClob(c));
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6569
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6570
        else{
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6571
           throw new SQLException(resBundle.handleGetObject("cachedrowsetimpl.opnotsupp").toString());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6572
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6573
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6574
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6575
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6576
     * Sets the designated column in either the current row or the insert
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6577
     * row of this <code>CachedRowSetImpl</code> object with the given
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6578
     * <code>double</code> value.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6579
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6580
     * This method updates a column value in either the current row or
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6581
     * the insert row of this rowset, but it does not update the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6582
     * database.  If the cursor is on a row in the rowset, the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6583
     * method {@link #updateRow} must be called to update the database.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6584
     * If the cursor is on the insert row, the method {@link #insertRow}
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6585
     * must be called, which will insert the new row into both this rowset
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6586
     * and the database. Both of these methods must be called before the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6587
     * cursor moves to another row.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6588
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6589
     * @param columnName a <code>String</code> object that must match the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6590
     *        SQL name of a column in this rowset, ignoring case
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6591
     * @param c the new column <code>Clob</code> value
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6592
     * @throws SQLException if (1) the given column name does not match the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6593
     *            name of a column in this rowset, (2) the cursor is not on
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6594
     *            one of this rowset's rows or its insert row, or (3) this
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6595
     *            rowset is <code>ResultSet.CONCUR_READ_ONLY</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6596
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6597
    public void updateClob(String columnName, Clob c) throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6598
        updateClob(getColIdxByName(columnName), c);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6599
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6600
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6601
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6602
     * Sets the designated column in either the current row or the insert
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6603
     * row of this <code>CachedRowSetImpl</code> object with the given
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6604
     * <code>java.sql.Blob</code> value.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6605
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6606
     * This method updates a column value in either the current row or
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6607
     * the insert row of this rowset, but it does not update the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6608
     * database.  If the cursor is on a row in the rowset, the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6609
     * method {@link #updateRow} must be called to update the database.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6610
     * If the cursor is on the insert row, the method {@link #insertRow}
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6611
     * must be called, which will insert the new row into both this rowset
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6612
     * and the database. Both of these methods must be called before the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6613
     * cursor moves to another row.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6614
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6615
     * @param columnIndex the first column is <code>1</code>, the second
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6616
     *        is <code>2</code>, and so on; must be <code>1</code> or larger
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6617
     *        and equal to or less than the number of columns in this rowset
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6618
     * @param b the new column <code>Blob</code> value
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6619
     * @throws SQLException if (1) the given column index is out of bounds,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6620
     *            (2) the cursor is not on one of this rowset's rows or its
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6621
     *            insert row, or (3) this rowset is
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6622
     *            <code>ResultSet.CONCUR_READ_ONLY</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6623
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6624
    public void updateBlob(int columnIndex, Blob b) throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6625
        // sanity check.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6626
        checkIndex(columnIndex);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6627
        // make sure the cursor is on a valid row
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6628
        checkCursor();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6629
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6630
        // SerialBlob will help in getting the byte array and storing it.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6631
        // We need to be checking DatabaseMetaData.locatorsUpdatorCopy()
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6632
        // or through RowSetMetaData.locatorsUpdatorCopy()
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6633
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6634
        if(dbmslocatorsUpdateCopy){
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6635
           getCurrentRow().setColumnObject(columnIndex, new SerialBlob(b));
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6636
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6637
        else{
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6638
           throw new SQLException(resBundle.handleGetObject("cachedrowsetimpl.opnotsupp").toString());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6639
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6640
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6641
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6642
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6643
     * Sets the designated column in either the current row or the insert
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6644
     * row of this <code>CachedRowSetImpl</code> object with the given
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6645
     * <code>java.sql.Blob </code> value.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6646
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6647
     * This method updates a column value in either the current row or
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6648
     * the insert row of this rowset, but it does not update the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6649
     * database.  If the cursor is on a row in the rowset, the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6650
     * method {@link #updateRow} must be called to update the database.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6651
     * If the cursor is on the insert row, the method {@link #insertRow}
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6652
     * must be called, which will insert the new row into both this rowset
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6653
     * and the database. Both of these methods must be called before the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6654
     * cursor moves to another row.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6655
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6656
     * @param columnName a <code>String</code> object that must match the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6657
     *        SQL name of a column in this rowset, ignoring case
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6658
     * @param b the new column <code>Blob</code> value
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6659
     * @throws SQLException if (1) the given column name does not match the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6660
     *            name of a column in this rowset, (2) the cursor is not on
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6661
     *            one of this rowset's rows or its insert row, or (3) this
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6662
     *            rowset is <code>ResultSet.CONCUR_READ_ONLY</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6663
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6664
    public void updateBlob(String columnName, Blob b) throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6665
        updateBlob(getColIdxByName(columnName), b);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6666
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6667
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6668
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6669
     * Sets the designated column in either the current row or the insert
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6670
     * row of this <code>CachedRowSetImpl</code> object with the given
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6671
     * <code>java.sql.Array</code> values.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6672
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6673
     * This method updates a column value in either the current row or
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6674
     * the insert row of this rowset, but it does not update the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6675
     * database.  If the cursor is on a row in the rowset, the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6676
     * method {@link #updateRow} must be called to update the database.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6677
     * If the cursor is on the insert row, the method {@link #insertRow}
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6678
     * must be called, which will insert the new row into both this rowset
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6679
     * and the database. Both of these methods must be called before the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6680
     * cursor moves to another row.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6681
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6682
     * @param columnIndex the first column is <code>1</code>, the second
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6683
     *        is <code>2</code>, and so on; must be <code>1</code> or larger
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6684
     *        and equal to or less than the number of columns in this rowset
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6685
     * @param a the new column <code>Array</code> value
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6686
     * @throws SQLException if (1) the given column index is out of bounds,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6687
     *            (2) the cursor is not on one of this rowset's rows or its
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6688
     *            insert row, or (3) this rowset is
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6689
     *            <code>ResultSet.CONCUR_READ_ONLY</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6690
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6691
    public void updateArray(int columnIndex, Array a) throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6692
        // sanity check.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6693
        checkIndex(columnIndex);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6694
        // make sure the cursor is on a valid row
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6695
        checkCursor();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6696
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6697
        // SerialArray will help in getting the byte array and storing it.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6698
        // We need to be checking DatabaseMetaData.locatorsUpdatorCopy()
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6699
        // or through RowSetMetaData.locatorsUpdatorCopy()
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6700
        getCurrentRow().setColumnObject(columnIndex, new SerialArray(a));
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6701
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6702
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6703
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6704
     * Sets the designated column in either the current row or the insert
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6705
     * row of this <code>CachedRowSetImpl</code> object with the given
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6706
     * <code>java.sql.Array</code> value.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6707
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6708
     * This method updates a column value in either the current row or
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6709
     * the insert row of this rowset, but it does not update the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6710
     * database.  If the cursor is on a row in the rowset, the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6711
     * method {@link #updateRow} must be called to update the database.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6712
     * If the cursor is on the insert row, the method {@link #insertRow}
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6713
     * must be called, which will insert the new row into both this rowset
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6714
     * and the database. Both of these methods must be called before the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6715
     * cursor moves to another row.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6716
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6717
     * @param columnName a <code>String</code> object that must match the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6718
     *        SQL name of a column in this rowset, ignoring case
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6719
     * @param a the new column <code>Array</code> value
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6720
     * @throws SQLException if (1) the given column name does not match the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6721
     *            name of a column in this rowset, (2) the cursor is not on
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6722
     *            one of this rowset's rows or its insert row, or (3) this
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6723
     *            rowset is <code>ResultSet.CONCUR_READ_ONLY</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6724
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6725
    public void updateArray(String columnName, Array a) throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6726
        updateArray(getColIdxByName(columnName), a);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6727
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6728
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6729
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6730
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6731
     * Retrieves the value of the designated column in this
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6732
     * <code>CachedRowSetImpl</code> object as a <code>java.net.URL</code> object
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6733
     * in the Java programming language.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6734
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6735
     * @return a java.net.URL object containing the resource reference described by
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6736
     * the URL
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6737
     * @throws SQLException if (1) the given column index is out of bounds,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6738
     * (2) the cursor is not on one of this rowset's rows or its
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6739
     * insert row, or (3) the designated column does not store an
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6740
     * SQL <code>DATALINK</code> value.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6741
     * @see #getURL(String)
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6742
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6743
    public java.net.URL getURL(int columnIndex) throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6744
        //throw new SQLException("Operation not supported");
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6745
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6746
        java.net.URL value;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6747
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6748
        // sanity check.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6749
        checkIndex(columnIndex);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6750
        // make sure the cursor is on a valid row
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6751
        checkCursor();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6752
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6753
        if (RowSetMD.getColumnType(columnIndex) != java.sql.Types.DATALINK) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6754
            throw new SQLException(resBundle.handleGetObject("cachedrowsetimpl.dtypemismt").toString());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6755
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6756
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6757
        setLastValueNull(false);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6758
        value = (java.net.URL)(getCurrentRow().getColumnObject(columnIndex));
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6759
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6760
        // check for SQL NULL
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6761
        if (value == null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6762
            setLastValueNull(true);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6763
            return null;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6764
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6765
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6766
        return value;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6767
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6768
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6769
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6770
     * Retrieves the value of the designated column in this
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6771
     * <code>CachedRowSetImpl</code> object as a <code>java.net.URL</code> object
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6772
     * in the Java programming language.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6773
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6774
     * @return a java.net.URL object containing the resource reference described by
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6775
     * the URL
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6776
     * @throws SQLException if (1) the given column name not the name of a column
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6777
     * in this rowset, or
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6778
     * (2) the cursor is not on one of this rowset's rows or its
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6779
     * insert row, or (3) the designated column does not store an
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6780
     * SQL <code>DATALINK</code> value.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6781
     * @see #getURL(int)
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6782
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6783
    public java.net.URL getURL(String columnName) throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6784
        return getURL(getColIdxByName(columnName));
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6785
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6786
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6787
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6788
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6789
     * The first warning reported by calls on this <code>CachedRowSetImpl</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6790
     * object is returned. Subsequent <code>CachedRowSetImpl</code> warnings will
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6791
     * be chained to this <code>SQLWarning</code>. All <code>RowSetWarnings</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6792
     * warnings are generated in the disconnected environment and remain a
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6793
     * seperate warning chain to that provided by the <code>getWarnings</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6794
     * method.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6795
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6796
     * <P>The warning chain is automatically cleared each time a new
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6797
     * row is read.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6798
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6799
     * <P><B>Note:</B> This warning chain only covers warnings caused
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6800
     * by <code>CachedRowSet</code> (and their child interface)
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6801
     * methods. All <code>SQLWarnings</code> can be obtained using the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6802
     * <code>getWarnings</code> method which tracks warnings generated
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6803
     * by the underlying JDBC driver.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6804
     * @return the first SQLWarning or null
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6805
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6806
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6807
    public RowSetWarning getRowSetWarnings() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6808
        try {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6809
            notifyCursorMoved();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6810
        } catch (SQLException e) {} // mask exception
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6811
        return rowsetWarning;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6812
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6813
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6814
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6815
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6816
     * The function tries to isolate the tablename when only setCommand
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6817
     * is set and not setTablename is called provided there is only one table
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6818
     * name in the query else just leaves the setting of table name as such.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6819
     * If setTablename is set later it will over ride this table name
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6820
     * value so retrieved.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6821
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6822
     * @return the tablename if only one table in query else return ""
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6823
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6824
    private String buildTableName(String command) throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6825
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6826
        // If we have a query from one table,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6827
        // we set the table name implicitly
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6828
        // else user has to explicitly set the table name.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6829
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6830
        int indexFrom, indexComma;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6831
        String strTablename ="";
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6832
        command = command.trim();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6833
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6834
        // Query can be a select, insert or  update
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6835
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6836
        if(command.toLowerCase().startsWith("select")) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6837
            // look for "from" keyword, after that look for a
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6838
            // comma after from. If comma is there don't set
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6839
            // table name else isolate table name.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6840
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6841
            indexFrom = command.toLowerCase().indexOf("from");
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6842
            indexComma = command.indexOf(",", indexFrom);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6843
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6844
            if(indexComma == -1) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6845
                // implies only one table
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6846
                strTablename = (command.substring(indexFrom+"from".length(),command.length())).trim();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6847
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6848
                String tabName = strTablename;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6849
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6850
                int idxWhere = tabName.toLowerCase().indexOf("where");
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6851
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6852
                /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6853
                  * Adding the addtional check for conditions following the table name.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6854
                  * If a condition is found truncate it.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6855
                  **/
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6856
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6857
                if(idxWhere != -1)
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6858
                {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6859
                   tabName = tabName.substring(0,idxWhere).trim();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6860
                }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6861
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6862
                strTablename = tabName;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6863
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6864
            } else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6865
                //strTablename="";
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6866
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6867
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6868
        } else if(command.toLowerCase().startsWith("insert")) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6869
            //strTablename="";
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6870
        } else if(command.toLowerCase().startsWith("update")) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6871
            //strTablename="";
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6872
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6873
        return strTablename;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6874
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6875
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6876
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6877
     * Commits all changes performed by the <code>acceptChanges()</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6878
     * methods
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6879
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6880
     * @see java.sql.Connection#commit
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6881
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6882
    public void commit() throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6883
        conn.commit();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6884
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6885
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6886
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6887
     * Rolls back all changes performed by the <code>acceptChanges()</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6888
     * methods
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6889
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6890
     * @see java.sql.Connection#rollback
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6891
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6892
    public void rollback() throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6893
        conn.rollback();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6894
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6895
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6896
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6897
     * Rolls back all changes performed by the <code>acceptChanges()</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6898
     * to the last <code>Savepoint</code> transaction marker.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6899
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6900
     * @see java.sql.Connection#rollback(Savepoint)
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6901
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6902
    public void rollback(Savepoint s) throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6903
        conn.rollback(s);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6904
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6905
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6906
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6907
     * Unsets the designated parameter to the given int array.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6908
     * This was set using <code>setMatchColumn</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6909
     * as the column which will form the basis of the join.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6910
     * <P>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6911
     * The parameter value unset by this method should be same
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6912
     * as was set.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6913
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6914
     * @param columnIdxes the index into this rowset
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6915
     *        object's internal representation of parameter values
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6916
     * @throws SQLException if an error occurs or the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6917
     *  parameter index is out of bounds or if the columnIdx is
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6918
     *  not the same as set using <code>setMatchColumn(int [])</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6919
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6920
    public void unsetMatchColumn(int[] columnIdxes) throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6921
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6922
         int i_val;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6923
         for( int j= 0 ;j < columnIdxes.length; j++) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6924
            i_val = (Integer.parseInt(iMatchColumns.get(j).toString()));
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6925
            if(columnIdxes[j] != i_val) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6926
               throw new SQLException(resBundle.handleGetObject("cachedrowsetimpl.matchcols").toString());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6927
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6928
         }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6929
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6930
         for( int i = 0;i < columnIdxes.length ;i++) {
11129
f9ad1aadf3fa 7116445: Miscellaneous warnings in the JDBC/RowSet classes
lancea
parents: 9537
diff changeset
  6931
            iMatchColumns.set(i, -1);
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6932
         }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6933
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6934
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6935
   /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6936
     * Unsets the designated parameter to the given String array.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6937
     * This was set using <code>setMatchColumn</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6938
     * as the column which will form the basis of the join.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6939
     * <P>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6940
     * The parameter value unset by this method should be same
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6941
     * as was set.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6942
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6943
     * @param columnIdxes the index into this rowset
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6944
     *        object's internal representation of parameter values
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6945
     * @throws SQLException if an error occurs or the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6946
     *  parameter index is out of bounds or if the columnName is
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6947
     *  not the same as set using <code>setMatchColumn(String [])</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6948
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6949
    public void unsetMatchColumn(String[] columnIdxes) throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6950
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6951
        for(int j = 0 ;j < columnIdxes.length; j++) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6952
           if( !columnIdxes[j].equals(strMatchColumns.get(j)) ){
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6953
              throw new SQLException(resBundle.handleGetObject("cachedrowsetimpl.matchcols").toString());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6954
           }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6955
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6956
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6957
        for(int i = 0 ; i < columnIdxes.length; i++) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6958
           strMatchColumns.set(i,null);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6959
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6960
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6961
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6962
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6963
     * Retrieves the column name as <code>String</code> array
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6964
     * that was set using <code>setMatchColumn(String [])</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6965
     * for this rowset.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6966
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6967
     * @return a <code>String</code> array object that contains the column names
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6968
     *         for the rowset which has this the match columns
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6969
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6970
     * @throws SQLException if an error occurs or column name is not set
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6971
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6972
    public String[] getMatchColumnNames() throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6973
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6974
        String []str_temp = new String[strMatchColumns.size()];
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6975
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6976
        if( strMatchColumns.get(0) == null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6977
           throw new SQLException(resBundle.handleGetObject("cachedrowsetimpl.setmatchcols").toString());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6978
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6979
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6980
        strMatchColumns.copyInto(str_temp);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6981
        return str_temp;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6982
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6983
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6984
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6985
     * Retrieves the column id as <code>int</code> array that was set using
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6986
     * <code>setMatchColumn(int [])</code> for this rowset.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6987
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6988
     * @return a <code>int</code> array object that contains the column ids
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6989
     *         for the rowset which has this as the match columns.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6990
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6991
     * @throws SQLException if an error occurs or column index is not set
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6992
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6993
    public int[] getMatchColumnIndexes() throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6994
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6995
        Integer []int_temp = new Integer[iMatchColumns.size()];
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6996
        int [] i_temp = new int[iMatchColumns.size()];
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6997
        int i_val;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6998
11129
f9ad1aadf3fa 7116445: Miscellaneous warnings in the JDBC/RowSet classes
lancea
parents: 9537
diff changeset
  6999
        i_val = iMatchColumns.get(0);
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7000
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7001
        if( i_val == -1 ) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7002
           throw new SQLException(resBundle.handleGetObject("cachedrowsetimpl.setmatchcols").toString());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7003
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7004
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7005
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7006
        iMatchColumns.copyInto(int_temp);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7007
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7008
        for(int i = 0; i < int_temp.length; i++) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7009
           i_temp[i] = (int_temp[i]).intValue();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7010
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7011
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7012
        return i_temp;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7013
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7014
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7015
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7016
     * Sets the designated parameter to the given int array.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7017
     * This forms the basis of the join for the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7018
     * <code>JoinRowSet</code> as the column which will form the basis of the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7019
     * join.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7020
     * <P>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7021
     * The parameter value set by this method is stored internally and
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7022
     * will be supplied as the appropriate parameter in this rowset's
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7023
     * command when the method <code>getMatchColumnIndexes</code> is called.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7024
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7025
     * @param columnIdxes the indexes into this rowset
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7026
     *        object's internal representation of parameter values; the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7027
     *        first parameter is 0, the second is 1, and so on; must be
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7028
     *        <code>0</code> or greater
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7029
     * @throws SQLException if an error occurs or the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7030
     *                         parameter index is out of bounds
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7031
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7032
    public void setMatchColumn(int[] columnIdxes) throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7033
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7034
        for(int j = 0 ; j < columnIdxes.length; j++) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7035
           if( columnIdxes[j] < 0 ) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7036
              throw new SQLException(resBundle.handleGetObject("cachedrowsetimpl.matchcols1").toString());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7037
           }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7038
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7039
        for(int i = 0 ;i < columnIdxes.length; i++) {
11129
f9ad1aadf3fa 7116445: Miscellaneous warnings in the JDBC/RowSet classes
lancea
parents: 9537
diff changeset
  7040
           iMatchColumns.add(i,columnIdxes[i]);
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7041
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7042
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7043
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7044
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7045
     * Sets the designated parameter to the given String array.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7046
     *  This forms the basis of the join for the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7047
     * <code>JoinRowSet</code> as the column which will form the basis of the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7048
     * join.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7049
     * <P>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7050
     * The parameter value set by this method is stored internally and
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7051
     * will be supplied as the appropriate parameter in this rowset's
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7052
     * command when the method <code>getMatchColumn</code> is called.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7053
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7054
     * @param columnNames the name of the column into this rowset
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7055
     *        object's internal representation of parameter values
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7056
     * @throws SQLException if an error occurs or the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7057
     *  parameter index is out of bounds
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7058
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7059
    public void setMatchColumn(String[] columnNames) throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7060
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7061
        for(int j = 0; j < columnNames.length; j++) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7062
           if( columnNames[j] == null || columnNames[j].equals("")) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7063
              throw new SQLException(resBundle.handleGetObject("cachedrowsetimpl.matchcols2").toString());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7064
           }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7065
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7066
        for( int i = 0; i < columnNames.length; i++) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7067
           strMatchColumns.add(i,columnNames[i]);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7068
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7069
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7070
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7071
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7072
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7073
     * Sets the designated parameter to the given <code>int</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7074
     * object.  This forms the basis of the join for the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7075
     * <code>JoinRowSet</code> as the column which will form the basis of the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7076
     * join.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7077
     * <P>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7078
     * The parameter value set by this method is stored internally and
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7079
     * will be supplied as the appropriate parameter in this rowset's
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7080
     * command when the method <code>getMatchColumn</code> is called.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7081
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7082
     * @param columnIdx the index into this rowset
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7083
     *        object's internal representation of parameter values; the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7084
     *        first parameter is 0, the second is 1, and so on; must be
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7085
     *        <code>0</code> or greater
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7086
     * @throws SQLException if an error occurs or the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7087
     *                         parameter index is out of bounds
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7088
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7089
    public void setMatchColumn(int columnIdx) throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7090
        // validate, if col is ok to be set
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7091
        if(columnIdx < 0) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7092
            throw new SQLException(resBundle.handleGetObject("cachedrowsetimpl.matchcols1").toString());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7093
        } else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7094
            // set iMatchColumn
11129
f9ad1aadf3fa 7116445: Miscellaneous warnings in the JDBC/RowSet classes
lancea
parents: 9537
diff changeset
  7095
            iMatchColumns.set(0, columnIdx);
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7096
            //strMatchColumn = null;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7097
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7098
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7099
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7100
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7101
     * Sets the designated parameter to the given <code>String</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7102
     * object.  This forms the basis of the join for the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7103
     * <code>JoinRowSet</code> as the column which will form the basis of the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7104
     * join.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7105
     * <P>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7106
     * The parameter value set by this method is stored internally and
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7107
     * will be supplied as the appropriate parameter in this rowset's
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7108
     * command when the method <code>getMatchColumn</code> is called.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7109
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7110
     * @param columnName the name of the column into this rowset
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7111
     *        object's internal representation of parameter values
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7112
     * @throws SQLException if an error occurs or the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7113
     *  parameter index is out of bounds
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7114
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7115
    public void setMatchColumn(String columnName) throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7116
        // validate, if col is ok to be set
6697
39929804f9d4 6989139: Address JDBC Findbugs where Number type Constructor are used
lancea
parents: 6692
diff changeset
  7117
        if(columnName == null || (columnName= columnName.trim()).equals("") ) {
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7118
            throw new SQLException(resBundle.handleGetObject("cachedrowsetimpl.matchcols2").toString());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7119
        } else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7120
            // set strMatchColumn
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7121
            strMatchColumns.set(0, columnName);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7122
            //iMatchColumn = -1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7123
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7124
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7125
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7126
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7127
     * Unsets the designated parameter to the given <code>int</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7128
     * object.  This was set using <code>setMatchColumn</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7129
     * as the column which will form the basis of the join.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7130
     * <P>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7131
     * The parameter value unset by this method should be same
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7132
     * as was set.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7133
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7134
     * @param columnIdx the index into this rowset
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7135
     *        object's internal representation of parameter values
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7136
     * @throws SQLException if an error occurs or the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7137
     *  parameter index is out of bounds or if the columnIdx is
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7138
     *  not the same as set using <code>setMatchColumn(int)</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7139
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7140
    public void unsetMatchColumn(int columnIdx) throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7141
        // check if we are unsetting the SAME column
6697
39929804f9d4 6989139: Address JDBC Findbugs where Number type Constructor are used
lancea
parents: 6692
diff changeset
  7142
        if(! iMatchColumns.get(0).equals(Integer.valueOf(columnIdx) )  ) {
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7143
            throw new SQLException(resBundle.handleGetObject("cachedrowsetimpl.unsetmatch").toString());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7144
        } else if(strMatchColumns.get(0) != null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7145
            throw new SQLException(resBundle.handleGetObject("cachedrowsetimpl.unsetmatch1").toString());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7146
        } else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7147
                // that is, we are unsetting it.
11129
f9ad1aadf3fa 7116445: Miscellaneous warnings in the JDBC/RowSet classes
lancea
parents: 9537
diff changeset
  7148
               iMatchColumns.set(0, -1);
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7149
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7150
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7151
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7152
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7153
     * Unsets the designated parameter to the given <code>String</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7154
     * object.  This was set using <code>setMatchColumn</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7155
     * as the column which will form the basis of the join.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7156
     * <P>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7157
     * The parameter value unset by this method should be same
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7158
     * as was set.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7159
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7160
     * @param columnName the index into this rowset
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7161
     *        object's internal representation of parameter values
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7162
     * @throws SQLException if an error occurs or the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7163
     *  parameter index is out of bounds or if the columnName is
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7164
     *  not the same as set using <code>setMatchColumn(String)</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7165
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7166
    public void unsetMatchColumn(String columnName) throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7167
        // check if we are unsetting the same column
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7168
        columnName = columnName.trim();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7169
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7170
        if(!((strMatchColumns.get(0)).equals(columnName))) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7171
            throw new SQLException(resBundle.handleGetObject("cachedrowsetimpl.unsetmatch").toString());
11129
f9ad1aadf3fa 7116445: Miscellaneous warnings in the JDBC/RowSet classes
lancea
parents: 9537
diff changeset
  7172
        } else if(iMatchColumns.get(0) > 0) {
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7173
            throw new SQLException(resBundle.handleGetObject("cachedrowsetimpl.unsetmatch2").toString());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7174
        } else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7175
            strMatchColumns.set(0, null);   // that is, we are unsetting it.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7176
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7177
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7178
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7179
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7180
     * Notifies registered listeners that a RowSet object in the given RowSetEvent
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7181
     * object has populated a number of additional rows. The <code>numRows</code> parameter
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7182
     * ensures that this event will only be fired every <code>numRow</code>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7183
     * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7184
     * The source of the event can be retrieved with the method event.getSource.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7185
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7186
     * @param event a <code>RowSetEvent</code> object that contains the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7187
     *     <code>RowSet</code> object that is the source of the events
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7188
     * @param numRows when populating, the number of rows interval on which the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7189
     *     <code>CachedRowSet</code> populated should fire; the default value
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7190
     *     is zero; cannot be less than <code>fetchSize</code> or zero
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7191
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7192
    public void rowSetPopulated(RowSetEvent event, int numRows) throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7193
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7194
        if( numRows < 0 || numRows < getFetchSize()) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7195
           throw new SQLException(resBundle.handleGetObject("cachedrowsetimpl.numrows").toString());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7196
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7197
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7198
        if(size() % numRows == 0) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7199
            RowSetEvent event_temp = new RowSetEvent(this);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7200
            event = event_temp;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7201
            notifyRowSetChanged();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7202
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7203
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7204
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7205
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7206
     * Populates this <code>CachedRowSet</code> object with data from
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7207
     * the given <code>ResultSet</code> object. While related to the <code>populate(ResultSet)</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7208
     * method, an additional parameter is provided to allow starting position within
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7209
     * the <code>ResultSet</code> from where to populate the CachedRowSet
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7210
     * instance.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7211
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7212
     * This method is an alternative to the method <code>execute</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7213
     * for filling the rowset with data.  The method <code>populate</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7214
     * does not require that the properties needed by the method
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7215
     * <code>execute</code>, such as the <code>command</code> property,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7216
     * be set. This is true because the method <code>populate</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7217
     * is given the <code>ResultSet</code> object from
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7218
     * which to get data and thus does not need to use the properties
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7219
     * required for setting up a connection and executing this
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7220
     * <code>CachedRowSetImpl</code> object's command.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7221
     * <P>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7222
     * After populating this rowset with data, the method
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7223
     * <code>populate</code> sets the rowset's metadata and
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7224
     * then sends a <code>RowSetChangedEvent</code> object
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7225
     * to all registered listeners prior to returning.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7226
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7227
     * @param data the <code>ResultSet</code> object containing the data
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7228
     *             to be read into this <code>CachedRowSetImpl</code> object
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7229
     * @param start the integer specifing the position in the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7230
     *        <code>ResultSet</code> object to popultate the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7231
     *        <code>CachedRowSetImpl</code> object.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7232
     * @throws SQLException if an error occurs; or the max row setting is
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7233
     *          violated while populating the RowSet.Also id the start position
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7234
     *          is negative.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7235
     * @see #execute
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7236
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7237
     public void populate(ResultSet data, int start) throws SQLException{
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7238
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7239
        int rowsFetched;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7240
        Row currentRow;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7241
        int numCols;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7242
        int i;
9257
53e6d7bc31b0 7035615: Address lint warnings for javax.sql.rowset & com.sun.rowset
lancea
parents: 6697
diff changeset
  7243
        Map<String, Class<?>> map = getTypeMap();
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7244
        Object obj;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7245
        int mRows;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7246
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7247
        cursorPos = 0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7248
        if(populatecallcount == 0){
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7249
            if(start < 0){
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7250
               throw new SQLException(resBundle.handleGetObject("cachedrowsetimpl.startpos").toString());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7251
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7252
            if(getMaxRows() == 0){
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7253
               data.absolute(start);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7254
               while(data.next()){
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7255
                   totalRows++;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7256
               }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7257
               totalRows++;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7258
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7259
            startPos = start;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7260
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7261
        populatecallcount = populatecallcount +1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7262
        resultSet = data;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7263
        if((endPos - startPos) >= getMaxRows() && (getMaxRows() > 0)){
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7264
            endPos = prevEndPos;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7265
            pagenotend = false;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7266
            return;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7267
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7268
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7269
        if((maxRowsreached != getMaxRows() || maxRowsreached != totalRows) && pagenotend) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7270
           startPrev = start - getPageSize();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7271
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7272
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7273
        if( pageSize == 0){
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7274
           prevEndPos = endPos;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7275
           endPos = start + getMaxRows() ;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7276
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7277
        else{
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7278
            prevEndPos = endPos;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7279
            endPos = start + getPageSize();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7280
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7281
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7282
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7283
        if (start == 1){
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7284
            resultSet.beforeFirst();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7285
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7286
        else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7287
            resultSet.absolute(start -1);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7288
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7289
        if( pageSize == 0) {
9257
53e6d7bc31b0 7035615: Address lint warnings for javax.sql.rowset & com.sun.rowset
lancea
parents: 6697
diff changeset
  7290
           rvh = new Vector<Object>(getMaxRows());
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7291
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7292
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7293
        else{
9257
53e6d7bc31b0 7035615: Address lint warnings for javax.sql.rowset & com.sun.rowset
lancea
parents: 6697
diff changeset
  7294
            rvh = new Vector<Object>(getPageSize());
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7295
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7296
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7297
        if (data == null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7298
            throw new SQLException(resBundle.handleGetObject("cachedrowsetimpl.populate").toString());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7299
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7300
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7301
        // get the meta data for this ResultSet
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7302
        RSMD = data.getMetaData();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7303
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7304
        // set up the metadata
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7305
        RowSetMD = new RowSetMetaDataImpl();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7306
        initMetaData(RowSetMD, RSMD);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7307
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7308
        // release the meta-data so that aren't tempted to use it.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7309
        RSMD = null;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7310
        numCols = RowSetMD.getColumnCount();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7311
        mRows = this.getMaxRows();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7312
        rowsFetched = 0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7313
        currentRow = null;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7314
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7315
        if(!data.next() && mRows == 0){
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7316
            endPos = prevEndPos;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7317
            pagenotend = false;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7318
            return;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7319
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7320
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7321
        data.previous();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7322
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7323
        while ( data.next()) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7324
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7325
            currentRow = new Row(numCols);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7326
          if(pageSize == 0){
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7327
            if ( rowsFetched >= mRows && mRows > 0) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7328
                rowsetWarning.setNextException(new SQLException("Populating rows "
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7329
                + "setting has exceeded max row setting"));
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7330
                break;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7331
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7332
          }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7333
          else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7334
              if ( (rowsFetched >= pageSize) ||( maxRowsreached >= mRows && mRows > 0)) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7335
                rowsetWarning.setNextException(new SQLException("Populating rows "
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7336
                + "setting has exceeded max row setting"));
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7337
                break;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7338
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7339
          }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7340
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7341
            for ( i = 1; i <= numCols; i++) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7342
                /*
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7343
                 * check if the user has set a map. If no map
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7344
                 * is set then use plain getObject. This lets
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7345
                 * us work with drivers that do not support
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7346
                 * getObject with a map in fairly sensible way
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7347
                 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7348
                if (map == null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7349
                    obj = data.getObject(i);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7350
                } else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7351
                    obj = data.getObject(i, map);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7352
                }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7353
                /*
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7354
                 * the following block checks for the various
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7355
                 * types that we have to serialize in order to
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7356
                 * store - right now only structs have been tested
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7357
                 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7358
                if (obj instanceof Struct) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7359
                    obj = new SerialStruct((Struct)obj, map);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7360
                } else if (obj instanceof SQLData) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7361
                    obj = new SerialStruct((SQLData)obj, map);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7362
                } else if (obj instanceof Blob) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7363
                    obj = new SerialBlob((Blob)obj);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7364
                } else if (obj instanceof Clob) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7365
                    obj = new SerialClob((Clob)obj);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7366
                } else if (obj instanceof java.sql.Array) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7367
                    obj = new SerialArray((java.sql.Array)obj, map);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7368
                }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7369
11129
f9ad1aadf3fa 7116445: Miscellaneous warnings in the JDBC/RowSet classes
lancea
parents: 9537
diff changeset
  7370
                currentRow.initColumnObject(i, obj);
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7371
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7372
            rowsFetched++;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7373
            maxRowsreached++;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7374
            rvh.add(currentRow);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7375
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7376
        numRows = rowsFetched ;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7377
        // Also rowsFetched should be equal to rvh.size()
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7378
        // notify any listeners that the rowset has changed
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7379
        notifyRowSetChanged();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7380
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7381
     }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7382
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7383
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7384
     * The nextPage gets the next page, that is a <code>CachedRowSetImpl</code> object
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7385
     * containing the number of rows specified by page size.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7386
     * @return boolean value true indicating whether there are more pages to come and
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7387
     *         false indicating that this is the last page.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7388
     * @throws SQLException if an error occurs or this called before calling populate.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7389
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7390
     public boolean nextPage() throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7391
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7392
         if (populatecallcount == 0){
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7393
             throw new SQLException(resBundle.handleGetObject("cachedrowsetimpl.nextpage").toString());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7394
         }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7395
         // Fix for 6554186
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7396
         onFirstPage = false;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7397
         if(callWithCon){
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7398
            crsReader.setStartPosition(endPos);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7399
            crsReader.readData((RowSetInternal)this);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7400
            resultSet = null;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7401
         }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7402
         else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7403
            populate(resultSet,endPos);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7404
         }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7405
         return pagenotend;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7406
     }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7407
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7408
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7409
     * This is the setter function for setting the size of the page, which specifies
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7410
     * how many rows have to be retrived at a time.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7411
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7412
     * @param size which is the page size
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7413
     * @throws SQLException if size is less than zero or greater than max rows.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7414
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7415
     public void setPageSize (int size) throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7416
        if (size < 0) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7417
            throw new SQLException(resBundle.handleGetObject("cachedrowsetimpl.pagesize").toString());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7418
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7419
        if (size > getMaxRows() && getMaxRows() != 0) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7420
            throw new SQLException(resBundle.handleGetObject("cachedrowsetimpl.pagesize1").toString());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7421
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7422
        pageSize = size;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7423
     }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7424
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7425
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7426
     * This is the getter function for the size of the page.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7427
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7428
     * @return an integer that is the page size.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7429
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7430
    public int getPageSize() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7431
        return pageSize;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7432
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7433
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7434
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7435
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7436
     * Retrieves the data present in the page prior to the page from where it is
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7437
     * called.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7438
     * @return boolean value true if it retrieves the previous page, flase if it
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7439
     *         is on the first page.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7440
     * @throws SQLException if it is called before populate is called or ResultSet
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7441
     *         is of type <code>ResultSet.TYPE_FORWARD_ONLY</code> or if an error
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7442
     *         occurs.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7443
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7444
    public boolean previousPage() throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7445
        int pS;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7446
        int mR;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7447
        int rem;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7448
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7449
        pS = getPageSize();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7450
        mR = maxRowsreached;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7451
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7452
        if (populatecallcount == 0){
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7453
             throw new SQLException(resBundle.handleGetObject("cachedrowsetimpl.nextpage").toString());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7454
         }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7455
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7456
        if( !callWithCon){
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7457
           if(resultSet.getType() == ResultSet.TYPE_FORWARD_ONLY){
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7458
               throw new SQLException (resBundle.handleGetObject("cachedrowsetimpl.fwdonly").toString());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7459
           }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7460
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7461
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7462
        pagenotend = true;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7463
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7464
        if(startPrev < startPos ){
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7465
                onFirstPage = true;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7466
               return false;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7467
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7468
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7469
        if(onFirstPage){
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7470
            return false;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7471
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7472
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7473
        rem = mR % pS;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7474
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7475
        if(rem == 0){
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7476
            maxRowsreached -= (2 * pS);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7477
            if(callWithCon){
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7478
                crsReader.setStartPosition(startPrev);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7479
                crsReader.readData((RowSetInternal)this);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7480
                resultSet = null;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7481
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7482
            else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7483
               populate(resultSet,startPrev);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7484
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7485
            return true;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7486
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7487
        else
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7488
        {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7489
            maxRowsreached -= (pS + rem);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7490
            if(callWithCon){
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7491
                crsReader.setStartPosition(startPrev);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7492
                crsReader.readData((RowSetInternal)this);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7493
                resultSet = null;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7494
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7495
            else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7496
               populate(resultSet,startPrev);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7497
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7498
            return true;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7499
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7500
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7501
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7502
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7503
     * Goes to the page number passed as the parameter
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7504
     * @param page , the page loaded on a call to this function
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7505
     * @return true if the page exists false otherwise
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7506
     * @throws SQLException if an error occurs
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7507
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7508
    /*
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7509
    public boolean absolutePage(int page) throws SQLException{
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7510
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7511
        boolean isAbs = true, retVal = true;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7512
        int counter;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7513
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7514
        if( page <= 0 ){
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7515
            throw new SQLException("Absolute positoin is invalid");
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7516
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7517
        counter = 0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7518
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7519
        firstPage();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7520
        counter++;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7521
        while((counter < page) && isAbs) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7522
            isAbs = nextPage();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7523
            counter ++;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7524
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7525
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7526
        if( !isAbs && counter < page){
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7527
            retVal = false;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7528
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7529
        else if(counter == page){
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7530
            retVal = true;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7531
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7532
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7533
       return retVal;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7534
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7535
    */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7536
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7537
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7538
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7539
     * Goes to the page number passed as the parameter  from the current page.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7540
     * The parameter can take postive or negative value accordingly.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7541
     * @param page , the page loaded on a call to this function
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7542
     * @return true if the page exists false otherwise
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7543
     * @throws SQLException if an error occurs
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7544
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7545
    /*
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7546
    public boolean relativePage(int page) throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7547
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7548
        boolean isRel = true,retVal = true;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7549
        int counter;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7550
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7551
        if(page > 0){
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7552
           counter  = 0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7553
           while((counter < page) && isRel){
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7554
              isRel = nextPage();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7555
              counter++;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7556
           }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7557
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7558
           if(!isRel && counter < page){
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7559
               retVal = false;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7560
           }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7561
           else if( counter == page){
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7562
               retVal = true;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7563
           }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7564
           return retVal;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7565
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7566
        else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7567
            counter = page;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7568
            isRel = true;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7569
            while((counter < 0) && isRel){
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7570
                isRel = previousPage();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7571
                counter++;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7572
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7573
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7574
            if( !isRel && counter < 0){
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7575
                retVal = false;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7576
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7577
            else if(counter == 0){
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7578
                retVal = true;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7579
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7580
            return retVal;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7581
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7582
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7583
    */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7584
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7585
     /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7586
     * Retrieves the first page of data as specified by the page size.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7587
     * @return boolean value true if present on first page, false otherwise
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7588
     * @throws SQLException if it called before populate or ResultSet is of
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7589
     *         type <code>ResultSet.TYPE_FORWARD_ONLY</code> or an error occurs
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7590
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7591
    /*
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7592
    public boolean firstPage() throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7593
           if (populatecallcount == 0){
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7594
             throw new SQLException("Populate the data before calling ");
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7595
           }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7596
           if( !callWithCon){
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7597
              if(resultSet.getType() == ResultSet.TYPE_FORWARD_ONLY) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7598
                  throw new SQLException("Result of type forward only");
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7599
              }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7600
           }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7601
           endPos = 0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7602
           maxRowsreached = 0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7603
           pagenotend = true;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7604
           if(callWithCon){
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7605
               crsReader.setStartPosition(startPos);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7606
               crsReader.readData((RowSetInternal)this);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7607
               resultSet = null;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7608
           }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7609
           else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7610
              populate(resultSet,startPos);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7611
           }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7612
           onFirstPage = true;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7613
           return onFirstPage;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7614
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7615
    */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7616
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7617
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7618
     * Retrives the last page of data as specified by the page size.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7619
     * @return boolean value tur if present on the last page, false otherwise
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7620
     * @throws SQLException if called before populate or if an error occurs.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7621
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7622
     /*
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7623
    public boolean lastPage() throws SQLException{
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7624
          int pS;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7625
          int mR;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7626
          int quo;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7627
          int rem;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7628
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7629
          pS = getPageSize();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7630
          mR = getMaxRows();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7631
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7632
          if(pS == 0){
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7633
              onLastPage = true;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7634
              return onLastPage;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7635
          }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7636
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7637
          if(getMaxRows() == 0){
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7638
              mR = totalRows;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7639
          }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7640
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7641
          if (populatecallcount == 0){
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7642
             throw new SQLException("Populate the data before calling ");
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7643
         }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7644
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7645
         onFirstPage = false;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7646
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7647
         if((mR % pS) == 0){
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7648
             quo = mR / pS;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7649
             int start = startPos + (pS * (quo - 1));
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7650
             maxRowsreached = mR - pS;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7651
             if(callWithCon){
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7652
                 crsReader.setStartPosition(start);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7653
                 crsReader.readData((RowSetInternal)this);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7654
                 resultSet = null;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7655
             }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7656
             else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7657
                populate(resultSet,start);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7658
             }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7659
             onLastPage = true;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7660
             return onLastPage;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7661
         }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7662
        else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7663
              quo = mR /pS;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7664
              rem = mR % pS;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7665
              int start = startPos + (pS * quo);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7666
             maxRowsreached = mR - (rem);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7667
             if(callWithCon){
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7668
                 crsReader.setStartPosition(start);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7669
                 crsReader.readData((RowSetInternal)this);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7670
                 resultSet = null;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7671
             }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7672
             else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7673
                populate(resultSet,start);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7674
             }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7675
             onLastPage = true;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7676
             return onLastPage;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7677
         }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7678
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7679
    */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7680
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7681
   /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7682
     * Sets the status for the row on which the cursor is positioned. The insertFlag is used
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7683
     * to mention the toggle status for this row
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7684
     * @param insertFlag if it is true  - marks this row as inserted
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7685
     *                   if it is false - marks it as not a newly inserted row
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7686
     * @throws SQLException if an error occurs while doing this operation
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7687
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7688
    public void setRowInserted(boolean insertFlag) throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7689
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7690
        checkCursor();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7691
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7692
        if(onInsertRow == true)
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7693
          throw new SQLException(resBundle.handleGetObject("cachedrowsetimpl.invalidop").toString());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7694
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7695
        if( insertFlag ) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7696
          ((Row)getCurrentRow()).setInserted();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7697
        } else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7698
          ((Row)getCurrentRow()).clearInserted();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7699
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7700
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7701
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7702
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7703
     * Retrieves the value of the designated <code>SQL XML</code> parameter as a
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7704
     * <code>SQLXML</code> object in the Java programming language.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7705
     * @param columnIndex the first column is 1, the second is 2, ...
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7706
     * @return a SQLXML object that maps an SQL XML value
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7707
     * @throws SQLException if a database access error occurs
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7708
     * @since 6.0
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7709
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7710
    public SQLXML getSQLXML(int columnIndex) throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7711
        throw new SQLFeatureNotSupportedException(resBundle.handleGetObject("cachedrowsetimpl.opnotysupp").toString());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7712
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7713
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7714
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7715
     * Retrieves the value of the designated <code>SQL XML</code> parameter as a
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7716
     * <code>SQLXML</code> object in the Java programming language.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7717
     * @param colName the name of the column from which to retrieve the value
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7718
     * @return a SQLXML object that maps an SQL XML value
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7719
     * @throws SQLException if a database access error occurs
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7720
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7721
    public SQLXML getSQLXML(String colName) throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7722
        throw new SQLFeatureNotSupportedException(resBundle.handleGetObject("cachedrowsetimpl.opnotysupp").toString());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7723
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7724
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7725
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7726
     * Retrieves the value of the designated column in the current row of this
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7727
     * <code>ResultSet</code> object as a java.sql.RowId object in the Java
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7728
     * programming language.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7729
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7730
     * @param columnIndex the first column is 1, the second 2, ...
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7731
     * @return the column value if the value is a SQL <code>NULL</code> the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7732
     *     value returned is <code>null</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7733
     * @throws SQLException if a database access error occurs
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7734
     * @since 6.0
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7735
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7736
    public RowId getRowId(int columnIndex) throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7737
        throw new SQLFeatureNotSupportedException(resBundle.handleGetObject("cachedrowsetimpl.opnotysupp").toString());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7738
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7739
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7740
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7741
     * Retrieves the value of the designated column in the current row of this
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7742
     * <code>ResultSet</code> object as a java.sql.RowId object in the Java
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7743
     * programming language.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7744
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7745
     * @param columnName the name of the column
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7746
     * @return the column value if the value is a SQL <code>NULL</code> the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7747
     *     value returned is <code>null</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7748
     * @throws SQLException if a database access error occurs
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7749
     * @since 6.0
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7750
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7751
    public RowId getRowId(String columnName) throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7752
        throw new SQLFeatureNotSupportedException(resBundle.handleGetObject("cachedrowsetimpl.opnotysupp").toString());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7753
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7754
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7755
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7756
     * Updates the designated column with a <code>RowId</code> value. The updater
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7757
     * methods are used to update column values in the current row or the insert
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7758
     * row. The updater methods do not update the underlying database; instead
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7759
     * the <code>updateRow<code> or <code>insertRow</code> methods are called
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7760
     * to update the database.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7761
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7762
     * @param columnIndex the first column is 1, the second 2, ...
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7763
     * @param x the column value
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7764
     * @throws SQLException if a database access occurs
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7765
     * @since 6.0
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7766
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7767
    public void updateRowId(int columnIndex, RowId x) throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7768
        throw new SQLFeatureNotSupportedException(resBundle.handleGetObject("cachedrowsetimpl.opnotysupp").toString());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7769
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7770
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7771
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7772
     * Updates the designated column with a <code>RowId</code> value. The updater
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7773
     * methods are used to update column values in the current row or the insert
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7774
     * row. The updater methods do not update the underlying database; instead
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7775
     * the <code>updateRow<code> or <code>insertRow</code> methods are called
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7776
     * to update the database.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7777
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7778
     * @param columnName the name of the column
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7779
     * @param x the column value
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7780
     * @throws SQLException if a database access occurs
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7781
     * @since 6.0
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7782
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7783
    public void updateRowId(String columnName, RowId x) throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7784
        throw new SQLFeatureNotSupportedException(resBundle.handleGetObject("cachedrowsetimpl.opnotysupp").toString());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7785
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7786
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7787
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7788
     * Retrieves the holdability of this ResultSet object
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7789
     * @return  either ResultSet.HOLD_CURSORS_OVER_COMMIT or ResultSet.CLOSE_CURSORS_AT_COMMIT
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7790
     * @throws SQLException if a database error occurs
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7791
     * @since 6.0
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7792
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7793
    public int getHoldability() throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7794
        throw new SQLFeatureNotSupportedException(resBundle.handleGetObject("cachedrowsetimpl.opnotysupp").toString());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7795
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7796
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7797
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7798
     * Retrieves whether this ResultSet object has been closed. A ResultSet is closed if the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7799
     * method close has been called on it, or if it is automatically closed.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7800
     * @return true if this ResultSet object is closed; false if it is still open
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7801
     * @throws SQLException if a database access error occurs
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7802
     * @since 6.0
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7803
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7804
    public boolean isClosed() throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7805
        throw new SQLFeatureNotSupportedException(resBundle.handleGetObject("cachedrowsetimpl.opnotysupp").toString());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7806
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7807
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7808
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7809
     * This method is used for updating columns that support National Character sets.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7810
     * It can be used for updating NCHAR,NVARCHAR and LONGNVARCHAR columns.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7811
     * @param columnIndex the first column is 1, the second 2, ...
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7812
     * @param nString the value for the column to be updated
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7813
     * @throws SQLException if a database access error occurs
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7814
     * @since 6.0
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7815
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7816
    public void updateNString(int columnIndex, String nString) throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7817
        throw new SQLFeatureNotSupportedException(resBundle.handleGetObject("cachedrowsetimpl.opnotysupp").toString());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7818
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7819
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7820
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7821
     * This method is used for updating columns that support National Character sets.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7822
     * It can be used for updating NCHAR,NVARCHAR and LONGNVARCHAR columns.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7823
     * @param columnName name of the Column
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7824
     * @param nString the value for the column to be updated
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7825
     * @throws SQLException if a database access error occurs
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7826
     * @since 6.0
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7827
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7828
    public void updateNString(String columnName, String nString) throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7829
        throw new SQLFeatureNotSupportedException(resBundle.handleGetObject("cachedrowsetimpl.opnotysupp").toString());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7830
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7831
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7832
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7833
    /*o
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7834
     * This method is used for updating SQL <code>NCLOB</code>  type that maps
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7835
     * to <code>java.sql.Types.NCLOB</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7836
     * @param columnIndex the first column is 1, the second 2, ...
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7837
     * @param nClob the value for the column to be updated
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7838
     * @throws SQLException if a database access error occurs
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7839
     * @since 6.0
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7840
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7841
    public void updateNClob(int columnIndex, NClob nClob) throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7842
        throw new SQLFeatureNotSupportedException(resBundle.handleGetObject("cachedrowsetimpl.opnotysupp").toString());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7843
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7844
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7845
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7846
     * This method is used for updating SQL <code>NCLOB</code>  type that maps
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7847
     * to <code>java.sql.Types.NCLOB</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7848
     * @param columnName name of the column
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7849
     * @param nClob the value for the column to be updated
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7850
     * @throws SQLException if a database access error occurs
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7851
     * @since 6.0
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7852
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7853
    public void updateNClob(String columnName, NClob nClob) throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7854
       throw new SQLFeatureNotSupportedException(resBundle.handleGetObject("cachedrowsetimpl.opnotysupp").toString());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7855
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7856
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7857
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7858
     * Retrieves the value of the designated column in the current row
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7859
     * of this <code>ResultSet</code> object as a <code>NClob</code> object
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7860
     * in the Java programming language.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7861
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7862
     * @param i the first column is 1, the second is 2, ...
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7863
     * @return a <code>NClob</code> object representing the SQL
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7864
     *         <code>NCLOB</code> value in the specified column
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7865
     * @exception SQLException if a database access error occurs
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7866
     * @since 6.0
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7867
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7868
    public NClob getNClob(int i) throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7869
        throw new SQLFeatureNotSupportedException(resBundle.handleGetObject("cachedrowsetimpl.opnotysupp").toString());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7870
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7871
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7872
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7873
   /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7874
     * Retrieves the value of the designated column in the current row
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7875
     * of this <code>ResultSet</code> object as a <code>NClob</code> object
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7876
     * in the Java programming language.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7877
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7878
     * @param colName the name of the column from which to retrieve the value
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7879
     * @return a <code>NClob</code> object representing the SQL <code>NCLOB</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7880
     * value in the specified column
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7881
     * @exception SQLException if a database access error occurs
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7882
     * @since 6.0
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7883
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7884
    public NClob getNClob(String colName) throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7885
        throw new SQLFeatureNotSupportedException(resBundle.handleGetObject("cachedrowsetimpl.opnotysupp").toString());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7886
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7887
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7888
    public <T> T unwrap(java.lang.Class<T> iface) throws java.sql.SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7889
        return null;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7890
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7891
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7892
    public boolean isWrapperFor(Class<?> interfaces) throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7893
        return false;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7894
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7895
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7896
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7897
   /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7898
      * Sets the designated parameter to the given <code>java.sql.SQLXML</code> object. The driver converts this to an
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7899
      * SQL <code>XML</code> value when it sends it to the database.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7900
      * @param parameterIndex index of the first parameter is 1, the second is 2, ...
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7901
      * @param xmlObject a <code>SQLXML</code> object that maps an SQL <code>XML</code> value
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7902
      * @throws SQLException if a database access error occurs
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7903
      * @since 1.6
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7904
      */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7905
     public void setSQLXML(int parameterIndex, SQLXML xmlObject) throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7906
         throw new SQLFeatureNotSupportedException(resBundle.handleGetObject("cachedrowsetimpl.opnotysupp").toString());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7907
     }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7908
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7909
   /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7910
     * Sets the designated parameter to the given <code>java.sql.SQLXML</code> object. The driver converts this to an
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7911
     * <code>SQL XML</code> value when it sends it to the database.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7912
     * @param parameterName the name of the parameter
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7913
     * @param xmlObject a <code>SQLXML</code> object that maps an <code>SQL XML</code> value
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7914
     * @throws SQLException if a database access error occurs
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7915
     * @since 1.6
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7916
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7917
    public void setSQLXML(String parameterName, SQLXML xmlObject) throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7918
         throw new SQLFeatureNotSupportedException(resBundle.handleGetObject("cachedrowsetimpl.opnotysupp").toString());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7919
     }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7920
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7921
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7922
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7923
     * Sets the designated parameter to the given <code>java.sql.RowId</code> object. The
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7924
     * driver converts this to a SQL <code>ROWID</code> value when it sends it
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7925
     * to the database
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7926
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7927
     * @param parameterIndex the first parameter is 1, the second is 2, ...
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7928
     * @param x the parameter value
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7929
     * @throws SQLException if a database access error occurs
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7930
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7931
     * @since 1.6
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7932
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7933
    public void setRowId(int parameterIndex, RowId x) throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7934
         throw new SQLFeatureNotSupportedException(resBundle.handleGetObject("cachedrowsetimpl.opnotysupp").toString());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7935
     }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7936
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7937
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7938
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7939
    * Sets the designated parameter to the given <code>java.sql.RowId</code> object. The
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7940
    * driver converts this to a SQL <code>ROWID</code> when it sends it to the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7941
    * database.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7942
    *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7943
    * @param parameterName the name of the parameter
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7944
    * @param x the parameter value
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7945
    * @throws SQLException if a database access error occurs
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7946
    * @since 1.6
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7947
    */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7948
   public void setRowId(String parameterName, RowId x) throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7949
         throw new SQLFeatureNotSupportedException(resBundle.handleGetObject("cachedrowsetimpl.opnotysupp").toString());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7950
     }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7951
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7952
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7953
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7954
     * Sets the designated parameter to a <code>Reader</code> object. The
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7955
     * <code>Reader</code> reads the data till end-of-file is reached. The
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7956
     * driver does the necessary conversion from Java character format to
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7957
     * the national character set in the database.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7958
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7959
     * <P><B>Note:</B> This stream object can either be a standard
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7960
     * Java stream object or your own subclass that implements the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7961
     * standard interface.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7962
     * <P><B>Note:</B> Consult your JDBC driver documentation to determine if
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7963
     * it might be more efficient to use a version of
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7964
     * <code>setNCharacterStream</code> which takes a length parameter.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7965
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7966
     * @param parameterIndex of the first parameter is 1, the second is 2, ...
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7967
     * @param value the parameter value
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7968
     * @throws SQLException if the driver does not support national
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7969
     *         character sets;  if the driver can detect that a data conversion
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7970
     *  error could occur ; if a database access error occurs; or
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7971
     * this method is called on a closed <code>PreparedStatement</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7972
     * @throws SQLFeatureNotSupportedException  if the JDBC driver does not support this method
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7973
     * @since 1.6
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7974
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7975
     public void setNCharacterStream(int parameterIndex, Reader value) throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7976
        throw new SQLFeatureNotSupportedException(resBundle.handleGetObject("cachedrowsetimpl.featnotsupp").toString());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7977
     }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7978
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7979
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7980
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7981
    * Sets the designated parameter to a <code>java.sql.NClob</code> object. The object
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7982
    * implements the <code>java.sql.NClob</code> interface. This <code>NClob</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7983
    * object maps to a SQL <code>NCLOB</code>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7984
    * @param parameterName the name of the column to be set
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7985
    * @param value the parameter value
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7986
    * @throws SQLException if the driver does not support national
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7987
    *         character sets;  if the driver can detect that a data conversion
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7988
    *  error could occur; or if a database access error occurs
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7989
    * @since 1.6
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7990
    */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7991
    public void setNClob(String parameterName, NClob value) throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7992
         throw new SQLFeatureNotSupportedException(resBundle.handleGetObject("cachedrowsetimpl.opnotysupp").toString());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7993
     }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7994
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7995
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7996
  /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7997
     * Retrieves the value of the designated column in the current row
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7998
     * of this <code>ResultSet</code> object as a
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7999
     * <code>java.io.Reader</code> object.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8000
     * It is intended for use when
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8001
     * accessing  <code>NCHAR</code>,<code>NVARCHAR</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8002
     * and <code>LONGNVARCHAR</code> columns.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8003
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8004
     * @return a <code>java.io.Reader</code> object that contains the column
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8005
     * value; if the value is SQL <code>NULL</code>, the value returned is
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8006
     * <code>null</code> in the Java programming language.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8007
     * @param columnIndex the first column is 1, the second is 2, ...
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8008
     * @exception SQLException if a database access error occurs
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8009
     * @since 1.6
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8010
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8011
    public java.io.Reader getNCharacterStream(int columnIndex) throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8012
       throw new SQLFeatureNotSupportedException(resBundle.handleGetObject("cachedrowsetimpl.opnotysupp").toString());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8013
     }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8014
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8015
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8016
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8017
     * Retrieves the value of the designated column in the current row
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8018
     * of this <code>ResultSet</code> object as a
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8019
     * <code>java.io.Reader</code> object.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8020
     * It is intended for use when
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8021
     * accessing  <code>NCHAR</code>,<code>NVARCHAR</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8022
     * and <code>LONGNVARCHAR</code> columns.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8023
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8024
     * @param columnName the name of the column
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8025
     * @return a <code>java.io.Reader</code> object that contains the column
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8026
     * value; if the value is SQL <code>NULL</code>, the value returned is
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8027
     * <code>null</code> in the Java programming language
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8028
     * @exception SQLException if a database access error occurs
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8029
     * @since 1.6
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8030
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8031
    public java.io.Reader getNCharacterStream(String columnName) throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8032
       throw new SQLFeatureNotSupportedException(resBundle.handleGetObject("cachedrowsetimpl.opnotysupp").toString());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8033
     }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8034
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8035
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8036
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8037
     * Updates the designated column with a <code>java.sql.SQLXML</code> value.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8038
     * The updater
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8039
     * methods are used to update column values in the current row or the insert
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8040
     * row. The updater methods do not update the underlying database; instead
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8041
     * the <code>updateRow</code> or <code>insertRow</code> methods are called
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8042
     * to update the database.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8043
     * @param columnIndex the first column is 1, the second 2, ...
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8044
     * @param xmlObject the value for the column to be updated
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8045
     * @throws SQLException if a database access error occurs
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8046
     * @since 1.6
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8047
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8048
    public void updateSQLXML(int columnIndex, SQLXML xmlObject) throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8049
        throw new SQLFeatureNotSupportedException(resBundle.handleGetObject("cachedrowsetimpl.opnotysupp").toString());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8050
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8051
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8052
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8053
     * Updates the designated column with a <code>java.sql.SQLXML</code> value.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8054
     * The updater
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8055
     * methods are used to update column values in the current row or the insert
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8056
     * row. The updater methods do not update the underlying database; instead
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8057
     * the <code>updateRow</code> or <code>insertRow</code> methods are called
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8058
     * to update the database.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8059
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8060
     * @param columnName the name of the column
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8061
     * @param xmlObject the column value
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8062
     * @throws SQLException if a database access occurs
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8063
     * @since 1.6
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8064
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8065
    public void updateSQLXML(String columnName, SQLXML xmlObject) throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8066
        throw new SQLFeatureNotSupportedException(resBundle.handleGetObject("cachedrowsetimpl.opnotysupp").toString());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8067
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8068
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8069
     /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8070
     * Retrieves the value of the designated column in the current row
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8071
     * of this <code>ResultSet</code> object as
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8072
     * a <code>String</code> in the Java programming language.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8073
     * It is intended for use when
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8074
     * accessing  <code>NCHAR</code>,<code>NVARCHAR</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8075
     * and <code>LONGNVARCHAR</code> columns.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8076
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8077
     * @param columnIndex the first column is 1, the second is 2, ...
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8078
     * @return the column value; if the value is SQL <code>NULL</code>, the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8079
     * value returned is <code>null</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8080
     * @exception SQLException if a database access error occurs
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8081
     * @since 1.6
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8082
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8083
    public String getNString(int columnIndex) throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8084
        throw new SQLFeatureNotSupportedException(resBundle.handleGetObject("cachedrowsetimpl.opnotysupp").toString());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8085
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8086
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8087
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8088
     * Retrieves the value of the designated column in the current row
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8089
     * of this <code>ResultSet</code> object as
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8090
     * a <code>String</code> in the Java programming language.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8091
     * It is intended for use when
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8092
     * accessing  <code>NCHAR</code>,<code>NVARCHAR</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8093
     * and <code>LONGNVARCHAR</code> columns.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8094
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8095
     * @param columnName the SQL name of the column
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8096
     * @return the column value; if the value is SQL <code>NULL</code>, the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8097
     * value returned is <code>null</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8098
     * @exception SQLException if a database access error occurs
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8099
     * @since 1.6
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8100
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8101
    public String getNString(String columnName) throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8102
        throw new SQLFeatureNotSupportedException(resBundle.handleGetObject("cachedrowsetimpl.opnotysupp").toString());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8103
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8104
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8105
     /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8106
       * Updates the designated column with a character stream value, which will
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8107
       * have the specified number of bytes. The driver does the necessary conversion
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8108
       * from Java character format to the national character set in the database.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8109
       * It is intended for use when updating NCHAR,NVARCHAR and LONGNVARCHAR columns.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8110
       * The updater methods are used to update column values in the current row or
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8111
       * the insert row. The updater methods do not update the underlying database;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8112
       * instead the updateRow or insertRow methods are called to update the database.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8113
       *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8114
       * @param columnIndex - the first column is 1, the second is 2, ...
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8115
       * @param x - the new column value
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8116
       * @param length - the length of the stream
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8117
       * @exception SQLException if a database access error occurs
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8118
       * @since 1.6
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8119
       */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8120
       public void updateNCharacterStream(int columnIndex,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8121
                            java.io.Reader x,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8122
                            long length)
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8123
                            throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8124
          throw new SQLFeatureNotSupportedException(resBundle.handleGetObject("cachedrowsetimpl.opnotysupp").toString());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8125
       }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8126
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8127
     /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8128
       * Updates the designated column with a character stream value, which will
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8129
       * have the specified number of bytes. The driver does the necessary conversion
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8130
       * from Java character format to the national character set in the database.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8131
       * It is intended for use when updating NCHAR,NVARCHAR and LONGNVARCHAR columns.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8132
       * The updater methods are used to update column values in the current row or
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8133
       * the insert row. The updater methods do not update the underlying database;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8134
       * instead the updateRow or insertRow methods are called to update the database.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8135
       *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8136
       * @param columnName - name of the Column
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8137
       * @param x - the new column value
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8138
       * @param length - the length of the stream
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8139
       * @exception SQLException if a database access error occurs
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8140
       * @since 1.6
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8141
       */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8142
       public void updateNCharacterStream(String columnName,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8143
                            java.io.Reader x,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8144
                            long length)
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8145
                            throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8146
          throw new SQLFeatureNotSupportedException(resBundle.handleGetObject("cachedrowsetimpl.opnotysupp").toString());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8147
       }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8148
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8149
     /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8150
     * Updates the designated column with a character stream value.   The
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8151
     * driver does the necessary conversion from Java character format to
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8152
     * the national character set in the database.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8153
     * It is intended for use when
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8154
     * updating  <code>NCHAR</code>,<code>NVARCHAR</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8155
     * and <code>LONGNVARCHAR</code> columns.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8156
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8157
     * The updater methods are used to update column values in the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8158
     * current row or the insert row.  The updater methods do not
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8159
     * update the underlying database; instead the <code>updateRow</code> or
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8160
     * <code>insertRow</code> methods are called to update the database.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8161
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8162
     * <P><B>Note:</B> Consult your JDBC driver documentation to determine if
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8163
     * it might be more efficient to use a version of
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8164
     * <code>updateNCharacterStream</code> which takes a length parameter.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8165
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8166
     * @param columnIndex the first column is 1, the second is 2, ...
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8167
     * @param x the new column value
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8168
     * @exception SQLException if a database access error occurs,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8169
     * the result set concurrency is <code>CONCUR_READ_ONLY</code> or this method is called on a closed result set
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8170
     * @exception SQLFeatureNotSupportedException if the JDBC driver does not support
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8171
     * this method
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8172
     * @since 1.6
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8173
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8174
    public void updateNCharacterStream(int columnIndex,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8175
                             java.io.Reader x) throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8176
        throw new SQLFeatureNotSupportedException(resBundle.handleGetObject("cachedrowsetimpl.featnotsupp").toString());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8177
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8178
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8179
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8180
     * Updates the designated column with a character stream value.  The
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8181
     * driver does the necessary conversion from Java character format to
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8182
     * the national character set in the database.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8183
     * It is intended for use when
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8184
     * updating  <code>NCHAR</code>,<code>NVARCHAR</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8185
     * and <code>LONGNVARCHAR</code> columns.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8186
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8187
     * The updater methods are used to update column values in the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8188
     * current row or the insert row.  The updater methods do not
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8189
     * update the underlying database; instead the <code>updateRow</code> or
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8190
     * <code>insertRow</code> methods are called to update the database.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8191
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8192
     * <P><B>Note:</B> Consult your JDBC driver documentation to determine if
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8193
     * it might be more efficient to use a version of
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8194
     * <code>updateNCharacterStream</code> which takes a length parameter.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8195
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8196
     * @param columnLabel the label for the column specified with the SQL AS clause.  If the SQL AS clause was not specified, then the la
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8197
bel is the name of the column
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8198
     * @param reader the <code>java.io.Reader</code> object containing
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8199
     *        the new column value
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8200
     * @exception SQLException if a database access error occurs,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8201
     * the result set concurrency is <code>CONCUR_READ_ONLY</code> or this method is called on a closed result set
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8202
      * @exception SQLFeatureNotSupportedException if the JDBC driver does not support
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8203
     * this method
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8204
     * @since 1.6
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8205
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8206
    public void updateNCharacterStream(String columnLabel,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8207
                             java.io.Reader reader) throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8208
        throw new SQLFeatureNotSupportedException(resBundle.handleGetObject("cachedrowsetimpl.featnotsupp").toString());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8209
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8210
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8211
//////////////////////////
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8212
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8213
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8214
     * Updates the designated column using the given input stream, which
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8215
     * will have the specified number of bytes.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8216
     * When a very large ASCII value is input to a <code>LONGVARCHAR</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8217
     * parameter, it may be more practical to send it via a
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8218
     * <code>java.io.InputStream</code>. Data will be read from the stream
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8219
     * as needed until end-of-file is reached.  The JDBC driver will
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8220
     * do any necessary conversion from ASCII to the database char format.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8221
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8222
     * <P><B>Note:</B> This stream object can either be a standard
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8223
     * Java stream object or your own subclass that implements the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8224
     * standard interface.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8225
     * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8226
     * The updater methods are used to update column values in the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8227
     * current row or the insert row.  The updater methods do not
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8228
     * update the underlying database; instead the <code>updateRow</code> or
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8229
     * <code>insertRow</code> methods are called to update the database.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8230
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8231
     * @param columnIndex the first column is 1, the second is 2, ...
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8232
     * @param inputStream An object that contains the data to set the parameter
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8233
     * value to.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8234
     * @param length the number of bytes in the parameter data.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8235
     * @exception SQLException if a database access error occurs,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8236
     * the result set concurrency is <code>CONCUR_READ_ONLY</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8237
     * or this method is called on a closed result set
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8238
     * @exception SQLFeatureNotSupportedException if the JDBC driver does not support
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8239
     * this method
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8240
     * @since 1.6
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8241
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8242
    public void updateBlob(int columnIndex, InputStream inputStream, long length) throws SQLException{
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8243
        throw new SQLFeatureNotSupportedException(resBundle.handleGetObject("cachedrowsetimpl.featnotsupp").toString());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8244
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8245
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8246
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8247
     * Updates the designated column using the given input stream, which
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8248
     * will have the specified number of bytes.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8249
     * When a very large ASCII value is input to a <code>LONGVARCHAR</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8250
     * parameter, it may be more practical to send it via a
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8251
     * <code>java.io.InputStream</code>. Data will be read from the stream
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8252
     * as needed until end-of-file is reached.  The JDBC driver will
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8253
     * do any necessary conversion from ASCII to the database char format.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8254
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8255
     * <P><B>Note:</B> This stream object can either be a standard
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8256
     * Java stream object or your own subclass that implements the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8257
     * standard interface.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8258
     * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8259
     * The updater methods are used to update column values in the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8260
     * current row or the insert row.  The updater methods do not
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8261
     * update the underlying database; instead the <code>updateRow</code> or
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8262
     * <code>insertRow</code> methods are called to update the database.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8263
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8264
     * @param columnLabel the label for the column specified with the SQL AS clause.  If the SQL AS clause was not specified, then the label is the name of the column
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8265
     * @param inputStream An object that contains the data to set the parameter
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8266
     * value to.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8267
     * @param length the number of bytes in the parameter data.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8268
     * @exception SQLException if a database access error occurs,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8269
     * the result set concurrency is <code>CONCUR_READ_ONLY</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8270
     * or this method is called on a closed result set
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8271
     * @exception SQLFeatureNotSupportedException if the JDBC driver does not support
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8272
     * this method
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8273
     * @since 1.6
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8274
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8275
    public void updateBlob(String columnLabel, InputStream inputStream, long length) throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8276
        throw new SQLFeatureNotSupportedException(resBundle.handleGetObject("cachedrowsetimpl.featnotsupp").toString());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8277
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8278
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8279
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8280
     * Updates the designated column using the given input stream.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8281
     * When a very large ASCII value is input to a <code>LONGVARCHAR</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8282
     * parameter, it may be more practical to send it via a
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8283
     * <code>java.io.InputStream</code>. Data will be read from the stream
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8284
     * as needed until end-of-file is reached.  The JDBC driver will
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8285
     * do any necessary conversion from ASCII to the database char format.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8286
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8287
     * <P><B>Note:</B> This stream object can either be a standard
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8288
     * Java stream object or your own subclass that implements the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8289
     * standard interface.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8290
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8291
     *  <P><B>Note:</B> Consult your JDBC driver documentation to determine if
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8292
     * it might be more efficient to use a version of
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8293
     * <code>updateBlob</code> which takes a length parameter.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8294
     * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8295
     * The updater methods are used to update column values in the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8296
     * current row or the insert row.  The updater methods do not
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8297
     * update the underlying database; instead the <code>updateRow</code> or
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8298
     * <code>insertRow</code> methods are called to update the database.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8299
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8300
     * @param columnIndex the first column is 1, the second is 2, ...
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8301
     * @param inputStream An object that contains the data to set the parameter
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8302
     * value to.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8303
     * @exception SQLException if a database access error occurs,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8304
     * the result set concurrency is <code>CONCUR_READ_ONLY</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8305
     * or this method is called on a closed result set
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8306
     * @exception SQLFeatureNotSupportedException if the JDBC driver does not support
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8307
     * this method
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8308
     * @since 1.6
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8309
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8310
    public void updateBlob(int columnIndex, InputStream inputStream) throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8311
        throw new SQLFeatureNotSupportedException(resBundle.handleGetObject("cachedrowsetimpl.featnotsupp").toString());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8312
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8313
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8314
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8315
     * Updates the designated column using the given input stream.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8316
     * When a very large ASCII value is input to a <code>LONGVARCHAR</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8317
     * parameter, it may be more practical to send it via a
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8318
     * <code>java.io.InputStream</code>. Data will be read from the stream
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8319
     * as needed until end-of-file is reached.  The JDBC driver will
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8320
     * do any necessary conversion from ASCII to the database char format.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8321
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8322
     * <P><B>Note:</B> This stream object can either be a standard
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8323
     * Java stream object or your own subclass that implements the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8324
     * standard interface.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8325
     *   <P><B>Note:</B> Consult your JDBC driver documentation to determine if
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8326
     * it might be more efficient to use a version of
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8327
     * <code>updateBlob</code> which takes a length parameter.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8328
     * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8329
     * The updater methods are used to update column values in the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8330
     * current row or the insert row.  The updater methods do not
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8331
     * update the underlying database; instead the <code>updateRow</code> or
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8332
     * <code>insertRow</code> methods are called to update the database.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8333
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8334
     * @param columnLabel the label for the column specified with the SQL AS clause.  If the SQL AS clause was not specified, then the la
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8335
bel is the name of the column
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8336
     * @param inputStream An object that contains the data to set the parameter
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8337
     * value to.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8338
     * @exception SQLException if a database access error occurs,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8339
     * the result set concurrency is <code>CONCUR_READ_ONLY</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8340
     * or this method is called on a closed result set
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8341
     * @exception SQLFeatureNotSupportedException if the JDBC driver does not support
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8342
     * this method
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8343
     * @since 1.6
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8344
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8345
    public void updateBlob(String columnLabel, InputStream inputStream) throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8346
        throw new SQLFeatureNotSupportedException(resBundle.handleGetObject("cachedrowsetimpl.featnotsupp").toString());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8347
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8348
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8349
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8350
     * Updates the designated column using the given <code>Reader</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8351
     * object, which is the given number of characters long.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8352
     * When a very large UNICODE value is input to a <code>LONGVARCHAR</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8353
     * parameter, it may be more practical to send it via a
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8354
     * <code>java.io.Reader</code> object. The data will be read from the stream
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8355
     * as needed until end-of-file is reached.  The JDBC driver will
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8356
     * do any necessary conversion from UNICODE to the database char format.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8357
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8358
     * <P><B>Note:</B> This stream object can either be a standard
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8359
     * Java stream object or your own subclass that implements the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8360
     * standard interface.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8361
     * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8362
     * The updater methods are used to update column values in the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8363
     * current row or the insert row.  The updater methods do not
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8364
     * update the underlying database; instead the <code>updateRow</code> or
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8365
     * <code>insertRow</code> methods are called to update the database.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8366
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8367
     * @param columnIndex the first column is 1, the second is 2, ...
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8368
     * @param reader An object that contains the data to set the parameter value to.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8369
     * @param length the number of characters in the parameter data.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8370
     * @exception SQLException if a database access error occurs,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8371
     * the result set concurrency is <code>CONCUR_READ_ONLY</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8372
     * or this method is called on a closed result set
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8373
     * @exception SQLFeatureNotSupportedException if the JDBC driver does not support
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8374
     * this method
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8375
     * @since 1.6
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8376
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8377
    public void updateClob(int columnIndex,  Reader reader, long length) throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8378
        throw new SQLFeatureNotSupportedException(resBundle.handleGetObject("cachedrowsetimpl.featnotsupp").toString());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8379
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8380
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8381
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8382
     * Updates the designated column using the given <code>Reader</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8383
     * object, which is the given number of characters long.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8384
     * When a very large UNICODE value is input to a <code>LONGVARCHAR</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8385
     * parameter, it may be more practical to send it via a
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8386
     * <code>java.io.Reader</code> object. The data will be read from the stream
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8387
     * as needed until end-of-file is reached.  The JDBC driver will
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8388
     * do any necessary conversion from UNICODE to the database char format.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8389
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8390
     * <P><B>Note:</B> This stream object can either be a standard
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8391
     * Java stream object or your own subclass that implements the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8392
     * standard interface.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8393
     * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8394
     * The updater methods are used to update column values in the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8395
     * current row or the insert row.  The updater methods do not
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8396
     * update the underlying database; instead the <code>updateRow</code> or
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8397
     * <code>insertRow</code> methods are called to update the database.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8398
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8399
     * @param columnLabel the label for the column specified with the SQL AS clause.  If the SQL AS clause was not specified, then the label is the name of the column
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8400
     * @param reader An object that contains the data to set the parameter value to.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8401
     * @param length the number of characters in the parameter data.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8402
     * @exception SQLException if a database access error occurs,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8403
     * the result set concurrency is <code>CONCUR_READ_ONLY</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8404
     * or this method is called on a closed result set
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8405
     * @exception SQLFeatureNotSupportedException if the JDBC driver does not support
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8406
     * this method
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8407
     * @since 1.6
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8408
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8409
    public void updateClob(String columnLabel,  Reader reader, long length) throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8410
        throw new SQLFeatureNotSupportedException(resBundle.handleGetObject("cachedrowsetimpl.featnotsupp").toString());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8411
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8412
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8413
   /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8414
     * Updates the designated column using the given <code>Reader</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8415
     * object.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8416
     * When a very large UNICODE value is input to a <code>LONGVARCHAR</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8417
     * parameter, it may be more practical to send it via a
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8418
     * <code>java.io.Reader</code> object. The data will be read from the stream
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8419
     * as needed until end-of-file is reached.  The JDBC driver will
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8420
     * do any necessary conversion from UNICODE to the database char format.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8421
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8422
     * <P><B>Note:</B> This stream object can either be a standard
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8423
     * Java stream object or your own subclass that implements the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8424
     * standard interface.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8425
     *   <P><B>Note:</B> Consult your JDBC driver documentation to determine if
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8426
     * it might be more efficient to use a version of
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8427
     * <code>updateClob</code> which takes a length parameter.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8428
     * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8429
     * The updater methods are used to update column values in the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8430
     * current row or the insert row.  The updater methods do not
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8431
     * update the underlying database; instead the <code>updateRow</code> or
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8432
     * <code>insertRow</code> methods are called to update the database.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8433
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8434
     * @param columnIndex the first column is 1, the second is 2, ...
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8435
     * @param reader An object that contains the data to set the parameter value to.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8436
     * @exception SQLException if a database access error occurs,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8437
     * the result set concurrency is <code>CONCUR_READ_ONLY</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8438
     * or this method is called on a closed result set
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8439
     * @exception SQLFeatureNotSupportedException if the JDBC driver does not support
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8440
     * this method
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8441
     * @since 1.6
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8442
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8443
    public void updateClob(int columnIndex,  Reader reader) throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8444
        throw new SQLFeatureNotSupportedException(resBundle.handleGetObject("cachedrowsetimpl.featnotsupp").toString());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8445
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8446
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8447
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8448
     * Updates the designated column using the given <code>Reader</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8449
     * object.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8450
     * When a very large UNICODE value is input to a <code>LONGVARCHAR</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8451
     * parameter, it may be more practical to send it via a
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8452
     * <code>java.io.Reader</code> object. The data will be read from the stream
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8453
     * as needed until end-of-file is reached.  The JDBC driver will
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8454
     * do any necessary conversion from UNICODE to the database char format.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8455
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8456
     * <P><B>Note:</B> This stream object can either be a standard
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8457
     * Java stream object or your own subclass that implements the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8458
     * standard interface.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8459
     *  <P><B>Note:</B> Consult your JDBC driver documentation to determine if
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8460
     * it might be more efficient to use a version of
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8461
     * <code>updateClob</code> which takes a length parameter.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8462
     * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8463
     * The updater methods are used to update column values in the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8464
     * current row or the insert row.  The updater methods do not
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8465
     * update the underlying database; instead the <code>updateRow</code> or
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8466
     * <code>insertRow</code> methods are called to update the database.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8467
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8468
     * @param columnLabel the label for the column specified with the SQL AS clause.  If the SQL AS clause was not specified, then the la
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8469
bel is the name of the column
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8470
     * @param reader An object that contains the data to set the parameter value to.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8471
     * @exception SQLException if a database access error occurs,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8472
     * the result set concurrency is <code>CONCUR_READ_ONLY</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8473
     * or this method is called on a closed result set
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8474
     * @exception SQLFeatureNotSupportedException if the JDBC driver does not support
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8475
     * this method
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8476
     * @since 1.6
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8477
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8478
    public void updateClob(String columnLabel,  Reader reader) throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8479
        throw new SQLFeatureNotSupportedException(resBundle.handleGetObject("cachedrowsetimpl.featnotsupp").toString());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8480
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8481
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8482
   /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8483
     * Updates the designated column using the given <code>Reader</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8484
     * object, which is the given number of characters long.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8485
     * When a very large UNICODE value is input to a <code>LONGVARCHAR</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8486
     * parameter, it may be more practical to send it via a
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8487
     * <code>java.io.Reader</code> object. The data will be read from the stream
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8488
     * as needed until end-of-file is reached.  The JDBC driver will
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8489
     * do any necessary conversion from UNICODE to the database char format.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8490
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8491
     * <P><B>Note:</B> This stream object can either be a standard
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8492
     * Java stream object or your own subclass that implements the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8493
     * standard interface.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8494
     * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8495
     * The updater methods are used to update column values in the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8496
     * current row or the insert row.  The updater methods do not
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8497
     * update the underlying database; instead the <code>updateRow</code> or
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8498
     * <code>insertRow</code> methods are called to update the database.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8499
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8500
     * @param columnIndex the first column is 1, the second 2, ...
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8501
     * @param reader An object that contains the data to set the parameter value to.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8502
     * @param length the number of characters in the parameter data.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8503
     * @throws SQLException if the driver does not support national
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8504
     *         character sets;  if the driver can detect that a data conversion
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8505
     *  error could occur; this method is called on a closed result set,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8506
     * if a database access error occurs or
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8507
     * the result set concurrency is <code>CONCUR_READ_ONLY</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8508
     * @exception SQLFeatureNotSupportedException if the JDBC driver does not support
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8509
     * this method
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8510
     * @since 1.6
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8511
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8512
    public void updateNClob(int columnIndex,  Reader reader, long length) throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8513
        throw new SQLFeatureNotSupportedException(resBundle.handleGetObject("cachedrowsetimpl.featnotsupp").toString());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8514
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8515
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8516
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8517
     * Updates the designated column using the given <code>Reader</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8518
     * object, which is the given number of characters long.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8519
     * When a very large UNICODE value is input to a <code>LONGVARCHAR</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8520
     * parameter, it may be more practical to send it via a
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8521
     * <code>java.io.Reader</code> object. The data will be read from the stream
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8522
     * as needed until end-of-file is reached.  The JDBC driver will
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8523
     * do any necessary conversion from UNICODE to the database char format.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8524
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8525
     * <P><B>Note:</B> This stream object can either be a standard
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8526
     * Java stream object or your own subclass that implements the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8527
     * standard interface.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8528
     * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8529
     * The updater methods are used to update column values in the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8530
     * current row or the insert row.  The updater methods do not
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8531
     * update the underlying database; instead the <code>updateRow</code> or
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8532
     * <code>insertRow</code> methods are called to update the database.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8533
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8534
     * @param columnLabel the label for the column specified with the SQL AS clause.  If the SQL AS clause was not specified, then the label is the name of the column
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8535
     * @param reader An object that contains the data to set the parameter value to.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8536
     * @param length the number of characters in the parameter data.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8537
     * @throws SQLException if the driver does not support national
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8538
     *         character sets;  if the driver can detect that a data conversion
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8539
     *  error could occur; this method is called on a closed result set;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8540
     *  if a database access error occurs or
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8541
     * the result set concurrency is <code>CONCUR_READ_ONLY</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8542
     * @exception SQLFeatureNotSupportedException if the JDBC driver does not support
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8543
     * this method
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8544
     * @since 1.6
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8545
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8546
    public void updateNClob(String columnLabel,  Reader reader, long length) throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8547
        throw new SQLFeatureNotSupportedException(resBundle.handleGetObject("cachedrowsetimpl.featnotsupp").toString());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8548
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8549
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8550
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8551
     * Updates the designated column using the given <code>Reader</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8552
     * object.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8553
     * When a very large UNICODE value is input to a <code>LONGVARCHAR</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8554
     * parameter, it may be more practical to send it via a
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8555
     * <code>java.io.Reader</code> object. The data will be read from the stream
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8556
     * as needed until end-of-file is reached.  The JDBC driver will
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8557
     * do any necessary conversion from UNICODE to the database char format.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8558
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8559
     * <P><B>Note:</B> This stream object can either be a standard
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8560
     * Java stream object or your own subclass that implements the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8561
     * standard interface.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8562
     * <P><B>Note:</B> Consult your JDBC driver documentation to determine if
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8563
     * it might be more efficient to use a version of
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8564
     * <code>updateNClob</code> which takes a length parameter.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8565
     * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8566
     * The updater methods are used to update column values in the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8567
     * current row or the insert row.  The updater methods do not
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8568
     * update the underlying database; instead the <code>updateRow</code> or
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8569
     * <code>insertRow</code> methods are called to update the database.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8570
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8571
     * @param columnIndex the first column is 1, the second 2, ...
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8572
     * @param reader An object that contains the data to set the parameter value to.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8573
     * @throws SQLException if the driver does not support national
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8574
     *         character sets;  if the driver can detect that a data conversion
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8575
     *  error could occur; this method is called on a closed result set,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8576
     * if a database access error occurs or
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8577
     * the result set concurrency is <code>CONCUR_READ_ONLY</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8578
     * @exception SQLFeatureNotSupportedException if the JDBC driver does not support
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8579
     * this method
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8580
     * @since 1.6
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8581
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8582
    public void updateNClob(int columnIndex,  Reader reader) throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8583
        throw new SQLFeatureNotSupportedException(resBundle.handleGetObject("cachedrowsetimpl.featnotsupp").toString());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8584
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8585
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8586
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8587
     * Updates the designated column using the given <code>Reader</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8588
     * object.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8589
     * When a very large UNICODE value is input to a <code>LONGVARCHAR</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8590
     * parameter, it may be more practical to send it via a
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8591
     * <code>java.io.Reader</code> object. The data will be read from the stream
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8592
     * as needed until end-of-file is reached.  The JDBC driver will
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8593
     * do any necessary conversion from UNICODE to the database char format.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8594
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8595
     * <P><B>Note:</B> This stream object can either be a standard
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8596
     * Java stream object or your own subclass that implements the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8597
     * standard interface.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8598
     * <P><B>Note:</B> Consult your JDBC driver documentation to determine if
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8599
     * it might be more efficient to use a version of
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8600
     * <code>updateNClob</code> which takes a length parameter.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8601
     * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8602
     * The updater methods are used to update column values in the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8603
     * current row or the insert row.  The updater methods do not
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8604
     * update the underlying database; instead the <code>updateRow</code> or
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8605
     * <code>insertRow</code> methods are called to update the database.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8606
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8607
     * @param columnLabel the label for the column specified with the SQL AS clause.  If the SQL AS clause was not specified, then the la
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8608
bel is the name of the column
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8609
     * @param reader An object that contains the data to set the parameter value to.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8610
     * @throws SQLException if the driver does not support national
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8611
     *         character sets;  if the driver can detect that a data conversion
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8612
     *  error could occur; this method is called on a closed result set;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8613
     *  if a database access error occurs or
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8614
     * the result set concurrency is <code>CONCUR_READ_ONLY</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8615
     * @exception SQLFeatureNotSupportedException if the JDBC driver does not support
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8616
     * this method
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8617
     * @since 1.6
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8618
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8619
    public void updateNClob(String columnLabel,  Reader reader) throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8620
        throw new SQLFeatureNotSupportedException(resBundle.handleGetObject("cachedrowsetimpl.featnotsupp").toString());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8621
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8622
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8623
        /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8624
     * Updates the designated column with an ascii stream value, which will have
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8625
     * the specified number of bytes.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8626
     * The updater methods are used to update column values in the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8627
     * current row or the insert row.  The updater methods do not
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8628
     * update the underlying database; instead the <code>updateRow</code> or
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8629
     * <code>insertRow</code> methods are called to update the database.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8630
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8631
     * @param columnIndex the first column is 1, the second is 2, ...
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8632
     * @param x the new column value
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8633
     * @param length the length of the stream
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8634
     * @exception SQLException if a database access error occurs,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8635
     * the result set concurrency is <code>CONCUR_READ_ONLY</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8636
     * or this method is called on a closed result set
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8637
     * @exception SQLFeatureNotSupportedException if the JDBC driver does not support
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8638
     * this method
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8639
     * @since 1.6
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8640
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8641
    public void updateAsciiStream(int columnIndex,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8642
                           java.io.InputStream x,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8643
                           long length) throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8644
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8645
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8646
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8647
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8648
     * Updates the designated column with a binary stream value, which will have
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8649
     * the specified number of bytes.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8650
     * The updater methods are used to update column values in the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8651
     * current row or the insert row.  The updater methods do not
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8652
     * update the underlying database; instead the <code>updateRow</code> or
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8653
     * <code>insertRow</code> methods are called to update the database.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8654
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8655
     * @param columnIndex the first column is 1, the second is 2, ...
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8656
     * @param x the new column value
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8657
     * @param length the length of the stream
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8658
     * @exception SQLException if a database access error occurs,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8659
     * the result set concurrency is <code>CONCUR_READ_ONLY</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8660
     * or this method is called on a closed result set
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8661
     * @exception SQLFeatureNotSupportedException if the JDBC driver does not support
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8662
     * this method
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8663
     * @since 1.6
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8664
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8665
    public void updateBinaryStream(int columnIndex,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8666
                            java.io.InputStream x,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8667
                            long length) throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8668
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8669
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8670
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8671
     * Updates the designated column with a character stream value, which will have
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8672
     * the specified number of bytes.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8673
     * The updater methods are used to update column values in the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8674
     * current row or the insert row.  The updater methods do not
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8675
     * update the underlying database; instead the <code>updateRow</code> or
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8676
     * <code>insertRow</code> methods are called to update the database.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8677
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8678
     * @param columnIndex the first column is 1, the second is 2, ...
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8679
     * @param x the new column value
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8680
     * @param length the length of the stream
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8681
     * @exception SQLException if a database access error occurs,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8682
     * the result set concurrency is <code>CONCUR_READ_ONLY</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8683
     * or this method is called on a closed result set
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8684
     * @exception SQLFeatureNotSupportedException if the JDBC driver does not support
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8685
     * this method
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8686
     * @since 1.6
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8687
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8688
    public void updateCharacterStream(int columnIndex,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8689
                             java.io.Reader x,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8690
                             long length) throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8691
        throw new SQLFeatureNotSupportedException(resBundle.handleGetObject("cachedrowsetimpl.featnotsupp").toString());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8692
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8693
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8694
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8695
     * Updates the designated column with a character stream value, which will have
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8696
     * the specified number of bytes.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8697
     * The updater methods are used to update column values in the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8698
     * current row or the insert row.  The updater methods do not
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8699
     * update the underlying database; instead the <code>updateRow</code> or
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8700
     * <code>insertRow</code> methods are called to update the database.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8701
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8702
     * @param columnLabel the label for the column specified with the SQL AS clause.  If the SQL AS clause was not specified, then the la
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8703
bel is the name of the column
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8704
     * @param reader the <code>java.io.Reader</code> object containing
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8705
     *        the new column value
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8706
     * @param length the length of the stream
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8707
     * @exception SQLException if a database access error occurs,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8708
     * the result set concurrency is <code>CONCUR_READ_ONLY</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8709
     * or this method is called on a closed result set
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8710
     * @exception SQLFeatureNotSupportedException if the JDBC driver does not support
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8711
     * this method
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8712
     * @since 1.6
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8713
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8714
    public void updateCharacterStream(String columnLabel,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8715
                             java.io.Reader reader,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8716
                             long length) throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8717
        throw new SQLFeatureNotSupportedException(resBundle.handleGetObject("cachedrowsetimpl.featnotsupp").toString());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8718
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8719
     /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8720
     * Updates the designated column with an ascii stream value, which will have
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8721
     * the specified number of bytes..
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8722
     * The updater methods are used to update column values in the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8723
     * current row or the insert row.  The updater methods do not
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8724
     * update the underlying database; instead the <code>updateRow</code> or
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8725
     * <code>insertRow</code> methods are called to update the database.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8726
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8727
     * @param columnLabel the label for the column specified with the SQL AS clause.  If the SQL AS clause was not specified, then the label is the name of the column
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8728
     * @param x the new column value
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8729
     * @param length the length of the stream
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8730
     * @exception SQLException if a database access error occurs,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8731
     * the result set concurrency is <code>CONCUR_READ_ONLY</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8732
     * or this method is called on a closed result set
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8733
     * @exception SQLFeatureNotSupportedException if the JDBC driver does not support
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8734
     * this method
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8735
     * @since 1.6
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8736
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8737
    public void updateAsciiStream(String columnLabel,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8738
                           java.io.InputStream x,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8739
                           long length) throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8740
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8741
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8742
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8743
     * Updates the designated column with a binary stream value, which will have
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8744
     * the specified number of bytes.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8745
     * The updater methods are used to update column values in the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8746
     * current row or the insert row.  The updater methods do not
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8747
     * update the underlying database; instead the <code>updateRow</code> or
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8748
     * <code>insertRow</code> methods are called to update the database.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8749
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8750
     * @param columnLabel the label for the column specified with the SQL AS clause.  If the SQL AS clause was not specified, then the label is the name of the column
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8751
     * @param x the new column value
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8752
     * @param length the length of the stream
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8753
     * @exception SQLException if a database access error occurs,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8754
     * the result set concurrency is <code>CONCUR_READ_ONLY</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8755
     * or this method is called on a closed result set
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8756
     * @exception SQLFeatureNotSupportedException if the JDBC driver does not support
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8757
     * this method
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8758
     * @since 1.6
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8759
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8760
    public void updateBinaryStream(String columnLabel,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8761
                            java.io.InputStream x,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8762
                            long length) throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8763
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8764
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8765
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8766
     * Updates the designated column with a binary stream value.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8767
     * The updater methods are used to update column values in the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8768
     * current row or the insert row.  The updater methods do not
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8769
     * update the underlying database; instead the <code>updateRow</code> or
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8770
     * <code>insertRow</code> methods are called to update the database.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8771
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8772
     * <P><B>Note:</B> Consult your JDBC driver documentation to determine if
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8773
     * it might be more efficient to use a version of
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8774
     * <code>updateBinaryStream</code> which takes a length parameter.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8775
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8776
     * @param columnIndex the first column is 1, the second is 2, ...
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8777
     * @param x the new column value
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8778
     * @exception SQLException if a database access error occurs,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8779
     * the result set concurrency is <code>CONCUR_READ_ONLY</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8780
     * or this method is called on a closed result set
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8781
     * @exception SQLFeatureNotSupportedException if the JDBC driver does not support
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8782
     * this method
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8783
     * @since 1.6
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8784
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8785
    public void updateBinaryStream(int columnIndex,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8786
                            java.io.InputStream x) throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8787
        throw new SQLFeatureNotSupportedException(resBundle.handleGetObject("cachedrowsetimpl.featnotsupp").toString());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8788
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8789
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8790
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8791
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8792
     * Updates the designated column with a binary stream value.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8793
     * The updater methods are used to update column values in the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8794
     * current row or the insert row.  The updater methods do not
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8795
     * update the underlying database; instead the <code>updateRow</code> or
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8796
     * <code>insertRow</code> methods are called to update the database.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8797
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8798
     * <P><B>Note:</B> Consult your JDBC driver documentation to determine if
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8799
     * it might be more efficient to use a version of
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8800
     * <code>updateBinaryStream</code> which takes a length parameter.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8801
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8802
     * @param columnLabel the label for the column specified with the SQL AS clause.  If the SQL AS clause was not specified, then the la
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8803
bel is the name of the column
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8804
     * @param x the new column value
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8805
     * @exception SQLException if a database access error occurs,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8806
     * the result set concurrency is <code>CONCUR_READ_ONLY</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8807
     * or this method is called on a closed result set
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8808
     * @exception SQLFeatureNotSupportedException if the JDBC driver does not support
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8809
     * this method
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8810
     * @since 1.6
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8811
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8812
    public void updateBinaryStream(String columnLabel,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8813
                            java.io.InputStream x) throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8814
        throw new SQLFeatureNotSupportedException(resBundle.handleGetObject("cachedrowsetimpl.featnotsupp").toString());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8815
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8816
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8817
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8818
     * Updates the designated column with a character stream value.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8819
     * The updater methods are used to update column values in the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8820
     * current row or the insert row.  The updater methods do not
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8821
     * update the underlying database; instead the <code>updateRow</code> or
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8822
     * <code>insertRow</code> methods are called to update the database.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8823
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8824
     * <P><B>Note:</B> Consult your JDBC driver documentation to determine if
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8825
     * it might be more efficient to use a version of
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8826
     * <code>updateCharacterStream</code> which takes a length parameter.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8827
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8828
     * @param columnIndex the first column is 1, the second is 2, ...
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8829
     * @param x the new column value
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8830
     * @exception SQLException if a database access error occurs,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8831
     * the result set concurrency is <code>CONCUR_READ_ONLY</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8832
     * or this method is called on a closed result set
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8833
     * @exception SQLFeatureNotSupportedException if the JDBC driver does not support
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8834
     * this method
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8835
     * @since 1.6
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8836
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8837
    public void updateCharacterStream(int columnIndex,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8838
                             java.io.Reader x) throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8839
        throw new SQLFeatureNotSupportedException(resBundle.handleGetObject("cachedrowsetimpl.featnotsupp").toString());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8840
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8841
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8842
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8843
     * Updates the designated column with a character stream value.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8844
     * The updater methods are used to update column values in the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8845
     * current row or the insert row.  The updater methods do not
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8846
     * update the underlying database; instead the <code>updateRow</code> or
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8847
     * <code>insertRow</code> methods are called to update the database.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8848
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8849
     * <P><B>Note:</B> Consult your JDBC driver documentation to determine if
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8850
     * it might be more efficient to use a version of
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8851
     * <code>updateCharacterStream</code> which takes a length parameter.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8852
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8853
     * @param columnLabel the label for the column specified with the SQL AS clause.  If the SQL AS clause was not specified, then the la
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8854
bel is the name of the column
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8855
     * @param reader the <code>java.io.Reader</code> object containing
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8856
     *        the new column value
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8857
     * @exception SQLException if a database access error occurs,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8858
     * the result set concurrency is <code>CONCUR_READ_ONLY</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8859
     * or this method is called on a closed result set
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8860
     * @exception SQLFeatureNotSupportedException if the JDBC driver does not support
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8861
     * this method
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8862
     * @since 1.6
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8863
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8864
    public void updateCharacterStream(String columnLabel,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8865
                             java.io.Reader reader) throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8866
        throw new SQLFeatureNotSupportedException(resBundle.handleGetObject("cachedrowsetimpl.featnotsupp").toString());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8867
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8868
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8869
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8870
     * Updates the designated column with an ascii stream value.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8871
     * The updater methods are used to update column values in the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8872
     * current row or the insert row.  The updater methods do not
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8873
     * update the underlying database; instead the <code>updateRow</code> or
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8874
     * <code>insertRow</code> methods are called to update the database.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8875
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8876
     * <P><B>Note:</B> Consult your JDBC driver documentation to determine if
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8877
     * it might be more efficient to use a version of
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8878
     * <code>updateAsciiStream</code> which takes a length parameter.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8879
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8880
     * @param columnIndex the first column is 1, the second is 2, ...
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8881
     * @param x the new column value
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8882
     * @exception SQLException if a database access error occurs,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8883
     * the result set concurrency is <code>CONCUR_READ_ONLY</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8884
     * or this method is called on a closed result set
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8885
     * @exception SQLFeatureNotSupportedException if the JDBC driver does not support
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8886
     * this method
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8887
     * @since 1.6
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8888
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8889
    public void updateAsciiStream(int columnIndex,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8890
                           java.io.InputStream x) throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8891
        throw new SQLFeatureNotSupportedException(resBundle.handleGetObject("cachedrowsetimpl.featnotsupp").toString());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8892
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8893
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8894
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8895
     * Updates the designated column with an ascii stream value.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8896
     * The updater methods are used to update column values in the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8897
     * current row or the insert row.  The updater methods do not
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8898
     * update the underlying database; instead the <code>updateRow</code> or
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8899
     * <code>insertRow</code> methods are called to update the database.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8900
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8901
     * <P><B>Note:</B> Consult your JDBC driver documentation to determine if
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8902
     * it might be more efficient to use a version of
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8903
     * <code>updateAsciiStream</code> which takes a length parameter.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8904
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8905
     * @param columnLabel the label for the column specified with the SQL AS clause.  If the SQL AS clause was not specified, then the la
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8906
bel is the name of the column
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8907
     * @param x the new column value
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8908
     * @exception SQLException if a database access error occurs,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8909
     * the result set concurrency is <code>CONCUR_READ_ONLY</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8910
     * or this method is called on a closed result set
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8911
     * @exception SQLFeatureNotSupportedException if the JDBC driver does not support
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8912
     * this method
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8913
     * @since 1.6
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8914
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8915
    public void updateAsciiStream(String columnLabel,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8916
                           java.io.InputStream x) throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8917
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8918
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8919
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8920
   /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8921
  * Sets the designated parameter to the given <code>java.net.URL</code> value.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8922
  * The driver converts this to an SQL <code>DATALINK</code> value
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8923
  * when it sends it to the database.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8924
  *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8925
  * @param parameterIndex the first parameter is 1, the second is 2, ...
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8926
  * @param x the <code>java.net.URL</code> object to be set
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8927
  * @exception SQLException if a database access error occurs or
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8928
  * this method is called on a closed <code>PreparedStatement</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8929
  * @throws SQLFeatureNotSupportedException  if the JDBC driver does not support this method
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8930
  * @since 1.4
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8931
  */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8932
  public void setURL(int parameterIndex, java.net.URL x) throws SQLException{
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8933
        throw new SQLFeatureNotSupportedException(resBundle.handleGetObject("cachedrowsetimpl.featnotsupp").toString());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8934
   }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8935
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8936
  /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8937
  * Sets the designated parameter to a <code>Reader</code> object.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8938
  * This method differs from the <code>setCharacterStream (int, Reader)</code> method
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8939
  * because it informs the driver that the parameter value should be sent to
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8940
  * the server as a <code>NCLOB</code>.  When the <code>setCharacterStream</code> method is used, the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8941
  * driver may have to do extra work to determine whether the parameter
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8942
  * data should be sent to the server as a <code>LONGNVARCHAR</code> or a <code>NCLOB</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8943
  * <P><B>Note:</B> Consult your JDBC driver documentation to determine if
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8944
  * it might be more efficient to use a version of
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8945
  * <code>setNClob</code> which takes a length parameter.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8946
  *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8947
  * @param parameterIndex index of the first parameter is 1, the second is 2, ...
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8948
  * @param reader An object that contains the data to set the parameter value to.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8949
  * @throws SQLException if parameterIndex does not correspond to a parameter
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8950
  * marker in the SQL statement;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8951
  * if the driver does not support national character sets;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8952
  * if the driver can detect that a data conversion
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8953
  *  error could occur;  if a database access error occurs or
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8954
  * this method is called on a closed <code>PreparedStatement</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8955
  * @throws SQLFeatureNotSupportedException  if the JDBC driver does not support this method
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8956
  *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8957
  * @since 1.6
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8958
  */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8959
  public void setNClob(int parameterIndex, Reader reader)
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8960
    throws SQLException{
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8961
        throw new SQLFeatureNotSupportedException(resBundle.handleGetObject("cachedrowsetimpl.featnotsupp").toString());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8962
   }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8963
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8964
  /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8965
  * Sets the designated parameter to a <code>Reader</code> object.  The <code>reader</code> must contain  the number
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8966
             * of characters specified by length otherwise a <code>SQLException</code> will be
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8967
            * generated when the <code>CallableStatement</code> is executed.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8968
            * This method differs from the <code>setCharacterStream (int, Reader, int)</code> method
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8969
            * because it informs the driver that the parameter value should be sent to
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8970
            * the server as a <code>NCLOB</code>.  When the <code>setCharacterStream</code> method is used, the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8971
            * driver may have to do extra work to determine whether the parameter
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8972
            * data should be send to the server as a <code>LONGNVARCHAR</code> or a <code>NCLOB</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8973
            *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8974
            * @param parameterName the name of the parameter to be set
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8975
            * @param reader An object that contains the data to set the parameter value to.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8976
            * @param length the number of characters in the parameter data.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8977
            * @throws SQLException if parameterIndex does not correspond to a parameter
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8978
            * marker in the SQL statement; if the length specified is less than zero;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8979
            * if the driver does not support national
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8980
            *         character sets;  if the driver can detect that a data conversion
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8981
            *  error could occur; if a database access error occurs or
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8982
            * this method is called on a closed <code>CallableStatement</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8983
            * @exception SQLFeatureNotSupportedException if the JDBC driver does not support
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8984
            * this method
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8985
            * @since 1.6
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8986
            */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8987
            public void setNClob(String parameterName, Reader reader, long length)
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8988
    throws SQLException{
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8989
        throw new SQLFeatureNotSupportedException(resBundle.handleGetObject("cachedrowsetimpl.featnotsupp").toString());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8990
   }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8991
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8992
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8993
 /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8994
  * Sets the designated parameter to a <code>Reader</code> object.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8995
  * This method differs from the <code>setCharacterStream (int, Reader)</code> method
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8996
  * because it informs the driver that the parameter value should be sent to
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8997
  * the server as a <code>NCLOB</code>.  When the <code>setCharacterStream</code> method is used, the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8998
  * driver may have to do extra work to determine whether the parameter
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8999
  * data should be send to the server as a <code>LONGNVARCHAR</code> or a <code>NCLOB</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9000
  * <P><B>Note:</B> Consult your JDBC driver documentation to determine if
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9001
  * it might be more efficient to use a version of
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9002
  * <code>setNClob</code> which takes a length parameter.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9003
  *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9004
  * @param parameterName the name of the parameter
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9005
  * @param reader An object that contains the data to set the parameter value to.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9006
  * @throws SQLException if the driver does not support national character sets;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9007
  * if the driver can detect that a data conversion
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9008
  *  error could occur;  if a database access error occurs or
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9009
  * this method is called on a closed <code>CallableStatement</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9010
  * @throws SQLFeatureNotSupportedException  if the JDBC driver does not support this method
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9011
  *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9012
  * @since 1.6
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9013
  */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9014
  public void setNClob(String parameterName, Reader reader)
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9015
    throws SQLException{
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9016
        throw new SQLFeatureNotSupportedException(resBundle.handleGetObject("cachedrowsetimpl.featnotsupp").toString());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9017
   }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9018
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9019
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9020
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9021
     * Sets the designated parameter to a <code>Reader</code> object.  The reader must contain  the number
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9022
     * of characters specified by length otherwise a <code>SQLException</code> will be
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9023
     * generated when the <code>PreparedStatement</code> is executed.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9024
     * This method differs from the <code>setCharacterStream (int, Reader, int)</code> method
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9025
     * because it informs the driver that the parameter value should be sent to
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9026
     * the server as a <code>NCLOB</code>.  When the <code>setCharacterStream</code> method is used, the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9027
     * driver may have to do extra work to determine whether the parameter
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9028
     * data should be sent to the server as a <code>LONGNVARCHAR</code> or a <code>NCLOB</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9029
     * @param parameterIndex index of the first parameter is 1, the second is 2, ...
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9030
     * @param reader An object that contains the data to set the parameter value to.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9031
     * @param length the number of characters in the parameter data.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9032
     * @throws SQLException if parameterIndex does not correspond to a parameter
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9033
     * marker in the SQL statement; if the length specified is less than zero;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9034
     * if the driver does not support national character sets;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9035
     * if the driver can detect that a data conversion
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9036
     *  error could occur;  if a database access error occurs or
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9037
     * this method is called on a closed <code>PreparedStatement</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9038
     * @throws SQLFeatureNotSupportedException  if the JDBC driver does not support this method
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9039
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9040
     * @since 1.6
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9041
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9042
     public void setNClob(int parameterIndex, Reader reader, long length)
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9043
       throws SQLException{
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9044
        throw new SQLFeatureNotSupportedException(resBundle.handleGetObject("cachedrowsetimpl.featnotsupp").toString());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9045
   }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9046
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9047
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9048
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9049
     * Sets the designated parameter to a <code>java.sql.NClob</code> object. The driver converts this to
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9050
a
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9051
     * SQL <code>NCLOB</code> value when it sends it to the database.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9052
     * @param parameterIndex of the first parameter is 1, the second is 2, ...
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9053
     * @param value the parameter value
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9054
     * @throws SQLException if the driver does not support national
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9055
     *         character sets;  if the driver can detect that a data conversion
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9056
     *  error could occur ; or if a database access error occurs
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9057
     * @since 1.6
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9058
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9059
     public void setNClob(int parameterIndex, NClob value) throws SQLException{
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9060
        throw new SQLFeatureNotSupportedException(resBundle.handleGetObject("cachedrowsetimpl.featnotsupp").toString());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9061
   }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9062
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9063
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9064
   /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9065
  * Sets the designated paramter to the given <code>String</code> object.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9066
  * The driver converts this to a SQL <code>NCHAR</code> or
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9067
  * <code>NVARCHAR</code> or <code>LONGNVARCHAR</code> value
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9068
  * (depending on the argument's
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9069
  * size relative to the driver's limits on <code>NVARCHAR</code> values)
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9070
  * when it sends it to the database.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9071
  *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9072
  * @param parameterIndex of the first parameter is 1, the second is 2, ...
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9073
  * @param value the parameter value
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9074
  * @throws SQLException if the driver does not support national
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9075
  *         character sets;  if the driver can detect that a data conversion
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9076
  *  error could occur ; or if a database access error occurs
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9077
  * @since 1.6
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9078
  */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9079
  public void setNString(int parameterIndex, String value) throws SQLException{
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9080
        throw new SQLFeatureNotSupportedException(resBundle.handleGetObject("cachedrowsetimpl.featnotsupp").toString());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9081
   }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9082
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9083
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9084
 /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9085
  * Sets the designated paramter to the given <code>String</code> object.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9086
  * The driver converts this to a SQL <code>NCHAR</code> or
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9087
  * <code>NVARCHAR</code> or <code>LONGNVARCHAR</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9088
  * @param parameterName the name of the column to be set
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9089
  * @param value the parameter value
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9090
  * @throws SQLException if the driver does not support national
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9091
  *         character sets;  if the driver can detect that a data conversion
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9092
  *  error could occur; or if a database access error occurs
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9093
  * @since 1.6
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9094
  */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9095
 public void setNString(String parameterName, String value)
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9096
         throws SQLException{
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9097
        throw new SQLFeatureNotSupportedException(resBundle.handleGetObject("cachedrowsetimpl.featnotsupp").toString());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9098
   }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9099
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9100
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9101
 /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9102
  * Sets the designated parameter to a <code>Reader</code> object. The
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9103
  * <code>Reader</code> reads the data till end-of-file is reached. The
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9104
  * driver does the necessary conversion from Java character format to
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9105
  * the national character set in the database.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9106
  * @param parameterIndex of the first parameter is 1, the second is 2, ...
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9107
  * @param value the parameter value
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9108
  * @param length the number of characters in the parameter data.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9109
  * @throws SQLException if the driver does not support national
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9110
  *         character sets;  if the driver can detect that a data conversion
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9111
  *  error could occur ; or if a database access error occurs
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9112
  * @since 1.6
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9113
  */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9114
  public void setNCharacterStream(int parameterIndex, Reader value, long length) throws SQLException{
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9115
        throw new SQLFeatureNotSupportedException(resBundle.handleGetObject("cachedrowsetimpl.featnotsupp").toString());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9116
   }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9117
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9118
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9119
 /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9120
  * Sets the designated parameter to a <code>Reader</code> object. The
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9121
  * <code>Reader</code> reads the data till end-of-file is reached. The
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9122
  * driver does the necessary conversion from Java character format to
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9123
  * the national character set in the database.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9124
  * @param parameterName the name of the column to be set
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9125
  * @param value the parameter value
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9126
  * @param length the number of characters in the parameter data.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9127
  * @throws SQLException if the driver does not support national
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9128
  *         character sets;  if the driver can detect that a data conversion
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9129
  *  error could occur; or if a database access error occurs
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9130
  * @since 1.6
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9131
  */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9132
 public void setNCharacterStream(String parameterName, Reader value, long length)
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9133
         throws SQLException{
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9134
        throw new SQLFeatureNotSupportedException(resBundle.handleGetObject("cachedrowsetimpl.featnotsupp").toString());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9135
   }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9136
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9137
  /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9138
  * Sets the designated parameter to a <code>Reader</code> object. The
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9139
  * <code>Reader</code> reads the data till end-of-file is reached. The
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9140
  * driver does the necessary conversion from Java character format to
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9141
  * the national character set in the database.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9142
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9143
  * <P><B>Note:</B> This stream object can either be a standard
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9144
  * Java stream object or your own subclass that implements the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9145
  * standard interface.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9146
  * <P><B>Note:</B> Consult your JDBC driver documentation to determine if
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9147
  * it might be more efficient to use a version of
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9148
  * <code>setNCharacterStream</code> which takes a length parameter.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9149
  *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9150
  * @param parameterName the name of the parameter
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9151
  * @param value the parameter value
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9152
  * @throws SQLException if the driver does not support national
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9153
  *         character sets;  if the driver can detect that a data conversion
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9154
  *  error could occur ; if a database access error occurs; or
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9155
  * this method is called on a closed <code>CallableStatement</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9156
  * @throws SQLFeatureNotSupportedException  if the JDBC driver does not support this method
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9157
  * @since 1.6
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9158
  */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9159
  public void setNCharacterStream(String parameterName, Reader value) throws SQLException{
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9160
        throw new SQLFeatureNotSupportedException(resBundle.handleGetObject("cachedrowsetimpl.featnotsupp").toString());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9161
   }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9162
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9163
  /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9164
    * Sets the designated parameter to the given <code>java.sql.Timestamp</code> value,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9165
    * using the given <code>Calendar</code> object.  The driver uses
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9166
    * the <code>Calendar</code> object to construct an SQL <code>TIMESTAMP</code> value,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9167
    * which the driver then sends to the database.  With a
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9168
    * a <code>Calendar</code> object, the driver can calculate the timestamp
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9169
    * taking into account a custom timezone.  If no
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9170
    * <code>Calendar</code> object is specified, the driver uses the default
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9171
    * timezone, which is that of the virtual machine running the application.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9172
    *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9173
    * @param parameterName the name of the parameter
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9174
    * @param x the parameter value
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9175
    * @param cal the <code>Calendar</code> object the driver will use
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9176
    *            to construct the timestamp
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9177
    * @exception SQLException if a database access error occurs or
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9178
    * this method is called on a closed <code>CallableStatement</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9179
    * @exception SQLFeatureNotSupportedException if the JDBC driver does not support
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9180
    * this method
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9181
    * @see #getTimestamp
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9182
    * @since 1.4
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9183
    */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9184
    public void setTimestamp(String parameterName, java.sql.Timestamp x, Calendar cal)
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9185
       throws SQLException{
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9186
        throw new SQLFeatureNotSupportedException(resBundle.handleGetObject("cachedrowsetimpl.featnotsupp").toString());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9187
   }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9188
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9189
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9190
    * Sets the designated parameter to a <code>Reader</code> object.  The <code>reader</code> must contain  the number
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9191
               * of characters specified by length otherwise a <code>SQLException</code> will be
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9192
               * generated when the <code>CallableStatement</code> is executed.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9193
              * This method differs from the <code>setCharacterStream (int, Reader, int)</code> method
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9194
              * because it informs the driver that the parameter value should be sent to
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9195
              * the server as a <code>CLOB</code>.  When the <code>setCharacterStream</code> method is used, the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9196
              * driver may have to do extra work to determine whether the parameter
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9197
              * data should be send to the server as a <code>LONGVARCHAR</code> or a <code>CLOB</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9198
              * @param parameterName the name of the parameter to be set
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9199
              * @param reader An object that contains the data to set the parameter value to.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9200
              * @param length the number of characters in the parameter data.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9201
              * @throws SQLException if parameterIndex does not correspond to a parameter
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9202
              * marker in the SQL statement; if the length specified is less than zero;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9203
              * a database access error occurs or
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9204
              * this method is called on a closed <code>CallableStatement</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9205
              * @exception SQLFeatureNotSupportedException if the JDBC driver does not support
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9206
              * this method
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9207
              *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9208
              * @since 1.6
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9209
              */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9210
      public  void setClob(String parameterName, Reader reader, long length)
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9211
      throws SQLException{
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9212
        throw new SQLFeatureNotSupportedException(resBundle.handleGetObject("cachedrowsetimpl.featnotsupp").toString());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9213
   }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9214
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9215
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9216
  /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9217
    * Sets the designated parameter to the given <code>java.sql.Clob</code> object.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9218
    * The driver converts this to an SQL <code>CLOB</code> value when it
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9219
    * sends it to the database.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9220
    *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9221
    * @param parameterName the name of the parameter
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9222
    * @param x a <code>Clob</code> object that maps an SQL <code>CLOB</code> value
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9223
    * @exception SQLException if a database access error occurs or
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9224
    * this method is called on a closed <code>CallableStatement</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9225
    * @exception SQLFeatureNotSupportedException if the JDBC driver does not support
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9226
    * this method
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9227
    * @since 1.6
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9228
    */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9229
    public void setClob (String parameterName, Clob x) throws SQLException{
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9230
        throw new SQLFeatureNotSupportedException(resBundle.handleGetObject("cachedrowsetimpl.featnotsupp").toString());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9231
   }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9232
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9233
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9234
 /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9235
    * Sets the designated parameter to a <code>Reader</code> object.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9236
    * This method differs from the <code>setCharacterStream (int, Reader)</code> method
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9237
    * because it informs the driver that the parameter value should be sent to
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9238
    * the server as a <code>CLOB</code>.  When the <code>setCharacterStream</code> method is used, the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9239
    * driver may have to do extra work to determine whether the parameter
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9240
    * data should be send to the server as a <code>LONGVARCHAR</code> or a <code>CLOB</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9241
    *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9242
    * <P><B>Note:</B> Consult your JDBC driver documentation to determine if
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9243
    * it might be more efficient to use a version of
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9244
    * <code>setClob</code> which takes a length parameter.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9245
    *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9246
    * @param parameterName the name of the parameter
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9247
    * @param reader An object that contains the data to set the parameter value to.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9248
    * @throws SQLException if a database access error occurs or this method is called on
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9249
    * a closed <code>CallableStatement</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9250
    *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9251
    * @throws SQLFeatureNotSupportedException  if the JDBC driver does not support this method
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9252
    * @since 1.6
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9253
    */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9254
    public void setClob(String parameterName, Reader reader)
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9255
      throws SQLException{
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9256
        throw new SQLFeatureNotSupportedException(resBundle.handleGetObject("cachedrowsetimpl.featnotsupp").toString());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9257
   }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9258
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9259
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9260
 /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9261
    * Sets the designated parameter to the given <code>java.sql.Date</code> value
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9262
    * using the default time zone of the virtual machine that is running
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9263
    * the application.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9264
    * The driver converts this
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9265
    * to an SQL <code>DATE</code> value when it sends it to the database.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9266
    *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9267
    * @param parameterName the name of the parameter
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9268
    * @param x the parameter value
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9269
    * @exception SQLException if a database access error occurs or
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9270
    * this method is called on a closed <code>CallableStatement</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9271
    * @exception SQLFeatureNotSupportedException if the JDBC driver does not support
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9272
    * this method
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9273
    * @see #getDate
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9274
    * @since 1.4
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9275
    */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9276
    public void setDate(String parameterName, java.sql.Date x)
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9277
       throws SQLException{
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9278
        throw new SQLFeatureNotSupportedException(resBundle.handleGetObject("cachedrowsetimpl.featnotsupp").toString());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9279
   }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9280
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9281
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9282
 /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9283
    * Sets the designated parameter to the given <code>java.sql.Date</code> value,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9284
    * using the given <code>Calendar</code> object.  The driver uses
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9285
    * the <code>Calendar</code> object to construct an SQL <code>DATE</code> value,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9286
    * which the driver then sends to the database.  With a
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9287
    * a <code>Calendar</code> object, the driver can calculate the date
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9288
    * taking into account a custom timezone.  If no
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9289
    * <code>Calendar</code> object is specified, the driver uses the default
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9290
    * timezone, which is that of the virtual machine running the application.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9291
    *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9292
    * @param parameterName the name of the parameter
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9293
    * @param x the parameter value
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9294
    * @param cal the <code>Calendar</code> object the driver will use
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9295
    *            to construct the date
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9296
    * @exception SQLException if a database access error occurs or
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9297
    * this method is called on a closed <code>CallableStatement</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9298
    * @exception SQLFeatureNotSupportedException if the JDBC driver does not support
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9299
    * this method
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9300
    * @see #getDate
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9301
    * @since 1.4
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9302
    */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9303
   public void setDate(String parameterName, java.sql.Date x, Calendar cal)
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9304
       throws SQLException{
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9305
        throw new SQLFeatureNotSupportedException(resBundle.handleGetObject("cachedrowsetimpl.featnotsupp").toString());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9306
   }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9307
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9308
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9309
 /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9310
    * Sets the designated parameter to the given <code>java.sql.Time</code> value.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9311
    * The driver converts this
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9312
    * to an SQL <code>TIME</code> value when it sends it to the database.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9313
    *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9314
    * @param parameterName the name of the parameter
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9315
    * @param x the parameter value
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9316
    * @exception SQLException if a database access error occurs or
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9317
    * this method is called on a closed <code>CallableStatement</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9318
    * @exception SQLFeatureNotSupportedException if the JDBC driver does not support
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9319
    * this method
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9320
    * @see #getTime
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9321
    * @since 1.4
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9322
    */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9323
   public void setTime(String parameterName, java.sql.Time x)
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9324
       throws SQLException{
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9325
        throw new SQLFeatureNotSupportedException(resBundle.handleGetObject("cachedrowsetimpl.featnotsupp").toString());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9326
   }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9327
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9328
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9329
 /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9330
    * Sets the designated parameter to the given <code>java.sql.Time</code> value,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9331
    * using the given <code>Calendar</code> object.  The driver uses
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9332
    * the <code>Calendar</code> object to construct an SQL <code>TIME</code> value,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9333
    * which the driver then sends to the database.  With a
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9334
    * a <code>Calendar</code> object, the driver can calculate the time
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9335
    * taking into account a custom timezone.  If no
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9336
    * <code>Calendar</code> object is specified, the driver uses the default
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9337
    * timezone, which is that of the virtual machine running the application.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9338
    *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9339
    * @param parameterName the name of the parameter
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9340
    * @param x the parameter value
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9341
    * @param cal the <code>Calendar</code> object the driver will use
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9342
    *            to construct the time
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9343
    * @exception SQLException if a database access error occurs or
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9344
    * this method is called on a closed <code>CallableStatement</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9345
    * @exception SQLFeatureNotSupportedException if the JDBC driver does not support
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9346
    * this method
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9347
    * @see #getTime
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9348
    * @since 1.4
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9349
    */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9350
   public void setTime(String parameterName, java.sql.Time x, Calendar cal)
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9351
       throws SQLException{
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9352
        throw new SQLFeatureNotSupportedException(resBundle.handleGetObject("cachedrowsetimpl.featnotsupp").toString());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9353
   }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9354
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9355
   /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9356
   * Sets the designated parameter to a <code>Reader</code> object.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9357
   * This method differs from the <code>setCharacterStream (int, Reader)</code> method
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9358
   * because it informs the driver that the parameter value should be sent to
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9359
   * the server as a <code>CLOB</code>.  When the <code>setCharacterStream</code> method is used, the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9360
   * driver may have to do extra work to determine whether the parameter
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9361
   * data should be sent to the server as a <code>LONGVARCHAR</code> or a <code>CLOB</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9362
   *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9363
   * <P><B>Note:</B> Consult your JDBC driver documentation to determine if
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9364
   * it might be more efficient to use a version of
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9365
   * <code>setClob</code> which takes a length parameter.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9366
   *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9367
   * @param parameterIndex index of the first parameter is 1, the second is 2, ...
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9368
   * @param reader An object that contains the data to set the parameter value to.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9369
   * @throws SQLException if a database access error occurs, this method is called on
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9370
   * a closed <code>PreparedStatement</code>or if parameterIndex does not correspond to a parameter
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9371
   * marker in the SQL statement
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9372
   *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9373
   * @throws SQLFeatureNotSupportedException  if the JDBC driver does not support this method
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9374
   * @since 1.6
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9375
   */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9376
   public void setClob(int parameterIndex, Reader reader)
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9377
     throws SQLException{
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9378
        throw new SQLFeatureNotSupportedException(resBundle.handleGetObject("cachedrowsetimpl.featnotsupp").toString());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9379
   }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9380
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9381
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9382
   * Sets the designated parameter to a <code>Reader</code> object.  The reader must contain  the number
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9383
   * of characters specified by length otherwise a <code>SQLException</code> will be
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9384
   * generated when the <code>PreparedStatement</code> is executed.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9385
   *This method differs from the <code>setCharacterStream (int, Reader, int)</code> method
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9386
   * because it informs the driver that the parameter value should be sent to
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9387
   * the server as a <code>CLOB</code>.  When the <code>setCharacterStream</code> method is used, the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9388
   * driver may have to do extra work to determine whether the parameter
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9389
   * data should be sent to the server as a <code>LONGVARCHAR</code> or a <code>CLOB</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9390
   * @param parameterIndex index of the first parameter is 1, the second is 2, ...
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9391
   * @param reader An object that contains the data to set the parameter value to.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9392
   * @param length the number of characters in the parameter data.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9393
   * @throws SQLException if a database access error occurs, this method is called on
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9394
   * a closed <code>PreparedStatement</code>, if parameterIndex does not correspond to a parameter
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9395
   * marker in the SQL statement, or if the length specified is less than zero.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9396
   *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9397
   * @throws SQLFeatureNotSupportedException  if the JDBC driver does not support this method
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9398
   * @since 1.6
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9399
   */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9400
   public void setClob(int parameterIndex, Reader reader, long length)
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9401
     throws SQLException{
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9402
        throw new SQLFeatureNotSupportedException(resBundle.handleGetObject("cachedrowsetimpl.featnotsupp").toString());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9403
   }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9404
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9405
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9406
 /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9407
    * Sets the designated parameter to a <code>InputStream</code> object.  The inputstream must contain  the number
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9408
    * of characters specified by length otherwise a <code>SQLException</code> will be
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9409
    * generated when the <code>PreparedStatement</code> is executed.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9410
    * This method differs from the <code>setBinaryStream (int, InputStream, int)</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9411
    * method because it informs the driver that the parameter value should be
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9412
    * sent to the server as a <code>BLOB</code>.  When the <code>setBinaryStream</code> method is used,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9413
    * the driver may have to do extra work to determine whether the parameter
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9414
    * data should be sent to the server as a <code>LONGVARBINARY</code> or a <code>BLOB</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9415
    * @param parameterIndex index of the first parameter is 1,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9416
    * the second is 2, ...
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9417
    * @param inputStream An object that contains the data to set the parameter
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9418
    * value to.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9419
    * @param length the number of bytes in the parameter data.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9420
    * @throws SQLException if a database access error occurs,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9421
    * this method is called on a closed <code>PreparedStatement</code>,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9422
    * if parameterIndex does not correspond
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9423
    * to a parameter marker in the SQL statement,  if the length specified
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9424
    * is less than zero or if the number of bytes in the inputstream does not match
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9425
    * the specfied length.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9426
    * @throws SQLFeatureNotSupportedException  if the JDBC driver does not support this method
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9427
    *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9428
    * @since 1.6
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9429
    */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9430
    public void setBlob(int parameterIndex, InputStream inputStream, long length)
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9431
       throws SQLException{
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9432
        throw new SQLFeatureNotSupportedException(resBundle.handleGetObject("cachedrowsetimpl.featnotsupp").toString());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9433
   }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9434
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9435
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9436
 /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9437
    * Sets the designated parameter to a <code>InputStream</code> object.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9438
    * This method differs from the <code>setBinaryStream (int, InputStream)</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9439
    * method because it informs the driver that the parameter value should be
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9440
    * sent to the server as a <code>BLOB</code>.  When the <code>setBinaryStream</code> method is used,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9441
    * the driver may have to do extra work to determine whether the parameter
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9442
    * data should be sent to the server as a <code>LONGVARBINARY</code> or a <code>BLOB</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9443
    *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9444
    * <P><B>Note:</B> Consult your JDBC driver documentation to determine if
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9445
    * it might be more efficient to use a version of
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9446
    * <code>setBlob</code> which takes a length parameter.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9447
    *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9448
    * @param parameterIndex index of the first parameter is 1,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9449
    * the second is 2, ...
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9450
    * @param inputStream An object that contains the data to set the parameter
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9451
    * value to.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9452
    * @throws SQLException if a database access error occurs,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9453
    * this method is called on a closed <code>PreparedStatement</code> or
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9454
    * if parameterIndex does not correspond
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9455
    * to a parameter marker in the SQL statement,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9456
    * @throws SQLFeatureNotSupportedException  if the JDBC driver does not support this method
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9457
    *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9458
    * @since 1.6
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9459
    */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9460
    public void setBlob(int parameterIndex, InputStream inputStream)
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9461
       throws SQLException{
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9462
        throw new SQLFeatureNotSupportedException(resBundle.handleGetObject("cachedrowsetimpl.featnotsupp").toString());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9463
   }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9464
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9465
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9466
 /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9467
    * Sets the designated parameter to a <code>InputStream</code> object.  The <code>inputstream</code> must contain  the number
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9468
     * of characters specified by length, otherwise a <code>SQLException</code> will be
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9469
     * generated when the <code>CallableStatement</code> is executed.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9470
     * This method differs from the <code>setBinaryStream (int, InputStream, int)</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9471
     * method because it informs the driver that the parameter value should be
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9472
     * sent to the server as a <code>BLOB</code>.  When the <code>setBinaryStream</code> method is used,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9473
     * the driver may have to do extra work to determine whether the parameter
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9474
     * data should be sent to the server as a <code>LONGVARBINARY</code> or a <code>BLOB</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9475
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9476
     * @param parameterName the name of the parameter to be set
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9477
     * the second is 2, ...
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9478
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9479
     * @param inputStream An object that contains the data to set the parameter
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9480
     * value to.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9481
     * @param length the number of bytes in the parameter data.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9482
     * @throws SQLException  if parameterIndex does not correspond
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9483
     * to a parameter marker in the SQL statement,  or if the length specified
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9484
     * is less than zero; if the number of bytes in the inputstream does not match
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9485
     * the specfied length; if a database access error occurs or
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9486
     * this method is called on a closed <code>CallableStatement</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9487
     * @exception SQLFeatureNotSupportedException if the JDBC driver does not support
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9488
     * this method
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9489
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9490
     * @since 1.6
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9491
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9492
     public void setBlob(String parameterName, InputStream inputStream, long length)
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9493
        throws SQLException{
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9494
        throw new SQLFeatureNotSupportedException(resBundle.handleGetObject("cachedrowsetimpl.featnotsupp").toString());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9495
   }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9496
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9497
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9498
 /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9499
    * Sets the designated parameter to the given <code>java.sql.Blob</code> object.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9500
    * The driver converts this to an SQL <code>BLOB</code> value when it
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9501
    * sends it to the database.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9502
    *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9503
    * @param parameterName the name of the parameter
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9504
    * @param x a <code>Blob</code> object that maps an SQL <code>BLOB</code> value
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9505
    * @exception SQLException if a database access error occurs or
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9506
    * this method is called on a closed <code>CallableStatement</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9507
    * @exception SQLFeatureNotSupportedException if the JDBC driver does not support
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9508
    * this method
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9509
    * @since 1.6
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9510
    */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9511
   public void setBlob (String parameterName, Blob x) throws SQLException{
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9512
        throw new SQLFeatureNotSupportedException(resBundle.handleGetObject("cachedrowsetimpl.featnotsupp").toString());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9513
   }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9514
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9515
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9516
 /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9517
    * Sets the designated parameter to a <code>InputStream</code> object.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9518
    * This method differs from the <code>setBinaryStream (int, InputStream)</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9519
    * method because it informs the driver that the parameter value should be
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9520
    * sent to the server as a <code>BLOB</code>.  When the <code>setBinaryStream</code> method is used,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9521
    * the driver may have to do extra work to determine whether the parameter
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9522
    * data should be send to the server as a <code>LONGVARBINARY</code> or a <code>BLOB</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9523
    *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9524
    * <P><B>Note:</B> Consult your JDBC driver documentation to determine if
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9525
    * it might be more efficient to use a version of
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9526
    * <code>setBlob</code> which takes a length parameter.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9527
    *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9528
    * @param parameterName the name of the parameter
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9529
    * @param inputStream An object that contains the data to set the parameter
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9530
    * value to.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9531
    * @throws SQLException if a database access error occurs or
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9532
    * this method is called on a closed <code>CallableStatement</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9533
    * @throws SQLFeatureNotSupportedException  if the JDBC driver does not support this method
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9534
    *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9535
    * @since 1.6
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9536
    */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9537
    public void setBlob(String parameterName, InputStream inputStream)
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9538
       throws SQLException{
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9539
        throw new SQLFeatureNotSupportedException(resBundle.handleGetObject("cachedrowsetimpl.featnotsupp").toString());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9540
   }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9541
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9542
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9543
    * Sets the value of the designated parameter with the given object. The second
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9544
    * argument must be an object type; for integral values, the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9545
    * <code>java.lang</code> equivalent objects should be used.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9546
    *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9547
    * <p>The given Java object will be converted to the given targetSqlType
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9548
    * before being sent to the database.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9549
    *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9550
    * If the object has a custom mapping (is of a class implementing the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9551
    * interface <code>SQLData</code>),
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9552
    * the JDBC driver should call the method <code>SQLData.writeSQL</code> to write it
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9553
    * to the SQL data stream.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9554
    * If, on the other hand, the object is of a class implementing
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9555
    * <code>Ref</code>, <code>Blob</code>, <code>Clob</code>,  <code>NClob</code>,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9556
    *  <code>Struct</code>, <code>java.net.URL</code>,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9557
    * or <code>Array</code>, the driver should pass it to the database as a
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9558
    * value of the corresponding SQL type.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9559
    * <P>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9560
    * Note that this method may be used to pass datatabase-
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9561
    * specific abstract data types.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9562
    *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9563
    * @param parameterName the name of the parameter
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9564
    * @param x the object containing the input parameter value
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9565
    * @param targetSqlType the SQL type (as defined in java.sql.Types) to be
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9566
    * sent to the database. The scale argument may further qualify this type.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9567
    * @param scale for java.sql.Types.DECIMAL or java.sql.Types.NUMERIC types,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9568
    *          this is the number of digits after the decimal point.  For all other
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9569
    *          types, this value will be ignored.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9570
    * @exception SQLException if a database access error occurs or
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9571
    * this method is called on a closed <code>CallableStatement</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9572
    * @exception SQLFeatureNotSupportedException if <code>targetSqlType</code> is
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9573
    * a <code>ARRAY</code>, <code>BLOB</code>, <code>CLOB</code>,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9574
    * <code>DATALINK</code>, <code>JAVA_OBJECT</code>, <code>NCHAR</code>,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9575
    * <code>NCLOB</code>, <code>NVARCHAR</code>, <code>LONGNVARCHAR</code>,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9576
    *  <code>REF</code>, <code>ROWID</code>, <code>SQLXML</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9577
    * or  <code>STRUCT</code> data type and the JDBC driver does not support
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9578
    * this data type
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9579
    * @see Types
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9580
    * @see #getObject
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9581
    * @since 1.4
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9582
    */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9583
    public void setObject(String parameterName, Object x, int targetSqlType, int scale)
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9584
       throws SQLException{
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9585
        throw new SQLFeatureNotSupportedException(resBundle.handleGetObject("cachedrowsetimpl.featnotsupp").toString());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9586
   }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9587
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9588
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9589
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9590
 /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9591
    * Sets the value of the designated parameter with the given object.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9592
    * This method is like the method <code>setObject</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9593
    * above, except that it assumes a scale of zero.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9594
    *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9595
    * @param parameterName the name of the parameter
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9596
    * @param x the object containing the input parameter value
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9597
    * @param targetSqlType the SQL type (as defined in java.sql.Types) to be
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9598
    *                      sent to the database
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9599
    * @exception SQLException if a database access error occurs or
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9600
    * this method is called on a closed <code>CallableStatement</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9601
    * @exception SQLFeatureNotSupportedException if <code>targetSqlType</code> is
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9602
    * a <code>ARRAY</code>, <code>BLOB</code>, <code>CLOB</code>,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9603
    * <code>DATALINK</code>, <code>JAVA_OBJECT</code>, <code>NCHAR</code>,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9604
    * <code>NCLOB</code>, <code>NVARCHAR</code>, <code>LONGNVARCHAR</code>,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9605
    *  <code>REF</code>, <code>ROWID</code>, <code>SQLXML</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9606
    * or  <code>STRUCT</code> data type and the JDBC driver does not support
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9607
    * this data type
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9608
    * @see #getObject
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9609
    * @since 1.4
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9610
    */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9611
    public void setObject(String parameterName, Object x, int targetSqlType)
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9612
       throws SQLException{
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9613
        throw new SQLFeatureNotSupportedException(resBundle.handleGetObject("cachedrowsetimpl.featnotsupp").toString());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9614
   }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9615
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9616
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9617
 /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9618
   * Sets the value of the designated parameter with the given object.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9619
   * The second parameter must be of type <code>Object</code>; therefore, the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9620
   * <code>java.lang</code> equivalent objects should be used for built-in types.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9621
   *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9622
   * <p>The JDBC specification specifies a standard mapping from
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9623
   * Java <code>Object</code> types to SQL types.  The given argument
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9624
   * will be converted to the corresponding SQL type before being
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9625
   * sent to the database.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9626
   *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9627
   * <p>Note that this method may be used to pass datatabase-
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9628
   * specific abstract data types, by using a driver-specific Java
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9629
   * type.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9630
   *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9631
   * If the object is of a class implementing the interface <code>SQLData</code>,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9632
   * the JDBC driver should call the method <code>SQLData.writeSQL</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9633
   * to write it to the SQL data stream.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9634
   * If, on the other hand, the object is of a class implementing
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9635
   * <code>Ref</code>, <code>Blob</code>, <code>Clob</code>,  <code>NClob</code>,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9636
   *  <code>Struct</code>, <code>java.net.URL</code>,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9637
   * or <code>Array</code>, the driver should pass it to the database as a
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9638
   * value of the corresponding SQL type.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9639
   * <P>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9640
   * This method throws an exception if there is an ambiguity, for example, if the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9641
   * object is of a class implementing more than one of the interfaces named above.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9642
   *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9643
   * @param parameterName the name of the parameter
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9644
   * @param x the object containing the input parameter value
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9645
   * @exception SQLException if a database access error occurs,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9646
   * this method is called on a closed <code>CallableStatement</code> or if the given
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9647
   *            <code>Object</code> parameter is ambiguous
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9648
   * @exception SQLFeatureNotSupportedException if the JDBC driver does not support
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9649
   * this method
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9650
   * @see #getObject
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9651
   * @since 1.4
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9652
   */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9653
   public void setObject(String parameterName, Object x) throws SQLException{
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9654
        throw new SQLFeatureNotSupportedException(resBundle.handleGetObject("cachedrowsetimpl.featnotsupp").toString());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9655
   }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9656
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9657
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9658
    * Sets the designated parameter to the given input stream, which will have
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9659
    * the specified number of bytes.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9660
    * When a very large ASCII value is input to a <code>LONGVARCHAR</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9661
    * parameter, it may be more practical to send it via a
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9662
    * <code>java.io.InputStream</code>. Data will be read from the stream
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9663
    * as needed until end-of-file is reached.  The JDBC driver will
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9664
    * do any necessary conversion from ASCII to the database char format.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9665
    *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9666
    * <P><B>Note:</B> This stream object can either be a standard
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9667
    * Java stream object or your own subclass that implements the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9668
    * standard interface.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9669
    *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9670
    * @param parameterName the name of the parameter
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9671
    * @param x the Java input stream that contains the ASCII parameter value
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9672
    * @param length the number of bytes in the stream
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9673
    * @exception SQLException if a database access error occurs or
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9674
    * this method is called on a closed <code>CallableStatement</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9675
    * @exception SQLFeatureNotSupportedException if the JDBC driver does not support
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9676
    * this method
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9677
    * @since 1.4
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9678
    */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9679
   public void setAsciiStream(String parameterName, java.io.InputStream x, int length)
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9680
       throws SQLException{
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9681
        throw new SQLFeatureNotSupportedException(resBundle.handleGetObject("cachedrowsetimpl.featnotsupp").toString());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9682
   }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9683
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9684
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9685
 /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9686
    * Sets the designated parameter to the given input stream, which will have
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9687
    * the specified number of bytes.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9688
    * When a very large binary value is input to a <code>LONGVARBINARY</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9689
    * parameter, it may be more practical to send it via a
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9690
    * <code>java.io.InputStream</code> object. The data will be read from the stream
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9691
    * as needed until end-of-file is reached.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9692
    *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9693
    * <P><B>Note:</B> This stream object can either be a standard
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9694
    * Java stream object or your own subclass that implements the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9695
    * standard interface.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9696
    *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9697
    * @param parameterName the name of the parameter
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9698
    * @param x the java input stream which contains the binary parameter value
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9699
    * @param length the number of bytes in the stream
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9700
    * @exception SQLException if a database access error occurs or
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9701
    * this method is called on a closed <code>CallableStatement</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9702
    * @exception SQLFeatureNotSupportedException if the JDBC driver does not support
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9703
    * this method
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9704
    * @since 1.4
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9705
    */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9706
   public void setBinaryStream(String parameterName, java.io.InputStream x,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9707
                        int length) throws SQLException{
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9708
        throw new SQLFeatureNotSupportedException(resBundle.handleGetObject("cachedrowsetimpl.featnotsupp").toString());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9709
   }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9710
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9711
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9712
  /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9713
    * Sets the designated parameter to the given <code>Reader</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9714
    * object, which is the given number of characters long.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9715
    * When a very large UNICODE value is input to a <code>LONGVARCHAR</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9716
    * parameter, it may be more practical to send it via a
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9717
    * <code>java.io.Reader</code> object. The data will be read from the stream
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9718
    * as needed until end-of-file is reached.  The JDBC driver will
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9719
    * do any necessary conversion from UNICODE to the database char format.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9720
    *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9721
    * <P><B>Note:</B> This stream object can either be a standard
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9722
    * Java stream object or your own subclass that implements the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9723
    * standard interface.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9724
    *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9725
    * @param parameterName the name of the parameter
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9726
    * @param reader the <code>java.io.Reader</code> object that
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9727
    *        contains the UNICODE data used as the designated parameter
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9728
    * @param length the number of characters in the stream
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9729
    * @exception SQLException if a database access error occurs or
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9730
    * this method is called on a closed <code>CallableStatement</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9731
    * @exception SQLFeatureNotSupportedException if the JDBC driver does not support
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9732
    * this method
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9733
    * @since 1.4
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9734
    */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9735
   public void setCharacterStream(String parameterName,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9736
                           java.io.Reader reader,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9737
                           int length) throws SQLException{
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9738
        throw new SQLFeatureNotSupportedException(resBundle.handleGetObject("cachedrowsetimpl.featnotsupp").toString());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9739
   }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9740
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9741
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9742
  /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9743
   * Sets the designated parameter to the given input stream.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9744
   * When a very large ASCII value is input to a <code>LONGVARCHAR</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9745
   * parameter, it may be more practical to send it via a
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9746
   * <code>java.io.InputStream</code>. Data will be read from the stream
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9747
   * as needed until end-of-file is reached.  The JDBC driver will
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9748
   * do any necessary conversion from ASCII to the database char format.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9749
   *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9750
   * <P><B>Note:</B> This stream object can either be a standard
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9751
   * Java stream object or your own subclass that implements the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9752
   * standard interface.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9753
   * <P><B>Note:</B> Consult your JDBC driver documentation to determine if
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9754
   * it might be more efficient to use a version of
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9755
   * <code>setAsciiStream</code> which takes a length parameter.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9756
   *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9757
   * @param parameterName the name of the parameter
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9758
   * @param x the Java input stream that contains the ASCII parameter value
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9759
   * @exception SQLException if a database access error occurs or
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9760
   * this method is called on a closed <code>CallableStatement</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9761
   * @throws SQLFeatureNotSupportedException  if the JDBC driver does not support this method
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9762
     * @since 1.6
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9763
  */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9764
  public void setAsciiStream(String parameterName, java.io.InputStream x)
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9765
          throws SQLException{
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9766
        throw new SQLFeatureNotSupportedException(resBundle.handleGetObject("cachedrowsetimpl.featnotsupp").toString());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9767
   }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9768
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9769
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9770
 /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9771
    * Sets the designated parameter to the given input stream.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9772
    * When a very large binary value is input to a <code>LONGVARBINARY</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9773
    * parameter, it may be more practical to send it via a
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9774
    * <code>java.io.InputStream</code> object. The data will be read from the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9775
    * stream as needed until end-of-file is reached.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9776
    *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9777
    * <P><B>Note:</B> This stream object can either be a standard
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9778
    * Java stream object or your own subclass that implements the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9779
    * standard interface.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9780
    * <P><B>Note:</B> Consult your JDBC driver documentation to determine if
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9781
    * it might be more efficient to use a version of
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9782
    * <code>setBinaryStream</code> which takes a length parameter.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9783
    *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9784
    * @param parameterName the name of the parameter
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9785
    * @param x the java input stream which contains the binary parameter value
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9786
    * @exception SQLException if a database access error occurs or
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9787
    * this method is called on a closed <code>CallableStatement</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9788
    * @throws SQLFeatureNotSupportedException  if the JDBC driver does not support this method
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9789
    * @since 1.6
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9790
    */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9791
   public void setBinaryStream(String parameterName, java.io.InputStream x)
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9792
   throws SQLException{
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9793
        throw new SQLFeatureNotSupportedException(resBundle.handleGetObject("cachedrowsetimpl.featnotsupp").toString());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9794
   }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9795
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9796
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9797
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9798
 /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9799
    * Sets the designated parameter to the given <code>Reader</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9800
    * object.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9801
    * When a very large UNICODE value is input to a <code>LONGVARCHAR</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9802
    * parameter, it may be more practical to send it via a
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9803
    * <code>java.io.Reader</code> object. The data will be read from the stream
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9804
    * as needed until end-of-file is reached.  The JDBC driver will
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9805
    * do any necessary conversion from UNICODE to the database char format.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9806
    *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9807
    * <P><B>Note:</B> This stream object can either be a standard
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9808
    * Java stream object or your own subclass that implements the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9809
    * standard interface.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9810
    * <P><B>Note:</B> Consult your JDBC driver documentation to determine if
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9811
    * it might be more efficient to use a version of
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9812
    * <code>setCharacterStream</code> which takes a length parameter.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9813
    *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9814
    * @param parameterName the name of the parameter
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9815
    * @param reader the <code>java.io.Reader</code> object that contains the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9816
    *        Unicode data
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9817
    * @exception SQLException if a database access error occurs or
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9818
    * this method is called on a closed <code>CallableStatement</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9819
    * @throws SQLFeatureNotSupportedException  if the JDBC driver does not support this method
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9820
    * @since 1.6
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9821
    */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9822
   public void setCharacterStream(String parameterName,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9823
                         java.io.Reader reader) throws SQLException{
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9824
        throw new SQLFeatureNotSupportedException(resBundle.handleGetObject("cachedrowsetimpl.featnotsupp").toString());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9825
   }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9826
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9827
   /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9828
    * Sets the designated parameter to the given
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9829
    * <code>java.math.BigDecimal</code> value.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9830
    * The driver converts this to an SQL <code>NUMERIC</code> value when
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9831
    * it sends it to the database.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9832
    *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9833
    * @param parameterName the name of the parameter
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9834
    * @param x the parameter value
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9835
    * @exception SQLException if a database access error occurs or
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9836
    * this method is called on a closed <code>CallableStatement</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9837
    * @exception SQLFeatureNotSupportedException if the JDBC driver does not support
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9838
    * this method
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9839
    * @see #getBigDecimal
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9840
    * @since 1.4
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9841
    */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9842
   public void setBigDecimal(String parameterName, BigDecimal x) throws SQLException{
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9843
        throw new SQLFeatureNotSupportedException(resBundle.handleGetObject("cachedrowsetimpl.featnotsupp").toString());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9844
   }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9845
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9846
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9847
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9848
 /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9849
    * Sets the designated parameter to the given Java <code>String</code> value.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9850
    * The driver converts this
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9851
    * to an SQL <code>VARCHAR</code> or <code>LONGVARCHAR</code> value
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9852
    * (depending on the argument's
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9853
    * size relative to the driver's limits on <code>VARCHAR</code> values)
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9854
    * when it sends it to the database.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9855
    *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9856
    * @param parameterName the name of the parameter
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9857
    * @param x the parameter value
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9858
    * @exception SQLException if a database access error occurs or
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9859
    * this method is called on a closed <code>CallableStatement</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9860
    * @exception SQLFeatureNotSupportedException if the JDBC driver does not support
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9861
    * this method
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9862
    * @see #getString
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9863
    * @since 1.4
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9864
    */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9865
   public void setString(String parameterName, String x) throws SQLException{
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9866
        throw new SQLFeatureNotSupportedException(resBundle.handleGetObject("cachedrowsetimpl.featnotsupp").toString());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9867
   }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9868
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9869
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9870
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9871
 /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9872
    * Sets the designated parameter to the given Java array of bytes.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9873
    * The driver converts this to an SQL <code>VARBINARY</code> or
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9874
    * <code>LONGVARBINARY</code> (depending on the argument's size relative
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9875
    * to the driver's limits on <code>VARBINARY</code> values) when it sends
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9876
    * it to the database.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9877
    *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9878
    * @param parameterName the name of the parameter
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9879
    * @param x the parameter value
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9880
    * @exception SQLException if a database access error occurs or
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9881
    * this method is called on a closed <code>CallableStatement</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9882
    * @exception SQLFeatureNotSupportedException if the JDBC driver does not support
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9883
    * this method
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9884
    * @see #getBytes
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9885
    * @since 1.4
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9886
    */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9887
   public void setBytes(String parameterName, byte x[]) throws SQLException{
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9888
        throw new SQLFeatureNotSupportedException(resBundle.handleGetObject("cachedrowsetimpl.featnotsupp").toString());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9889
   }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9890
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9891
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9892
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9893
 /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9894
    * Sets the designated parameter to the given <code>java.sql.Timestamp</code> value.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9895
    * The driver
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9896
    * converts this to an SQL <code>TIMESTAMP</code> value when it sends it to the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9897
    * database.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9898
    *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9899
    * @param parameterName the name of the parameter
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9900
    * @param x the parameter value
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9901
    * @exception SQLException if a database access error occurs or
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9902
    * this method is called on a closed <code>CallableStatement</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9903
    * @exception SQLFeatureNotSupportedException if the JDBC driver does not support
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9904
    * this method
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9905
    * @see #getTimestamp
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9906
    * @since 1.4
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9907
    */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9908
   public void setTimestamp(String parameterName, java.sql.Timestamp x)
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9909
       throws SQLException{
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9910
        throw new SQLFeatureNotSupportedException(resBundle.handleGetObject("cachedrowsetimpl.featnotsupp").toString());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9911
   }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9912
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9913
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9914
    * Sets the designated parameter to SQL <code>NULL</code>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9915
    *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9916
    * <P><B>Note:</B> You must specify the parameter's SQL type.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9917
    *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9918
    * @param parameterName the name of the parameter
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9919
    * @param sqlType the SQL type code defined in <code>java.sql.Types</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9920
    * @exception SQLException if a database access error occurs or
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9921
    * this method is called on a closed <code>CallableStatement</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9922
    * @exception SQLFeatureNotSupportedException if the JDBC driver does not support
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9923
    * this method
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9924
    * @since 1.4
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9925
    */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9926
   public void setNull(String parameterName, int sqlType) throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9927
        throw new SQLFeatureNotSupportedException(resBundle.handleGetObject("cachedrowsetimpl.featnotsupp").toString());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9928
   }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9929
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9930
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9931
 /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9932
    * Sets the designated parameter to SQL <code>NULL</code>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9933
    * This version of the method <code>setNull</code> should
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9934
    * be used for user-defined types and REF type parameters.  Examples
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9935
    * of user-defined types include: STRUCT, DISTINCT, JAVA_OBJECT, and
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9936
    * named array types.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9937
    *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9938
    * <P><B>Note:</B> To be portable, applications must give the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9939
    * SQL type code and the fully-qualified SQL type name when specifying
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9940
    * a NULL user-defined or REF parameter.  In the case of a user-defined type
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9941
    * the name is the type name of the parameter itself.  For a REF
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9942
    * parameter, the name is the type name of the referenced type.  If
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9943
    * a JDBC driver does not need the type code or type name information,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9944
    * it may ignore it.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9945
    *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9946
    * Although it is intended for user-defined and Ref parameters,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9947
    * this method may be used to set a null parameter of any JDBC type.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9948
    * If the parameter does not have a user-defined or REF type, the given
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9949
    * typeName is ignored.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9950
    *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9951
    *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9952
    * @param parameterName the name of the parameter
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9953
    * @param sqlType a value from <code>java.sql.Types</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9954
    * @param typeName the fully-qualified name of an SQL user-defined type;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9955
    *        ignored if the parameter is not a user-defined type or
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9956
    *        SQL <code>REF</code> value
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9957
    * @exception SQLException if a database access error occurs or
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9958
    * this method is called on a closed <code>CallableStatement</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9959
    * @exception SQLFeatureNotSupportedException if the JDBC driver does not support
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9960
    * this method
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9961
    * @since 1.4
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9962
    */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9963
   public void setNull (String parameterName, int sqlType, String typeName)
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9964
       throws SQLException{
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9965
        throw new SQLFeatureNotSupportedException(resBundle.handleGetObject("cachedrowsetimpl.featnotsupp").toString());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9966
   }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9967
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9968
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9969
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9970
 /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9971
    * Sets the designated parameter to the given Java <code>boolean</code> value.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9972
    * The driver converts this
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9973
    * to an SQL <code>BIT</code> or <code>BOOLEAN</code> value when it sends it to the database.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9974
    *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9975
    * @param parameterName the name of the parameter
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9976
    * @param x the parameter value
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9977
    * @exception SQLException if a database access error occurs or
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9978
    * this method is called on a closed <code>CallableStatement</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9979
    * @see #getBoolean
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9980
    * @exception SQLFeatureNotSupportedException if the JDBC driver does not support
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9981
    * this method
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9982
    * @since 1.4
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9983
    */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9984
   public void setBoolean(String parameterName, boolean x) throws SQLException{
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9985
        throw new SQLFeatureNotSupportedException(resBundle.handleGetObject("cachedrowsetimpl.featnotsupp").toString());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9986
   }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9987
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9988
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9989
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9990
 /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9991
    * Sets the designated parameter to the given Java <code>byte</code> value.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9992
    * The driver converts this
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9993
    * to an SQL <code>TINYINT</code> value when it sends it to the database.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9994
    *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9995
    * @param parameterName the name of the parameter
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9996
    * @param x the parameter value
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9997
    * @exception SQLException if a database access error occurs or
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9998
    * this method is called on a closed <code>CallableStatement</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9999
    * @exception SQLFeatureNotSupportedException if the JDBC driver does not support
90ce3da70b43 Initial load
duke
parents:
diff changeset
 10000
    * this method
90ce3da70b43 Initial load
duke
parents:
diff changeset
 10001
    * @see #getByte
90ce3da70b43 Initial load
duke
parents:
diff changeset
 10002
    * @since 1.4
90ce3da70b43 Initial load
duke
parents:
diff changeset
 10003
    */
90ce3da70b43 Initial load
duke
parents:
diff changeset
 10004
   public void setByte(String parameterName, byte x) throws SQLException{
90ce3da70b43 Initial load
duke
parents:
diff changeset
 10005
        throw new SQLFeatureNotSupportedException(resBundle.handleGetObject("cachedrowsetimpl.featnotsupp").toString());
90ce3da70b43 Initial load
duke
parents:
diff changeset
 10006
   }
90ce3da70b43 Initial load
duke
parents:
diff changeset
 10007
90ce3da70b43 Initial load
duke
parents:
diff changeset
 10008
90ce3da70b43 Initial load
duke
parents:
diff changeset
 10009
90ce3da70b43 Initial load
duke
parents:
diff changeset
 10010
 /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
 10011
    * Sets the designated parameter to the given Java <code>short</code> value.
90ce3da70b43 Initial load
duke
parents:
diff changeset
 10012
    * The driver converts this
90ce3da70b43 Initial load
duke
parents:
diff changeset
 10013
    * to an SQL <code>SMALLINT</code> value when it sends it to the database.
90ce3da70b43 Initial load
duke
parents:
diff changeset
 10014
    *
90ce3da70b43 Initial load
duke
parents:
diff changeset
 10015
    * @param parameterName the name of the parameter
90ce3da70b43 Initial load
duke
parents:
diff changeset
 10016
    * @param x the parameter value
90ce3da70b43 Initial load
duke
parents:
diff changeset
 10017
    * @exception SQLException if a database access error occurs or
90ce3da70b43 Initial load
duke
parents:
diff changeset
 10018
    * this method is called on a closed <code>CallableStatement</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
 10019
    * @exception SQLFeatureNotSupportedException if the JDBC driver does not support
90ce3da70b43 Initial load
duke
parents:
diff changeset
 10020
    * this method
90ce3da70b43 Initial load
duke
parents:
diff changeset
 10021
    * @see #getShort
90ce3da70b43 Initial load
duke
parents:
diff changeset
 10022
    * @since 1.4
90ce3da70b43 Initial load
duke
parents:
diff changeset
 10023
    */
90ce3da70b43 Initial load
duke
parents:
diff changeset
 10024
   public void setShort(String parameterName, short x) throws SQLException{
90ce3da70b43 Initial load
duke
parents:
diff changeset
 10025
        throw new SQLFeatureNotSupportedException(resBundle.handleGetObject("cachedrowsetimpl.featnotsupp").toString());
90ce3da70b43 Initial load
duke
parents:
diff changeset
 10026
   }
90ce3da70b43 Initial load
duke
parents:
diff changeset
 10027
90ce3da70b43 Initial load
duke
parents:
diff changeset
 10028
90ce3da70b43 Initial load
duke
parents:
diff changeset
 10029
 /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
 10030
    * Sets the designated parameter to the given Java <code>int</code> value.
90ce3da70b43 Initial load
duke
parents:
diff changeset
 10031
    * The driver converts this
90ce3da70b43 Initial load
duke
parents:
diff changeset
 10032
    * to an SQL <code>INTEGER</code> value when it sends it to the database.
90ce3da70b43 Initial load
duke
parents:
diff changeset
 10033
    *
90ce3da70b43 Initial load
duke
parents:
diff changeset
 10034
    * @param parameterName the name of the parameter
90ce3da70b43 Initial load
duke
parents:
diff changeset
 10035
    * @param x the parameter value
90ce3da70b43 Initial load
duke
parents:
diff changeset
 10036
    * @exception SQLException if a database access error occurs or
90ce3da70b43 Initial load
duke
parents:
diff changeset
 10037
    * this method is called on a closed <code>CallableStatement</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
 10038
    * @exception SQLFeatureNotSupportedException if the JDBC driver does not support
90ce3da70b43 Initial load
duke
parents:
diff changeset
 10039
    * this method
90ce3da70b43 Initial load
duke
parents:
diff changeset
 10040
    * @see #getInt
90ce3da70b43 Initial load
duke
parents:
diff changeset
 10041
    * @since 1.4
90ce3da70b43 Initial load
duke
parents:
diff changeset
 10042
    */
90ce3da70b43 Initial load
duke
parents:
diff changeset
 10043
   public void setInt(String parameterName, int x) throws SQLException{
90ce3da70b43 Initial load
duke
parents:
diff changeset
 10044
        throw new SQLFeatureNotSupportedException(resBundle.handleGetObject("cachedrowsetimpl.featnotsupp").toString());
90ce3da70b43 Initial load
duke
parents:
diff changeset
 10045
   }
90ce3da70b43 Initial load
duke
parents:
diff changeset
 10046
90ce3da70b43 Initial load
duke
parents:
diff changeset
 10047
90ce3da70b43 Initial load
duke
parents:
diff changeset
 10048
 /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
 10049
    * Sets the designated parameter to the given Java <code>long</code> value.
90ce3da70b43 Initial load
duke
parents:
diff changeset
 10050
    * The driver converts this
90ce3da70b43 Initial load
duke
parents:
diff changeset
 10051
    * to an SQL <code>BIGINT</code> value when it sends it to the database.
90ce3da70b43 Initial load
duke
parents:
diff changeset
 10052
    *
90ce3da70b43 Initial load
duke
parents:
diff changeset
 10053
    * @param parameterName the name of the parameter
90ce3da70b43 Initial load
duke
parents:
diff changeset
 10054
    * @param x the parameter value
90ce3da70b43 Initial load
duke
parents:
diff changeset
 10055
    * @exception SQLException if a database access error occurs or
90ce3da70b43 Initial load
duke
parents:
diff changeset
 10056
    * this method is called on a closed <code>CallableStatement</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
 10057
    * @exception SQLFeatureNotSupportedException if the JDBC driver does not support
90ce3da70b43 Initial load
duke
parents:
diff changeset
 10058
    * this method
90ce3da70b43 Initial load
duke
parents:
diff changeset
 10059
    * @see #getLong
90ce3da70b43 Initial load
duke
parents:
diff changeset
 10060
    * @since 1.4
90ce3da70b43 Initial load
duke
parents:
diff changeset
 10061
    */
90ce3da70b43 Initial load
duke
parents:
diff changeset
 10062
   public void setLong(String parameterName, long x) throws SQLException{
90ce3da70b43 Initial load
duke
parents:
diff changeset
 10063
        throw new SQLFeatureNotSupportedException(resBundle.handleGetObject("cachedrowsetimpl.featnotsupp").toString());
90ce3da70b43 Initial load
duke
parents:
diff changeset
 10064
   }
90ce3da70b43 Initial load
duke
parents:
diff changeset
 10065
90ce3da70b43 Initial load
duke
parents:
diff changeset
 10066
90ce3da70b43 Initial load
duke
parents:
diff changeset
 10067
 /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
 10068
    * Sets the designated parameter to the given Java <code>float</code> value.
90ce3da70b43 Initial load
duke
parents:
diff changeset
 10069
    * The driver converts this
90ce3da70b43 Initial load
duke
parents:
diff changeset
 10070
    * to an SQL <code>FLOAT</code> value when it sends it to the database.
90ce3da70b43 Initial load
duke
parents:
diff changeset
 10071
    *
90ce3da70b43 Initial load
duke
parents:
diff changeset
 10072
    * @param parameterName the name of the parameter
90ce3da70b43 Initial load
duke
parents:
diff changeset
 10073
    * @param x the parameter value
90ce3da70b43 Initial load
duke
parents:
diff changeset
 10074
    * @exception SQLException if a database access error occurs or
90ce3da70b43 Initial load
duke
parents:
diff changeset
 10075
    * this method is called on a closed <code>CallableStatement</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
 10076
    * @exception SQLFeatureNotSupportedException if the JDBC driver does not support
90ce3da70b43 Initial load
duke
parents:
diff changeset
 10077
    * this method
90ce3da70b43 Initial load
duke
parents:
diff changeset
 10078
    * @see #getFloat
90ce3da70b43 Initial load
duke
parents:
diff changeset
 10079
    * @since 1.4
90ce3da70b43 Initial load
duke
parents:
diff changeset
 10080
    */
90ce3da70b43 Initial load
duke
parents:
diff changeset
 10081
   public void setFloat(String parameterName, float x) throws SQLException{
90ce3da70b43 Initial load
duke
parents:
diff changeset
 10082
        throw new SQLFeatureNotSupportedException(resBundle.handleGetObject("cachedrowsetimpl.featnotsupp").toString());
90ce3da70b43 Initial load
duke
parents:
diff changeset
 10083
   }
90ce3da70b43 Initial load
duke
parents:
diff changeset
 10084
90ce3da70b43 Initial load
duke
parents:
diff changeset
 10085
90ce3da70b43 Initial load
duke
parents:
diff changeset
 10086
 /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
 10087
    * Sets the designated parameter to the given Java <code>double</code> value.
90ce3da70b43 Initial load
duke
parents:
diff changeset
 10088
    * The driver converts this
90ce3da70b43 Initial load
duke
parents:
diff changeset
 10089
    * to an SQL <code>DOUBLE</code> value when it sends it to the database.
90ce3da70b43 Initial load
duke
parents:
diff changeset
 10090
    *
90ce3da70b43 Initial load
duke
parents:
diff changeset
 10091
    * @param parameterName the name of the parameter
90ce3da70b43 Initial load
duke
parents:
diff changeset
 10092
    * @param x the parameter value
90ce3da70b43 Initial load
duke
parents:
diff changeset
 10093
    * @exception SQLException if a database access error occurs or
90ce3da70b43 Initial load
duke
parents:
diff changeset
 10094
    * this method is called on a closed <code>CallableStatement</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
 10095
    * @exception SQLFeatureNotSupportedException if the JDBC driver does not support
90ce3da70b43 Initial load
duke
parents:
diff changeset
 10096
    * this method
90ce3da70b43 Initial load
duke
parents:
diff changeset
 10097
    * @see #getDouble
90ce3da70b43 Initial load
duke
parents:
diff changeset
 10098
    * @since 1.4
90ce3da70b43 Initial load
duke
parents:
diff changeset
 10099
    */
90ce3da70b43 Initial load
duke
parents:
diff changeset
 10100
   public void setDouble(String parameterName, double x) throws SQLException{
90ce3da70b43 Initial load
duke
parents:
diff changeset
 10101
        throw new SQLFeatureNotSupportedException(resBundle.handleGetObject("cachedrowsetimpl.featnotsupp").toString());
90ce3da70b43 Initial load
duke
parents:
diff changeset
 10102
   }
90ce3da70b43 Initial load
duke
parents:
diff changeset
 10103
90ce3da70b43 Initial load
duke
parents:
diff changeset
 10104
   /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
 10105
     * This method re populates the resBundle
90ce3da70b43 Initial load
duke
parents:
diff changeset
 10106
     * during the deserialization process
90ce3da70b43 Initial load
duke
parents:
diff changeset
 10107
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
 10108
     */
6530
bfb7b294dd14 6680198: UnmarshalException caused by incompatible serialVersionUID
lancea
parents: 5506
diff changeset
 10109
    private void readObject(ObjectInputStream ois) throws IOException, ClassNotFoundException {
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
 10110
        // Default state initialization happens here
90ce3da70b43 Initial load
duke
parents:
diff changeset
 10111
        ois.defaultReadObject();
90ce3da70b43 Initial load
duke
parents:
diff changeset
 10112
        // Initialization of transient Res Bundle happens here .
90ce3da70b43 Initial load
duke
parents:
diff changeset
 10113
        try {
90ce3da70b43 Initial load
duke
parents:
diff changeset
 10114
           resBundle = JdbcRowSetResourceBundle.getJdbcRowSetResourceBundle();
90ce3da70b43 Initial load
duke
parents:
diff changeset
 10115
        } catch(IOException ioe) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
 10116
            throw new RuntimeException(ioe);
90ce3da70b43 Initial load
duke
parents:
diff changeset
 10117
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
 10118
90ce3da70b43 Initial load
duke
parents:
diff changeset
 10119
    }
6530
bfb7b294dd14 6680198: UnmarshalException caused by incompatible serialVersionUID
lancea
parents: 5506
diff changeset
 10120
6540
a4ae668f6125 6589685: JDBC 4.1 updates
lancea
parents: 6530
diff changeset
 10121
    //------------------------- JDBC 4.1 -----------------------------------
a4ae668f6125 6589685: JDBC 4.1 updates
lancea
parents: 6530
diff changeset
 10122
    public <T> T getObject(int columnIndex, Class<T> type) throws SQLException {
a4ae668f6125 6589685: JDBC 4.1 updates
lancea
parents: 6530
diff changeset
 10123
        throw new SQLFeatureNotSupportedException("Not supported yet.");
a4ae668f6125 6589685: JDBC 4.1 updates
lancea
parents: 6530
diff changeset
 10124
    }
a4ae668f6125 6589685: JDBC 4.1 updates
lancea
parents: 6530
diff changeset
 10125
a4ae668f6125 6589685: JDBC 4.1 updates
lancea
parents: 6530
diff changeset
 10126
    public <T> T getObject(String columnLabel, Class<T> type) throws SQLException {
a4ae668f6125 6589685: JDBC 4.1 updates
lancea
parents: 6530
diff changeset
 10127
        throw new SQLFeatureNotSupportedException("Not supported yet.");
a4ae668f6125 6589685: JDBC 4.1 updates
lancea
parents: 6530
diff changeset
 10128
    }
a4ae668f6125 6589685: JDBC 4.1 updates
lancea
parents: 6530
diff changeset
 10129
6530
bfb7b294dd14 6680198: UnmarshalException caused by incompatible serialVersionUID
lancea
parents: 5506
diff changeset
 10130
    static final long serialVersionUID =1884577171200622428L;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
 10131
}