jdk/src/share/classes/com/sun/rowset/CachedRowSetImpl.java
author mfang
Tue, 18 Jun 2013 21:08:48 -0700
changeset 18282 61693b1882bf
parent 14179 4681260d262a
child 21278 ef8a3a2a72f2
permissions -rw-r--r--
8015657: jdk8 l10n resource file translation update 3 Reviewed-by: yhuang
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     1
/*
14179
4681260d262a 8000763: use XXX.valueOf methods instead of constructors
lancea
parents: 14171
diff changeset
     2
 * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
90ce3da70b43 Initial load
duke
parents:
diff changeset
     4
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
90ce3da70b43 Initial load
duke
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
     7
 * published by the Free Software Foundation.  Oracle designates this
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     8
 * particular file as subject to the "Classpath" exception as provided
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
     9
 * by Oracle in the LICENSE file that accompanied this code.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    10
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    11
 * This code is distributed in the hope that it will be useful, but WITHOUT
90ce3da70b43 Initial load
duke
parents:
diff changeset
    12
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
90ce3da70b43 Initial load
duke
parents:
diff changeset
    13
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
90ce3da70b43 Initial load
duke
parents:
diff changeset
    14
 * version 2 for more details (a copy is included in the LICENSE file that
90ce3da70b43 Initial load
duke
parents:
diff changeset
    15
 * accompanied this code).
90ce3da70b43 Initial load
duke
parents:
diff changeset
    16
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    17
 * You should have received a copy of the GNU General Public License version
90ce3da70b43 Initial load
duke
parents:
diff changeset
    18
 * 2 along with this work; if not, write to the Free Software Foundation,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    19
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    20
 *
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
    21
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
    22
 * or visit www.oracle.com if you need additional information or have any
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
    23
 * questions.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    24
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    25
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
                 */
13012
c4ef809d7fca 7171917: CachedRowSetImpl.populate does not handle map properly
lancea
parents: 11683
diff changeset
   662
                if (map == null || map.isEmpty()) {
2
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 {
14179
4681260d262a 8000763: use XXX.valueOf methods instead of constructors
lancea
parents: 14171
diff changeset
  1749
            return Double.compare(Double.parseDouble(value.toString()), 0) != 0;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1750
        } catch (NumberFormatException ex) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1751
            throw new SQLException(MessageFormat.format(resBundle.handleGetObject("cachedrowsetimpl.boolfail").toString(),
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1752
                  new Object[] {value.toString().trim(), columnIndex}));
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1753
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1754
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1755
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1756
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1757
     * Retrieves the value of the designated column in the current row
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1758
     * of this <code>CachedRowSetImpl</code> object as a
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1759
     * <code>byte</code> value.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1760
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1761
     * @param columnIndex the first column is <code>1</code>, the second
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1762
     *        is <code>2</code>, and so on; must be <code>1</code> or larger
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1763
     *        and equal to or less than the number of columns in the rowset
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1764
     * @return the column value as a <code>byte</code> in the Java programming
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1765
     * language; if the value is SQL <code>NULL</code>, the result is <code>0</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1766
     * @throws SQLException if (1) the given column index is out of bounds,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1767
     *            (2) the cursor is not on one of this rowset's rows or its
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1768
     *            insert row, or (3) the designated column does not store an
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1769
     *            SQL <code><b>TINYINT</b>, SMALLINT, INTEGER, BIGINT, REAL,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1770
     *            FLOAT, DOUBLE, DECIMAL, NUMERIC, BIT, CHAR, VARCHAR</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1771
     *            or <code>LONGVARCHAR</code> value. The bold SQL type
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1772
     *            designates the recommended return type.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1773
     * @see #getByte(String)
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1774
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1775
    public byte getByte(int columnIndex) throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1776
        Object value;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1777
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1778
        // sanity check.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1779
        checkIndex(columnIndex);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1780
        // make sure the cursor is on a valid row
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1781
        checkCursor();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1782
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1783
        setLastValueNull(false);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1784
        value = getCurrentRow().getColumnObject(columnIndex);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1785
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1786
        // check for SQL NULL
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1787
        if (value == null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1788
            setLastValueNull(true);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1789
            return (byte)0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1790
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1791
        try {
6697
39929804f9d4 6989139: Address JDBC Findbugs where Number type Constructor are used
lancea
parents: 6692
diff changeset
  1792
            return ((Byte.valueOf(value.toString())).byteValue());
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1793
        } catch (NumberFormatException ex) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1794
            throw new SQLException(MessageFormat.format(resBundle.handleGetObject("cachedrowsetimpl.bytefail").toString(),
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1795
                  new Object[] {value.toString().trim(), columnIndex}));
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1796
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1797
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1798
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1799
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1800
     * Retrieves the value of the designated column in the current row
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1801
     * of this <code>CachedRowSetImpl</code> object as a
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1802
     * <code>short</code> value.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1803
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1804
     * @param columnIndex the first column is <code>1</code>, the second
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1805
     *        is <code>2</code>, and so on; must be <code>1</code> or larger
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1806
     *        and equal to or less than the number of columns in the rowset
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1807
     * @return the column value; if the value is SQL <code>NULL</code>, the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1808
     *         result is <code>0</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1809
     * @throws SQLException if (1) the given column index is out of bounds,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1810
     * (2) the cursor is not on one of this rowset's rows or its
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1811
     * insert row, or (3) the designated column does not store an
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1812
     * SQL <code>TINYINT, <b>SMALLINT</b>, INTEGER, BIGINT, REAL
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1813
     * FLOAT, DOUBLE, DECIMAL, NUMERIC, BIT, CHAR, VARCHAR</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1814
     * or <code>LONGVARCHAR</code> value. The bold SQL type designates the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1815
     * recommended return type.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1816
     * @see #getShort(String)
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1817
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1818
    public short getShort(int columnIndex) throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1819
        Object value;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1820
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1821
        // sanity check.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1822
        checkIndex(columnIndex);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1823
        // make sure the cursor is on a valid row
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1824
        checkCursor();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1825
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1826
        setLastValueNull(false);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1827
        value = getCurrentRow().getColumnObject(columnIndex);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1828
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1829
        // check for SQL NULL
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1830
        if (value == null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1831
            setLastValueNull(true);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1832
            return (short)0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1833
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1834
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1835
        try {
6697
39929804f9d4 6989139: Address JDBC Findbugs where Number type Constructor are used
lancea
parents: 6692
diff changeset
  1836
            return ((Short.valueOf(value.toString().trim())).shortValue());
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1837
        } catch (NumberFormatException ex) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1838
            throw new SQLException(MessageFormat.format(resBundle.handleGetObject("cachedrowsetimpl.shortfail").toString(),
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1839
                  new Object[] {value.toString().trim(), columnIndex}));
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1840
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1841
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1842
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1843
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1844
     * Retrieves the value of the designated column in the current row
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1845
     * of this <code>CachedRowSetImpl</code> object as an
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1846
     * <code>int</code> value.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1847
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1848
     * @param columnIndex the first column is <code>1</code>, the second
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1849
     *        is <code>2</code>, and so on; must be <code>1</code> or larger
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1850
     *        and equal to or less than the number of columns in the rowset
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1851
     * @return the column value; if the value is SQL <code>NULL</code>, the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1852
     *         result is <code>0</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1853
     * @throws SQLException if (1) the given column index is out of bounds,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1854
     * (2) the cursor is not on one of this rowset's rows or its
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1855
     * insert row, or (3) the designated column does not store an
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1856
     * SQL <code>TINYINT, SMALLINT, <b>INTEGER</b>, BIGINT, REAL
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1857
     * FLOAT, DOUBLE, DECIMAL, NUMERIC, BIT, CHAR, VARCHAR</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1858
     * or <code>LONGVARCHAR</code> value. The bold SQL type designates the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1859
     * recommended return type.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1860
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1861
    public int getInt(int columnIndex) throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1862
        Object value;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1863
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1864
        // sanity check.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1865
        checkIndex(columnIndex);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1866
        // make sure the cursor is on a valid row
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1867
        checkCursor();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1868
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1869
        setLastValueNull(false);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1870
        value = getCurrentRow().getColumnObject(columnIndex);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1871
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1872
        // check for SQL NULL
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1873
        if (value == null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1874
            setLastValueNull(true);
11129
f9ad1aadf3fa 7116445: Miscellaneous warnings in the JDBC/RowSet classes
lancea
parents: 9537
diff changeset
  1875
            return 0;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1876
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1877
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1878
        try {
6697
39929804f9d4 6989139: Address JDBC Findbugs where Number type Constructor are used
lancea
parents: 6692
diff changeset
  1879
            return ((Integer.valueOf(value.toString().trim())).intValue());
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1880
        } catch (NumberFormatException ex) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1881
            throw new SQLException(MessageFormat.format(resBundle.handleGetObject("cachedrowsetimpl.intfail").toString(),
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1882
                  new Object[] {value.toString().trim(), columnIndex}));
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1883
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1884
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1885
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1886
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1887
     * Retrieves the value of the designated column in the current row
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1888
     * of this <code>CachedRowSetImpl</code> object as a
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1889
     * <code>long</code> value.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1890
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1891
     * @param columnIndex the first column is <code>1</code>, the second
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1892
     *        is <code>2</code>, and so on; must be <code>1</code> or larger
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1893
     *        and equal to or less than the number of columns in the rowset
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1894
     * @return the column value; if the value is SQL <code>NULL</code>, the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1895
     *         result is <code>0</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1896
     * @throws SQLException if (1) the given column index is out of bounds,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1897
     * (2) the cursor is not on one of this rowset's rows or its
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1898
     * insert row, or (3) the designated column does not store an
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1899
     * SQL <code>TINYINT, SMALLINT, INTEGER, <b>BIGINT</b>, REAL
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1900
     * FLOAT, DOUBLE, DECIMAL, NUMERIC, BIT, CHAR, VARCHAR</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1901
     * or <code>LONGVARCHAR</code> value. The bold SQL type designates the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1902
     * recommended return type.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1903
     * @see #getLong(String)
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1904
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1905
    public long getLong(int columnIndex) throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1906
        Object value;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1907
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1908
        // sanity check.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1909
        checkIndex(columnIndex);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1910
        // make sure the cursor is on a valid row
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1911
        checkCursor();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1912
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1913
        setLastValueNull(false);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1914
        value = getCurrentRow().getColumnObject(columnIndex);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1915
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1916
        // check for SQL NULL
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1917
        if (value == null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1918
            setLastValueNull(true);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1919
            return (long)0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1920
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1921
        try {
6697
39929804f9d4 6989139: Address JDBC Findbugs where Number type Constructor are used
lancea
parents: 6692
diff changeset
  1922
            return ((Long.valueOf(value.toString().trim())).longValue());
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1923
        } catch (NumberFormatException ex) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1924
            throw new SQLException(MessageFormat.format(resBundle.handleGetObject("cachedrowsetimpl.longfail").toString(),
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1925
                  new Object[] {value.toString().trim(), columnIndex}));
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1926
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1927
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1928
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1929
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1930
     * Retrieves the value of the designated column in the current row
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1931
     * of this <code>CachedRowSetImpl</code> object as a
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1932
     * <code>float</code> value.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1933
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1934
     * @param columnIndex the first column is <code>1</code>, the second
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1935
     *        is <code>2</code>, and so on; must be <code>1</code> or larger
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1936
     *        and equal to or less than the number of columns in the rowset
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1937
     * @return the column value; if the value is SQL <code>NULL</code>, the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1938
     *         result is <code>0</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1939
     * @throws SQLException if (1) the given column index is out of bounds,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1940
     * (2) the cursor is not on one of this rowset's rows or its
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1941
     * insert row, or (3) the designated column does not store an
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1942
     * SQL <code>TINYINT, SMALLINT, INTEGER, BIGINT, <b>REAL</b>,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1943
     * FLOAT, DOUBLE, DECIMAL, NUMERIC, BIT, CHAR, VARCHAR</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1944
     * or <code>LONGVARCHAR</code> value. The bold SQL type designates the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1945
     * recommended return type.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1946
     * @see #getFloat(String)
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1947
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1948
    public float getFloat(int columnIndex) throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1949
        Object value;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1950
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1951
        // sanity check.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1952
        checkIndex(columnIndex);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1953
        // make sure the cursor is on a valid row
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1954
        checkCursor();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1955
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1956
        setLastValueNull(false);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1957
        value = getCurrentRow().getColumnObject(columnIndex);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1958
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1959
        // check for SQL NULL
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1960
        if (value == null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1961
            setLastValueNull(true);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1962
            return (float)0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1963
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1964
        try {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1965
            return ((new Float(value.toString())).floatValue());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1966
        } catch (NumberFormatException ex) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1967
            throw new SQLException(MessageFormat.format(resBundle.handleGetObject("cachedrowsetimpl.floatfail").toString(),
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1968
                  new Object[] {value.toString().trim(), columnIndex}));
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1969
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1970
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1971
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1972
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1973
     * Retrieves the value of the designated column in the current row
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1974
     * of this <code>CachedRowSetImpl</code> object as a
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1975
     * <code>double</code> value.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1976
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1977
     * @param columnIndex the first column is <code>1</code>, the second
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1978
     *        is <code>2</code>, and so on; must be <code>1</code> or larger
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1979
     *        and equal to or less than the number of columns in the rowset
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1980
     * @return the column value; if the value is SQL <code>NULL</code>, the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1981
     *         result is <code>0</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1982
     * @throws SQLException if (1) the given column index is out of bounds,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1983
     * (2) the cursor is not on one of this rowset's rows or its
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1984
     * insert row, or (3) the designated column does not store an
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1985
     * SQL <code>TINYINT, SMALLINT, INTEGER, BIGINT, REAL,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1986
     * <b>FLOAT</b>, <b>DOUBLE</b>, DECIMAL, NUMERIC, BIT, CHAR, VARCHAR</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1987
     * or <code>LONGVARCHAR</code> value. The bold SQL type designates the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1988
     * recommended return type.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1989
     * @see #getDouble(String)
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1990
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1991
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1992
    public double getDouble(int columnIndex) throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1993
        Object value;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1994
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1995
        // sanity check.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1996
        checkIndex(columnIndex);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1997
        // make sure the cursor is on a valid row
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1998
        checkCursor();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1999
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2000
        setLastValueNull(false);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2001
        value = getCurrentRow().getColumnObject(columnIndex);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2002
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2003
        // check for SQL NULL
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2004
        if (value == null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2005
            setLastValueNull(true);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2006
            return (double)0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2007
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2008
        try {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2009
            return ((new Double(value.toString().trim())).doubleValue());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2010
        } catch (NumberFormatException ex) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2011
            throw new SQLException(MessageFormat.format(resBundle.handleGetObject("cachedrowsetimpl.doublefail").toString(),
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2012
                  new Object[] {value.toString().trim(), columnIndex}));
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2013
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2014
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2015
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2016
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2017
     * Retrieves the value of the designated column in the current row
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2018
     * of this <code>CachedRowSetImpl</code> object as a
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2019
     * <code>java.math.BigDecimal</code> object.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2020
     * <P>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2021
     * This method is deprecated; use the version of <code>getBigDecimal</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2022
     * that does not take a scale parameter and returns a value with full
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2023
     * precision.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2024
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2025
     * @param columnIndex the first column is <code>1</code>, the second
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2026
     *        is <code>2</code>, and so on; must be <code>1</code> or larger
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2027
     *        and equal to or less than the number of columns in the rowset
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2028
     * @param scale the number of digits to the right of the decimal point in the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2029
     *        value returned
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2030
     * @return the column value with the specified number of digits to the right
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2031
     *         of the decimal point; if the value is SQL <code>NULL</code>, the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2032
     *         result is <code>null</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2033
     * @throws SQLException if the given column index is out of bounds,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2034
     *            the cursor is not on a valid row, or this method fails
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2035
     * @deprecated
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2036
     */
14171
94eb36844bd7 7197395: Add @Deprecated to all deprecated methods to eliminate compiler warnings in JDBC
lancea
parents: 13012
diff changeset
  2037
    @Deprecated
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2038
    public BigDecimal getBigDecimal(int columnIndex, int scale) throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2039
        Object value;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2040
        BigDecimal bDecimal, retVal;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2041
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2042
        // sanity check.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2043
        checkIndex(columnIndex);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2044
        // make sure the cursor is on a valid row
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2045
        checkCursor();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2046
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2047
        setLastValueNull(false);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2048
        value = getCurrentRow().getColumnObject(columnIndex);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2049
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2050
        // check for SQL NULL
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2051
        if (value == null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2052
            setLastValueNull(true);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2053
            return (new BigDecimal(0));
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2054
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2055
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2056
        bDecimal = this.getBigDecimal(columnIndex);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2057
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2058
        retVal = bDecimal.setScale(scale);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2059
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2060
        return retVal;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2061
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2062
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2063
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2064
     * Retrieves the value of the designated column in the current row
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2065
     * of this <code>CachedRowSetImpl</code> object as a
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2066
     * <code>byte</code> array value.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2067
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2068
     * @param columnIndex the first column is <code>1</code>, the second
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2069
     *        is <code>2</code>, and so on; must be <code>1</code> or larger
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2070
     *        and equal to or less than the number of columns in the rowset
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2071
     * @return the column value as a <code>byte</code> array in the Java programming
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2072
     * language; if the value is SQL <code>NULL</code>, the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2073
     * result is <code>null</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2074
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2075
     * @throws SQLException if (1) the given column index is out of bounds,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2076
     * (2) the cursor is not on one of this rowset's rows or its
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2077
     * insert row, or (3) the designated column does not store an
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2078
     * SQL <code><b>BINARY</b>, <b>VARBINARY</b> or
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2079
     * LONGVARBINARY</code> value.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2080
     * The bold SQL type designates the recommended return type.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2081
     * @see #getBytes(String)
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2082
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2083
    public byte[] getBytes(int columnIndex) throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2084
        // sanity check.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2085
        checkIndex(columnIndex);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2086
        // make sure the cursor is on a valid row
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2087
        checkCursor();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2088
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2089
        if (isBinary(RowSetMD.getColumnType(columnIndex)) == false) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2090
            throw new SQLException(resBundle.handleGetObject("cachedrowsetimpl.dtypemismt").toString());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2091
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2092
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2093
        return (byte[])(getCurrentRow().getColumnObject(columnIndex));
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2094
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2095
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2096
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2097
     * Retrieves the value of the designated column in the current row
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2098
     * of this <code>CachedRowSetImpl</code> object as a
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2099
     * <code>java.sql.Date</code> object.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2100
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2101
     * @param columnIndex the first column is <code>1</code>, the second
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2102
     *        is <code>2</code>, and so on; must be <code>1</code> or larger
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2103
     *        and equal to or less than the number of columns in the rowset
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2104
     * @return the column value as a <code>java.sql.Data</code> object; if
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2105
     *        the value is SQL <code>NULL</code>, the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2106
     *        result is <code>null</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2107
     * @throws SQLException if the given column index is out of bounds,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2108
     *            the cursor is not on a valid row, or this method fails
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2109
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2110
    public java.sql.Date getDate(int columnIndex) throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2111
        Object value;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2112
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2113
        // sanity check.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2114
        checkIndex(columnIndex);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2115
        // make sure the cursor is on a valid row
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2116
        checkCursor();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2117
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2118
        setLastValueNull(false);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2119
        value = getCurrentRow().getColumnObject(columnIndex);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2120
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2121
        // check for SQL NULL
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2122
        if (value == null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2123
            setLastValueNull(true);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2124
            return null;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2125
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2126
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2127
        /*
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2128
         * The object coming back from the db could be
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2129
         * a date, a timestamp, or a char field variety.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2130
         * If it's a date type return it, a timestamp
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2131
         * we turn into a long and then into a date,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2132
         * char strings we try to parse. Yuck.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2133
         */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2134
        switch (RowSetMD.getColumnType(columnIndex)) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2135
            case java.sql.Types.DATE: {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2136
                long sec = ((java.sql.Date)value).getTime();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2137
                return new java.sql.Date(sec);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2138
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2139
            case java.sql.Types.TIMESTAMP: {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2140
                long sec = ((java.sql.Timestamp)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.CHAR:
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2144
            case java.sql.Types.VARCHAR:
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2145
            case java.sql.Types.LONGVARCHAR: {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2146
                try {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2147
                    DateFormat df = DateFormat.getDateInstance();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2148
                    return ((java.sql.Date)(df.parse(value.toString())));
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2149
                } catch (ParseException ex) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2150
                    throw new SQLException(MessageFormat.format(resBundle.handleGetObject("cachedrowsetimpl.datefail").toString(),
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2151
                        new Object[] {value.toString().trim(), columnIndex}));
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2152
                }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2153
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2154
            default: {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2155
                throw new SQLException(MessageFormat.format(resBundle.handleGetObject("cachedrowsetimpl.datefail").toString(),
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2156
                        new Object[] {value.toString().trim(), columnIndex}));
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2157
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2158
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2159
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2160
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2161
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2162
     * Retrieves the value of the designated column in the current row
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2163
     * of this <code>CachedRowSetImpl</code> object as a
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2164
     * <code>java.sql.Time</code> object.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2165
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2166
     * @param columnIndex the first column is <code>1</code>, the second
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2167
     *        is <code>2</code>, and so on; must be <code>1</code> or larger
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2168
     *        and equal to or less than the number of columns in the rowset
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2169
     * @return the column value; if the value is SQL <code>NULL</code>, the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2170
     *         result is <code>null</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2171
     * @throws SQLException if the given column index is out of bounds,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2172
     *         the cursor is not on a valid row, or this method fails
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2173
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2174
    public java.sql.Time getTime(int columnIndex) throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2175
        Object value;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2176
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2177
        // sanity check.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2178
        checkIndex(columnIndex);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2179
        // make sure the cursor is on a valid row
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2180
        checkCursor();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2181
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2182
        setLastValueNull(false);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2183
        value = getCurrentRow().getColumnObject(columnIndex);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2184
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2185
        // check for SQL NULL
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2186
        if (value == null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2187
            setLastValueNull(true);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2188
            return null;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2189
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2190
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2191
        /*
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2192
         * The object coming back from the db could be
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2193
         * a date, a timestamp, or a char field variety.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2194
         * If it's a date type return it, a timestamp
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2195
         * we turn into a long and then into a date,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2196
         * char strings we try to parse. Yuck.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2197
         */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2198
        switch (RowSetMD.getColumnType(columnIndex)) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2199
            case java.sql.Types.TIME: {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2200
                return (java.sql.Time)value;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2201
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2202
            case java.sql.Types.TIMESTAMP: {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2203
                long sec = ((java.sql.Timestamp)value).getTime();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2204
                return new java.sql.Time(sec);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2205
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2206
            case java.sql.Types.CHAR:
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2207
            case java.sql.Types.VARCHAR:
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2208
            case java.sql.Types.LONGVARCHAR: {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2209
                try {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2210
                    DateFormat tf = DateFormat.getTimeInstance();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2211
                    return ((java.sql.Time)(tf.parse(value.toString())));
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2212
                } catch (ParseException ex) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2213
                    throw new SQLException(MessageFormat.format(resBundle.handleGetObject("cachedrowsetimpl.timefail").toString(),
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2214
                        new Object[] {value.toString().trim(), columnIndex}));
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2215
                }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2216
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2217
            default: {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2218
                throw new SQLException(MessageFormat.format(resBundle.handleGetObject("cachedrowsetimpl.timefail").toString(),
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2219
                        new Object[] {value.toString().trim(), columnIndex}));
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2220
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2221
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2222
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2223
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2224
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2225
     * Retrieves the value of the designated column in the current row
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2226
     * of this <code>CachedRowSetImpl</code> object as a
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2227
     * <code>java.sql.Timestamp</code> object.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2228
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2229
     * @param columnIndex the first column is <code>1</code>, the second
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2230
     *        is <code>2</code>, and so on; must be <code>1</code> or larger
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2231
     *        and equal to or less than the number of columns in the rowset
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2232
     * @return the column value; if the value is SQL <code>NULL</code>, the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2233
     *         result is <code>null</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2234
     * @throws SQLException if the given column index is out of bounds,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2235
     *            the cursor is not on a valid row, or this method fails
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2236
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2237
    public java.sql.Timestamp getTimestamp(int columnIndex) throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2238
        Object value;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2239
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2240
        // sanity check.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2241
        checkIndex(columnIndex);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2242
        // make sure the cursor is on a valid row
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2243
        checkCursor();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2244
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2245
        setLastValueNull(false);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2246
        value = getCurrentRow().getColumnObject(columnIndex);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2247
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2248
        // check for SQL NULL
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2249
        if (value == null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2250
            setLastValueNull(true);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2251
            return null;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2252
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2253
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2254
        /*
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2255
         * The object coming back from the db could be
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2256
         * a date, a timestamp, or a char field variety.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2257
         * If it's a date type return it; a timestamp
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2258
         * we turn into a long and then into a date;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2259
         * char strings we try to parse. Yuck.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2260
         */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2261
        switch (RowSetMD.getColumnType(columnIndex)) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2262
            case java.sql.Types.TIMESTAMP: {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2263
                return (java.sql.Timestamp)value;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2264
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2265
            case java.sql.Types.TIME: {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2266
                long sec = ((java.sql.Time)value).getTime();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2267
                return new java.sql.Timestamp(sec);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2268
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2269
            case java.sql.Types.DATE: {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2270
                long sec = ((java.sql.Date)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.CHAR:
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2274
            case java.sql.Types.VARCHAR:
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2275
            case java.sql.Types.LONGVARCHAR: {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2276
                try {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2277
                    DateFormat tf = DateFormat.getTimeInstance();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2278
                    return ((java.sql.Timestamp)(tf.parse(value.toString())));
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2279
                } catch (ParseException ex) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2280
                    throw new SQLException(MessageFormat.format(resBundle.handleGetObject("cachedrowsetimpl.timefail").toString(),
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2281
                        new Object[] {value.toString().trim(), columnIndex}));
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2282
                }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2283
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2284
            default: {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2285
                throw new SQLException(MessageFormat.format(resBundle.handleGetObject("cachedrowsetimpl.timefail").toString(),
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2286
                        new Object[] {value.toString().trim(), columnIndex}));
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2287
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2288
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2289
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2290
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2291
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2292
     * Retrieves the value of the designated column in the current row of this
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2293
     * <code>CachedRowSetImpl</code> object as a <code>java.io.InputStream</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2294
     * object.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2295
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2296
     * A column value can be retrieved as a stream of ASCII characters
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2297
     * and then read in chunks from the stream.  This method is particularly
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2298
     * suitable for retrieving large <code>LONGVARCHAR</code> values.  The JDBC
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2299
     * driver will do any necessary conversion from the database format into ASCII.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2300
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2301
     * <P><B>Note:</B> All the data in the returned stream must be
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2302
     * read prior to getting the value of any other column. The next
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2303
     * call to a get method implicitly closes the stream. . Also, a
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2304
     * stream may return <code>0</code> for <code>CachedRowSetImpl.available()</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2305
     * whether there is data available or not.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2306
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2307
     * @param columnIndex the first column is <code>1</code>, the second
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2308
     *        is <code>2</code>, and so on; must be <code>1</code> or larger
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2309
     *        and equal to or less than the number of columns in this rowset
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2310
     * @return a Java input stream that delivers the database column value
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2311
     *         as a stream of one-byte ASCII characters.  If the value is SQL
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2312
     *         <code>NULL</code>, the result is <code>null</code>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2313
     * @throws SQLException if (1) the given column index is out of bounds,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2314
     * (2) the cursor is not on one of this rowset's rows or its
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2315
     * insert row, or (3) the designated column does not store an
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2316
     * SQL <code>CHAR, VARCHAR</code>, <code><b>LONGVARCHAR</b></code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2317
     * <code>BINARY, VARBINARY</code> or <code>LONGVARBINARY</code> value. The
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2318
     * bold SQL type designates the recommended return types that this method is
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2319
     * used to retrieve.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2320
     * @see #getAsciiStream(String)
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2321
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2322
    public java.io.InputStream getAsciiStream(int columnIndex) throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2323
        Object value;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2324
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2325
        // always free an old stream
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2326
        asciiStream = null;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2327
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2328
        // sanity check
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2329
        checkIndex(columnIndex);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2330
        //make sure the cursor is on a vlid row
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2331
        checkCursor();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2332
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2333
        value =  getCurrentRow().getColumnObject(columnIndex);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2334
        if (value == null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2335
            lastValueNull = true;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2336
            return null;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2337
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2338
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2339
        try {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2340
            if (isString(RowSetMD.getColumnType(columnIndex))) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2341
                asciiStream = new ByteArrayInputStream(((String)value).getBytes("ASCII"));
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2342
            } else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2343
                throw new SQLException(resBundle.handleGetObject("cachedrowsetimpl.dtypemismt").toString());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2344
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2345
        } catch (java.io.UnsupportedEncodingException ex) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2346
            throw new SQLException(ex.getMessage());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2347
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2348
11129
f9ad1aadf3fa 7116445: Miscellaneous warnings in the JDBC/RowSet classes
lancea
parents: 9537
diff changeset
  2349
        return asciiStream;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2350
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2351
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2352
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2353
     * A column value can be retrieved as a stream of Unicode characters
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2354
     * and then read in chunks from the stream.  This method is particularly
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2355
     * suitable for retrieving large LONGVARCHAR values.  The JDBC driver will
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2356
     * do any necessary conversion from the database format into Unicode.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2357
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2358
     * <P><B>Note:</B> All the data in the returned stream must be
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2359
     * read prior to getting the value of any other column. The next
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2360
     * call to a get method implicitly closes the stream. . Also, a
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2361
     * stream may return 0 for available() whether there is data
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2362
     * available or not.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2363
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2364
     * @param columnIndex the first column is <code>1</code>, the second
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2365
     *        is <code>2</code>, and so on; must be <code>1</code> or larger
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2366
     *        and equal to or less than the number of columns in this rowset
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2367
     * @return a Java input stream that delivers the database column value
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2368
     * as a stream of two byte Unicode characters.  If the value is SQL NULL
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2369
     * then the result is null.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2370
     * @throws SQLException if an error occurs
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2371
     * @deprecated
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2372
     */
14171
94eb36844bd7 7197395: Add @Deprecated to all deprecated methods to eliminate compiler warnings in JDBC
lancea
parents: 13012
diff changeset
  2373
    @Deprecated
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2374
    public java.io.InputStream getUnicodeStream(int columnIndex) throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2375
        // always free an old stream
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2376
        unicodeStream = null;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2377
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2378
        // sanity check.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2379
        checkIndex(columnIndex);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2380
        // make sure the cursor is on a valid row
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2381
        checkCursor();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2382
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2383
        if (isBinary(RowSetMD.getColumnType(columnIndex)) == false &&
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2384
        isString(RowSetMD.getColumnType(columnIndex)) == false) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2385
            throw new SQLException(resBundle.handleGetObject("cachedrowsetimpl.dtypemismt").toString());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2386
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2387
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2388
        Object value = getCurrentRow().getColumnObject(columnIndex);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2389
        if (value == null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2390
            lastValueNull = true;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2391
            return null;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2392
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2393
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2394
        unicodeStream = new StringBufferInputStream(value.toString());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2395
11129
f9ad1aadf3fa 7116445: Miscellaneous warnings in the JDBC/RowSet classes
lancea
parents: 9537
diff changeset
  2396
        return unicodeStream;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2397
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2398
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2399
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2400
     * Retrieves the value of the designated column in the current row of this
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2401
     * <code>CachedRowSetImpl</code> object as a <code>java.io.InputStream</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2402
     * object.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2403
     * <P>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2404
     * A column value can be retrieved as a stream of uninterpreted bytes
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2405
     * and then read in chunks from the stream.  This method is particularly
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2406
     * suitable for retrieving large <code>LONGVARBINARY</code> values.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2407
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2408
     * <P><B>Note:</B> All the data in the returned stream must be
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2409
     * read prior to getting the value of any other column. The next
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2410
     * call to a get method implicitly closes the stream. Also, a
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2411
     * stream may return <code>0</code> for
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2412
     * <code>CachedRowSetImpl.available()</code> whether there is data
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2413
     * available or not.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2414
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2415
     * @param columnIndex the first column is <code>1</code>, the second
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2416
     * is <code>2</code>, and so on; must be <code>1</code> or larger
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2417
     * and equal to or less than the number of columns in the rowset
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2418
     * @return a Java input stream that delivers the database column value
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2419
     * as a stream of uninterpreted bytes.  If the value is SQL <code>NULL</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2420
     * then the result is <code>null</code>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2421
     * @throws SQLException if (1) the given column index is out of bounds,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2422
     * (2) the cursor is not on one of this rowset's rows or its
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2423
     * insert row, or (3) the designated column does not store an
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2424
     * SQL <code>BINARY, VARBINARY</code> or <code><b>LONGVARBINARY</b></code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2425
     * The bold type indicates the SQL type that this method is recommened
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2426
     * to retrieve.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2427
     * @see #getBinaryStream(String)
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2428
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2429
    public java.io.InputStream getBinaryStream(int columnIndex) throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2430
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2431
        // always free an old stream
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2432
        binaryStream = null;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2433
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2434
        // sanity check.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2435
        checkIndex(columnIndex);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2436
        // make sure the cursor is on a valid row
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2437
        checkCursor();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2438
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2439
        if (isBinary(RowSetMD.getColumnType(columnIndex)) == false) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2440
            throw new SQLException(resBundle.handleGetObject("cachedrowsetimpl.dtypemismt").toString());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2441
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2442
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2443
        Object value = getCurrentRow().getColumnObject(columnIndex);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2444
        if (value == null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2445
            lastValueNull = true;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2446
            return null;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2447
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2448
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2449
        binaryStream = new ByteArrayInputStream((byte[])value);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2450
11129
f9ad1aadf3fa 7116445: Miscellaneous warnings in the JDBC/RowSet classes
lancea
parents: 9537
diff changeset
  2451
        return binaryStream;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2452
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2453
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2454
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2455
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2456
    // Methods for accessing results by column name
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2457
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2458
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2459
     * Retrieves the value stored in the designated column
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2460
     * of the current row as a <code>String</code> object.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2461
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2462
     * @param columnName a <code>String</code> object giving the SQL name of
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2463
     *        a column in this <code>CachedRowSetImpl</code> object
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2464
     * @return the column value; if the value is SQL <code>NULL</code>,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2465
     *         the result is <code>null</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2466
     * @throws SQLException if (1) the given column name is not the name of
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2467
     * a column in this rowset, (2) the cursor is not on one of
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2468
     * this rowset's rows or its insert row, or (3) the designated
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2469
     * column does not store an SQL <code>TINYINT, SMALLINT, INTEGER
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2470
     * BIGINT, REAL, FLOAT, DOUBLE, DECIMAL, NUMERIC, BIT, <b>CHAR</b>,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2471
     * <b>VARCHAR</b></code> or <code>LONGVARCHAR<</code> value. The bold SQL type
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2472
     * designates the recommended return type.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2473
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2474
    public String getString(String columnName) throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2475
        return getString(getColIdxByName(columnName));
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2476
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2477
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2478
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2479
     * Retrieves the value stored in the designated column
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2480
     * of the current row as a <code>boolean</code> value.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2481
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2482
     * @param columnName a <code>String</code> object giving the SQL name of
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2483
     *        a column in this <code>CachedRowSetImpl</code> object
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2484
     * @return the column value as a <code>boolean</code> in the Java programming
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2485
     *        language; if the value is SQL <code>NULL</code>,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2486
     *        the result is <code>false</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2487
     * @throws SQLException if (1) the given column name is not the name of
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2488
     *            a column in this rowset, (2) the cursor is not on one of
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2489
     *            this rowset's rows or its insert row, or (3) the designated
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2490
     *            column does not store an SQL <code>BOOLEAN</code> value
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2491
     * @see #getBoolean(int)
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2492
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2493
    public boolean getBoolean(String columnName) throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2494
        return getBoolean(getColIdxByName(columnName));
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2495
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2496
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2497
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2498
     * Retrieves the value stored in the designated column
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2499
     * of the current row as a <code>byte</code> value.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2500
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2501
     * @param columnName a <code>String</code> object giving the SQL name of
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2502
     *        a column in this <code>CachedRowSetImpl</code> object
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2503
     * @return the column value as a <code>byte</code> in the Java programming
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2504
     * language; if the value is SQL <code>NULL</code>, the result is <code>0</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2505
     * @throws SQLException if (1) the given column name is not the name of
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2506
     * a column in this rowset, (2) the cursor is not on one of
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2507
     * this rowset's rows or its insert row, or (3) the designated
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2508
     * column does not store an SQL <code><B>TINYINT</B>, SMALLINT, INTEGER,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2509
     * BIGINT, REAL, FLOAT, DOUBLE, DECIMAL, NUMERIC, BIT, CHAR,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2510
     * VARCHAR</code> or <code>LONGVARCHAR</code> value. The
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2511
     * bold type designates the recommended return type
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2512
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2513
    public byte getByte(String columnName) throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2514
        return getByte(getColIdxByName(columnName));
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2515
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2516
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2517
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2518
     * Retrieves the value stored in the designated column
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2519
     * of the current row as a <code>short</code> value.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2520
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2521
     * @param columnName a <code>String</code> object giving the SQL name of
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2522
     *        a column in this <code>CachedRowSetImpl</code> object
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2523
     * @return the column value; if the value is SQL <code>NULL</code>,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2524
     *         the result is <code>0</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2525
     * @throws SQLException if (1) the given column name is not the name of
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2526
     * a column in this rowset, (2) the cursor is not on one of
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2527
     * this rowset's rows or its insert row, or (3) the designated
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2528
     * column does not store an SQL <code>TINYINT, <b>SMALLINT</b>, INTEGER
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2529
     * BIGINT, REAL, FLOAT, DOUBLE, DECIMAL, NUMERIC, BIT, CHAR,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2530
     * VARCHAR</code> or <code>LONGVARCHAR</code> value. The bold SQL type
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2531
     * designates the recommended return type.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2532
     * @see #getShort(int)
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2533
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2534
    public short getShort(String columnName) throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2535
        return getShort(getColIdxByName(columnName));
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2536
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2537
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2538
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2539
     * Retrieves the value stored in the designated column
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2540
     * of the current row as an <code>int</code> value.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2541
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2542
     * @param columnName a <code>String</code> object giving the SQL name of
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2543
     *        a column in this <code>CachedRowSetImpl</code> object
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2544
     * @return the column value; if the value is SQL <code>NULL</code>,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2545
     *         the result is <code>0</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2546
     * @throws SQLException if (1) the given column name is not the name
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2547
     * of a column in this rowset,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2548
     * (2) the cursor is not on one of this rowset's rows or its
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2549
     * insert row, or (3) the designated column does not store an
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2550
     * SQL <code>TINYINT, SMALLINT, <b>INTEGER</b>, BIGINT, REAL
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2551
     * FLOAT, DOUBLE, DECIMAL, NUMERIC, BIT, CHAR, VARCHAR</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2552
     * or <code>LONGVARCHAR</code> value. The bold SQL type designates the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2553
     * recommended return type.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2554
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2555
    public int getInt(String columnName) throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2556
        return getInt(getColIdxByName(columnName));
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2557
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2558
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2559
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2560
     * Retrieves the value stored in the designated column
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2561
     * of the current row as a <code>long</code> value.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2562
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2563
     * @param columnName a <code>String</code> object giving the SQL name of
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2564
     *        a column in this <code>CachedRowSetImpl</code> object
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2565
     * @return the column value; if the value is SQL <code>NULL</code>,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2566
     *         the result is <code>0</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2567
     * @throws SQLException if (1) the given column name is not the name of
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2568
     * a column in this rowset, (2) the cursor is not on one of
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2569
     * this rowset's rows or its insert row, or (3) the designated
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2570
     * column does not store an SQL <code>TINYINT, SMALLINT, INTEGER
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2571
     * <b>BIGINT</b>, REAL, FLOAT, DOUBLE, DECIMAL, NUMERIC, BIT, CHAR,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2572
     * VARCHAR</code> or <code>LONGVARCHAR</code> value. The bold SQL type
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2573
     * designates the recommended return type.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2574
     * @see #getLong(int)
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2575
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2576
    public long getLong(String columnName) throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2577
        return getLong(getColIdxByName(columnName));
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2578
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2579
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2580
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2581
     * Retrieves the value stored in the designated column
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2582
     * of the current row as a <code>float</code> value.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2583
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2584
     * @param columnName a <code>String</code> object giving the SQL name of
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2585
     *        a column in this <code>CachedRowSetImpl</code> object
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2586
     * @return the column value; if the value is SQL <code>NULL</code>,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2587
     *         the result is <code>0</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2588
     * @throws SQLException if (1) the given column name is not the name of
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2589
     * a column in this rowset, (2) the cursor is not on one of
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2590
     * this rowset's rows or its insert row, or (3) the designated
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2591
     * column does not store an SQL <code>TINYINT, SMALLINT, INTEGER
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2592
     * BIGINT, <b>REAL</b>, FLOAT, DOUBLE, DECIMAL, NUMERIC, BIT, CHAR,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2593
     * VARCHAR</code> or <code>LONGVARCHAR</code> value. The bold SQL type
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2594
     * designates the recommended return type.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2595
     * @see #getFloat(String)
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2596
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2597
    public float getFloat(String columnName) throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2598
        return getFloat(getColIdxByName(columnName));
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2599
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2600
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2601
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2602
     * Retrieves the value stored in the designated column
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2603
     * of the current row of this <code>CachedRowSetImpl</code> object
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2604
     * as a <code>double</code> value.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2605
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2606
     * @param columnName a <code>String</code> object giving the SQL name of
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2607
     *        a column in this <code>CachedRowSetImpl</code> object
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2608
     * @return the column value; if the value is SQL <code>NULL</code>,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2609
     *         the result is <code>0</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2610
     * @throws SQLException if (1) the given column name is not the name of
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2611
     * a column in this rowset, (2) the cursor is not on one of
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2612
     * this rowset's rows or its insert row, or (3) the designated
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2613
     * column does not store an SQL <code>TINYINT, SMALLINT, INTEGER
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2614
     * BIGINT, REAL, <b>FLOAT</b>, <b>DOUBLE</b>, DECIMAL, NUMERIC, BIT, CHAR,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2615
     * VARCHAR</code> or <code>LONGVARCHAR</code> value. The bold SQL type
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2616
     * designates the recommended return types.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2617
     * @see #getDouble(int)
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2618
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2619
    public double getDouble(String columnName) throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2620
        return getDouble(getColIdxByName(columnName));
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2621
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2622
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2623
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2624
     * Retrieves the value stored in the designated column
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2625
     * of the current row as a <code>java.math.BigDecimal</code> object.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2626
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2627
     * @param columnName a <code>String</code> object giving the SQL name of
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2628
     *        a column in this <code>CachedRowSetImpl</code> object
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2629
     * @param scale the number of digits to the right of the decimal point
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2630
     * @return a java.math.BugDecimal object with <code><i>scale</i></code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2631
     * number of digits to the right of the decimal point.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2632
     * @throws SQLException if (1) the given column name is not the name of
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2633
     * a column in this rowset, (2) the cursor is not on one of
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2634
     * this rowset's rows or its insert row, or (3) the designated
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2635
     * column does not store an SQL <code>TINYINT, SMALLINT, INTEGER
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2636
     * BIGINT, REAL, FLOAT, DOUBLE, <b>DECIMAL</b>, <b>NUMERIC</b>, BIT CHAR,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2637
     * VARCHAR</code> or <code>LONGVARCHAR</code> value. The bold SQL type
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2638
     * designates the recommended return type that this method is used to
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2639
     * retrieve.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2640
     * @deprecated Use the <code>getBigDecimal(String columnName)</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2641
     *             method instead
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2642
     */
14171
94eb36844bd7 7197395: Add @Deprecated to all deprecated methods to eliminate compiler warnings in JDBC
lancea
parents: 13012
diff changeset
  2643
    @Deprecated
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2644
    public BigDecimal getBigDecimal(String columnName, int scale) throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2645
        return getBigDecimal(getColIdxByName(columnName), scale);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2646
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2647
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2648
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2649
     * Retrieves the value stored in the designated column
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2650
     * of the current row as a <code>byte</code> array.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2651
     * The bytes represent the raw values returned by the driver.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2652
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2653
     * @param columnName a <code>String</code> object giving the SQL name of
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2654
     *        a column in this <code>CachedRowSetImpl</code> object
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2655
     * @return the column value as a <code>byte</code> array in the Java programming
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2656
     * language; if the value is SQL <code>NULL</code>, the result is <code>null</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2657
     * @throws SQLException if (1) the given column name is not the name of
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2658
     * a column in this rowset, (2) the cursor is not on one of
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2659
     * this rowset's rows or its insert row, or (3) the designated
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2660
     * column does not store an SQL <code><b>BINARY</b>, <b>VARBINARY</b>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2661
     * </code> or <code>LONGVARBINARY</code> values
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2662
     * The bold SQL type designates the recommended return type.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2663
     * @see #getBytes(int)
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2664
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2665
    public byte[] getBytes(String columnName) throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2666
        return getBytes(getColIdxByName(columnName));
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2667
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2668
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2669
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2670
     * Retrieves the value stored in the designated column
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2671
     * of the current row as a <code>java.sql.Date</code> object.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2672
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2673
     * @param columnName a <code>String</code> object giving the SQL name of
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2674
     *        a column in this <code>CachedRowSetImpl</code> object
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2675
     * @return the column value; if the value is SQL <code>NULL</code>,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2676
     *         the result is <code>null</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2677
     * @throws SQLException if (1) the given column name is not the name of
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2678
     *            a column in this rowset, (2) the cursor is not on one of
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2679
     *            this rowset's rows or its insert row, or (3) the designated
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2680
     *            column does not store an SQL <code>DATE</code> or
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2681
     *            <code>TIMESTAMP</code> value
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2682
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2683
    public java.sql.Date getDate(String columnName) throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2684
        return getDate(getColIdxByName(columnName));
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2685
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2686
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2687
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2688
     * Retrieves the value stored in the designated column
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2689
     * of the current row as a <code>java.sql.Time</code> object.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2690
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2691
     * @param columnName a <code>String</code> object giving the SQL name of
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2692
     *        a column in this <code>CachedRowSetImpl</code> object
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2693
     * @return the column value; if the value is SQL <code>NULL</code>,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2694
     *         the result is <code>null</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2695
     * @throws SQLException if the given column name does not match one of
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2696
     *            this rowset's column names or the cursor is not on one of
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2697
     *            this rowset's rows or its insert row
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2698
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2699
    public java.sql.Time getTime(String columnName) throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2700
        return getTime(getColIdxByName(columnName));
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2701
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2702
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2703
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2704
     * Retrieves the value stored in the designated column
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2705
     * of the current row as a <code>java.sql.Timestamp</code> object.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2706
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2707
     * @param columnName a <code>String</code> object giving the SQL name of
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2708
     *        a column in this <code>CachedRowSetImpl</code> object
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2709
     * @return the column value; if the value is SQL <code>NULL</code>,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2710
     *         the result is <code>null</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2711
     * @throws SQLException if the given column name does not match one of
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2712
     *            this rowset's column names or the cursor is not on one of
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2713
     *            this rowset's rows or its insert row
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2714
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2715
    public java.sql.Timestamp getTimestamp(String columnName) throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2716
        return getTimestamp(getColIdxByName(columnName));
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2717
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2718
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2719
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2720
     * Retrieves the value of the designated column in the current row of this
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2721
     * <code>CachedRowSetImpl</code> object as a <code>java.io.InputStream</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2722
     * object.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2723
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2724
     * A column value can be retrieved as a stream of ASCII characters
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2725
     * and then read in chunks from the stream. This method is particularly
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2726
     * suitable for retrieving large <code>LONGVARCHAR</code> values. The
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2727
     * <code>SyncProvider</code> will rely on the JDBC driver to do any necessary
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2728
     * conversion from the database format into ASCII format.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2729
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2730
     * <P><B>Note:</B> All the data in the returned stream must
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2731
     * be read prior to getting the value of any other column. The
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2732
     * next call to a <code>getXXX</code> method implicitly closes the stream.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2733
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2734
     * @param columnName a <code>String</code> object giving the SQL name of
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2735
     *        a column in this <code>CachedRowSetImpl</code> object
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2736
     * @return a Java input stream that delivers the database column value
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2737
     *         as a stream of one-byte ASCII characters.  If the value is SQL
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2738
     *         <code>NULL</code>, the result is <code>null</code>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2739
     * @throws SQLException if (1) the given column name is not the name of
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2740
     * a column in this rowset
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2741
     * (2) the cursor is not on one of this rowset's rows or its
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2742
     * insert row, or (3) the designated column does not store an
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2743
     * SQL <code>CHAR, VARCHAR</code>, <code><b>LONGVARCHAR</b></code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2744
     * <code>BINARY, VARBINARY</code> or <code>LONGVARBINARY</code> value. The
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2745
     * bold SQL type designates the recommended return types that this method is
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2746
     * used to retrieve.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2747
     * @see #getAsciiStream(int)
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2748
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2749
    public java.io.InputStream getAsciiStream(String columnName) throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2750
        return getAsciiStream(getColIdxByName(columnName));
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2751
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2752
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2753
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2754
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2755
     * A column value can be retrieved as a stream of Unicode characters
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2756
     * and then read in chunks from the stream.  This method is particularly
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2757
     * suitable for retrieving large <code>LONGVARCHAR</code> values.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2758
     * The JDBC driver will do any necessary conversion from the database
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2759
     * format into Unicode.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2760
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2761
     * <P><B>Note:</B> All the data in the returned stream must
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2762
     * be read prior to getting the value of any other column. The
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2763
     * next call to a <code>getXXX</code> method implicitly closes the stream.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2764
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2765
     * @param columnName a <code>String</code> object giving the SQL name of
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2766
     *        a column in this <code>CachedRowSetImpl</code> object
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2767
     * @return a Java input stream that delivers the database column value
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2768
     *         as a stream of two-byte Unicode characters.  If the value is
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2769
     *         SQL <code>NULL</code>, the result is <code>null</code>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2770
     * @throws SQLException if the given column name does not match one of
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2771
     *            this rowset's column names or the cursor is not on one of
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2772
     *            this rowset's rows or its insert row
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2773
     * @deprecated use the method <code>getCharacterStream</code> instead
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2774
     */
14171
94eb36844bd7 7197395: Add @Deprecated to all deprecated methods to eliminate compiler warnings in JDBC
lancea
parents: 13012
diff changeset
  2775
    @Deprecated
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2776
    public java.io.InputStream getUnicodeStream(String columnName) throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2777
        return getUnicodeStream(getColIdxByName(columnName));
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2778
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2779
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2780
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2781
     * Retrieves the value of the designated column in the current row of this
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2782
     * <code>CachedRowSetImpl</code> object as a <code>java.io.InputStream</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2783
     * object.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2784
     * <P>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2785
     * A column value can be retrieved as a stream of uninterpreted bytes
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2786
     * and then read in chunks from the stream.  This method is particularly
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2787
     * suitable for retrieving large <code>LONGVARBINARY</code> values.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2788
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2789
     * <P><B>Note:</B> All the data in the returned stream must be
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2790
     * read prior to getting the value of any other column. The next
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2791
     * call to a get method implicitly closes the stream. Also, a
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2792
     * stream may return <code>0</code> for <code>CachedRowSetImpl.available()</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2793
     * whether there is data available or not.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2794
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2795
     * @param columnName a <code>String</code> object giving the SQL name of
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2796
     *        a column in this <code>CachedRowSetImpl</code> object
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2797
     * @return a Java input stream that delivers the database column value
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2798
     *         as a stream of uninterpreted bytes.  If the value is SQL
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2799
     *         <code>NULL</code>, the result is <code>null</code>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2800
     * @throws SQLException if (1) the given column name is unknown,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2801
     * (2) the cursor is not on one of this rowset's rows or its
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2802
     * insert row, or (3) the designated column does not store an
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2803
     * SQL <code>BINARY, VARBINARY</code> or <code><b>LONGVARBINARY</b></code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2804
     * The bold type indicates the SQL type that this method is recommened
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2805
     * to retrieve.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2806
     * @see #getBinaryStream(int)
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2807
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2808
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2809
    public java.io.InputStream getBinaryStream(String columnName) throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2810
        return getBinaryStream(getColIdxByName(columnName));
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2811
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2812
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2813
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2814
    // Advanced features:
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2815
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2816
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2817
     * The first warning reported by calls on this <code>CachedRowSetImpl</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2818
     * object is returned. Subsequent <code>CachedRowSetImpl</code> warnings will
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2819
     * be chained to this <code>SQLWarning</code>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2820
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2821
     * <P>The warning chain is automatically cleared each time a new
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2822
     * row is read.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2823
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2824
     * <P><B>Note:</B> This warning chain only covers warnings caused
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2825
     * by <code>ResultSet</code> methods.  Any warning caused by statement
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2826
     * methods (such as reading OUT parameters) will be chained on the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2827
     * <code>Statement</code> object.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2828
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2829
     * @return the first SQLWarning or null
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2830
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2831
    public SQLWarning getWarnings() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2832
        return sqlwarn;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2833
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2834
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2835
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2836
     * Clears all the warnings reporeted for the <code>CachedRowSetImpl</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2837
     * object. After a call to this method, the <code>getWarnings</code> method
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2838
     * returns <code>null</code> until a new warning is reported for this
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2839
     * <code>CachedRowSetImpl</code> object.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2840
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2841
    public void clearWarnings() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2842
        sqlwarn = null;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2843
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2844
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2845
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2846
     * Retrieves the name of the SQL cursor used by this
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2847
     * <code>CachedRowSetImpl</code> object.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2848
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2849
     * <P>In SQL, a result table is retrieved through a cursor that is
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2850
     * named. The current row of a <code>ResultSet</code> can be updated or deleted
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2851
     * using a positioned update/delete statement that references the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2852
     * cursor name. To ensure that the cursor has the proper isolation
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2853
     * level to support an update operation, the cursor's <code>SELECT</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2854
     * statement should be of the form <code>select for update</code>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2855
     * If the <code>for update</code> clause
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2856
     * is omitted, positioned updates may fail.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2857
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2858
     * <P>JDBC supports this SQL feature by providing the name of the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2859
     * SQL cursor used by a <code>ResultSet</code> object. The current row
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2860
     * of a result set is also the current row of this SQL cursor.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2861
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2862
     * <P><B>Note:</B> If positioned updates are not supported, an
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2863
     * <code>SQLException</code> is thrown.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2864
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2865
     * @return the SQL cursor name for this <code>CachedRowSetImpl</code> object's
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2866
     *         cursor
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2867
     * @throws SQLException if an error occurs
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2868
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2869
    public String getCursorName() throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2870
        throw new SQLException(resBundle.handleGetObject("cachedrowsetimpl.posupdate").toString());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2871
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2872
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2873
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2874
     * Retrieves a <code>ResultSetMetaData</code> object instance that
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2875
     * contains information about the <code>CachedRowSet</code> object.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2876
     * However, applications should cast the returned object to a
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2877
     * <code>RowSetMetaData</code> interface implementation. In the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2878
     * reference implementation, this cast can be done on the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2879
     * <code>RowSetMetaDataImpl</code> class.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2880
     * <P>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2881
     * For example:
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2882
     * <pre>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2883
     * CachedRowSet crs = new CachedRowSetImpl();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2884
     * RowSetMetaDataImpl metaData =
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2885
     *     (RowSetMetaDataImpl)crs.getMetaData();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2886
     * // Set the number of columns in the RowSet object for
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2887
     * // which this RowSetMetaDataImpl object was created to the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2888
     * // given number.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2889
     * metaData.setColumnCount(3);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2890
     * crs.setMetaData(metaData);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2891
     * </pre>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2892
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2893
     * @return the <code>ResultSetMetaData</code> object that describes this
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2894
     *         <code>CachedRowSetImpl</code> object's columns
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2895
     * @throws SQLException if an error occurs in generating the RowSet
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2896
     * meta data; or if the <code>CachedRowSetImpl</code> is empty.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2897
     * @see javax.sql.RowSetMetaData
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2898
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2899
    public ResultSetMetaData getMetaData() throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2900
        return (ResultSetMetaData)RowSetMD;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2901
    }
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
     * Retrieves the value of the designated column in the current row
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2906
     * of this <code>CachedRowSetImpl</code> object as an
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2907
     * <code>Object</code> value.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2908
     * <P>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2909
     * The type of the <code>Object</code> will be the default
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2910
     * Java object type corresponding to the column's SQL type,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2911
     * following the mapping for built-in types specified in the JDBC 3.0
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2912
     * specification.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2913
     * <P>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2914
     * This method may also be used to read datatabase-specific
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2915
     * abstract data types.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2916
     * <P>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2917
     * This implementation of the method <code>getObject</code> extends its
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2918
     * behavior so that it gets the attributes of an SQL structured type
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2919
     * as an array of <code>Object</code> values.  This method also custom
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2920
     * maps SQL user-defined types to classes in the Java programming language.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2921
     * When the specified column contains
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2922
     * a structured or distinct value, the behavior of this method is as
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2923
     * if it were a call to the method <code>getObject(columnIndex,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2924
     * this.getStatement().getConnection().getTypeMap())</code>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2925
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2926
     * @param columnIndex the first column is <code>1</code>, the second
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2927
     *        is <code>2</code>, and so on; must be <code>1</code> or larger
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2928
     *        and equal to or less than the number of columns in the rowset
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2929
     * @return a <code>java.lang.Object</code> holding the column value;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2930
     *         if the value is SQL <code>NULL</code>, the result is <code>null</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2931
     * @throws SQLException if the given column index is out of bounds,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2932
     *            the cursor is not on a valid row, or there is a problem getting
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2933
     *            the <code>Class</code> object for a custom mapping
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2934
     * @see #getObject(String)
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2935
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2936
    public Object getObject(int columnIndex) throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2937
        Object value;
9257
53e6d7bc31b0 7035615: Address lint warnings for javax.sql.rowset & com.sun.rowset
lancea
parents: 6697
diff changeset
  2938
        Map<String, Class<?>> map;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2939
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2940
        // sanity check.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2941
        checkIndex(columnIndex);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2942
        // make sure the cursor is on a valid row
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2943
        checkCursor();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2944
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2945
        setLastValueNull(false);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2946
        value = getCurrentRow().getColumnObject(columnIndex);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2947
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2948
        // check for SQL NULL
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2949
        if (value == null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2950
            setLastValueNull(true);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2951
            return null;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2952
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2953
        if (value instanceof Struct) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2954
            Struct s = (Struct)value;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2955
            map = getTypeMap();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2956
            // look up the class in the map
11129
f9ad1aadf3fa 7116445: Miscellaneous warnings in the JDBC/RowSet classes
lancea
parents: 9537
diff changeset
  2957
            Class<?> c = map.get(s.getSQLTypeName());
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2958
            if (c != null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2959
                // create new instance of the class
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2960
                SQLData obj = null;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2961
                try {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2962
                    obj = (SQLData)c.newInstance();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2963
                } catch (java.lang.InstantiationException ex) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2964
                    throw new SQLException(MessageFormat.format(resBundle.handleGetObject("cachedrowsetimpl.unableins").toString(),
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2965
                    ex.getMessage()));
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2966
                } catch (java.lang.IllegalAccessException ex) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2967
                    throw new SQLException(MessageFormat.format(resBundle.handleGetObject("cachedrowsetimpl.unableins").toString(),
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2968
                    ex.getMessage()));
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2969
                }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2970
                // get the attributes from the struct
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2971
                Object attribs[] = s.getAttributes(map);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2972
                // create the SQLInput "stream"
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2973
                SQLInputImpl sqlInput = new SQLInputImpl(attribs, map);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2974
                // read the values...
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2975
                obj.readSQL(sqlInput, s.getSQLTypeName());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2976
                return (Object)obj;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2977
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2978
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2979
        return value;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2980
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2981
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2982
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2983
     * Retrieves the value of the designated column in the current row
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2984
     * of this <code>CachedRowSetImpl</code> object as an
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2985
     * <code>Object</code> value.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2986
     * <P>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2987
     * The type of the <code>Object</code> will be the default
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2988
     * Java object type corresponding to the column's SQL type,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2989
     * following the mapping for built-in types specified in the JDBC 3.0
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2990
     * specification.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2991
     * <P>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2992
     * This method may also be used to read datatabase-specific
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2993
     * abstract data types.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2994
     * <P>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2995
     * This implementation of the method <code>getObject</code> extends its
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2996
     * behavior so that it gets the attributes of an SQL structured type
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2997
     * as an array of <code>Object</code> values.  This method also custom
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2998
     * maps SQL user-defined types to classes
90ce3da70b43 Initial load
duke
parents:
diff changeset
  2999
     * in the Java programming language. When the specified column contains
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3000
     * a structured or distinct value, the behavior of this method is as
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3001
     * if it were a call to the method <code>getObject(columnIndex,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3002
     * this.getStatement().getConnection().getTypeMap())</code>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3003
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3004
     * @param columnName a <code>String</code> object that must match the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3005
     *        SQL name of a column in this rowset, ignoring case
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3006
     * @return a <code>java.lang.Object</code> holding the column value;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3007
     *         if the value is SQL <code>NULL</code>, the result is <code>null</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3008
     * @throws SQLException if (1) the given column name does not match one of
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3009
     *            this rowset's column names, (2) the cursor is not
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3010
     *            on a valid row, or (3) there is a problem getting
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3011
     *            the <code>Class</code> object for a custom mapping
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3012
     * @see #getObject(int)
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3013
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3014
    public Object getObject(String columnName) throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3015
        return getObject(getColIdxByName(columnName));
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3016
    }
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
     * Maps the given column name for one of this <code>CachedRowSetImpl</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3022
     * object's columns to its column number.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3023
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3024
     * @param columnName a <code>String</code> object that must match the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3025
     *        SQL name of a column in this rowset, ignoring case
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3026
     * @return the column index of the given column name
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3027
     * @throws SQLException if the given column name does not match one
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3028
     *            of this rowset's column names
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3029
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3030
    public int findColumn(String columnName) throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3031
        return getColIdxByName(columnName);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3032
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3033
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3034
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3035
    //--------------------------JDBC 2.0-----------------------------------
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3036
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3037
    //---------------------------------------------------------------------
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3038
    // Getter's and Setter's
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3039
    //---------------------------------------------------------------------
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3040
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3041
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3042
     * Retrieves the value stored in the designated column
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3043
     * of the current row as a <code>java.io.Reader</code> object.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3044
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3045
     * <P><B>Note:</B> All the data in the returned stream must
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3046
     * be read prior to getting the value of any other column. The
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3047
     * next call to a <code>getXXX</code> method implicitly closes the stream.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3048
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3049
     * @param columnIndex the first column is <code>1</code>, the second
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3050
     *        is <code>2</code>, and so on; must be <code>1</code> or larger
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3051
     *        and equal to or less than the number of columns in the rowset
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3052
     * @return a Java character stream that delivers the database column value
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3053
     * as a stream of two-byte unicode characters in a
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3054
     * <code>java.io.Reader</code> object.  If the value is
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3055
     * SQL <code>NULL</code>, the result is <code>null</code>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3056
     * @throws SQLException if (1) the given column index is out of bounds,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3057
     * (2) the cursor is not on one of this rowset's rows or its
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3058
     * insert row, or (3) the designated column does not store an
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3059
     * SQL <code>CHAR, VARCHAR, <b>LONGVARCHAR</b>, BINARY, VARBINARY</code> or
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3060
     * <code>LONGVARBINARY</code> value.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3061
     * The bold SQL type designates the recommended return type.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3062
     * @see #getCharacterStream(String)
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3063
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3064
    public java.io.Reader getCharacterStream(int columnIndex) throws SQLException{
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3065
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3066
        // sanity check.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3067
        checkIndex(columnIndex);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3068
        // make sure the cursor is on a valid row
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3069
        checkCursor();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3070
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3071
        if (isBinary(RowSetMD.getColumnType(columnIndex))) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3072
            Object value = getCurrentRow().getColumnObject(columnIndex);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3073
            if (value == null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3074
                lastValueNull = true;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3075
                return null;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3076
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3077
            charStream = new InputStreamReader
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3078
            (new ByteArrayInputStream((byte[])value));
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3079
        } else if (isString(RowSetMD.getColumnType(columnIndex))) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3080
            Object value = getCurrentRow().getColumnObject(columnIndex);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3081
            if (value == null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3082
                lastValueNull = true;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3083
                return null;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3084
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3085
            charStream = new StringReader(value.toString());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3086
        } else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3087
            throw new SQLException(resBundle.handleGetObject("cachedrowsetimpl.dtypemismt").toString());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3088
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3089
11129
f9ad1aadf3fa 7116445: Miscellaneous warnings in the JDBC/RowSet classes
lancea
parents: 9537
diff changeset
  3090
        return charStream;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3091
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3092
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3093
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3094
     * Retrieves the value stored in the designated column
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3095
     * of the current row as a <code>java.io.Reader</code> object.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3096
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3097
     * <P><B>Note:</B> All the data in the returned stream must
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3098
     * be read prior to getting the value of any other column. The
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3099
     * next call to a <code>getXXX</code> method implicitly closes the stream.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3100
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3101
     * @param columnName a <code>String</code> object giving the SQL name of
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3102
     *        a column in this <code>CachedRowSetImpl</code> object
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3103
     * @return a Java input stream that delivers the database column value
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3104
     *         as a stream of two-byte Unicode characters.  If the value is
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3105
     *         SQL <code>NULL</code>, the result is <code>null</code>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3106
     * @throws SQLException if (1) the given column name is not the name of
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3107
     * a column in this rowset, (2) the cursor is not on one of
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3108
     * this rowset's rows or its insert row, or (3) the designated
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3109
     * column does not store an SQL <code>CHAR, VARCHAR, <b>LONGVARCHAR</b>,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3110
     * BINARY, VARYBINARY</code> or <code>LONGVARBINARY</code> value.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3111
     * The bold SQL type designates the recommended return type.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3112
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3113
    public java.io.Reader getCharacterStream(String columnName) throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3114
        return getCharacterStream(getColIdxByName(columnName));
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3115
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3116
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3117
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3118
     * Retrieves the value of the designated column in the current row
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3119
     * of this <code>CachedRowSetImpl</code> object as a
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3120
     * <code>java.math.BigDecimal</code> object.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3121
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3122
     * @param columnIndex the first column is <code>1</code>, the second
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3123
     *        is <code>2</code>, and so on; must be <code>1</code> or larger
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3124
     *        and equal to or less than the number of columns in the rowset
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3125
     * @return a <code>java.math.BigDecimal</code> value with full precision;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3126
     *         if the value is SQL <code>NULL</code>, the result is <code>null</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3127
     * @throws SQLException if (1) the given column index is out of bounds,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3128
     * (2) the cursor is not on one of this rowset's rows or its
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3129
     * insert row, or (3) the designated column does not store an
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3130
     * SQL <code>TINYINT, SMALLINT, INTEGER, BIGINT, REAL,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3131
     * FLOAT, DOUBLE, <b>DECIMAL</b>, <b>NUMERIC</b>, BIT, CHAR, VARCHAR</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3132
     * or <code>LONGVARCHAR</code> value. The bold SQL type designates the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3133
     * recommended return types that this method is used to retrieve.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3134
     * @see #getBigDecimal(String)
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3135
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3136
    public BigDecimal getBigDecimal(int columnIndex) throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3137
        Object value;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3138
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3139
        // sanity check.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3140
        checkIndex(columnIndex);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3141
        // make sure the cursor is on a valid row
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3142
        checkCursor();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3143
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3144
        setLastValueNull(false);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3145
        value = getCurrentRow().getColumnObject(columnIndex);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3146
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3147
        // check for SQL NULL
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3148
        if (value == null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3149
            setLastValueNull(true);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3150
            return null;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3151
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3152
        try {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3153
            return (new BigDecimal(value.toString().trim()));
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3154
        } catch (NumberFormatException ex) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3155
            throw new SQLException(MessageFormat.format(resBundle.handleGetObject("cachedrowsetimpl.doublefail").toString(),
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3156
                new Object[] {value.toString().trim(), columnIndex}));
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3157
        }
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
     * Retrieves the value of the designated column in the current row
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3162
     * of this <code>CachedRowSetImpl</code> object as a
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3163
     * <code>java.math.BigDecimal</code> object.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3164
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3165
     * @param columnName a <code>String</code> object that must match the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3166
     *        SQL name of a column in this rowset, ignoring case
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3167
     * @return a <code>java.math.BigDecimal</code> value with full precision;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3168
     *         if the value is SQL <code>NULL</code>, the result is <code>null</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3169
     * @throws SQLException if (1) the given column name is not the name of
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3170
     * a column in this rowset, (2) the cursor is not on one of
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3171
     * this rowset's rows or its insert row, or (3) the designated
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3172
     * column does not store an SQL <code>TINYINT, SMALLINT, INTEGER
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3173
     * BIGINT, REAL, FLOAT, DOUBLE, <b>DECIMAL</b>, <b>NUMERIC</b>, BIT CHAR,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3174
     * VARCHAR</code> or <code>LONGVARCHAR</code> value. The bold SQL type
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3175
     * designates the recommended return type that this method is used to
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3176
     * retrieve
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3177
     * @see #getBigDecimal(int)
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3178
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3179
    public BigDecimal getBigDecimal(String columnName) throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3180
        return getBigDecimal(getColIdxByName(columnName));
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3181
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3182
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3183
    //---------------------------------------------------------------------
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3184
    // Traversal/Positioning
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3185
    //---------------------------------------------------------------------
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3186
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3187
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3188
     * Returns the number of rows in this <code>CachedRowSetImpl</code> object.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3189
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3190
     * @return number of rows in the rowset
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3191
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3192
    public int size() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3193
        return numRows;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3194
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3195
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3196
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3197
     * Indicates whether the cursor is before the first row in this
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3198
     * <code>CachedRowSetImpl</code> object.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3199
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3200
     * @return <code>true</code> if the cursor is before the first row;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3201
     *         <code>false</code> otherwise or if the rowset contains no rows
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3202
     * @throws SQLException if an error occurs
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3203
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3204
    public boolean isBeforeFirst() throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3205
        if (cursorPos == 0 && numRows > 0) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3206
            return true;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3207
        } else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3208
            return false;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3209
        }
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
     * Indicates whether the cursor is after the last row in this
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3214
     * <code>CachedRowSetImpl</code> object.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3215
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3216
     * @return <code>true</code> if the cursor is after the last row;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3217
     *         <code>false</code> otherwise or if the rowset contains no rows
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3218
     * @throws SQLException if an error occurs
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3219
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3220
    public boolean isAfterLast() throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3221
        if (cursorPos == numRows+1 && numRows > 0) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3222
            return true;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3223
        } else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3224
            return false;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3225
        }
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
     * Indicates whether the cursor is on the first row in this
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3230
     * <code>CachedRowSetImpl</code> object.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3231
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3232
     * @return <code>true</code> if the cursor is on the first row;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3233
     *         <code>false</code> otherwise or if the rowset contains no rows
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3234
     * @throws SQLException if an error occurs
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3235
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3236
    public boolean isFirst() throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3237
        // this becomes nasty because of deletes.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3238
        int saveCursorPos = cursorPos;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3239
        int saveAbsoluteCursorPos = absolutePos;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3240
        internalFirst();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3241
        if (cursorPos == saveCursorPos) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3242
            return true;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3243
        } else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3244
            cursorPos = saveCursorPos;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3245
            absolutePos = saveAbsoluteCursorPos;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3246
            return false;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3247
        }
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
     * Indicates whether the cursor is on the last row in this
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3252
     * <code>CachedRowSetImpl</code> object.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3253
     * <P>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3254
     * Note: Calling the method <code>isLast</code> may be expensive
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3255
     * because the JDBC driver might need to fetch ahead one row in order
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3256
     * to determine whether the current row is the last row in this rowset.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3257
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3258
     * @return <code>true</code> if the cursor is on the last row;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3259
     *         <code>false</code> otherwise or if this rowset contains no rows
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3260
     * @throws SQLException if an error occurs
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3261
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3262
    public boolean isLast() throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3263
        int saveCursorPos = cursorPos;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3264
        int saveAbsoluteCursorPos = absolutePos;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3265
        boolean saveShowDeleted = getShowDeleted();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3266
        setShowDeleted(true);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3267
        internalLast();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3268
        if (cursorPos == saveCursorPos) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3269
            setShowDeleted(saveShowDeleted);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3270
            return true;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3271
        } else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3272
            setShowDeleted(saveShowDeleted);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3273
            cursorPos = saveCursorPos;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3274
            absolutePos = saveAbsoluteCursorPos;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3275
            return false;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3276
        }
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
     * Moves this <code>CachedRowSetImpl</code> object's cursor to the front of
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3281
     * the rowset, just before the first row. This method has no effect if
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3282
     * this rowset contains no rows.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3283
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3284
     * @throws SQLException if an error occurs or the type of this rowset
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3285
     *            is <code>ResultSet.TYPE_FORWARD_ONLY</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3286
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3287
    public void beforeFirst() throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3288
       if (getType() == ResultSet.TYPE_FORWARD_ONLY) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3289
            throw new SQLException(resBundle.handleGetObject("cachedrowsetimpl.beforefirst").toString());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3290
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3291
        cursorPos = 0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3292
        absolutePos = 0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3293
        notifyCursorMoved();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3294
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3295
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3296
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3297
     * Moves this <code>CachedRowSetImpl</code> object's cursor to the end of
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3298
     * the rowset, just after the last row. This method has no effect if
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3299
     * this rowset contains no rows.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3300
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3301
     * @throws SQLException if an error occurs
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3302
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3303
    public void afterLast() throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3304
        if (numRows > 0) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3305
            cursorPos = numRows + 1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3306
            absolutePos = 0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3307
            notifyCursorMoved();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3308
        }
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
     * Moves this <code>CachedRowSetImpl</code> object's cursor to the first row
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3313
     * and returns <code>true</code> if the operation was successful.  This
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3314
     * method also notifies registered listeners that the cursor has moved.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3315
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3316
     * @return <code>true</code> if the cursor is on a valid row;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3317
     *         <code>false</code> otherwise or if there are no rows in this
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3318
     *         <code>CachedRowSetImpl</code> object
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3319
     * @throws SQLException if the type of this rowset
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3320
     *            is <code>ResultSet.TYPE_FORWARD_ONLY</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3321
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3322
    public boolean first() throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3323
        if(getType() == ResultSet.TYPE_FORWARD_ONLY) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3324
            throw new SQLException(resBundle.handleGetObject("cachedrowsetimpl.first").toString());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3325
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3326
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3327
        // move and notify
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3328
        boolean ret = this.internalFirst();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3329
        notifyCursorMoved();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3330
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3331
        return ret;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3332
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3333
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3334
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3335
     * Moves this <code>CachedRowSetImpl</code> object's cursor to the first
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3336
     * row and returns <code>true</code> if the operation is successful.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3337
     * <P>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3338
     * This method is called internally by the methods <code>first</code>,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3339
     * <code>isFirst</code>, and <code>absolute</code>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3340
     * It in turn calls the method <code>internalNext</code> in order to
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3341
     * handle the case where the first row is a deleted row that is not visible.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3342
     * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3343
     * This is a implementation only method and is not required as a standard
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3344
     * implementation of the <code>CachedRowSet</code> interface.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3345
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3346
     * @return <code>true</code> if the cursor moved to the first row;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3347
     *         <code>false</code> otherwise
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3348
     * @throws SQLException if an error occurs
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3349
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3350
    protected boolean internalFirst() throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3351
        boolean ret = false;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3352
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3353
        if (numRows > 0) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3354
            cursorPos = 1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3355
            if ((getShowDeleted() == false) && (rowDeleted() == true)) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3356
                ret = internalNext();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3357
            } else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3358
                ret = true;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3359
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3360
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3361
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3362
        if (ret == true)
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3363
            absolutePos = 1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3364
        else
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3365
            absolutePos = 0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3366
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3367
        return ret;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3368
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3369
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3370
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3371
     * Moves this <code>CachedRowSetImpl</code> object's cursor to the last row
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3372
     * and returns <code>true</code> if the operation was successful.  This
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3373
     * method also notifies registered listeners that the cursor has moved.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3374
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3375
     * @return <code>true</code> if the cursor is on a valid row;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3376
     *         <code>false</code> otherwise or if there are no rows in this
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3377
     *         <code>CachedRowSetImpl</code> object
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3378
     * @throws SQLException if the type of this rowset
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3379
     *            is <code>ResultSet.TYPE_FORWARD_ONLY</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3380
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3381
    public boolean last() throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3382
        if (getType() == ResultSet.TYPE_FORWARD_ONLY) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3383
            throw new SQLException(resBundle.handleGetObject("cachedrowsetimpl.last").toString());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3384
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3385
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3386
        // move and notify
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3387
        boolean ret = this.internalLast();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3388
        notifyCursorMoved();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3389
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3390
        return ret;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3391
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3392
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3393
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3394
     * Moves this <code>CachedRowSetImpl</code> object's cursor to the last
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3395
     * row and returns <code>true</code> if the operation is successful.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3396
     * <P>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3397
     * This method is called internally by the method <code>last</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3398
     * when rows have been deleted and the deletions are not visible.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3399
     * The method <code>internalLast</code> handles the case where the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3400
     * last row is a deleted row that is not visible by in turn calling
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3401
     * the method <code>internalPrevious</code>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3402
     * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3403
     * This is a implementation only method and is not required as a standard
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3404
     * implementation of the <code>CachedRowSet</code> interface.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3405
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3406
     * @return <code>true</code> if the cursor moved to the last row;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3407
     *         <code>false</code> otherwise
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3408
     * @throws SQLException if an error occurs
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3409
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3410
    protected boolean internalLast() throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3411
        boolean ret = false;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3412
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3413
        if (numRows > 0) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3414
            cursorPos = numRows;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3415
            if ((getShowDeleted() == false) && (rowDeleted() == true)) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3416
                ret = internalPrevious();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3417
            } else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3418
                ret = true;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3419
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3420
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3421
        if (ret == true)
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3422
            absolutePos = numRows - numDeleted;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3423
        else
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3424
            absolutePos = 0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3425
        return ret;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3426
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3427
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3428
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3429
     * Returns the number of the current row in this <code>CachedRowSetImpl</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3430
     * object. The first row is number 1, the second number 2, and so on.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3431
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3432
     * @return the number of the current row;  <code>0</code> if there is no
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3433
     *         current row
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3434
     * @throws SQLException if an error occurs; or if the <code>CacheRowSetImpl</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3435
     *         is empty
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3436
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3437
    public int getRow() throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3438
        // are we on a valid row? Valid rows are between first and last
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3439
        if (numRows > 0 &&
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3440
        cursorPos > 0 &&
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3441
        cursorPos < (numRows + 1) &&
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3442
        (getShowDeleted() == false && rowDeleted() == false)) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3443
            return absolutePos;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3444
        } else if (getShowDeleted() == true) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3445
            return cursorPos;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3446
        } else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3447
            return 0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3448
        }
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
     * Moves this <code>CachedRowSetImpl</code> object's cursor to the row number
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3453
     * specified.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3454
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3455
     * <p>If the number is positive, the cursor moves to an absolute row with
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3456
     * respect to the beginning of the rowset.  The first row is row 1, the second
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3457
     * is row 2, and so on.  For example, the following command, in which
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3458
     * <code>crs</code> is a <code>CachedRowSetImpl</code> object, moves the cursor
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3459
     * to the fourth row, starting from the beginning of the rowset.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3460
     * <PRE><code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3461
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3462
     *    crs.absolute(4);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3463
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3464
     * </code> </PRE>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3465
     * <P>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3466
     * If the number is negative, the cursor moves to an absolute row position
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3467
     * with respect to the end of the rowset.  For example, calling
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3468
     * <code>absolute(-1)</code> positions the cursor on the last row,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3469
     * <code>absolute(-2)</code> moves it on the next-to-last row, and so on.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3470
     * If the <code>CachedRowSetImpl</code> object <code>crs</code> has five rows,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3471
     * the following command moves the cursor to the fourth-to-last row, which
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3472
     * in the case of a  rowset with five rows, is also the second row, counting
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3473
     * from the beginning.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3474
     * <PRE><code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3475
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3476
     *    crs.absolute(-4);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3477
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3478
     * </code> </PRE>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3479
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3480
     * If the number specified is larger than the number of rows, the cursor
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3481
     * will move to the position after the last row. If the number specified
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3482
     * would move the cursor one or more rows before the first row, the cursor
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3483
     * moves to the position before the first row.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3484
     * <P>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3485
     * Note: Calling <code>absolute(1)</code> is the same as calling the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3486
     * method <code>first()</code>.  Calling <code>absolute(-1)</code> is the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3487
     * same as calling <code>last()</code>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3488
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3489
     * @param row a positive number to indicate the row, starting row numbering from
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3490
     *        the first row, which is <code>1</code>; a negative number to indicate
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3491
     *        the row, starting row numbering from the last row, which is
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3492
     *        <code>-1</code>; it must not be <code>0</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3493
     * @return <code>true</code> if the cursor is on the rowset; <code>false</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3494
     *         otherwise
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3495
     * @throws SQLException if the given cursor position is <code>0</code> or the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3496
     *            type of this rowset is <code>ResultSet.TYPE_FORWARD_ONLY</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3497
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3498
    public boolean absolute( int row ) throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3499
        if (row == 0 || getType() == ResultSet.TYPE_FORWARD_ONLY) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3500
            throw new SQLException(resBundle.handleGetObject("cachedrowsetimpl.absolute").toString());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3501
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3502
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3503
        if (row > 0) { // we are moving foward
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3504
            if (row > numRows) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3505
                // fell off the end
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3506
                afterLast();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3507
                return false;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3508
            } else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3509
                if (absolutePos <= 0)
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3510
                    internalFirst();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3511
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3512
        } else { // we are moving backward
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3513
            if (cursorPos + row < 0) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3514
                // fell off the front
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3515
                beforeFirst();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3516
                return false;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3517
            } else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3518
                if (absolutePos >= 0)
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3519
                    internalLast();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3520
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3521
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3522
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3523
        // Now move towards the absolute row that we're looking for
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3524
        while (absolutePos != row) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3525
            if (absolutePos < row) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3526
                if (!internalNext())
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3527
                    break;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3528
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3529
            else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3530
                if (!internalPrevious())
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3531
                    break;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3532
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3533
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3534
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3535
        notifyCursorMoved();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3536
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3537
        if (isAfterLast() || isBeforeFirst()) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3538
            return false;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3539
        } else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3540
            return true;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3541
        }
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
     * Moves the cursor the specified number of rows from the current
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3546
     * position, with a positive number moving it forward and a
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3547
     * negative number moving it backward.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3548
     * <P>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3549
     * If the number is positive, the cursor moves the specified number of
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3550
     * rows toward the end of the rowset, starting at the current row.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3551
     * For example, the following command, in which
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3552
     * <code>crs</code> is a <code>CachedRowSetImpl</code> object with 100 rows,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3553
     * moves the cursor forward four rows from the current row.  If the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3554
     * current row is 50, the cursor would move to row 54.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3555
     * <PRE><code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3556
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3557
     *    crs.relative(4);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3558
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3559
     * </code> </PRE>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3560
     * <P>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3561
     * If the number is negative, the cursor moves back toward the beginning
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3562
     * the specified number of rows, starting at the current row.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3563
     * For example, calling the method
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3564
     * <code>absolute(-1)</code> positions the cursor on the last row,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3565
     * <code>absolute(-2)</code> moves it on the next-to-last row, and so on.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3566
     * If the <code>CachedRowSetImpl</code> object <code>crs</code> has five rows,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3567
     * the following command moves the cursor to the fourth-to-last row, which
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3568
     * in the case of a  rowset with five rows, is also the second row
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3569
     * from the beginning.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3570
     * <PRE><code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3571
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3572
     *    crs.absolute(-4);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3573
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3574
     * </code> </PRE>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3575
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3576
     * If the number specified is larger than the number of rows, the cursor
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3577
     * will move to the position after the last row. If the number specified
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3578
     * would move the cursor one or more rows before the first row, the cursor
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3579
     * moves to the position before the first row. In both cases, this method
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3580
     * throws an <code>SQLException</code>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3581
     * <P>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3582
     * Note: Calling <code>absolute(1)</code> is the same as calling the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3583
     * method <code>first()</code>.  Calling <code>absolute(-1)</code> is the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3584
     * same as calling <code>last()</code>.  Calling <code>relative(0)</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3585
     * is valid, but it does not change the cursor position.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3586
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3587
     * @param rows an <code>int</code> indicating the number of rows to move
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3588
     *             the cursor, starting at the current row; a positive number
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3589
     *             moves the cursor forward; a negative number moves the cursor
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3590
     *             backward; must not move the cursor past the valid
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3591
     *             rows
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3592
     * @return <code>true</code> if the cursor is on a row in this
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3593
     *         <code>CachedRowSetImpl</code> object; <code>false</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3594
     *         otherwise
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3595
     * @throws SQLException if there are no rows in this rowset, the cursor is
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3596
     *         positioned either before the first row or after the last row, or
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3597
     *         the rowset is type <code>ResultSet.TYPE_FORWARD_ONLY</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3598
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3599
    public boolean relative(int rows) throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3600
        if (numRows == 0 || isBeforeFirst() ||
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3601
        isAfterLast() || getType() == ResultSet.TYPE_FORWARD_ONLY) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3602
            throw new SQLException(resBundle.handleGetObject("cachedrowsetimpl.relative").toString());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3603
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3604
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3605
        if (rows == 0) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3606
            return true;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3607
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3608
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3609
        if (rows > 0) { // we are moving forward
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3610
            if (cursorPos + rows > numRows) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3611
                // fell off the end
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3612
                afterLast();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3613
            } else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3614
                for (int i=0; i < rows; i++) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3615
                    if (!internalNext())
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3616
                        break;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3617
                }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3618
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3619
        } else { // we are moving backward
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3620
            if (cursorPos + rows < 0) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3621
                // fell off the front
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3622
                beforeFirst();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3623
            } else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3624
                for (int i=rows; i < 0; i++) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3625
                    if (!internalPrevious())
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3626
                        break;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3627
                }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3628
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3629
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3630
        notifyCursorMoved();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3631
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3632
        if (isAfterLast() || isBeforeFirst()) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3633
            return false;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3634
        } else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3635
            return true;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3636
        }
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
     * Moves this <code>CachedRowSetImpl</code> object's cursor to the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3641
     * previous row and returns <code>true</code> if the cursor is on
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3642
     * a valid row or <code>false</code> if it is not.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3643
     * This method also notifies all listeners registered with this
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3644
     * <code>CachedRowSetImpl</code> object that its cursor has moved.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3645
     * <P>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3646
     * Note: calling the method <code>previous()</code> is not the same
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3647
     * as calling the method <code>relative(-1)</code>.  This is true
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3648
     * because it is possible to call <code>previous()</code> from the insert
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3649
     * row, from after the last row, or from the current row, whereas
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3650
     * <code>relative</code> may only be called from the current row.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3651
     * <P>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3652
     * The method <code>previous</code> may used in a <code>while</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3653
     * loop to iterate through a rowset starting after the last row
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3654
     * and moving toward the beginning. The loop ends when <code>previous</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3655
     * returns <code>false</code>, meaning that there are no more rows.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3656
     * For example, the following code fragment retrieves all the data in
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3657
     * the <code>CachedRowSetImpl</code> object <code>crs</code>, which has
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3658
     * three columns.  Note that the cursor must initially be positioned
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3659
     * after the last row so that the first call to the method
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3660
     * <code>previous</code> places the cursor on the last line.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3661
     * <PRE> <code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3662
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3663
     *     crs.afterLast();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3664
     *     while (previous()) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3665
     *         String name = crs.getString(1);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3666
     *         int age = crs.getInt(2);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3667
     *         short ssn = crs.getShort(3);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3668
     *         System.out.println(name + "   " + age + "   " + ssn);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3669
     *     }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3670
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3671
     * </code> </PRE>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3672
     * This method throws an <code>SQLException</code> if the cursor is not
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3673
     * on a row in the rowset, before the first row, or after the last row.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3674
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3675
     * @return <code>true</code> if the cursor is on a valid row;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3676
     *         <code>false</code> if it is before the first row or after the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3677
     *         last row
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3678
     * @throws SQLException if the cursor is not on a valid position or the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3679
     *           type of this rowset is <code>ResultSet.TYPE_FORWARD_ONLY</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3680
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3681
    public boolean previous() throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3682
        if (getType() == ResultSet.TYPE_FORWARD_ONLY) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3683
            throw new SQLException(resBundle.handleGetObject("cachedrowsetimpl.last").toString());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3684
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3685
        /*
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3686
         * make sure things look sane. The cursor must be
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3687
         * positioned in the rowset or before first (0) or
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3688
         * after last (numRows + 1)
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3689
         */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3690
        if (cursorPos < 0 || cursorPos > numRows + 1) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3691
            throw new SQLException(resBundle.handleGetObject("cachedrowsetimpl.invalidcp").toString());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3692
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3693
        // move and notify
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3694
        boolean ret = this.internalPrevious();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3695
        notifyCursorMoved();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3696
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3697
        return ret;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3698
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3699
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3700
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3701
     * Moves the cursor to the previous row in this <code>CachedRowSetImpl</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3702
     * object, skipping past deleted rows that are not visible; returns
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3703
     * <code>true</code> if the cursor is on a row in this rowset and
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3704
     * <code>false</code> when the cursor goes before the first row.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3705
     * <P>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3706
     * This method is called internally by the method <code>previous</code>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3707
     * <P>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3708
     * This is a implementation only method and is not required as a standard
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3709
     * implementation of the <code>CachedRowSet</code> interface.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3710
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3711
     * @return <code>true</code> if the cursor is on a row in this rowset;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3712
     *         <code>false</code> when the cursor reaches the position before
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3713
     *         the first row
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3714
     * @throws SQLException if an error occurs
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3715
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3716
    protected boolean internalPrevious() throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3717
        boolean ret = false;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3718
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3719
        do {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3720
            if (cursorPos > 1) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3721
                --cursorPos;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3722
                ret = true;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3723
            } else if (cursorPos == 1) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3724
                // decrement to before first
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3725
                --cursorPos;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3726
                ret = false;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3727
                break;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3728
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3729
        } while ((getShowDeleted() == false) && (rowDeleted() == true));
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3730
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3731
        /*
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3732
         * Each call to internalPrevious may move the cursor
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3733
         * over multiple rows, the absolute postion moves one one row
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3734
         */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3735
        if (ret == true)
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3736
            --absolutePos;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3737
        else
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3738
            absolutePos = 0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3739
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3740
        return ret;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3741
    }
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
    // Updates
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3746
    //---------------------------------------------------------------------
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3747
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3748
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3749
     * Indicates whether the current row of this <code>CachedRowSetImpl</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3750
     * object has been updated.  The value returned
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3751
     * depends on whether this rowset can detect updates: <code>false</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3752
     * will always be returned if it does not detect updates.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3753
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3754
     * @return <code>true</code> if the row has been visibly updated
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3755
     *         by the owner or another and updates are detected;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3756
     *         <code>false</code> otherwise
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3757
     * @throws SQLException if the cursor is on the insert row or not
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3758
     *            not on a valid row
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3759
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3760
     * @see DatabaseMetaData#updatesAreDetected
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3761
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3762
    public boolean rowUpdated() throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3763
        // make sure the cursor is on a valid row
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3764
        checkCursor();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3765
        if (onInsertRow == true) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3766
            throw new SQLException(resBundle.handleGetObject("cachedrowsetimpl.invalidop").toString());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3767
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3768
        return(((Row)getCurrentRow()).getUpdated());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3769
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3770
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3771
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3772
     * Indicates whether the designated column of the current row of
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3773
     * this <code>CachedRowSetImpl</code> object has been updated. The
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3774
     * value returned depends on whether this rowset can detcted updates:
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3775
     * <code>false</code> will always be returned if it does not detect updates.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3776
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3777
     * @param idx the index identifier of the column that may be have been updated.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3778
     * @return <code>true</code> is the designated column has been updated
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3779
     * and the rowset detects updates; <code>false</code> if the rowset has not
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3780
     * been updated or the rowset does not detect updates
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3781
     * @throws SQLException if the cursor is on the insert row or not
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3782
     *          on a valid row
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3783
     * @see DatabaseMetaData#updatesAreDetected
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3784
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3785
    public boolean columnUpdated(int idx) throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3786
        // make sure the cursor is on a valid row
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3787
        checkCursor();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3788
        if (onInsertRow == true) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3789
            throw new SQLException(resBundle.handleGetObject("cachedrowsetimpl.invalidop").toString());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3790
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3791
        return (((Row)getCurrentRow()).getColUpdated(idx - 1));
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3792
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3793
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3794
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3795
     * Indicates whether the designated column of the current row of
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3796
     * this <code>CachedRowSetImpl</code> object has been updated. The
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3797
     * value returned depends on whether this rowset can detcted updates:
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3798
     * <code>false</code> will always be returned if it does not detect updates.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3799
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3800
     * @param columnName the <code>String</code> column name column that may be have
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3801
     * been updated.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3802
     * @return <code>true</code> is the designated column has been updated
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3803
     * and the rowset detects updates; <code>false</code> if the rowset has not
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3804
     * been updated or the rowset does not detect updates
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3805
     * @throws SQLException if the cursor is on the insert row or not
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3806
     *          on a valid row
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3807
     * @see DatabaseMetaData#updatesAreDetected
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3808
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3809
    public boolean columnUpdated(String columnName) throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3810
        return columnUpdated(getColIdxByName(columnName));
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3811
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3812
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3813
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3814
     * Indicates whether the current row has been inserted.  The value returned
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3815
     * depends on whether or not the rowset can detect visible inserts.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3816
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3817
     * @return <code>true</code> if a row has been inserted and inserts are detected;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3818
     *         <code>false</code> otherwise
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3819
     * @throws SQLException if the cursor is on the insert row or not
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3820
     *            not on a valid row
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3821
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3822
     * @see DatabaseMetaData#insertsAreDetected
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3823
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3824
    public boolean rowInserted() throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3825
        // make sure the cursor is on a valid row
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3826
        checkCursor();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3827
        if (onInsertRow == true) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3828
            throw new SQLException(resBundle.handleGetObject("cachedrowsetimpl.invalidop").toString());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3829
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3830
        return(((Row)getCurrentRow()).getInserted());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3831
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3832
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3833
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3834
     * Indicates whether the current row has been deleted.  A deleted row
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3835
     * may leave a visible "hole" in a rowset.  This method can be used to
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3836
     * detect such holes if the rowset can detect deletions. This method
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3837
     * will always return <code>false</code> if this rowset cannot detect
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3838
     * deletions.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3839
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3840
     * @return <code>true</code> if (1)the current row is blank, indicating that
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3841
     *         the row has been deleted, and (2)deletions are detected;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3842
     *         <code>false</code> otherwise
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3843
     * @throws SQLException if the cursor is on a valid row in this rowset
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3844
     * @see DatabaseMetaData#deletesAreDetected
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3845
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3846
    public boolean rowDeleted() throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3847
        // make sure the cursor is on a valid row
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3848
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3849
        if (isAfterLast() == true ||
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3850
        isBeforeFirst() == true ||
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3851
        onInsertRow == true) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3852
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3853
            throw new SQLException(resBundle.handleGetObject("cachedrowsetimpl.invalidcp").toString());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3854
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3855
        return(((Row)getCurrentRow()).getDeleted());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3856
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3857
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3858
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3859
     * Indicates whether the given SQL data type is a numberic type.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3860
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3861
     * @param type one of the constants from <code>java.sql.Types</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3862
     * @return <code>true</code> if the given type is <code>NUMERIC</code>,'
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3863
     *         <code>DECIMAL</code>, <code>BIT</code>, <code>TINYINT</code>,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3864
     *         <code>SMALLINT</code>, <code>INTEGER</code>, <code>BIGINT</code>,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3865
     *         <code>REAL</code>, <code>DOUBLE</code>, or <code>FLOAT</code>;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3866
     *         <code>false</code> otherwise
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3867
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3868
    private boolean isNumeric(int type) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3869
        switch (type) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3870
            case java.sql.Types.NUMERIC:
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3871
            case java.sql.Types.DECIMAL:
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3872
            case java.sql.Types.BIT:
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3873
            case java.sql.Types.TINYINT:
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3874
            case java.sql.Types.SMALLINT:
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3875
            case java.sql.Types.INTEGER:
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3876
            case java.sql.Types.BIGINT:
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3877
            case java.sql.Types.REAL:
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3878
            case java.sql.Types.DOUBLE:
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3879
            case java.sql.Types.FLOAT:
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3880
                return true;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3881
            default:
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3882
                return false;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3883
        }
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
     * Indicates whether the given SQL data type is a string type.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3888
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3889
     * @param type one of the constants from <code>java.sql.Types</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3890
     * @return <code>true</code> if the given type is <code>CHAR</code>,'
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3891
     *         <code>VARCHAR</code>, or <code>LONGVARCHAR</code>;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3892
     *         <code>false</code> otherwise
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3893
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3894
    private boolean isString(int type) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3895
        switch (type) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3896
            case java.sql.Types.CHAR:
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3897
            case java.sql.Types.VARCHAR:
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3898
            case java.sql.Types.LONGVARCHAR:
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3899
                return true;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3900
            default:
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3901
                return false;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3902
        }
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
     * Indicates whether the given SQL data type is a binary type.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3907
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3908
     * @param type one of the constants from <code>java.sql.Types</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3909
     * @return <code>true</code> if the given type is <code>BINARY</code>,'
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3910
     *         <code>VARBINARY</code>, or <code>LONGVARBINARY</code>;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3911
     *         <code>false</code> otherwise
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3912
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3913
    private boolean isBinary(int type) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3914
        switch (type) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3915
            case java.sql.Types.BINARY:
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3916
            case java.sql.Types.VARBINARY:
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3917
            case java.sql.Types.LONGVARBINARY:
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3918
                return true;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3919
            default:
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3920
                return false;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3921
        }
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
     * Indicates whether the given SQL data type is a temporal type.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3926
     * This method is called internally by the conversion methods
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3927
     * <code>convertNumeric</code> and <code>convertTemporal</code>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3928
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3929
     * @param type one of the constants from <code>java.sql.Types</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3930
     * @return <code>true</code> if the given type is <code>DATE</code>,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3931
     *         <code>TIME</code>, or <code>TIMESTAMP</code>;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3932
     *         <code>false</code> otherwise
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3933
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3934
    private boolean isTemporal(int type) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3935
        switch (type) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3936
            case java.sql.Types.DATE:
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3937
            case java.sql.Types.TIME:
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3938
            case java.sql.Types.TIMESTAMP:
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3939
                return true;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3940
            default:
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3941
                return false;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3942
        }
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
     * Indicates whether the given SQL data type is a boolean type.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3947
     * This method is called internally by the conversion methods
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3948
     * <code>convertNumeric</code> and <code>convertBoolean</code>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3949
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3950
     * @param type one of the constants from <code>java.sql.Types</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3951
     * @return <code>true</code> if the given type is <code>BIT</code>,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3952
     *         , or <code>BOOLEAN</code>;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3953
     *         <code>false</code> otherwise
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3954
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3955
    private boolean isBoolean(int type) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3956
        switch (type) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3957
            case java.sql.Types.BIT:
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3958
            case java.sql.Types.BOOLEAN:
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3959
                return true;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3960
            default:
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3961
                return false;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3962
        }
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
     * Converts the given <code>Object</code> in the Java programming language
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3968
     * to the standard mapping for the specified SQL target data type.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3969
     * The conversion must be to a string or numeric type, but there are no
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3970
     * restrictions on the type to be converted.  If the source type and target
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3971
     * type are the same, the given object is simply returned.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3972
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3973
     * @param srcObj the <code>Object</code> in the Java programming language
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3974
     *               that is to be converted to the target type
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3975
     * @param srcType the data type that is the standard mapping in SQL of the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3976
     *                object to be converted; must be one of the constants in
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3977
     *                <code>java.sql.Types</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3978
     * @param trgType the SQL data type to which to convert the given object;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3979
     *                must be one of the following constants in
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3980
     *                <code>java.sql.Types</code>: <code>NUMERIC</code>,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3981
     *         <code>DECIMAL</code>, <code>BIT</code>, <code>TINYINT</code>,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3982
     *         <code>SMALLINT</code>, <code>INTEGER</code>, <code>BIGINT</code>,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3983
     *         <code>REAL</code>, <code>DOUBLE</code>, <code>FLOAT</code>,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3984
     *         <code>VARCHAR</code>, <code>LONGVARCHAR</code>, or <code>CHAR</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3985
     * @return an <code>Object</code> value.that is
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3986
     *         the standard object mapping for the target SQL type
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3987
     * @throws SQLException if the given target type is not one of the string or
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3988
     *         numeric types in <code>java.sql.Types</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3989
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3990
    private Object convertNumeric(Object srcObj, int srcType,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3991
    int trgType) throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3992
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3993
        if (srcType == trgType) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3994
            return srcObj;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3995
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3996
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3997
        if (isNumeric(trgType) == false && isString(trgType) == false) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3998
            throw new SQLException(resBundle.handleGetObject("cachedrowsetimpl.dtypemismt").toString() + trgType);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  3999
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4000
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4001
        try {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4002
            switch (trgType) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4003
                case java.sql.Types.BIT:
6697
39929804f9d4 6989139: Address JDBC Findbugs where Number type Constructor are used
lancea
parents: 6692
diff changeset
  4004
                    Integer i = Integer.valueOf(srcObj.toString().trim());
11129
f9ad1aadf3fa 7116445: Miscellaneous warnings in the JDBC/RowSet classes
lancea
parents: 9537
diff changeset
  4005
                    return i.equals(0) ?
6697
39929804f9d4 6989139: Address JDBC Findbugs where Number type Constructor are used
lancea
parents: 6692
diff changeset
  4006
                    Boolean.valueOf(false) :
39929804f9d4 6989139: Address JDBC Findbugs where Number type Constructor are used
lancea
parents: 6692
diff changeset
  4007
                        Boolean.valueOf(true);
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4008
                case java.sql.Types.TINYINT:
6697
39929804f9d4 6989139: Address JDBC Findbugs where Number type Constructor are used
lancea
parents: 6692
diff changeset
  4009
                    return Byte.valueOf(srcObj.toString().trim());
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4010
                case java.sql.Types.SMALLINT:
6697
39929804f9d4 6989139: Address JDBC Findbugs where Number type Constructor are used
lancea
parents: 6692
diff changeset
  4011
                    return Short.valueOf(srcObj.toString().trim());
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4012
                case java.sql.Types.INTEGER:
6697
39929804f9d4 6989139: Address JDBC Findbugs where Number type Constructor are used
lancea
parents: 6692
diff changeset
  4013
                    return Integer.valueOf(srcObj.toString().trim());
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4014
                case java.sql.Types.BIGINT:
6697
39929804f9d4 6989139: Address JDBC Findbugs where Number type Constructor are used
lancea
parents: 6692
diff changeset
  4015
                    return Long.valueOf(srcObj.toString().trim());
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4016
                case java.sql.Types.NUMERIC:
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4017
                case java.sql.Types.DECIMAL:
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4018
                    return new BigDecimal(srcObj.toString().trim());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4019
                case java.sql.Types.REAL:
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4020
                case java.sql.Types.FLOAT:
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4021
                    return new Float(srcObj.toString().trim());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4022
                case java.sql.Types.DOUBLE:
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4023
                    return new Double(srcObj.toString().trim());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4024
                case java.sql.Types.CHAR:
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4025
                case java.sql.Types.VARCHAR:
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4026
                case java.sql.Types.LONGVARCHAR:
6692
aef4e294026f 6988993: Address Findbugs warnings for the use of String Constructor
lancea
parents: 6664
diff changeset
  4027
                    return srcObj.toString();
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4028
                default:
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4029
                    throw new SQLException(resBundle.handleGetObject("cachedrowsetimpl.dtypemismt").toString()+ trgType);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4030
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4031
        } catch (NumberFormatException ex) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4032
            throw new SQLException(resBundle.handleGetObject("cachedrowsetimpl.dtypemismt").toString() + trgType);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4033
        }
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
     * Converts the given <code>Object</code> in the Java programming language
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4038
     * to the standard object mapping for the specified SQL target data type.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4039
     * The conversion must be to a string or temporal type, and there are also
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4040
     * restrictions on the type to be converted.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4041
     * <P>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4042
     * <TABLE ALIGN="CENTER" BORDER CELLPADDING=10 BORDERCOLOR="#0000FF"
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4043
     * <CAPTION ALIGN="CENTER"><B>Parameters and Return Values</B></CAPTION>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4044
     * <TR>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4045
     *   <TD><B>Source SQL Type</B>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4046
     *   <TD><B>Target SQL Type</B>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4047
     *   <TD><B>Object Returned</B>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4048
     * </TR>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4049
     * <TR>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4050
     *   <TD><code>TIMESTAMP</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4051
     *   <TD><code>DATE</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4052
     *   <TD><code>java.sql.Date</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4053
     * </TR>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4054
     * <TR>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4055
     *   <TD><code>TIMESTAMP</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4056
     *   <TD><code>TIME</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4057
     *   <TD><code>java.sql.Time</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4058
     * </TR>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4059
     * <TR>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4060
     *   <TD><code>TIME</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4061
     *   <TD><code>TIMESTAMP</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4062
     *   <TD><code>java.sql.Timestamp</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4063
     * </TR>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4064
     * <TR>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4065
     *   <TD><code>DATE</code>, <code>TIME</code>, or <code>TIMESTAMP</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4066
     *   <TD><code>CHAR</code>, <code>VARCHAR</code>, or <code>LONGVARCHAR</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4067
     *   <TD><code>java.lang.String</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4068
     * </TR>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4069
     * </TABLE>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4070
     * <P>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4071
     * If the source type and target type are the same,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4072
     * the given object is simply returned.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4073
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4074
     * @param srcObj the <code>Object</code> in the Java programming language
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4075
     *               that is to be converted to the target type
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4076
     * @param srcType the data type that is the standard mapping in SQL of the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4077
     *                object to be converted; must be one of the constants in
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4078
     *                <code>java.sql.Types</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4079
     * @param trgType the SQL data type to which to convert the given object;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4080
     *                must be one of the following constants in
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4081
     *                <code>java.sql.Types</code>: <code>DATE</code>,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4082
     *         <code>TIME</code>, <code>TIMESTAMP</code>, <code>CHAR</code>,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4083
     *         <code>VARCHAR</code>, or <code>LONGVARCHAR</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4084
     * @return an <code>Object</code> value.that is
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4085
     *         the standard object mapping for the target SQL type
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4086
     * @throws SQLException if the given target type is not one of the string or
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4087
     *         temporal types in <code>java.sql.Types</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4088
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4089
    private Object convertTemporal(Object srcObj,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4090
    int srcType, int trgType) throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4091
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4092
        if (srcType == trgType) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4093
            return srcObj;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4094
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4095
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4096
        if (isNumeric(trgType) == true ||
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4097
        (isString(trgType) == false && isTemporal(trgType) == false)) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4098
            throw new SQLException(resBundle.handleGetObject("cachedrowsetimpl.dtypemismt").toString());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4099
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4100
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4101
        try {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4102
            switch (trgType) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4103
                case java.sql.Types.DATE:
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4104
                    if (srcType == java.sql.Types.TIMESTAMP) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4105
                        return new java.sql.Date(((java.sql.Timestamp)srcObj).getTime());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4106
                    } else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4107
                        throw new SQLException(resBundle.handleGetObject("cachedrowsetimpl.dtypemismt").toString());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4108
                    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4109
                case java.sql.Types.TIMESTAMP:
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4110
                    if (srcType == java.sql.Types.TIME) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4111
                        return new Timestamp(((java.sql.Time)srcObj).getTime());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4112
                    } else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4113
                        return new Timestamp(((java.sql.Date)srcObj).getTime());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4114
                    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4115
                case java.sql.Types.TIME:
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4116
                    if (srcType == java.sql.Types.TIMESTAMP) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4117
                        return new Time(((java.sql.Timestamp)srcObj).getTime());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4118
                    } else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4119
                        throw new SQLException(resBundle.handleGetObject("cachedrowsetimpl.dtypemismt").toString());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4120
                    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4121
                case java.sql.Types.CHAR:
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4122
                case java.sql.Types.VARCHAR:
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4123
                case java.sql.Types.LONGVARCHAR:
6692
aef4e294026f 6988993: Address Findbugs warnings for the use of String Constructor
lancea
parents: 6664
diff changeset
  4124
                    return srcObj.toString();
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4125
                default:
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4126
                    throw new SQLException(resBundle.handleGetObject("cachedrowsetimpl.dtypemismt").toString());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4127
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4128
        } catch (NumberFormatException ex) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4129
            throw new SQLException(resBundle.handleGetObject("cachedrowsetimpl.dtypemismt").toString());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4130
        }
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
     * Converts the given <code>Object</code> in the Java programming language
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4136
     * to the standard mapping for the specified SQL target data type.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4137
     * The conversion must be to a string or numeric type, but there are no
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4138
     * restrictions on the type to be converted.  If the source type and target
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4139
     * type are the same, the given object is simply returned.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4140
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4141
     * @param srcObj the <code>Object</code> in the Java programming language
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4142
     *               that is to be converted to the target type
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4143
     * @param srcType the data type that is the standard mapping in SQL of the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4144
     *                object to be converted; must be one of the constants in
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4145
     *                <code>java.sql.Types</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4146
     * @param trgType the SQL data type to which to convert the given object;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4147
     *                must be one of the following constants in
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4148
     *                <code>java.sql.Types</code>: <code>BIT</code>,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4149
     *         or <code>BOOLEAN</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4150
     * @return an <code>Object</code> value.that is
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4151
     *         the standard object mapping for the target SQL type
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4152
     * @throws SQLException if the given target type is not one of the Boolean
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4153
     *         types in <code>java.sql.Types</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4154
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4155
    private Object convertBoolean(Object srcObj, int srcType,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4156
    int trgType) throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4157
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4158
        if (srcType == trgType) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4159
            return srcObj;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4160
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4161
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4162
        if (isNumeric(trgType) == true ||
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4163
        (isString(trgType) == false && isBoolean(trgType) == false)) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4164
            throw new SQLException(resBundle.handleGetObject("cachedrowsetimpl.dtypemismt").toString());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4165
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4166
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4167
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4168
        try {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4169
            switch (trgType) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4170
                case java.sql.Types.BIT:
6697
39929804f9d4 6989139: Address JDBC Findbugs where Number type Constructor are used
lancea
parents: 6692
diff changeset
  4171
                    Integer i = Integer.valueOf(srcObj.toString().trim());
11129
f9ad1aadf3fa 7116445: Miscellaneous warnings in the JDBC/RowSet classes
lancea
parents: 9537
diff changeset
  4172
                    return i.equals(0) ?
6697
39929804f9d4 6989139: Address JDBC Findbugs where Number type Constructor are used
lancea
parents: 6692
diff changeset
  4173
                    Boolean.valueOf(false) :
39929804f9d4 6989139: Address JDBC Findbugs where Number type Constructor are used
lancea
parents: 6692
diff changeset
  4174
                        Boolean.valueOf(true);
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4175
                case java.sql.Types.BOOLEAN:
6697
39929804f9d4 6989139: Address JDBC Findbugs where Number type Constructor are used
lancea
parents: 6692
diff changeset
  4176
                    return Boolean.valueOf(srcObj.toString().trim());
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4177
                default:
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4178
                    throw new SQLException(resBundle.handleGetObject("cachedrowsetimpl.dtypemismt").toString()+ trgType);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4179
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4180
        } catch (NumberFormatException ex) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4181
            throw new SQLException(resBundle.handleGetObject("cachedrowsetimpl.dtypemismt").toString() + trgType);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4182
        }
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
     * Sets the designated nullable column in the current row or the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4187
     * insert row of this <code>CachedRowSetImpl</code> object with
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4188
     * <code>null</code> value.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4189
     * <P>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4190
     * This method updates a column value in the current row or the insert
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4191
     * row of this rowset; however, another method must be called to complete
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4192
     * the update process. If the cursor is on a row in the rowset, the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4193
     * method {@link #updateRow} must be called to mark the row as updated
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4194
     * and to notify listeners that the row has changed.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4195
     * If the cursor is on the insert row, the method {@link #insertRow}
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4196
     * must be called to insert the new row into this rowset and to notify
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4197
     * listeners that a row has changed.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4198
     * <P>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4199
     * In order to propagate updates in this rowset to the underlying
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4200
     * data source, an application must call the method {@link #acceptChanges}
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4201
     * after it calls either <code>updateRow</code> or <code>insertRow</code>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4202
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4203
     * @param columnIndex the first column is <code>1</code>, the second
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4204
     *        is <code>2</code>, and so on; must be <code>1</code> or larger
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4205
     *        and equal to or less than the number of columns in this rowset
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4206
     * @throws SQLException if (1) the given column index is out of bounds,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4207
     *            (2) the cursor is not on one of this rowset's rows or its
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4208
     *            insert row, or (3) this rowset is
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4209
     *            <code>ResultSet.CONCUR_READ_ONLY</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4210
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4211
    public void updateNull(int columnIndex) throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4212
        // sanity check.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4213
        checkIndex(columnIndex);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4214
        // make sure the cursor is on a valid row
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4215
        checkCursor();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4216
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4217
        BaseRow row = getCurrentRow();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4218
        row.setColumnObject(columnIndex, null);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4219
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
     * Sets the designated column in either the current row or the insert
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4224
     * row of this <code>CachedRowSetImpl</code> object with the given
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4225
     * <code>boolean</code> value.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4226
     * <P>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4227
     * This method updates a column value in the current row or the insert
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4228
     * row of this rowset, but it does not update the database.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4229
     * If the cursor is on a row in the rowset, the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4230
     * method {@link #updateRow} must be called to update the database.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4231
     * If the cursor is on the insert row, the method {@link #insertRow}
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4232
     * must be called, which will insert the new row into both this rowset
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4233
     * and the database. Both of these methods must be called before the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4234
     * cursor moves to another row.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4235
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4236
     * @param columnIndex the first column is <code>1</code>, the second
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4237
     *        is <code>2</code>, and so on; must be <code>1</code> or larger
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4238
     *        and equal to or less than the number of columns in this rowset
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4239
     * @param x the new column value
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4240
     * @throws SQLException if (1) the given column index is out of bounds,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4241
     *            (2) the cursor is not on one of this rowset's rows or its
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4242
     *            insert row, or (3) this rowset is
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4243
     *            <code>ResultSet.CONCUR_READ_ONLY</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4244
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4245
    public void updateBoolean(int columnIndex, boolean x) throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4246
        // sanity check.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4247
        checkIndex(columnIndex);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4248
        // make sure the cursor is on a valid row
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4249
        checkCursor();
6697
39929804f9d4 6989139: Address JDBC Findbugs where Number type Constructor are used
lancea
parents: 6692
diff changeset
  4250
        Object obj = convertBoolean(Boolean.valueOf(x),
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4251
        java.sql.Types.BIT,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4252
        RowSetMD.getColumnType(columnIndex));
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4253
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4254
        getCurrentRow().setColumnObject(columnIndex, obj);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4255
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4256
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4257
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4258
     * Sets the designated column in either the current row or the insert
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4259
     * row of this <code>CachedRowSetImpl</code> object with the given
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4260
     * <code>byte</code> value.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4261
     * <P>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4262
     * This method updates a column value in the current row or the insert
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4263
     * row of this rowset, but it does not update the database.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4264
     * If the cursor is on a row in the rowset, the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4265
     * method {@link #updateRow} must be called to update the database.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4266
     * If the cursor is on the insert row, the method {@link #insertRow}
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4267
     * must be called, which will insert the new row into both this rowset
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4268
     * and the database. Both of these methods must be called before the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4269
     * cursor moves to another row.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4270
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4271
     * @param columnIndex the first column is <code>1</code>, the second
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4272
     *        is <code>2</code>, and so on; must be <code>1</code> or larger
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4273
     *        and equal to or less than the number of columns in this rowset
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4274
     * @param x the new column value
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4275
     * @throws SQLException if (1) the given column index is out of bounds,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4276
     *            (2) the cursor is not on one of this rowset's rows or its
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4277
     *            insert row, or (3) this rowset is
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4278
     *            <code>ResultSet.CONCUR_READ_ONLY</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4279
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4280
    public void updateByte(int columnIndex, byte x) throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4281
        // sanity check.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4282
        checkIndex(columnIndex);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4283
        // make sure the cursor is on a valid row
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4284
        checkCursor();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4285
6697
39929804f9d4 6989139: Address JDBC Findbugs where Number type Constructor are used
lancea
parents: 6692
diff changeset
  4286
        Object obj = convertNumeric(Byte.valueOf(x),
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4287
        java.sql.Types.TINYINT,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4288
        RowSetMD.getColumnType(columnIndex));
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4289
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4290
        getCurrentRow().setColumnObject(columnIndex, obj);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4291
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4292
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4293
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4294
     * Sets the designated column in either the current row or the insert
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4295
     * row of this <code>CachedRowSetImpl</code> object with the given
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4296
     * <code>short</code> value.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4297
     * <P>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4298
     * This method updates a column value in the current row or the insert
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4299
     * row of this rowset, but it does not update the database.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4300
     * If the cursor is on a row in the rowset, the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4301
     * method {@link #updateRow} must be called to update the database.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4302
     * If the cursor is on the insert row, the method {@link #insertRow}
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4303
     * must be called, which will insert the new row into both this rowset
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4304
     * and the database. Both of these methods must be called before the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4305
     * cursor moves to another row.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4306
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4307
     * @param columnIndex the first column is <code>1</code>, the second
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4308
     *        is <code>2</code>, and so on; must be <code>1</code> or larger
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4309
     *        and equal to or less than the number of columns in this rowset
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4310
     * @param x the new column value
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4311
     * @throws SQLException if (1) the given column index is out of bounds,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4312
     *            (2) the cursor is not on one of this rowset's rows or its
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4313
     *            insert row, or (3) this rowset is
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4314
     *            <code>ResultSet.CONCUR_READ_ONLY</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4315
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4316
    public void updateShort(int columnIndex, short x) throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4317
        // sanity check.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4318
        checkIndex(columnIndex);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4319
        // make sure the cursor is on a valid row
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4320
        checkCursor();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4321
6697
39929804f9d4 6989139: Address JDBC Findbugs where Number type Constructor are used
lancea
parents: 6692
diff changeset
  4322
        Object obj = convertNumeric(Short.valueOf(x),
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4323
        java.sql.Types.SMALLINT,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4324
        RowSetMD.getColumnType(columnIndex));
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4325
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4326
        getCurrentRow().setColumnObject(columnIndex, obj);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4327
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4328
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4329
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4330
     * Sets the designated column in either the current row or the insert
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4331
     * row of this <code>CachedRowSetImpl</code> object with the given
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4332
     * <code>int</code> value.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4333
     * <P>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4334
     * This method updates a column value in the current row or the insert
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4335
     * row of this rowset, but it does not update the database.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4336
     * If the cursor is on a row in the rowset, the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4337
     * method {@link #updateRow} must be called to update the database.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4338
     * If the cursor is on the insert row, the method {@link #insertRow}
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4339
     * must be called, which will insert the new row into both this rowset
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4340
     * and the database. Both of these methods must be called before the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4341
     * cursor moves to another row.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4342
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4343
     * @param columnIndex the first column is <code>1</code>, the second
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4344
     *        is <code>2</code>, and so on; must be <code>1</code> or larger
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4345
     *        and equal to or less than the number of columns in this rowset
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4346
     * @param x the new column value
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4347
     * @throws SQLException if (1) the given column index is out of bounds,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4348
     *            (2) the cursor is not on one of this rowset's rows or its
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4349
     *            insert row, or (3) this rowset is
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4350
     *            <code>ResultSet.CONCUR_READ_ONLY</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4351
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4352
    public void updateInt(int columnIndex, int x) throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4353
        // sanity check.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4354
        checkIndex(columnIndex);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4355
        // make sure the cursor is on a valid row
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4356
        checkCursor();
11129
f9ad1aadf3fa 7116445: Miscellaneous warnings in the JDBC/RowSet classes
lancea
parents: 9537
diff changeset
  4357
        Object obj = convertNumeric(x,
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4358
        java.sql.Types.INTEGER,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4359
        RowSetMD.getColumnType(columnIndex));
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4360
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4361
        getCurrentRow().setColumnObject(columnIndex, obj);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4362
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4363
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4364
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4365
     * Sets the designated column in either the current row or the insert
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4366
     * row of this <code>CachedRowSetImpl</code> object with the given
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4367
     * <code>long</code> value.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4368
     * <P>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4369
     * This method updates a column value in the current row or the insert
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4370
     * row of this rowset, but it does not update the database.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4371
     * If the cursor is on a row in the rowset, the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4372
     * method {@link #updateRow} must be called to update the database.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4373
     * If the cursor is on the insert row, the method {@link #insertRow}
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4374
     * must be called, which will insert the new row into both this rowset
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4375
     * and the database. Both of these methods must be called before the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4376
     * cursor moves to another row.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4377
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4378
     * @param columnIndex the first column is <code>1</code>, the second
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4379
     *        is <code>2</code>, and so on; must be <code>1</code> or larger
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4380
     *        and equal to or less than the number of columns in this rowset
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4381
     * @param x the new column value
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4382
     * @throws SQLException if (1) the given column index is out of bounds,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4383
     *            (2) the cursor is not on one of this rowset's rows or its
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4384
     *            insert row, or (3) this rowset is
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4385
     *            <code>ResultSet.CONCUR_READ_ONLY</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4386
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4387
    public void updateLong(int columnIndex, long x) throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4388
        // sanity check.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4389
        checkIndex(columnIndex);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4390
        // make sure the cursor is on a valid row
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4391
        checkCursor();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4392
6697
39929804f9d4 6989139: Address JDBC Findbugs where Number type Constructor are used
lancea
parents: 6692
diff changeset
  4393
        Object obj = convertNumeric(Long.valueOf(x),
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4394
        java.sql.Types.BIGINT,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4395
        RowSetMD.getColumnType(columnIndex));
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4396
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4397
        getCurrentRow().setColumnObject(columnIndex, obj);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4398
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
     * Sets the designated column in either the current row or the insert
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4403
     * row of this <code>CachedRowSetImpl</code> object with the given
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4404
     * <code>float</code> value.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4405
     * <P>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4406
     * This method updates a column value in the current row or the insert
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4407
     * row of this rowset, but it does not update the database.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4408
     * If the cursor is on a row in the rowset, the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4409
     * method {@link #updateRow} must be called to update the database.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4410
     * If the cursor is on the insert row, the method {@link #insertRow}
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4411
     * must be called, which will insert the new row into both this rowset
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4412
     * and the database. Both of these methods must be called before the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4413
     * cursor moves to another row.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4414
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4415
     * @param columnIndex the first column is <code>1</code>, the second
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4416
     *        is <code>2</code>, and so on; must be <code>1</code> or larger
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4417
     *        and equal to or less than the number of columns in this rowset
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4418
     * @param x the new column value
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4419
     * @throws SQLException if (1) the given column index is out of bounds,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4420
     *            (2) the cursor is not on one of this rowset's rows or its
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4421
     *            insert row, or (3) this rowset is
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4422
     *            <code>ResultSet.CONCUR_READ_ONLY</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4423
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4424
    public void updateFloat(int columnIndex, float x) throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4425
        // sanity check.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4426
        checkIndex(columnIndex);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4427
        // make sure the cursor is on a valid row
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4428
        checkCursor();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4429
14179
4681260d262a 8000763: use XXX.valueOf methods instead of constructors
lancea
parents: 14171
diff changeset
  4430
        Object obj = convertNumeric(Float.valueOf(x),
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4431
        java.sql.Types.REAL,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4432
        RowSetMD.getColumnType(columnIndex));
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4433
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4434
        getCurrentRow().setColumnObject(columnIndex, obj);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4435
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4436
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4437
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4438
     * Sets the designated column in either the current row or the insert
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4439
     * row of this <code>CachedRowSetImpl</code> object with the given
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4440
     * <code>double</code> value.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4441
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4442
     * This method updates a column value in either the current row or
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4443
     * the insert row of this rowset, but it does not update the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4444
     * database.  If the cursor is on a row in the rowset, the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4445
     * method {@link #updateRow} must be called to update the database.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4446
     * If the cursor is on the insert row, the method {@link #insertRow}
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4447
     * must be called, which will insert the new row into both this rowset
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4448
     * and the database. Both of these methods must be called before the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4449
     * cursor moves to another row.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4450
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4451
     * @param columnIndex the first column is <code>1</code>, the second
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4452
     *        is <code>2</code>, and so on; must be <code>1</code> or larger
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4453
     *        and equal to or less than the number of columns in this rowset
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4454
     * @param x the new column value
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4455
     * @throws SQLException if (1) the given column index is out of bounds,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4456
     *            (2) the cursor is not on one of this rowset's rows or its
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4457
     *            insert row, or (3) this rowset is
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4458
     *            <code>ResultSet.CONCUR_READ_ONLY</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4459
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4460
    public void updateDouble(int columnIndex, double x) throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4461
        // sanity check.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4462
        checkIndex(columnIndex);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4463
        // make sure the cursor is on a valid row
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4464
        checkCursor();
14179
4681260d262a 8000763: use XXX.valueOf methods instead of constructors
lancea
parents: 14171
diff changeset
  4465
        Object obj = convertNumeric(Double.valueOf(x),
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4466
        java.sql.Types.DOUBLE,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4467
        RowSetMD.getColumnType(columnIndex));
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4468
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4469
        getCurrentRow().setColumnObject(columnIndex, obj);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4470
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4471
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4472
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4473
     * Sets the designated column in either the current row or the insert
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4474
     * row of this <code>CachedRowSetImpl</code> object with the given
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4475
     * <code>java.math.BigDecimal</code> object.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4476
     * <P>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4477
     * This method updates a column value in the current row or the insert
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4478
     * row of this rowset, but it does not update the database.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4479
     * If the cursor is on a row in the rowset, the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4480
     * method {@link #updateRow} must be called to update the database.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4481
     * If the cursor is on the insert row, the method {@link #insertRow}
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4482
     * must be called, which will insert the new row into both this rowset
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4483
     * and the database. Both of these methods must be called before the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4484
     * cursor moves to another row.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4485
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4486
     * @param columnIndex the first column is <code>1</code>, the second
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4487
     *        is <code>2</code>, and so on; must be <code>1</code> or larger
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4488
     *        and equal to or less than the number of columns in this rowset
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4489
     * @param x the new column value
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4490
     * @throws SQLException if (1) the given column index is out of bounds,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4491
     *            (2) the cursor is not on one of this rowset's rows or its
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4492
     *            insert row, or (3) this rowset is
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4493
     *            <code>ResultSet.CONCUR_READ_ONLY</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4494
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4495
    public void updateBigDecimal(int columnIndex, BigDecimal x) throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4496
        // sanity check.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4497
        checkIndex(columnIndex);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4498
        // make sure the cursor is on a valid row
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4499
        checkCursor();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4500
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4501
        Object obj = convertNumeric(x,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4502
        java.sql.Types.NUMERIC,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4503
        RowSetMD.getColumnType(columnIndex));
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4504
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4505
        getCurrentRow().setColumnObject(columnIndex, obj);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4506
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4507
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4508
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4509
     * Sets the designated column in either the current row or the insert
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4510
     * row of this <code>CachedRowSetImpl</code> object with the given
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4511
     * <code>String</code> object.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4512
     * <P>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4513
     * This method updates a column value in either the current row or
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4514
     * the insert row of this rowset, but it does not update the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4515
     * database.  If the cursor is on a row in the rowset, the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4516
     * method {@link #updateRow} must be called to mark the row as updated.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4517
     * If the cursor is on the insert row, the method {@link #insertRow}
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4518
     * must be called to insert the new row into this rowset and mark it
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4519
     * as inserted. Both of these methods must be called before the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4520
     * cursor moves to another row.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4521
     * <P>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4522
     * The method <code>acceptChanges</code> must be called if the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4523
     * updated values are to be written back to the underlying database.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4524
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4525
     * @param columnIndex the first column is <code>1</code>, the second
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4526
     *        is <code>2</code>, and so on; must be <code>1</code> or larger
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4527
     *        and equal to or less than the number of columns in this rowset
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4528
     * @param x the new column value
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4529
     * @throws SQLException if (1) the given column index is out of bounds,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4530
     *            (2) the cursor is not on one of this rowset's rows or its
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4531
     *            insert row, or (3) this rowset is
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4532
     *            <code>ResultSet.CONCUR_READ_ONLY</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4533
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4534
    public void updateString(int columnIndex, String x) throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4535
        // sanity check.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4536
        checkIndex(columnIndex);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4537
        // make sure the cursor is on a valid row
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4538
        checkCursor();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4539
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4540
        getCurrentRow().setColumnObject(columnIndex, x);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4541
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4542
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4543
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4544
     * Sets the designated column in either the current row or the insert
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4545
     * row of this <code>CachedRowSetImpl</code> object with the given
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4546
     * <code>byte</code> array.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4547
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4548
     * This method updates a column value in either the current row or
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4549
     * the insert row of this rowset, but it does not update the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4550
     * database.  If the cursor is on a row in the rowset, the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4551
     * method {@link #updateRow} must be called to update the database.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4552
     * If the cursor is on the insert row, the method {@link #insertRow}
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4553
     * must be called, which will insert the new row into both this rowset
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4554
     * and the database. Both of these methods must be called before the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4555
     * cursor moves to another row.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4556
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4557
     * @param columnIndex the first column is <code>1</code>, the second
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4558
     *        is <code>2</code>, and so on; must be <code>1</code> or larger
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4559
     *        and equal to or less than the number of columns in this rowset
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4560
     * @param x the new column value
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4561
     * @throws SQLException if (1) the given column index is out of bounds,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4562
     *            (2) the cursor is not on one of this rowset's rows or its
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4563
     *            insert row, or (3) this rowset is
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4564
     *            <code>ResultSet.CONCUR_READ_ONLY</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4565
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4566
    public void updateBytes(int columnIndex, byte x[]) throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4567
        // sanity check.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4568
        checkIndex(columnIndex);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4569
        // make sure the cursor is on a valid row
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4570
        checkCursor();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4571
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4572
        if (isBinary(RowSetMD.getColumnType(columnIndex)) == false) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4573
            throw new SQLException(resBundle.handleGetObject("cachedrowsetimpl.dtypemismt").toString());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4574
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4575
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4576
        getCurrentRow().setColumnObject(columnIndex, x);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4577
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4578
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4579
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4580
     * Sets the designated column in either the current row or the insert
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4581
     * row of this <code>CachedRowSetImpl</code> object with the given
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4582
     * <code>Date</code> object.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4583
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4584
     * This method updates a column value in either the current row or
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4585
     * the insert row of this rowset, but it does not update the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4586
     * database.  If the cursor is on a row in the rowset, the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4587
     * method {@link #updateRow} must be called to update the database.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4588
     * If the cursor is on the insert row, the method {@link #insertRow}
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4589
     * must be called, which will insert the new row into both this rowset
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4590
     * and the database. Both of these methods must be called before the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4591
     * cursor moves to another row.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4592
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4593
     * @param columnIndex the first column is <code>1</code>, the second
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4594
     *        is <code>2</code>, and so on; must be <code>1</code> or larger
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4595
     *        and equal to or less than the number of columns in this rowset
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4596
     * @param x the new column value
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4597
     * @throws SQLException if (1) the given column index is out of bounds,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4598
     *            (2) the cursor is not on one of this rowset's rows or its
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4599
     *            insert row, (3) the type of the designated column is not
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4600
     *            an SQL <code>DATE</code> or <code>TIMESTAMP</code>, or
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4601
     *            (4) this rowset is <code>ResultSet.CONCUR_READ_ONLY</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4602
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4603
    public void updateDate(int columnIndex, java.sql.Date x) throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4604
        // sanity check.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4605
        checkIndex(columnIndex);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4606
        // make sure the cursor is on a valid row
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4607
        checkCursor();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4608
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4609
        Object obj = convertTemporal(x,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4610
        java.sql.Types.DATE,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4611
        RowSetMD.getColumnType(columnIndex));
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4612
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4613
        getCurrentRow().setColumnObject(columnIndex, obj);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4614
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4615
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4616
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4617
     * Sets the designated column in either the current row or the insert
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4618
     * row of this <code>CachedRowSetImpl</code> object with the given
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4619
     * <code>Time</code> object.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4620
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4621
     * This method updates a column value in either the current row or
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4622
     * the insert row of this rowset, but it does not update the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4623
     * database.  If the cursor is on a row in the rowset, the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4624
     * method {@link #updateRow} must be called to update the database.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4625
     * If the cursor is on the insert row, the method {@link #insertRow}
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4626
     * must be called, which will insert the new row into both this rowset
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4627
     * and the database. Both of these methods must be called before the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4628
     * cursor moves to another row.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4629
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4630
     * @param columnIndex the first column is <code>1</code>, the second
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4631
     *        is <code>2</code>, and so on; must be <code>1</code> or larger
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4632
     *        and equal to or less than the number of columns in this rowset
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4633
     * @param x the new column value
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4634
     * @throws SQLException if (1) the given column index is out of bounds,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4635
     *            (2) the cursor is not on one of this rowset's rows or its
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4636
     *            insert row, (3) the type of the designated column is not
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4637
     *            an SQL <code>TIME</code> or <code>TIMESTAMP</code>, or
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4638
     *            (4) this rowset is <code>ResultSet.CONCUR_READ_ONLY</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4639
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4640
    public void updateTime(int columnIndex, java.sql.Time x) throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4641
        // sanity check.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4642
        checkIndex(columnIndex);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4643
        // make sure the cursor is on a valid row
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4644
        checkCursor();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4645
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4646
        Object obj = convertTemporal(x,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4647
        java.sql.Types.TIME,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4648
        RowSetMD.getColumnType(columnIndex));
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4649
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4650
        getCurrentRow().setColumnObject(columnIndex, obj);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4651
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4652
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4653
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4654
     * Sets the designated column in either the current row or the insert
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4655
     * row of this <code>CachedRowSetImpl</code> object with the given
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4656
     * <code>Timestamp</code> object.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4657
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4658
     * This method updates a column value in either the current row or
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4659
     * the insert row of this rowset, but it does not update the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4660
     * database.  If the cursor is on a row in the rowset, the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4661
     * method {@link #updateRow} must be called to update the database.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4662
     * If the cursor is on the insert row, the method {@link #insertRow}
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4663
     * must be called, which will insert the new row into both this rowset
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4664
     * and the database. Both of these methods must be called before the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4665
     * cursor moves to another row.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4666
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4667
     * @param columnIndex the first column is <code>1</code>, the second
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4668
     *        is <code>2</code>, and so on; must be <code>1</code> or larger
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4669
     *        and equal to or less than the number of columns in this rowset
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4670
     * @param x the new column value
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4671
     * @throws SQLException if (1) the given column index is out of bounds,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4672
     *            (2) the cursor is not on one of this rowset's rows or its
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4673
     *            insert row, (3) the type of the designated column is not
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4674
     *            an SQL <code>DATE</code>, <code>TIME</code>, or
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4675
     *            <code>TIMESTAMP</code>, or (4) this rowset is
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4676
     *            <code>ResultSet.CONCUR_READ_ONLY</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4677
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4678
    public void updateTimestamp(int columnIndex, java.sql.Timestamp x) throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4679
        // sanity check.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4680
        checkIndex(columnIndex);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4681
        // make sure the cursor is on a valid row
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4682
        checkCursor();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4683
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4684
        Object obj = convertTemporal(x,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4685
        java.sql.Types.TIMESTAMP,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4686
        RowSetMD.getColumnType(columnIndex));
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4687
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4688
        getCurrentRow().setColumnObject(columnIndex, obj);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4689
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4690
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4691
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4692
     * Sets the designated column in either the current row or the insert
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4693
     * row of this <code>CachedRowSetImpl</code> object with the given
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4694
     * ASCII stream value.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4695
     * <P>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4696
     * This method updates a column value in either the current row or
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4697
     * the insert row of this rowset, but it does not update the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4698
     * database.  If the cursor is on a row in the rowset, the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4699
     * method {@link #updateRow} must be called to update the database.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4700
     * If the cursor is on the insert row, the method {@link #insertRow}
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4701
     * must be called, which will insert the new row into both this rowset
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4702
     * and the database. Both of these methods must be called before the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4703
     * cursor moves to another row.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4704
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4705
     * @param columnIndex the first column is <code>1</code>, the second
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4706
     *        is <code>2</code>, and so on; must be <code>1</code> or larger
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4707
     *        and equal to or less than the number of columns in this rowset
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4708
     * @param x the new column value
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4709
     * @param length the number of one-byte ASCII characters in the stream
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4710
     * @throws SQLException if this method is invoked
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4711
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4712
    public void updateAsciiStream(int columnIndex, java.io.InputStream x, int length) throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4713
        // sanity Check
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4714
        checkIndex(columnIndex);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4715
        // make sure the cursor is on a valid row
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4716
        checkCursor();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4717
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4718
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4719
        if (isString(RowSetMD.getColumnType(columnIndex)) == false &&
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4720
        isBinary(RowSetMD.getColumnType(columnIndex)) == false) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4721
            throw new SQLException(resBundle.handleGetObject("cachedrowsetimpl.dtypemismt").toString());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4722
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4723
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4724
        byte buf[] = new byte[length];
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4725
        try {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4726
            int charsRead = 0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4727
            do {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4728
                charsRead += x.read(buf, charsRead, length - charsRead);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4729
            } while (charsRead != length);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4730
            //Changed the condition check to check for length instead of -1
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4731
        } catch (java.io.IOException ex) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4732
            throw new SQLException(resBundle.handleGetObject("cachedrowsetimpl.asciistream").toString());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4733
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4734
        String str = new String(buf);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4735
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4736
        getCurrentRow().setColumnObject(columnIndex, str);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4737
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
     * Sets the designated column in either the current row or the insert
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4742
     * row of this <code>CachedRowSetImpl</code> object with the given
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4743
     * <code>java.io.InputStream</code> object.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4744
     * <P>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4745
     * This method updates a column value in either the current row or
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4746
     * the insert row of this rowset, but it does not update the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4747
     * database.  If the cursor is on a row in the rowset, the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4748
     * method {@link #updateRow} must be called to update the database.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4749
     * If the cursor is on the insert row, the method {@link #insertRow}
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4750
     * must be called, which will insert the new row into both this rowset
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4751
     * and the database. Both of these methods must be called before the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4752
     * cursor moves to another row.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4753
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4754
     * @param columnIndex the first column is <code>1</code>, the second
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4755
     *        is <code>2</code>, and so on; must be <code>1</code> or larger
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4756
     *        and equal to or less than the number of columns in this rowset
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4757
     * @param x the new column value; must be a <code>java.io.InputStream</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4758
     *          containing <code>BINARY</code>, <code>VARBINARY</code>, or
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4759
     *          <code>LONGVARBINARY</code> data
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4760
     * @param length the length of the stream in bytes
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4761
     * @throws SQLException if (1) the given column index is out of bounds,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4762
     *            (2) the cursor is not on one of this rowset's rows or its
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4763
     *            insert row, (3) the data in the stream is not binary, or
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4764
     *            (4) this rowset is <code>ResultSet.CONCUR_READ_ONLY</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4765
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4766
    public void updateBinaryStream(int columnIndex, java.io.InputStream x,int length) throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4767
        // sanity Check
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4768
        checkIndex(columnIndex);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4769
        // make sure the cursor is on a valid row
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4770
        checkCursor();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4771
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4772
        if (isBinary(RowSetMD.getColumnType(columnIndex)) == false) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4773
            throw new SQLException(resBundle.handleGetObject("cachedrowsetimpl.dtypemismt").toString());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4774
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4775
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4776
        byte buf[] = new byte[length];
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4777
        try {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4778
            int bytesRead = 0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4779
            do {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4780
                bytesRead += x.read(buf, bytesRead, length - bytesRead);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4781
            } while (bytesRead != -1);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4782
        } catch (java.io.IOException ex) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4783
            throw new SQLException(resBundle.handleGetObject("cachedrowsetimpl.binstream").toString());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4784
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4785
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4786
        getCurrentRow().setColumnObject(columnIndex, buf);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4787
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4788
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4789
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4790
     * Sets the designated column in either the current row or the insert
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4791
     * row of this <code>CachedRowSetImpl</code> object with the given
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4792
     * <code>java.io.Reader</code> object.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4793
     * <P>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4794
     * This method updates a column value in either the current row or
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4795
     * the insert row of this rowset, but it does not update the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4796
     * database.  If the cursor is on a row in the rowset, the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4797
     * method {@link #updateRow} must be called to update the database.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4798
     * If the cursor is on the insert row, the method {@link #insertRow}
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4799
     * must be called, which will insert the new row into both this rowset
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4800
     * and the database. Both of these methods must be called before the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4801
     * cursor moves to another row.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4802
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4803
     * @param columnIndex the first column is <code>1</code>, the second
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4804
     *        is <code>2</code>, and so on; must be <code>1</code> or larger
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4805
     *        and equal to or less than the number of columns in this rowset
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4806
     * @param x the new column value; must be a <code>java.io.Reader</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4807
     *          containing <code>BINARY</code>, <code>VARBINARY</code>,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4808
     *          <code>LONGVARBINARY</code>, <code>CHAR</code>, <code>VARCHAR</code>,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4809
     *          or <code>LONGVARCHAR</code> data
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4810
     * @param length the length of the stream in characters
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4811
     * @throws SQLException if (1) the given column index is out of bounds,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4812
     *            (2) the cursor is not on one of this rowset's rows or its
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4813
     *            insert row, (3) the data in the stream is not a binary or
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4814
     *            character type, or (4) this rowset is
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4815
     *            <code>ResultSet.CONCUR_READ_ONLY</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4816
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4817
    public void updateCharacterStream(int columnIndex, java.io.Reader x, int length) throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4818
        // sanity Check
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4819
        checkIndex(columnIndex);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4820
        // make sure the cursor is on a valid row
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4821
        checkCursor();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4822
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4823
        if (isString(RowSetMD.getColumnType(columnIndex)) == false &&
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4824
        isBinary(RowSetMD.getColumnType(columnIndex)) == false) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4825
            throw new SQLException(resBundle.handleGetObject("cachedrowsetimpl.dtypemismt").toString());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4826
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4827
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4828
        char buf[] = new char[length];
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4829
        try {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4830
            int charsRead = 0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4831
            do {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4832
                charsRead += x.read(buf, charsRead, length - charsRead);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4833
            } while (charsRead != length);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4834
            //Changed the condition checking to check for length instead of -1
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4835
        } catch (java.io.IOException ex) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4836
            throw new SQLException(resBundle.handleGetObject("cachedrowsetimpl.binstream").toString());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4837
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4838
        String str = new String(buf);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4839
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4840
        getCurrentRow().setColumnObject(columnIndex, str);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4841
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4842
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4843
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4844
     * Sets the designated column in either the current row or the insert
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4845
     * row of this <code>CachedRowSetImpl</code> object with the given
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4846
     * <code>Object</code> value.  The <code>scale</code> parameter indicates
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4847
     * the number of digits to the right of the decimal point and is ignored
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4848
     * if the new column value is not a type that will be mapped to an SQL
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4849
     * <code>DECIMAL</code> or <code>NUMERIC</code> value.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4850
     * <P>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4851
     * This method updates a column value in either the current row or
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4852
     * the insert row of this rowset, but it does not update the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4853
     * database.  If the cursor is on a row in the rowset, the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4854
     * method {@link #updateRow} must be called to update the database.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4855
     * If the cursor is on the insert row, the method {@link #insertRow}
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4856
     * must be called, which will insert the new row into both this rowset
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4857
     * and the database. Both of these methods must be called before the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4858
     * cursor moves to another row.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4859
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4860
     * @param columnIndex the first column is <code>1</code>, the second
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4861
     *        is <code>2</code>, and so on; must be <code>1</code> or larger
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4862
     *        and equal to or less than the number of columns in this rowset
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4863
     * @param x the new column value
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4864
     * @param scale the number of digits to the right of the decimal point (for
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4865
     *              <code>DECIMAL</code> and <code>NUMERIC</code> types only)
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4866
     * @throws SQLException if (1) the given column index is out of bounds,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4867
     *            (2) the cursor is not on one of this rowset's rows or its
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4868
     *            insert row, or (3) this rowset is
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4869
     *            <code>ResultSet.CONCUR_READ_ONLY</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4870
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4871
    public void updateObject(int columnIndex, Object x, int scale) throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4872
        // sanity check.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4873
        checkIndex(columnIndex);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4874
        // make sure the cursor is on a valid row
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4875
        checkCursor();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4876
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4877
        int type = RowSetMD.getColumnType(columnIndex);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4878
        if (type == Types.DECIMAL || type == Types.NUMERIC) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4879
            ((java.math.BigDecimal)x).setScale(scale);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4880
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4881
        getCurrentRow().setColumnObject(columnIndex, x);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4882
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4883
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4884
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4885
     * Sets the designated column in either the current row or the insert
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4886
     * row of this <code>CachedRowSetImpl</code> object with the given
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4887
     * <code>Object</code> value.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4888
     * <P>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4889
     * This method updates a column value in either the current row or
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4890
     * the insert row of this rowset, but it does not update the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4891
     * database.  If the cursor is on a row in the rowset, the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4892
     * method {@link #updateRow} must be called to update the database.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4893
     * If the cursor is on the insert row, the method {@link #insertRow}
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4894
     * must be called, which will insert the new row into both this rowset
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4895
     * and the database. Both of these methods must be called before the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4896
     * cursor moves to another row.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4897
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4898
     * @param columnIndex the first column is <code>1</code>, the second
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4899
     *        is <code>2</code>, and so on; must be <code>1</code> or larger
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4900
     *        and equal to or less than the number of columns in this rowset
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4901
     * @param x the new column value
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4902
     * @throws SQLException if (1) the given column index is out of bounds,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4903
     *            (2) the cursor is not on one of this rowset's rows or its
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4904
     *            insert row, or (3) this rowset is
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4905
     *            <code>ResultSet.CONCUR_READ_ONLY</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4906
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4907
    public void updateObject(int columnIndex, Object x) throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4908
        // sanity check.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4909
        checkIndex(columnIndex);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4910
        // make sure the cursor is on a valid row
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4911
        checkCursor();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4912
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4913
        getCurrentRow().setColumnObject(columnIndex, x);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4914
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4915
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4916
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4917
     * Sets the designated nullable column in the current row or the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4918
     * insert row of this <code>CachedRowSetImpl</code> object with
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4919
     * <code>null</code> value.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4920
     * <P>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4921
     * This method updates a column value in the current row or the insert
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4922
     * row of this rowset, but it does not update the database.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4923
     * If the cursor is on a row in the rowset, the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4924
     * method {@link #updateRow} must be called to update the database.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4925
     * If the cursor is on the insert row, the method {@link #insertRow}
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4926
     * must be called, which will insert the new row into both this rowset
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4927
     * and the database.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4928
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4929
     * @param columnName a <code>String</code> object that must match the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4930
     *        SQL name of a column in this rowset, ignoring case
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4931
     * @throws SQLException if (1) the given column name does not match the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4932
     *            name of a column in this rowset, (2) the cursor is not on
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4933
     *            one of this rowset's rows or its insert row, or (3) this
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4934
     *            rowset is <code>ResultSet.CONCUR_READ_ONLY</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4935
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4936
    public void updateNull(String columnName) throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4937
        updateNull(getColIdxByName(columnName));
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4938
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4939
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4940
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4941
     * Sets the designated column in either the current row or the insert
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4942
     * row of this <code>CachedRowSetImpl</code> object with the given
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4943
     * <code>boolean</code> value.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4944
     * <P>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4945
     * This method updates a column value in the current row or the insert
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4946
     * row of this rowset, but it does not update the database.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4947
     * If the cursor is on a row in the rowset, the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4948
     * method {@link #updateRow} must be called to update the database.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4949
     * If the cursor is on the insert row, the method {@link #insertRow}
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4950
     * must be called, which will insert the new row into both this rowset
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4951
     * and the database. Both of these methods must be called before the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4952
     * cursor moves to another row.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4953
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4954
     * @param columnName a <code>String</code> object that must match the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4955
     *        SQL name of a column in this rowset, ignoring case
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4956
     * @param x the new column value
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4957
     * @throws SQLException if (1) the given column name does not match the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4958
     *            name of a column in this rowset, (2) the cursor is not on
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4959
     *            one of this rowset's rows or its insert row, or (3) this
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4960
     *            rowset is <code>ResultSet.CONCUR_READ_ONLY</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4961
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4962
    public void updateBoolean(String columnName, boolean x) throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4963
        updateBoolean(getColIdxByName(columnName), x);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4964
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4965
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4966
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4967
     * Sets the designated column in either the current row or the insert
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4968
     * row of this <code>CachedRowSetImpl</code> object with the given
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4969
     * <code>byte</code> value.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4970
     * <P>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4971
     * This method updates a column value in the current row or the insert
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4972
     * row of this rowset, but it does not update the database.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4973
     * If the cursor is on a row in the rowset, the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4974
     * method {@link #updateRow} must be called to update the database.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4975
     * If the cursor is on the insert row, the method {@link #insertRow}
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4976
     * must be called, which will insert the new row into both this rowset
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4977
     * and the database. Both of these methods must be called before the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4978
     * cursor moves to another row.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4979
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4980
     * @param columnName a <code>String</code> object that must match the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4981
     *        SQL name of a column in this rowset, ignoring case
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4982
     * @param x the new column value
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4983
     * @throws SQLException if (1) the given column name does not match the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4984
     *            name of a column in this rowset, (2) the cursor is not on
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4985
     *            one of this rowset's rows or its insert row, or (3) this
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4986
     *            rowset is <code>ResultSet.CONCUR_READ_ONLY</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4987
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4988
    public void updateByte(String columnName, byte x) throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4989
        updateByte(getColIdxByName(columnName), x);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4990
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4991
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4992
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4993
     * Sets the designated column in either the current row or the insert
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4994
     * row of this <code>CachedRowSetImpl</code> object with the given
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4995
     * <code>short</code> value.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4996
     * <P>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4997
     * This method updates a column value in the current row or the insert
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4998
     * row of this rowset, but it does not update the database.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  4999
     * If the cursor is on a row in the rowset, the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5000
     * method {@link #updateRow} must be called to update the database.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5001
     * If the cursor is on the insert row, the method {@link #insertRow}
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5002
     * must be called, which will insert the new row into both this rowset
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5003
     * and the database. Both of these methods must be called before the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5004
     * cursor moves to another row.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5005
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5006
     * @param columnName a <code>String</code> object that must match the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5007
     *        SQL name of a column in this rowset, ignoring case
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5008
     * @param x the new column value
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5009
     * @throws SQLException if (1) the given column name does not match the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5010
     *            name of a column in this rowset, (2) the cursor is not on
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5011
     *            one of this rowset's rows or its insert row, or (3) this
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5012
     *            rowset is <code>ResultSet.CONCUR_READ_ONLY</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5013
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5014
    public void updateShort(String columnName, short x) throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5015
        updateShort(getColIdxByName(columnName), x);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5016
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5017
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5018
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5019
     * Sets the designated column in either the current row or the insert
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5020
     * row of this <code>CachedRowSetImpl</code> object with the given
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5021
     * <code>int</code> value.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5022
     * <P>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5023
     * This method updates a column value in the current row or the insert
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5024
     * row of this rowset, but it does not update the database.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5025
     * If the cursor is on a row in the rowset, the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5026
     * method {@link #updateRow} must be called to update the database.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5027
     * If the cursor is on the insert row, the method {@link #insertRow}
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5028
     * must be called, which will insert the new row into both this rowset
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5029
     * and the database. Both of these methods must be called before the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5030
     * cursor moves to another row.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5031
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5032
     * @param columnName a <code>String</code> object that must match the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5033
     *        SQL name of a column in this rowset, ignoring case
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5034
     * @param x the new column value
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5035
     * @throws SQLException if (1) the given column name does not match the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5036
     *            name of a column in this rowset, (2) the cursor is not on
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5037
     *            one of this rowset's rows or its insert row, or (3) this
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5038
     *            rowset is <code>ResultSet.CONCUR_READ_ONLY</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5039
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5040
    public void updateInt(String columnName, int x) throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5041
        updateInt(getColIdxByName(columnName), x);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5042
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5043
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5044
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5045
     * Sets the designated column in either the current row or the insert
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5046
     * row of this <code>CachedRowSetImpl</code> object with the given
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5047
     * <code>long</code> value.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5048
     * <P>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5049
     * This method updates a column value in the current row or the insert
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5050
     * row of this rowset, but it does not update the database.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5051
     * If the cursor is on a row in the rowset, the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5052
     * method {@link #updateRow} must be called to update the database.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5053
     * If the cursor is on the insert row, the method {@link #insertRow}
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5054
     * must be called, which will insert the new row into both this rowset
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5055
     * and the database. Both of these methods must be called before the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5056
     * cursor moves to another row.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5057
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5058
     * @param columnName a <code>String</code> object that must match the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5059
     *        SQL name of a column in this rowset, ignoring case
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5060
     * @param x the new column value
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5061
     * @throws SQLException if (1) the given column name does not match the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5062
     *            name of a column in this rowset, (2) the cursor is not on
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5063
     *            one of this rowset's rows or its insert row, or (3) this
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5064
     *            rowset is <code>ResultSet.CONCUR_READ_ONLY</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5065
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5066
    public void updateLong(String columnName, long x) throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5067
        updateLong(getColIdxByName(columnName), x);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5068
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5069
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5070
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5071
     * Sets the designated column in either the current row or the insert
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5072
     * row of this <code>CachedRowSetImpl</code> object with the given
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5073
     * <code>float</code> value.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5074
     * <P>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5075
     * This method updates a column value in the current row or the insert
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5076
     * row of this rowset, but it does not update the database.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5077
     * If the cursor is on a row in the rowset, the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5078
     * method {@link #updateRow} must be called to update the database.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5079
     * If the cursor is on the insert row, the method {@link #insertRow}
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5080
     * must be called, which will insert the new row into both this rowset
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5081
     * and the database. Both of these methods must be called before the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5082
     * cursor moves to another row.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5083
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5084
     * @param columnName a <code>String</code> object that must match the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5085
     *        SQL name of a column in this rowset, ignoring case
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5086
     * @param x the new column value
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5087
     * @throws SQLException if (1) the given column name does not match the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5088
     *            name of a column in this rowset, (2) the cursor is not on
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5089
     *            one of this rowset's rows or its insert row, or (3) this
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5090
     *            rowset is <code>ResultSet.CONCUR_READ_ONLY</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5091
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5092
    public void updateFloat(String columnName, float x) throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5093
        updateFloat(getColIdxByName(columnName), x);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5094
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5095
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5096
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5097
     * Sets the designated column in either the current row or the insert
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5098
     * row of this <code>CachedRowSetImpl</code> object with the given
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5099
     * <code>double</code> value.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5100
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5101
     * This method updates a column value in either the current row or
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5102
     * the insert row of this rowset, but it does not update the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5103
     * database.  If the cursor is on a row in the rowset, the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5104
     * method {@link #updateRow} must be called to update the database.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5105
     * If the cursor is on the insert row, the method {@link #insertRow}
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5106
     * must be called, which will insert the new row into both this rowset
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5107
     * and the database. Both of these methods must be called before the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5108
     * cursor moves to another row.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5109
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5110
     * @param columnName a <code>String</code> object that must match the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5111
     *        SQL name of a column in this rowset, ignoring case
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5112
     * @param x the new column value
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5113
     * @throws SQLException if (1) the given column name does not match the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5114
     *            name of a column in this rowset, (2) the cursor is not on
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5115
     *            one of this rowset's rows or its insert row, or (3) this
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5116
     *            rowset is <code>ResultSet.CONCUR_READ_ONLY</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5117
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5118
    public void updateDouble(String columnName, double x) throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5119
        updateDouble(getColIdxByName(columnName), x);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5120
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5121
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5122
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5123
     * Sets the designated column in either the current row or the insert
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5124
     * row of this <code>CachedRowSetImpl</code> object with the given
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5125
     * <code>java.math.BigDecimal</code> object.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5126
     * <P>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5127
     * This method updates a column value in the current row or the insert
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5128
     * row of this rowset, but it does not update the database.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5129
     * If the cursor is on a row in the rowset, the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5130
     * method {@link #updateRow} must be called to update the database.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5131
     * If the cursor is on the insert row, the method {@link #insertRow}
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5132
     * must be called, which will insert the new row into both this rowset
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5133
     * and the database. Both of these methods must be called before the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5134
     * cursor moves to another row.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5135
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5136
     * @param columnName a <code>String</code> object that must match the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5137
     *        SQL name of a column in this rowset, ignoring case
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5138
     * @param x the new column value
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5139
     * @throws SQLException if (1) the given column name does not match the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5140
     *            name of a column in this rowset, (2) the cursor is not on
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5141
     *            one of this rowset's rows or its insert row, or (3) this
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5142
     *            rowset is <code>ResultSet.CONCUR_READ_ONLY</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5143
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5144
    public void updateBigDecimal(String columnName, BigDecimal x) throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5145
        updateBigDecimal(getColIdxByName(columnName), x);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5146
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5147
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5148
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5149
     * Sets the designated column in either the current row or the insert
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5150
     * row of this <code>CachedRowSetImpl</code> object with the given
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5151
     * <code>String</code> object.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5152
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5153
     * This method updates a column value in either the current row or
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5154
     * the insert row of this rowset, but it does not update the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5155
     * database.  If the cursor is on a row in the rowset, the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5156
     * method {@link #updateRow} must be called to update the database.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5157
     * If the cursor is on the insert row, the method {@link #insertRow}
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5158
     * must be called, which will insert the new row into both this rowset
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5159
     * and the database. Both of these methods must be called before the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5160
     * cursor moves to another row.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5161
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5162
     * @param columnName a <code>String</code> object that must match the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5163
     *        SQL name of a column in this rowset, ignoring case
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5164
     * @param x the new column value
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5165
     * @throws SQLException if (1) the given column name does not match the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5166
     *            name of a column in this rowset, (2) the cursor is not on
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5167
     *            one of this rowset's rows or its insert row, or (3) this
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5168
     *            rowset is <code>ResultSet.CONCUR_READ_ONLY</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5169
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5170
    public void updateString(String columnName, String x) throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5171
        updateString(getColIdxByName(columnName), x);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5172
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5173
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5174
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5175
     * Sets the designated column in either the current row or the insert
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5176
     * row of this <code>CachedRowSetImpl</code> object with the given
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5177
     * <code>byte</code> array.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5178
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5179
     * This method updates a column value in either the current row or
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5180
     * the insert row of this rowset, but it does not update the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5181
     * database.  If the cursor is on a row in the rowset, the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5182
     * method {@link #updateRow} must be called to update the database.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5183
     * If the cursor is on the insert row, the method {@link #insertRow}
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5184
     * must be called, which will insert the new row into both this rowset
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5185
     * and the database. Both of these methods must be called before the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5186
     * cursor moves to another row.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5187
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5188
     * @param columnName a <code>String</code> object that must match the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5189
     *        SQL name of a column in this rowset, ignoring case
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5190
     * @param x the new column value
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5191
     * @throws SQLException if (1) the given column name does not match the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5192
     *            name of a column in this rowset, (2) the cursor is not on
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5193
     *            one of this rowset's rows or its insert row, or (3) this
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5194
     *            rowset is <code>ResultSet.CONCUR_READ_ONLY</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5195
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5196
    public void updateBytes(String columnName, byte x[]) throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5197
        updateBytes(getColIdxByName(columnName), x);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5198
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5199
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5200
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5201
     * Sets the designated column in either the current row or the insert
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5202
     * row of this <code>CachedRowSetImpl</code> object with the given
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5203
     * <code>Date</code> object.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5204
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5205
     * This method updates a column value in either the current row or
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5206
     * the insert row of this rowset, but it does not update the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5207
     * database.  If the cursor is on a row in the rowset, the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5208
     * method {@link #updateRow} must be called to update the database.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5209
     * If the cursor is on the insert row, the method {@link #insertRow}
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5210
     * must be called, which will insert the new row into both this rowset
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5211
     * and the database. Both of these methods must be called before the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5212
     * cursor moves to another row.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5213
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5214
     * @param columnName a <code>String</code> object that must match the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5215
     *        SQL name of a column in this rowset, ignoring case
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5216
     * @param x the new column value
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5217
     * @throws SQLException if (1) the given column name does not match the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5218
     *            name of a column in this rowset, (2) the cursor is not on
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5219
     *            one of this rowset's rows or its insert row, (3) the type
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5220
     *            of the designated column is not an SQL <code>DATE</code> or
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5221
     *            <code>TIMESTAMP</code>, or (4) this rowset is
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5222
     *            <code>ResultSet.CONCUR_READ_ONLY</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5223
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5224
    public void updateDate(String columnName, java.sql.Date x) throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5225
        updateDate(getColIdxByName(columnName), x);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5226
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5227
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5228
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5229
     * Sets the designated column in either the current row or the insert
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5230
     * row of this <code>CachedRowSetImpl</code> object with the given
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5231
     * <code>Time</code> object.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5232
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5233
     * This method updates a column value in either the current row or
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5234
     * the insert row of this rowset, but it does not update the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5235
     * database.  If the cursor is on a row in the rowset, the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5236
     * method {@link #updateRow} must be called to update the database.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5237
     * If the cursor is on the insert row, the method {@link #insertRow}
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5238
     * must be called, which will insert the new row into both this rowset
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5239
     * and the database. Both of these methods must be called before the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5240
     * cursor moves to another row.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5241
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5242
     * @param columnName a <code>String</code> object that must match the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5243
     *        SQL name of a column in this rowset, ignoring case
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5244
     * @param x the new column value
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5245
     * @throws SQLException if (1) the given column name does not match the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5246
     *            name of a column in this rowset, (2) the cursor is not on
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5247
     *            one of this rowset's rows or its insert row, (3) the type
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5248
     *            of the designated column is not an SQL <code>TIME</code> or
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5249
     *            <code>TIMESTAMP</code>, or (4) this rowset is
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5250
     *            <code>ResultSet.CONCUR_READ_ONLY</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5251
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5252
    public void updateTime(String columnName, java.sql.Time x) throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5253
        updateTime(getColIdxByName(columnName), x);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5254
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5255
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5256
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5257
     * Sets the designated column in either the current row or the insert
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5258
     * row of this <code>CachedRowSetImpl</code> object with the given
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5259
     * <code>Timestamp</code> object.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5260
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5261
     * This method updates a column value in either the current row or
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5262
     * the insert row of this rowset, but it does not update the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5263
     * database.  If the cursor is on a row in the rowset, the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5264
     * method {@link #updateRow} must be called to update the database.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5265
     * If the cursor is on the insert row, the method {@link #insertRow}
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5266
     * must be called, which will insert the new row into both this rowset
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5267
     * and the database. Both of these methods must be called before the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5268
     * cursor moves to another row.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5269
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5270
     * @param columnName a <code>String</code> object that must match the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5271
     *        SQL name of a column in this rowset, ignoring case
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5272
     * @param x the new column value
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5273
     * @throws SQLException if the given column index is out of bounds or
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5274
     *            the cursor is not on one of this rowset's rows or its
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5275
     *            insert row
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5276
     * @throws SQLException if (1) the given column name does not match the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5277
     *            name of a column in this rowset, (2) the cursor is not on
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5278
     *            one of this rowset's rows or its insert row, (3) the type
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5279
     *            of the designated column is not an SQL <code>DATE</code>,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5280
     *            <code>TIME</code>, or <code>TIMESTAMP</code>, or (4) this
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5281
     *            rowset is <code>ResultSet.CONCUR_READ_ONLY</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5282
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5283
    public void updateTimestamp(String columnName, java.sql.Timestamp x) throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5284
        updateTimestamp(getColIdxByName(columnName), x);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5285
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5286
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5287
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5288
     * Sets the designated column in either the current row or the insert
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5289
     * row of this <code>CachedRowSetImpl</code> object with the given
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5290
     * ASCII stream value.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5291
     * <P>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5292
     * This method updates a column value in either the current row or
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5293
     * the insert row of this rowset, but it does not update the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5294
     * database.  If the cursor is on a row in the rowset, the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5295
     * method {@link #updateRow} must be called to update the database.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5296
     * If the cursor is on the insert row, the method {@link #insertRow}
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5297
     * must be called, which will insert the new row into both this rowset
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5298
     * and the database. Both of these methods must be called before the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5299
     * cursor moves to another row.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5300
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5301
     * @param columnName a <code>String</code> object that must match the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5302
     *        SQL name of a column in this rowset, ignoring case
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5303
     * @param x the new column value
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5304
     * @param length the number of one-byte ASCII characters in the stream
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5305
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5306
    public void updateAsciiStream(String columnName,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5307
    java.io.InputStream x,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5308
    int length) throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5309
        updateAsciiStream(getColIdxByName(columnName), x, length);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5310
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5311
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5312
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5313
     * Sets the designated column in either the current row or the insert
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5314
     * row of this <code>CachedRowSetImpl</code> object with the given
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5315
     * <code>java.io.InputStream</code> object.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5316
     * <P>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5317
     * This method updates a column value in either the current row or
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5318
     * the insert row of this rowset, but it does not update the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5319
     * database.  If the cursor is on a row in the rowset, the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5320
     * method {@link #updateRow} must be called to update the database.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5321
     * If the cursor is on the insert row, the method {@link #insertRow}
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5322
     * must be called, which will insert the new row into both this rowset
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5323
     * and the database. Both of these methods must be called before the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5324
     * cursor moves to another row.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5325
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5326
     * @param columnName a <code>String</code> object that must match the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5327
     *        SQL name of a column in this rowset, ignoring case
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5328
     * @param x the new column value; must be a <code>java.io.InputStream</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5329
     *          containing <code>BINARY</code>, <code>VARBINARY</code>, or
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5330
     *          <code>LONGVARBINARY</code> data
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5331
     * @param length the length of the stream in bytes
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5332
     * @throws SQLException if (1) the given column name does not match the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5333
     *            name of a column in this rowset, (2) the cursor is not on
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5334
     *            one of this rowset's rows or its insert row, (3) the data
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5335
     *            in the stream is not binary, or (4) this rowset is
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5336
     *            <code>ResultSet.CONCUR_READ_ONLY</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5337
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5338
    public void updateBinaryStream(String columnName, java.io.InputStream x, int length) throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5339
        updateBinaryStream(getColIdxByName(columnName), x, length);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5340
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5341
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5342
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5343
     * Sets the designated column in either the current row or the insert
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5344
     * row of this <code>CachedRowSetImpl</code> object with the given
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5345
     * <code>java.io.Reader</code> object.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5346
     * <P>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5347
     * This method updates a column value in either the current row or
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5348
     * the insert row of this rowset, but it does not update the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5349
     * database.  If the cursor is on a row in the rowset, the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5350
     * method {@link #updateRow} must be called to update the database.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5351
     * If the cursor is on the insert row, the method {@link #insertRow}
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5352
     * must be called, which will insert the new row into both this rowset
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5353
     * and the database. Both of these methods must be called before the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5354
     * cursor moves to another row.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5355
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5356
     * @param columnName a <code>String</code> object that must match the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5357
     *        SQL name of a column in this rowset, ignoring case
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5358
     * @param reader the new column value; must be a
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5359
     * <code>java.io.Reader</code> containing <code>BINARY</code>,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5360
     * <code>VARBINARY</code>, <code>LONGVARBINARY</code>, <code>CHAR</code>,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5361
     * <code>VARCHAR</code>, or <code>LONGVARCHAR</code> data
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5362
     * @param length the length of the stream in characters
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5363
     * @throws SQLException if (1) the given column name does not match the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5364
     *            name of a column in this rowset, (2) the cursor is not on
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5365
     *            one of this rowset's rows or its insert row, (3) the data
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5366
     *            in the stream is not a binary or character type, or (4) this
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5367
     *            rowset is <code>ResultSet.CONCUR_READ_ONLY</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5368
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5369
    public void updateCharacterStream(String columnName,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5370
    java.io.Reader reader,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5371
    int length) throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5372
        updateCharacterStream(getColIdxByName(columnName), reader, length);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5373
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5374
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5375
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5376
     * Sets the designated column in either the current row or the insert
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5377
     * row of this <code>CachedRowSetImpl</code> object with the given
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5378
     * <code>Object</code> value.  The <code>scale</code> parameter
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5379
     * indicates the number of digits to the right of the decimal point
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5380
     * and is ignored if the new column value is not a type that will be
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5381
     *  mapped to an SQL <code>DECIMAL</code> or <code>NUMERIC</code> value.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5382
     * <P>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5383
     * This method updates a column value in either the current row or
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5384
     * the insert row of this rowset, but it does not update the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5385
     * database.  If the cursor is on a row in the rowset, the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5386
     * method {@link #updateRow} must be called to update the database.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5387
     * If the cursor is on the insert row, the method {@link #insertRow}
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5388
     * must be called, which will insert the new row into both this rowset
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5389
     * and the database. Both of these methods must be called before the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5390
     * cursor moves to another row.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5391
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5392
     * @param columnName a <code>String</code> object that must match the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5393
     *        SQL name of a column in this rowset, ignoring case
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5394
     * @param x the new column value
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5395
     * @param scale the number of digits to the right of the decimal point (for
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5396
     *              <code>DECIMAL</code> and <code>NUMERIC</code> types only)
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5397
     * @throws SQLException if (1) the given column name does not match the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5398
     *            name of a column in this rowset, (2) the cursor is not on
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5399
     *            one of this rowset's rows or its insert row, or (3) this
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5400
     *            rowset is <code>ResultSet.CONCUR_READ_ONLY</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5401
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5402
    public void updateObject(String columnName, Object x, int scale) throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5403
        updateObject(getColIdxByName(columnName), x, scale);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5404
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5405
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5406
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5407
     * Sets the designated column in either the current row or the insert
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5408
     * row of this <code>CachedRowSetImpl</code> object with the given
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5409
     * <code>Object</code> value.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5410
     * <P>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5411
     * This method updates a column value in either the current row or
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5412
     * the insert row of this rowset, but it does not update the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5413
     * database.  If the cursor is on a row in the rowset, the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5414
     * method {@link #updateRow} must be called to update the database.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5415
     * If the cursor is on the insert row, the method {@link #insertRow}
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5416
     * must be called, which will insert the new row into both this rowset
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5417
     * and the database. Both of these methods must be called before the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5418
     * cursor moves to another row.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5419
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5420
     * @param columnName a <code>String</code> object that must match the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5421
     *        SQL name of a column in this rowset, ignoring case
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5422
     * @param x the new column value
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5423
     * @throws SQLException if (1) the given column name does not match the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5424
     *            name of a column in this rowset, (2) the cursor is not on
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5425
     *            one of this rowset's rows or its insert row, or (3) this
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5426
     *            rowset is <code>ResultSet.CONCUR_READ_ONLY</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5427
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5428
    public void updateObject(String columnName, Object x) throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5429
        updateObject(getColIdxByName(columnName), x);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5430
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5431
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5432
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5433
     * Inserts the contents of this <code>CachedRowSetImpl</code> object's insert
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5434
     * row into this rowset immediately following the current row.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5435
     * If the current row is the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5436
     * position after the last row or before the first row, the new row will
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5437
     * be inserted at the end of the rowset.  This method also notifies
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5438
     * listeners registered with this rowset that the row has changed.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5439
     * <P>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5440
     * The cursor must be on the insert row when this method is called.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5441
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5442
     * @throws SQLException if (1) the cursor is not on the insert row,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5443
     *            (2) one or more of the non-nullable columns in the insert
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5444
     *            row has not been given a value, or (3) this rowset is
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5445
     *            <code>ResultSet.CONCUR_READ_ONLY</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5446
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5447
    public void insertRow() throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5448
        int pos;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5449
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5450
        if (onInsertRow == false ||
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5451
            insertRow.isCompleteRow(RowSetMD) == false) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5452
                throw new SQLException(resBundle.handleGetObject("cachedrowsetimpl.failedins").toString());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5453
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5454
        // Added the setting of parameters that are passed
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5455
        // to setXXX methods after an empty CRS Object is
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5456
        // created through RowSetMetaData object
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5457
        Object [] toInsert = getParams();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5458
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5459
        for(int i = 0;i < toInsert.length; i++) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5460
          insertRow.setColumnObject(i+1,toInsert[i]);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5461
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5462
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5463
        Row insRow = new Row(RowSetMD.getColumnCount(),
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5464
        insertRow.getOrigRow());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5465
        insRow.setInserted();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5466
        /*
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5467
         * The new row is inserted into the RowSet
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5468
         * immediately following the current row.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5469
         *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5470
         * If we are afterlast then the rows are
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5471
         * inserted at the end.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5472
         */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5473
        if (currentRow >= numRows || currentRow < 0) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5474
            pos = numRows;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5475
        } else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5476
            pos = currentRow;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5477
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5478
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5479
        rvh.add(pos, insRow);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5480
        ++numRows;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5481
        // notify the listeners that the row changed.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5482
        notifyRowChanged();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5483
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5484
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5485
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5486
     * Marks the current row of this <code>CachedRowSetImpl</code> object as
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5487
     * updated and notifies listeners registered with this rowset that the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5488
     * row has changed.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5489
     * <P>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5490
     * This method  cannot be called when the cursor is on the insert row, and
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5491
     * it should be called before the cursor moves to another row.  If it is
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5492
     * called after the cursor moves to another row, this method has no effect,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5493
     * and the updates made before the cursor moved will be lost.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5494
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5495
     * @throws SQLException if the cursor is on the insert row or this
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5496
     *            rowset is <code>ResultSet.CONCUR_READ_ONLY</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5497
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5498
    public void updateRow() throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5499
        // make sure we aren't on the insert row
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5500
        if (onInsertRow == true) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5501
            throw new SQLException(resBundle.handleGetObject("cachedrowsetimpl.updateins").toString());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5502
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5503
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5504
        ((Row)getCurrentRow()).setUpdated();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5505
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5506
        // notify the listeners that the row changed.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5507
        notifyRowChanged();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5508
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5509
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5510
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5511
     * Deletes the current row from this <code>CachedRowSetImpl</code> object and
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5512
     * notifies listeners registered with this rowset that a row has changed.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5513
     * This method cannot be called when the cursor is on the insert row.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5514
     * <P>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5515
     * This method marks the current row as deleted, but it does not delete
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5516
     * the row from the underlying data source.  The method
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5517
     * <code>acceptChanges</code> must be called to delete the row in
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5518
     * the data source.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5519
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5520
     * @throws SQLException if (1) this method is called when the cursor
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5521
     *            is on the insert row, before the first row, or after the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5522
     *            last row or (2) this rowset is
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5523
     *            <code>ResultSet.CONCUR_READ_ONLY</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5524
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5525
    public void deleteRow() throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5526
        // make sure the cursor is on a valid row
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5527
        checkCursor();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5528
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5529
        ((Row)getCurrentRow()).setDeleted();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5530
        ++numDeleted;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5531
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5532
        // notify the listeners that the row changed.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5533
        notifyRowChanged();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5534
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5535
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5536
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5537
     * Sets the current row with its original value and marks the row as
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5538
     * not updated, thus undoing any changes made to the row since the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5539
     * last call to the methods <code>updateRow</code> or <code>deleteRow</code>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5540
     * This method should be called only when the cursor is on a row in
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5541
     * this rowset.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5542
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5543
     * @throws SQLException if the cursor is on the insert row, before the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5544
     *            first row, or after the last row
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5545
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5546
    public void refreshRow() throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5547
        // make sure we are on a row
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5548
        checkCursor();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5549
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5550
        // don't want this to happen...
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5551
        if (onInsertRow == true) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5552
            throw new SQLException(resBundle.handleGetObject("cachedrowsetimpl.invalidcp").toString());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5553
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5554
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5555
        Row currentRow = (Row)getCurrentRow();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5556
        // just undo any changes made to this row.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5557
        currentRow.clearUpdated();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5558
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
     * Rolls back any updates made to the current row of this
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5563
     * <code>CachedRowSetImpl</code> object and notifies listeners that
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5564
     * a row has changed.  To have an effect, this method
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5565
     * must be called after an <code>updateXXX</code> method has been
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5566
     * called and before the method <code>updateRow</code> has been called.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5567
     * If no updates have been made or the method <code>updateRow</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5568
     * has already been called, this method has no effect.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5569
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5570
     * @throws SQLException if the cursor is on the insert row, before the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5571
     *            first row, or after the last row
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5572
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5573
    public void cancelRowUpdates() throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5574
        // make sure we are on a row
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5575
        checkCursor();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5576
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5577
        // don't want this to happen...
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5578
        if (onInsertRow == true) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5579
            throw new SQLException(resBundle.handleGetObject("cachedrowsetimpl.invalidcp").toString());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5580
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5581
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5582
        Row currentRow = (Row)getCurrentRow();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5583
        if (currentRow.getUpdated() == true) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5584
            currentRow.clearUpdated();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5585
            notifyRowChanged();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5586
        }
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
     * Moves the cursor for this <code>CachedRowSetImpl</code> object
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5591
     * to the insert row.  The current row in the rowset is remembered
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5592
     * while the cursor is on the insert row.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5593
     * <P>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5594
     * The insert row is a special row associated with an updatable
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5595
     * rowset.  It is essentially a buffer where a new row may
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5596
     * be constructed by calling the appropriate <code>updateXXX</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5597
     * methods to assign a value to each column in the row.  A complete
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5598
     * row must be constructed; that is, every column that is not nullable
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5599
     * must be assigned a value.  In order for the new row to become part
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5600
     * of this rowset, the method <code>insertRow</code> must be called
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5601
     * before the cursor is moved back to the rowset.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5602
     * <P>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5603
     * Only certain methods may be invoked while the cursor is on the insert
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5604
     * row; many methods throw an exception if they are called while the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5605
     * cursor is there.  In addition to the <code>updateXXX</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5606
     * and <code>insertRow</code> methods, only the <code>getXXX</code> methods
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5607
     * may be called when the cursor is on the insert row.  A <code>getXXX</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5608
     * method should be called on a column only after an <code>updateXXX</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5609
     * method has been called on that column; otherwise, the value returned is
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5610
     * undetermined.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5611
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5612
     * @throws SQLException if this <code>CachedRowSetImpl</code> object is
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5613
     *            <code>ResultSet.CONCUR_READ_ONLY</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5614
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5615
    public void moveToInsertRow() throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5616
        if (getConcurrency() == ResultSet.CONCUR_READ_ONLY) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5617
            throw new SQLException(resBundle.handleGetObject("cachedrowsetimpl.movetoins").toString());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5618
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5619
        if (insertRow == null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5620
            if (RowSetMD == null)
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5621
                throw new SQLException(resBundle.handleGetObject("cachedrowsetimpl.movetoins1").toString());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5622
            int numCols = RowSetMD.getColumnCount();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5623
            if (numCols > 0) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5624
                insertRow = new InsertRow(numCols);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5625
            } else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5626
                throw new SQLException(resBundle.handleGetObject("cachedrowsetimpl.movetoins2").toString());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5627
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5628
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5629
        onInsertRow = true;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5630
        // %%% setCurrentRow called in BaseRow
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5631
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5632
        currentRow = cursorPos;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5633
        cursorPos = -1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5634
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5635
        insertRow.initInsertRow();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5636
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5637
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5638
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5639
     * Moves the cursor for this <code>CachedRowSetImpl</code> object to
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5640
     * the current row.  The current row is the row the cursor was on
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5641
     * when the method <code>moveToInsertRow</code> was called.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5642
     * <P>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5643
     * Calling this method has no effect unless it is called while the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5644
     * cursor is on the insert row.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5645
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5646
     * @throws SQLException if an error occurs
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5647
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5648
    public void moveToCurrentRow() throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5649
        if (onInsertRow == false) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5650
            return;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5651
        } else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5652
            cursorPos = currentRow;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5653
            onInsertRow = false;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5654
        }
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
     * Returns <code>null</code>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5659
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5660
     * @return <code>null</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5661
     * @throws SQLException if an error occurs
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5662
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5663
    public Statement getStatement() throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5664
        return null;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5665
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5666
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5667
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5668
     * Retrieves the value of the designated column in this
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5669
     * <code>CachedRowSetImpl</code> object as an <code>Object</code> in
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5670
     * the Java programming language, using the given
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5671
     * <code>java.util.Map</code> object to custom map the value if
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5672
     * appropriate.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5673
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5674
     * @param columnIndex the first column is <code>1</code>, the second
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5675
     *        is <code>2</code>, and so on; must be <code>1</code> or larger
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5676
     *        and equal to or less than the number of columns in this rowset
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5677
     * @param map a <code>java.util.Map</code> object showing the mapping
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5678
     *            from SQL type names to classes in the Java programming
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5679
     *            language
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5680
     * @return an <code>Object</code> representing the SQL value
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5681
     * @throws SQLException if the given column index is out of bounds or
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5682
     *            the cursor is not on one of this rowset's rows or its
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5683
     *            insert row
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5684
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5685
     public Object getObject(int columnIndex,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5686
                             java.util.Map<String,Class<?>> map)
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5687
         throws SQLException
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5688
     {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5689
        Object value;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5690
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5691
        // sanity check.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5692
        checkIndex(columnIndex);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5693
        // make sure the cursor is on a valid row
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5694
        checkCursor();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5695
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5696
        setLastValueNull(false);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5697
        value = getCurrentRow().getColumnObject(columnIndex);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5698
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5699
        // check for SQL NULL
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5700
        if (value == null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5701
            setLastValueNull(true);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5702
            return null;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5703
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5704
        if (value instanceof Struct) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5705
            Struct s = (Struct)value;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5706
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5707
            // look up the class in the map
11129
f9ad1aadf3fa 7116445: Miscellaneous warnings in the JDBC/RowSet classes
lancea
parents: 9537
diff changeset
  5708
            Class<?> c = map.get(s.getSQLTypeName());
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5709
            if (c != null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5710
                // create new instance of the class
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5711
                SQLData obj = null;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5712
                try {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5713
                    obj = (SQLData)c.newInstance();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5714
                } catch (java.lang.InstantiationException ex) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5715
                    throw new SQLException(MessageFormat.format(resBundle.handleGetObject("cachedrowsetimpl.unableins").toString(),
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5716
                    ex.getMessage()));
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5717
                } catch (java.lang.IllegalAccessException ex) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5718
                    throw new SQLException(MessageFormat.format(resBundle.handleGetObject("cachedrowsetimpl.unableins").toString(),
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5719
                    ex.getMessage()));
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5720
                }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5721
                // get the attributes from the struct
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5722
                Object attribs[] = s.getAttributes(map);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5723
                // create the SQLInput "stream"
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5724
                SQLInputImpl sqlInput = new SQLInputImpl(attribs, map);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5725
                // read the values...
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5726
                obj.readSQL(sqlInput, s.getSQLTypeName());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5727
                return (Object)obj;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5728
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5729
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5730
        return value;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5731
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5732
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5733
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5734
     * Retrieves the value of the designated column in this
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5735
     * <code>CachedRowSetImpl</code> object as a <code>Ref</code> object
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5736
     * in the Java programming language.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5737
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5738
     * @param columnIndex the first column is <code>1</code>, the second
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5739
     *        is <code>2</code>, and so on; must be <code>1</code> or larger
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5740
     *        and equal to or less than the number of columns in this rowset
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5741
     * @return a <code>Ref</code> object representing an SQL<code> REF</code> value
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5742
     * @throws SQLException if (1) the given column index is out of bounds,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5743
     *            (2) the cursor is not on one of this rowset's rows or its
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5744
     *            insert row, or (3) the designated column does not store an
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5745
     *            SQL <code>REF</code> value
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5746
     * @see #getRef(String)
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5747
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5748
    public Ref getRef(int columnIndex) throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5749
        Ref value;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5750
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5751
        // sanity check.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5752
        checkIndex(columnIndex);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5753
        // make sure the cursor is on a valid row
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5754
        checkCursor();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5755
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5756
        if (RowSetMD.getColumnType(columnIndex) != java.sql.Types.REF) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5757
            throw new SQLException(resBundle.handleGetObject("cachedrowsetimpl.dtypemismt").toString());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5758
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5759
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5760
        setLastValueNull(false);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5761
        value = (Ref)(getCurrentRow().getColumnObject(columnIndex));
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5762
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5763
        // check for SQL NULL
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5764
        if (value == null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5765
            setLastValueNull(true);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5766
            return null;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5767
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5768
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5769
        return value;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5770
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5771
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5772
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5773
     * Retrieves the value of the designated column in this
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5774
     * <code>CachedRowSetImpl</code> object as a <code>Blob</code> object
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5775
     * in the Java programming language.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5776
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5777
     * @param columnIndex the first column is <code>1</code>, the second
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5778
     *        is <code>2</code>, and so on; must be <code>1</code> or larger
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5779
     *        and equal to or less than the number of columns in this rowset
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5780
     * @return a <code>Blob</code> object representing an SQL <code>BLOB</code> value
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5781
     * @throws SQLException if (1) the given column index is out of bounds,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5782
     *            (2) the cursor is not on one of this rowset's rows or its
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5783
     *            insert row, or (3) the designated column does not store an
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5784
     *            SQL <code>BLOB</code> value
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5785
     * @see #getBlob(String)
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5786
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5787
    public Blob getBlob(int columnIndex) throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5788
        Blob value;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5789
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5790
        // sanity check.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5791
        checkIndex(columnIndex);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5792
        // make sure the cursor is on a valid row
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5793
        checkCursor();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5794
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5795
        if (RowSetMD.getColumnType(columnIndex) != java.sql.Types.BLOB) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5796
            System.out.println(MessageFormat.format(resBundle.handleGetObject("cachedrowsetimpl.type").toString(), RowSetMD.getColumnType(columnIndex)));
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5797
            throw new SQLException(resBundle.handleGetObject("cachedrowsetimpl.dtypemismt").toString());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5798
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5799
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5800
        setLastValueNull(false);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5801
        value = (Blob)(getCurrentRow().getColumnObject(columnIndex));
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5802
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5803
        // check for SQL NULL
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5804
        if (value == null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5805
            setLastValueNull(true);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5806
            return null;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5807
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5808
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5809
        return value;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5810
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5811
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5812
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5813
     * Retrieves the value of the designated column in this
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5814
     * <code>CachedRowSetImpl</code> object as a <code>Clob</code> object
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5815
     * in the Java programming language.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5816
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5817
     * @param columnIndex the first column is <code>1</code>, the second
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5818
     *        is <code>2</code>, and so on; must be <code>1</code> or larger
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5819
     *        and equal to or less than the number of columns in this rowset
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5820
     * @return a <code>Clob</code> object representing an SQL <code>CLOB</code> value
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5821
     * @throws SQLException if (1) the given column index is out of bounds,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5822
     *            (2) the cursor is not on one of this rowset's rows or its
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5823
     *            insert row, or (3) the designated column does not store an
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5824
     *            SQL <code>CLOB</code> value
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5825
     * @see #getClob(String)
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5826
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5827
    public Clob getClob(int columnIndex) throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5828
        Clob value;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5829
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5830
        // sanity check.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5831
        checkIndex(columnIndex);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5832
        // make sure the cursor is on a valid row
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5833
        checkCursor();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5834
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5835
        if (RowSetMD.getColumnType(columnIndex) != java.sql.Types.CLOB) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5836
            System.out.println(MessageFormat.format(resBundle.handleGetObject("cachedrowsetimpl.type").toString(), RowSetMD.getColumnType(columnIndex)));
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5837
            throw new SQLException(resBundle.handleGetObject("cachedrowsetimpl.dtypemismt").toString());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5838
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5839
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5840
        setLastValueNull(false);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5841
        value = (Clob)(getCurrentRow().getColumnObject(columnIndex));
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5842
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5843
        // check for SQL NULL
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5844
        if (value == null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5845
            setLastValueNull(true);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5846
            return null;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5847
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5848
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5849
        return value;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5850
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5851
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5852
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5853
     * Retrieves the value of the designated column in this
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5854
     * <code>CachedRowSetImpl</code> object as an <code>Array</code> object
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5855
     * in the Java programming language.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5856
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5857
     * @param columnIndex the first column is <code>1</code>, the second
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5858
     *        is <code>2</code>, and so on; must be <code>1</code> or larger
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5859
     *        and equal to or less than the number of columns in this rowset
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5860
     * @return an <code>Array</code> object representing an SQL
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5861
     *         <code>ARRAY</code> value
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5862
     * @throws SQLException if (1) the given column index is out of bounds,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5863
     *            (2) the cursor is not on one of this rowset's rows or its
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5864
     *            insert row, or (3) the designated column does not store an
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5865
     *            SQL <code>ARRAY</code> value
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5866
     * @see #getArray(String)
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5867
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5868
    public Array getArray(int columnIndex) throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5869
        java.sql.Array value;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5870
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5871
        // sanity check.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5872
        checkIndex(columnIndex);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5873
        // make sure the cursor is on a valid row
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5874
        checkCursor();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5875
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5876
        if (RowSetMD.getColumnType(columnIndex) != java.sql.Types.ARRAY) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5877
            throw new SQLException(resBundle.handleGetObject("cachedrowsetimpl.dtypemismt").toString());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5878
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5879
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5880
        setLastValueNull(false);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5881
        value = (java.sql.Array)(getCurrentRow().getColumnObject(columnIndex));
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5882
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5883
        // check for SQL NULL
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5884
        if (value == null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5885
            setLastValueNull(true);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5886
            return null;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5887
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5888
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5889
        return value;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5890
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5891
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5892
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5893
     * Retrieves the value of the designated column in this
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5894
     * <code>CachedRowSetImpl</code> object as an <code>Object</code> in
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5895
     * the Java programming language, using the given
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5896
     * <code>java.util.Map</code> object to custom map the value if
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5897
     * appropriate.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5898
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5899
     * @param columnName a <code>String</code> object that must match the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5900
     *        SQL name of a column in this rowset, ignoring case
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5901
     * @param map a <code>java.util.Map</code> object showing the mapping
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5902
     *        from SQL type names to classes in the Java programming
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5903
     *        language
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5904
     * @return an <code>Object</code> representing the SQL value
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5905
     * @throws SQLException if the given column name is not the name of
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5906
     *         a column in this rowset or the cursor is not on one of
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5907
     *         this rowset's rows or its insert row
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5908
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5909
    public Object getObject(String columnName,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5910
                            java.util.Map<String,Class<?>> map)
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5911
    throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5912
        return getObject(getColIdxByName(columnName), map);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5913
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5914
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5915
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5916
     * Retrieves the value of the designated column in this
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5917
     * <code>CachedRowSetImpl</code> object as a <code>Ref</code> object
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5918
     * in the Java programming language.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5919
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5920
     * @param colName a <code>String</code> object that must match the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5921
     *        SQL name of a column in this rowset, ignoring case
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5922
     * @return a <code>Ref</code> object representing an SQL<code> REF</code> value
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5923
     * @throws SQLException  if (1) the given column name is not the name of
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5924
     *            a column in this rowset, (2) the cursor is not on one of
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5925
     *            this rowset's rows or its insert row, or (3) the column value
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5926
     *            is not an SQL <code>REF</code> value
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5927
     * @see #getRef(int)
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5928
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5929
    public Ref getRef(String colName) throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5930
        return getRef(getColIdxByName(colName));
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5931
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5932
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5933
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5934
     * Retrieves the value of the designated column in this
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5935
     * <code>CachedRowSetImpl</code> object as a <code>Blob</code> object
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5936
     * in the Java programming language.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5937
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5938
     * @param colName a <code>String</code> object that must match the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5939
     *        SQL name of a column in this rowset, ignoring case
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5940
     * @return a <code>Blob</code> object representing an SQL <code>BLOB</code> value
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5941
     * @throws SQLException if (1) the given column name is not the name of
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5942
     *            a column in this rowset, (2) the cursor is not on one of
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5943
     *            this rowset's rows or its insert row, or (3) the designated
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5944
     *            column does not store an SQL <code>BLOB</code> value
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5945
     * @see #getBlob(int)
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5946
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5947
    public Blob getBlob(String colName) throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5948
        return getBlob(getColIdxByName(colName));
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5949
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5950
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5951
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5952
     * Retrieves the value of the designated column in this
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5953
     * <code>CachedRowSetImpl</code> object as a <code>Clob</code> object
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5954
     * in the Java programming language.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5955
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5956
     * @param colName a <code>String</code> object that must match the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5957
     *        SQL name of a column in this rowset, ignoring case
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5958
     * @return a <code>Clob</code> object representing an SQL
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5959
     *         <code>CLOB</code> value
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5960
     * @throws SQLException if (1) the given column name is not the name of
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5961
     *            a column in this rowset, (2) the cursor is not on one of
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5962
     *            this rowset's rows or its insert row, or (3) the designated
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5963
     *            column does not store an SQL <code>CLOB</code> value
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5964
     * @see #getClob(int)
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5965
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5966
    public Clob getClob(String colName) throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5967
        return getClob(getColIdxByName(colName));
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5968
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5969
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5970
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5971
     * Retrieves the value of the designated column in this
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5972
     * <code>CachedRowSetImpl</code> object as an <code>Array</code> object
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5973
     * in the Java programming langugage.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5974
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5975
     * @param colName a <code>String</code> object that must match the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5976
     *        SQL name of a column in this rowset, ignoring case
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5977
     * @return an <code>Array</code> object representing an SQL
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5978
     *         <code>ARRAY</code> value
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5979
     * @throws SQLException if (1) the given column name is not the name of
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5980
     *            a column in this rowset, (2) the cursor is not on one of
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5981
     *            this rowset's rows or its insert row, or (3) the designated
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5982
     *            column does not store an SQL <code>ARRAY</code> value
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5983
     * @see #getArray(int)
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5984
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5985
    public Array getArray(String colName) throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5986
        return getArray(getColIdxByName(colName));
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5987
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5988
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5989
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5990
     * Retrieves the value of the designated column in the current row
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5991
     * of this <code>CachedRowSetImpl</code> object as a <code>java.sql.Date</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5992
     * object, using the given <code>Calendar</code> object to construct an
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5993
     * appropriate millisecond value for the date.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5994
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5995
     * @param columnIndex the first column is <code>1</code>, the second
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5996
     *        is <code>2</code>, and so on; must be <code>1</code> or larger
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5997
     *        and equal to or less than the number of columns in the rowset
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5998
     * @param cal the <code>java.util.Calendar</code> object to use in
90ce3da70b43 Initial load
duke
parents:
diff changeset
  5999
     *            constructing the date
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6000
     * @return the column value; if the value is SQL <code>NULL</code>,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6001
     *         the result is <code>null</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6002
     * @throws SQLException if (1) the given column name is not the name of
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6003
     *            a column in this rowset, (2) the cursor is not on one of
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6004
     *            this rowset's rows or its insert row, or (3) the designated
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6005
     *            column does not store an SQL <code>DATE</code> or
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6006
     *            <code>TIMESTAMP</code> value
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6007
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6008
    public java.sql.Date getDate(int columnIndex, Calendar cal) throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6009
        Object value;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6010
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6011
        // sanity check.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6012
        checkIndex(columnIndex);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6013
        // make sure the cursor is on a valid row
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6014
        checkCursor();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6015
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6016
        setLastValueNull(false);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6017
        value = getCurrentRow().getColumnObject(columnIndex);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6018
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6019
        // check for SQL NULL
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6020
        if (value == null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6021
            setLastValueNull(true);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6022
            return null;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6023
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6024
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6025
        value = convertTemporal(value,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6026
        RowSetMD.getColumnType(columnIndex),
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6027
        java.sql.Types.DATE);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6028
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6029
        // create a default calendar
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6030
        Calendar defaultCal = Calendar.getInstance();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6031
        // set this Calendar to the time we have
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6032
        defaultCal.setTime((java.util.Date)value);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6033
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6034
        /*
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6035
         * Now we can pull the pieces of the date out
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6036
         * of the default calendar and put them into
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6037
         * the user provided calendar
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6038
         */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6039
        cal.set(Calendar.YEAR, defaultCal.get(Calendar.YEAR));
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6040
        cal.set(Calendar.MONTH, defaultCal.get(Calendar.MONTH));
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6041
        cal.set(Calendar.DAY_OF_MONTH, defaultCal.get(Calendar.DAY_OF_MONTH));
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6042
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6043
        /*
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6044
         * This looks a little odd but it is correct -
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6045
         * Calendar.getTime() returns a Date...
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6046
         */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6047
        return new java.sql.Date(cal.getTime().getTime());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6048
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6049
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6050
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6051
     * Retrieves the value of the designated column in the current row
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6052
     * of this <code>CachedRowSetImpl</code> object as a <code>java.sql.Date</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6053
     * object, using the given <code>Calendar</code> object to construct an
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6054
     * appropriate millisecond value for the date.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6055
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6056
     * @param columnName a <code>String</code> object that must match the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6057
     *        SQL name of a column in this rowset, ignoring case
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6058
     * @param cal the <code>java.util.Calendar</code> object to use in
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6059
     *            constructing the date
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6060
     * @return the column value; if the value is SQL <code>NULL</code>,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6061
     *         the result is <code>null</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6062
     * @throws SQLException if (1) the given column name is not the name of
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6063
     *            a column in this rowset, (2) the cursor is not on one of
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6064
     *            this rowset's rows or its insert row, or (3) the designated
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6065
     *            column does not store an SQL <code>DATE</code> or
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6066
     *            <code>TIMESTAMP</code> value
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6067
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6068
    public java.sql.Date getDate(String columnName, Calendar cal) throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6069
        return getDate(getColIdxByName(columnName), cal);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6070
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6071
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6072
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6073
     * Retrieves the value of the designated column in the current row
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6074
     * of this <code>CachedRowSetImpl</code> object as a <code>java.sql.Time</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6075
     * object, using the given <code>Calendar</code> object to construct an
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6076
     * appropriate millisecond value for the date.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6077
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6078
     * @param columnIndex the first column is <code>1</code>, the second
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6079
     *        is <code>2</code>, and so on; must be <code>1</code> or larger
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6080
     *        and equal to or less than the number of columns in the rowset
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6081
     * @param cal the <code>java.util.Calendar</code> object to use in
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6082
     *            constructing the date
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6083
     * @return the column value; if the value is SQL <code>NULL</code>,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6084
     *         the result is <code>null</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6085
     * @throws SQLException if (1) the given column name is not the name of
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6086
     *            a column in this rowset, (2) the cursor is not on one of
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6087
     *            this rowset's rows or its insert row, or (3) the designated
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6088
     *            column does not store an SQL <code>TIME</code> or
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6089
     *            <code>TIMESTAMP</code> value
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6090
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6091
    public java.sql.Time getTime(int columnIndex, Calendar cal) throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6092
        Object value;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6093
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6094
        // sanity check.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6095
        checkIndex(columnIndex);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6096
        // make sure the cursor is on a valid row
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6097
        checkCursor();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6098
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6099
        setLastValueNull(false);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6100
        value = getCurrentRow().getColumnObject(columnIndex);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6101
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6102
        // check for SQL NULL
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6103
        if (value == null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6104
            setLastValueNull(true);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6105
            return null;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6106
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6107
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6108
        value = convertTemporal(value,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6109
        RowSetMD.getColumnType(columnIndex),
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6110
        java.sql.Types.TIME);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6111
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6112
        // create a default calendar
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6113
        Calendar defaultCal = Calendar.getInstance();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6114
        // set the time in the default calendar
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6115
        defaultCal.setTime((java.util.Date)value);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6116
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6117
        /*
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6118
         * Now we can pull the pieces of the date out
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6119
         * of the default calendar and put them into
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6120
         * the user provided calendar
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6121
         */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6122
        cal.set(Calendar.HOUR_OF_DAY, defaultCal.get(Calendar.HOUR_OF_DAY));
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6123
        cal.set(Calendar.MINUTE, defaultCal.get(Calendar.MINUTE));
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6124
        cal.set(Calendar.SECOND, defaultCal.get(Calendar.SECOND));
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6125
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6126
        return new java.sql.Time(cal.getTime().getTime());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6127
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6128
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6129
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6130
     * Retrieves the value of the designated column in the current row
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6131
     * of this <code>CachedRowSetImpl</code> object as a <code>java.sql.Time</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6132
     * object, using the given <code>Calendar</code> object to construct an
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6133
     * appropriate millisecond value for the date.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6134
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6135
     * @param columnName a <code>String</code> object that must match the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6136
     *        SQL name of a column in this rowset, ignoring case
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6137
     * @param cal the <code>java.util.Calendar</code> object to use in
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6138
     *            constructing the date
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6139
     * @return the column value; if the value is SQL <code>NULL</code>,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6140
     *         the result is <code>null</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6141
     * @throws SQLException if (1) the given column name is not the name of
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6142
     *            a column in this rowset, (2) the cursor is not on one of
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6143
     *            this rowset's rows or its insert row, or (3) the designated
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6144
     *            column does not store an SQL <code>TIME</code> or
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6145
     *            <code>TIMESTAMP</code> value
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6146
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6147
    public java.sql.Time getTime(String columnName, Calendar cal) throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6148
        return getTime(getColIdxByName(columnName), cal);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6149
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6150
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6151
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6152
     * Retrieves the value of the designated column in the current row
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6153
     * of this <code>CachedRowSetImpl</code> object as a <code>java.sql.Timestamp</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6154
     * object, using the given <code>Calendar</code> object to construct an
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6155
     * appropriate millisecond value for the date.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6156
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6157
     * @param columnIndex the first column is <code>1</code>, the second
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6158
     *        is <code>2</code>, and so on; must be <code>1</code> or larger
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6159
     *        and equal to or less than the number of columns in the rowset
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6160
     * @param cal the <code>java.util.Calendar</code> object to use in
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6161
     *            constructing the date
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6162
     * @return the column value; if the value is SQL <code>NULL</code>,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6163
     *         the result is <code>null</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6164
     * @throws SQLException if (1) the given column name is not the name of
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6165
     *            a column in this rowset, (2) the cursor is not on one of
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6166
     *            this rowset's rows or its insert row, or (3) the designated
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6167
     *            column does not store an SQL <code>TIME</code> or
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6168
     *            <code>TIMESTAMP</code> value
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6169
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6170
    public java.sql.Timestamp getTimestamp(int columnIndex, Calendar cal) throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6171
        Object value;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6172
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6173
        // sanity check.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6174
        checkIndex(columnIndex);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6175
        // make sure the cursor is on a valid row
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6176
        checkCursor();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6177
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6178
        setLastValueNull(false);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6179
        value = getCurrentRow().getColumnObject(columnIndex);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6180
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6181
        // check for SQL NULL
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6182
        if (value == null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6183
            setLastValueNull(true);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6184
            return null;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6185
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6186
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6187
        value = convertTemporal(value,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6188
        RowSetMD.getColumnType(columnIndex),
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6189
        java.sql.Types.TIMESTAMP);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6190
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6191
        // create a default calendar
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6192
        Calendar defaultCal = Calendar.getInstance();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6193
        // set the time in the default calendar
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6194
        defaultCal.setTime((java.util.Date)value);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6195
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6196
        /*
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6197
         * Now we can pull the pieces of the date out
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6198
         * of the default calendar and put them into
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6199
         * the user provided calendar
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6200
         */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6201
        cal.set(Calendar.YEAR, defaultCal.get(Calendar.YEAR));
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6202
        cal.set(Calendar.MONTH, defaultCal.get(Calendar.MONTH));
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6203
        cal.set(Calendar.DAY_OF_MONTH, defaultCal.get(Calendar.DAY_OF_MONTH));
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6204
        cal.set(Calendar.HOUR_OF_DAY, defaultCal.get(Calendar.HOUR_OF_DAY));
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6205
        cal.set(Calendar.MINUTE, defaultCal.get(Calendar.MINUTE));
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6206
        cal.set(Calendar.SECOND, defaultCal.get(Calendar.SECOND));
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6207
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6208
        return new java.sql.Timestamp(cal.getTime().getTime());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6209
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6210
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6211
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6212
     * Retrieves the value of the designated column in the current row
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6213
     * of this <code>CachedRowSetImpl</code> object as a
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6214
     * <code>java.sql.Timestamp</code> object, using the given
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6215
     * <code>Calendar</code> object to construct an appropriate
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6216
     * millisecond value for the date.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6217
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6218
     * @param columnName a <code>String</code> object that must match the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6219
     *        SQL name of a column in this rowset, ignoring case
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6220
     * @param cal the <code>java.util.Calendar</code> object to use in
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6221
     *            constructing the date
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6222
     * @return the column value; if the value is SQL <code>NULL</code>,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6223
     *         the result is <code>null</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6224
     * @throws SQLException if (1) the given column name is not the name of
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6225
     *            a column in this rowset, (2) the cursor is not on one of
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6226
     *            this rowset's rows or its insert row, or (3) the designated
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6227
     *            column does not store an SQL <code>DATE</code>,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6228
     *            <code>TIME</code>, or <code>TIMESTAMP</code> value
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6229
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6230
    public java.sql.Timestamp getTimestamp(String columnName, Calendar cal) throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6231
        return getTimestamp(getColIdxByName(columnName), cal);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6232
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6233
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6234
    /*
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6235
     * RowSetInternal Interface
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6236
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6237
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6238
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6239
     * Retrieves the <code>Connection</code> object passed to this
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6240
     * <code>CachedRowSetImpl</code> object.  This connection may be
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6241
     * used to populate this rowset with data or to write data back
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6242
     * to its underlying data source.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6243
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6244
     * @return the <code>Connection</code> object passed to this rowset;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6245
     *         may be <code>null</code> if there is no connection
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6246
     * @throws SQLException if an error occurs
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6247
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6248
    public Connection getConnection() throws SQLException{
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6249
        return conn;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6250
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6251
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6252
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6253
     * Sets the metadata for this <code>CachedRowSetImpl</code> object
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6254
     * with the given <code>RowSetMetaData</code> object.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6255
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6256
     * @param md a <code>RowSetMetaData</code> object instance containing
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6257
     *            metadata about the columsn in the rowset
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6258
     * @throws SQLException if invalid meta data is supplied to the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6259
     *            rowset
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6260
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6261
    public void setMetaData(RowSetMetaData md) throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6262
        RowSetMD =(RowSetMetaDataImpl) md;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6263
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6264
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6265
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6266
     * Returns a result set containing the original value of the rowset. The
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6267
     * original value is the state of the <code>CachedRowSetImpl</code> after the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6268
     * last population or synchronization (whichever occured most recently) with
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6269
     * the data source.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6270
     * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6271
     * The cursor is positioned before the first row in the result set.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6272
     * Only rows contained in the result set returned by <code>getOriginal()</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6273
     * are said to have an original value.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6274
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6275
     * @return the original result set of the rowset
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6276
     * @throws SQLException if an error occurs produce the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6277
     *           <code>ResultSet</code> object
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6278
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6279
    public ResultSet getOriginal() throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6280
        CachedRowSetImpl crs = new CachedRowSetImpl();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6281
        crs.RowSetMD = RowSetMD;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6282
        crs.numRows = numRows;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6283
        crs.cursorPos = 0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6284
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6285
        // make sure we don't get someone playing with these
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6286
        // %%% is this now necessary ???
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6287
        //crs.setReader(null);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6288
        //crs.setWriter(null);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6289
        int colCount = RowSetMD.getColumnCount();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6290
        Row orig;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6291
11129
f9ad1aadf3fa 7116445: Miscellaneous warnings in the JDBC/RowSet classes
lancea
parents: 9537
diff changeset
  6292
        for (Iterator<?> i = rvh.iterator(); i.hasNext();) {
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6293
            orig = new Row(colCount, ((Row)i.next()).getOrigRow());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6294
            crs.rvh.add(orig);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6295
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6296
        return (ResultSet)crs;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6297
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6298
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6299
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6300
     * Returns a result set containing the original value of the current
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6301
     * row only.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6302
     * The original value is the state of the <code>CachedRowSetImpl</code> after
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6303
     * the last population or synchronization (whichever occured most recently)
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6304
     * with the data source.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6305
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6306
     * @return the original result set of the row
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6307
     * @throws SQLException if there is no current row
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6308
     * @see #setOriginalRow
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6309
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6310
    public ResultSet getOriginalRow() throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6311
        CachedRowSetImpl crs = new CachedRowSetImpl();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6312
        crs.RowSetMD = RowSetMD;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6313
        crs.numRows = 1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6314
        crs.cursorPos = 0;
6530
bfb7b294dd14 6680198: UnmarshalException caused by incompatible serialVersionUID
lancea
parents: 5506
diff changeset
  6315
        crs.setTypeMap(this.getTypeMap());
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6316
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6317
        // make sure we don't get someone playing with these
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6318
        // %%% is this now necessary ???
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6319
        //crs.setReader(null);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6320
        //crs.setWriter(null);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6321
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6322
        Row orig = new Row(RowSetMD.getColumnCount(),
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6323
        getCurrentRow().getOrigRow());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6324
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6325
        crs.rvh.add(orig);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6326
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6327
        return (ResultSet)crs;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6328
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
     * Marks the current row in this rowset as being an original row.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6333
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6334
     * @throws SQLException if there is no current row
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6335
     * @see #getOriginalRow
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6336
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6337
    public void setOriginalRow() throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6338
        if (onInsertRow == true) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6339
            throw new SQLException(resBundle.handleGetObject("cachedrowsetimpl.invalidop").toString());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6340
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6341
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6342
        Row row = (Row)getCurrentRow();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6343
        makeRowOriginal(row);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6344
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6345
        // this can happen if deleted rows are being shown
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6346
        if (row.getDeleted() == true) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6347
            removeCurrentRow();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6348
        }
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
     * Makes the given row of this rowset the original row by clearing any
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6353
     * settings that mark the row as having been inserted, deleted, or updated.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6354
     * This method is called internally by the methods
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6355
     * <code>setOriginalRow</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6356
     * and <code>setOriginal</code>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6357
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6358
     * @param row the row to be made the original row
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6359
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6360
    private void makeRowOriginal(Row row) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6361
        if (row.getInserted() == true) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6362
            row.clearInserted();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6363
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6364
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6365
        if (row.getUpdated() == true) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6366
            row.moveCurrentToOrig();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6367
        }
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
     * Marks all rows in this rowset as being original rows. Any updates
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6372
     * made to the rows become the original values for the rowset.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6373
     * Calls to the method <code>setOriginal</code> connot be reversed.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6374
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6375
     * @throws SQLException if an error occurs
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6376
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6377
    public void setOriginal() throws SQLException {
11129
f9ad1aadf3fa 7116445: Miscellaneous warnings in the JDBC/RowSet classes
lancea
parents: 9537
diff changeset
  6378
        for (Iterator<?> i = rvh.iterator(); i.hasNext();) {
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6379
            Row row = (Row)i.next();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6380
            makeRowOriginal(row);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6381
            // remove deleted rows from the collection.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6382
            if (row.getDeleted() == true) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6383
                i.remove();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6384
                --numRows;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6385
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6386
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6387
        numDeleted = 0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6388
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6389
        // notify any listeners that the rowset has changed
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6390
        notifyRowSetChanged();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6391
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6392
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6393
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6394
     * Returns an identifier for the object (table) that was used to create this
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6395
     * rowset.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6396
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6397
     * @return a <code>String</code> object that identifies the table from
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6398
     *         which this <code>CachedRowSetImpl</code> object was derived
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6399
     * @throws SQLException if an error occurs
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6400
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6401
    public String getTableName() throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6402
        return tableName;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6403
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6404
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6405
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6406
     * Sets the identifier for the table from which this rowset was derived
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6407
     * to the given table name.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6408
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6409
     * @param tabName a <code>String</code> object that identifies the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6410
     *          table from which this <code>CachedRowSetImpl</code> object
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6411
     *          was derived
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6412
     * @throws SQLException if an error occurs
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6413
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6414
    public void setTableName(String tabName) throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6415
        if (tabName == null)
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6416
            throw new SQLException(resBundle.handleGetObject("cachedrowsetimpl.tablename").toString());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6417
        else
6692
aef4e294026f 6988993: Address Findbugs warnings for the use of String Constructor
lancea
parents: 6664
diff changeset
  6418
            tableName = tabName;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6419
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6420
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6421
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6422
     * Returns the columns that make a key to uniquely identify a
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6423
     * row in this <code>CachedRowSetImpl</code> object.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6424
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6425
     * @return an array of column numbers that constitutes a primary
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6426
     *           key for this rowset. This array should be empty
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6427
     *           if no column is representitive of a primary key
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6428
     * @throws SQLException if the rowset is empty or no columns
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6429
     *           are designated as primary keys
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6430
     * @see #setKeyColumns
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6431
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6432
    public int[] getKeyColumns() throws SQLException {
11683
5e02efd89af6 7133815: address the findbug errors in CachedRowSetImpl, SerialStruct, BaseRow, SerialInputImpl, SerialOutputImpl
lancea
parents: 11129
diff changeset
  6433
        int[]keyColumns  = this.keyCols;
5e02efd89af6 7133815: address the findbug errors in CachedRowSetImpl, SerialStruct, BaseRow, SerialInputImpl, SerialOutputImpl
lancea
parents: 11129
diff changeset
  6434
        return (keyColumns == null) ? null : Arrays.copyOf(keyColumns, keyColumns.length);
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6435
    }
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
     * Sets this <code>CachedRowSetImpl</code> object's
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6440
     * <code>keyCols</code> field with the given array of column
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6441
     * numbers, which forms a key for uniquely identifying a row
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6442
     * in this rowset.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6443
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6444
     * @param keys an array of <code>int</code> indicating the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6445
     *        columns that form a primary key for this
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6446
     *        <code>CachedRowSetImpl</code> object; every
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6447
     *        element in the array must be greater than
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6448
     *        <code>0</code> and less than or equal to the number
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6449
     *        of columns in this rowset
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6450
     * @throws SQLException if any of the numbers in the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6451
     *            given array is not valid for this rowset
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6452
     * @see #getKeyColumns
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6453
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6454
    public void setKeyColumns(int [] keys) throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6455
        int numCols = 0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6456
        if (RowSetMD != null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6457
            numCols = RowSetMD.getColumnCount();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6458
            if (keys.length > numCols)
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6459
                throw new SQLException(resBundle.handleGetObject("cachedrowsetimpl.keycols").toString());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6460
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6461
        keyCols = new int[keys.length];
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6462
        for (int i = 0; i < keys.length; i++) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6463
            if (RowSetMD != null && (keys[i] <= 0 ||
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6464
            keys[i] > numCols)) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6465
                throw new SQLException(resBundle.handleGetObject("cachedrowsetimpl.invalidcol").toString() +
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6466
                keys[i]);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6467
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6468
            keyCols[i] = keys[i];
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6469
        }
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
     * Sets the designated column in either the current row or the insert
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6474
     * row of this <code>CachedRowSetImpl</code> object with the given
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6475
     * <code>Ref</code> value.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6476
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6477
     * This method updates a column value in either the current row or
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6478
     * the insert row of this rowset, but it does not update the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6479
     * database.  If the cursor is on a row in the rowset, the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6480
     * method {@link #updateRow} must be called to update the database.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6481
     * If the cursor is on the insert row, the method {@link #insertRow}
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6482
     * must be called, which will insert the new row into both this rowset
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6483
     * and the database. Both of these methods must be called before the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6484
     * cursor moves to another row.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6485
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6486
     * @param columnIndex the first column is <code>1</code>, the second
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6487
     *        is <code>2</code>, and so on; must be <code>1</code> or larger
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6488
     *        and equal to or less than the number of columns in this rowset
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6489
     * @param ref the new column <code>java.sql.Ref</code> value
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6490
     * @throws SQLException if (1) the given column index is out of bounds,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6491
     *        (2) the cursor is not on one of this rowset's rows or its
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6492
     *        insert row, or (3) this rowset is
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6493
     *        <code>ResultSet.CONCUR_READ_ONLY</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6494
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6495
    public void updateRef(int columnIndex, java.sql.Ref ref) throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6496
        // sanity check.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6497
        checkIndex(columnIndex);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6498
        // make sure the cursor is on a valid row
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6499
        checkCursor();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6500
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6501
        // SerialClob will help in getting the byte array and storing it.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6502
        // We need to be checking DatabaseMetaData.locatorsUpdatorCopy()
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6503
        // or through RowSetMetaData.locatorsUpdatorCopy()
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6504
        getCurrentRow().setColumnObject(columnIndex, new SerialRef(ref));
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6505
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6506
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6507
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6508
     * Sets the designated column in either the current row or the insert
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6509
     * row of this <code>CachedRowSetImpl</code> object with the given
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6510
     * <code>double</code> value.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6511
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6512
     * This method updates a column value in either the current row or
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6513
     * the insert row of this rowset, but it does not update the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6514
     * database.  If the cursor is on a row in the rowset, the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6515
     * method {@link #updateRow} must be called to update the database.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6516
     * If the cursor is on the insert row, the method {@link #insertRow}
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6517
     * must be called, which will insert the new row into both this rowset
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6518
     * and the database. Both of these methods must be called before the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6519
     * cursor moves to another row.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6520
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6521
     * @param columnName a <code>String</code> object that must match the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6522
     *        SQL name of a column in this rowset, ignoring case
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6523
     * @param ref the new column <code>java.sql.Ref</code> value
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6524
     * @throws SQLException if (1) the given column name does not match the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6525
     *        name of a column in this rowset, (2) the cursor is not on
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6526
     *        one of this rowset's rows or its insert row, or (3) this
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6527
     *        rowset is <code>ResultSet.CONCUR_READ_ONLY</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6528
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6529
    public void updateRef(String columnName, java.sql.Ref ref) throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6530
        updateRef(getColIdxByName(columnName), ref);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6531
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6532
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6533
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6534
     * Sets the designated column in either the current row or the insert
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6535
     * row of this <code>CachedRowSetImpl</code> object with the given
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6536
     * <code>double</code> value.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6537
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6538
     * This method updates a column value in either the current row or
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6539
     * the insert row of this rowset, but it does not update the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6540
     * database.  If the cursor is on a row in the rowset, the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6541
     * method {@link #updateRow} must be called to update the database.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6542
     * If the cursor is on the insert row, the method {@link #insertRow}
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6543
     * must be called, which will insert the new row into both this rowset
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6544
     * and the database. Both of these methods must be called before the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6545
     * cursor moves to another row.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6546
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6547
     * @param columnIndex the first column is <code>1</code>, the second
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6548
     *        is <code>2</code>, and so on; must be <code>1</code> or larger
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6549
     *        and equal to or less than the number of columns in this rowset
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6550
     * @param c the new column <code>Clob</code> value
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6551
     * @throws SQLException if (1) the given column index is out of bounds,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6552
     *        (2) the cursor is not on one of this rowset's rows or its
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6553
     *        insert row, or (3) this rowset is
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6554
     *        <code>ResultSet.CONCUR_READ_ONLY</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6555
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6556
    public void updateClob(int columnIndex, Clob c) throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6557
        // sanity check.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6558
        checkIndex(columnIndex);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6559
        // make sure the cursor is on a valid row
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6560
        checkCursor();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6561
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6562
        // SerialClob will help in getting the byte array and storing it.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6563
        // We need to be checking DatabaseMetaData.locatorsUpdatorCopy()
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6564
        // or through RowSetMetaData.locatorsUpdatorCopy()
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6565
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6566
        if(dbmslocatorsUpdateCopy){
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6567
           getCurrentRow().setColumnObject(columnIndex, new SerialClob(c));
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6568
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6569
        else{
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6570
           throw new SQLException(resBundle.handleGetObject("cachedrowsetimpl.opnotsupp").toString());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6571
        }
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
     * Sets the designated column in either the current row or the insert
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6576
     * row of this <code>CachedRowSetImpl</code> object with the given
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6577
     * <code>double</code> value.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6578
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6579
     * This method updates a column value in either the current row or
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6580
     * the insert row of this rowset, but it does not update the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6581
     * database.  If the cursor is on a row in the rowset, the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6582
     * method {@link #updateRow} must be called to update the database.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6583
     * If the cursor is on the insert row, the method {@link #insertRow}
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6584
     * must be called, which will insert the new row into both this rowset
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6585
     * and the database. Both of these methods must be called before the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6586
     * cursor moves to another row.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6587
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6588
     * @param columnName a <code>String</code> object that must match the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6589
     *        SQL name of a column in this rowset, ignoring case
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6590
     * @param c the new column <code>Clob</code> value
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6591
     * @throws SQLException if (1) the given column name does not match the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6592
     *            name of a column in this rowset, (2) the cursor is not on
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6593
     *            one of this rowset's rows or its insert row, or (3) this
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6594
     *            rowset is <code>ResultSet.CONCUR_READ_ONLY</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6595
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6596
    public void updateClob(String columnName, Clob c) throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6597
        updateClob(getColIdxByName(columnName), c);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6598
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6599
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6600
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6601
     * Sets the designated column in either the current row or the insert
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6602
     * row of this <code>CachedRowSetImpl</code> object with the given
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6603
     * <code>java.sql.Blob</code> value.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6604
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6605
     * This method updates a column value in either the current row or
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6606
     * the insert row of this rowset, but it does not update the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6607
     * database.  If the cursor is on a row in the rowset, the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6608
     * method {@link #updateRow} must be called to update the database.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6609
     * If the cursor is on the insert row, the method {@link #insertRow}
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6610
     * must be called, which will insert the new row into both this rowset
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6611
     * and the database. Both of these methods must be called before the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6612
     * cursor moves to another row.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6613
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6614
     * @param columnIndex the first column is <code>1</code>, the second
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6615
     *        is <code>2</code>, and so on; must be <code>1</code> or larger
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6616
     *        and equal to or less than the number of columns in this rowset
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6617
     * @param b the new column <code>Blob</code> value
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6618
     * @throws SQLException if (1) the given column index is out of bounds,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6619
     *            (2) the cursor is not on one of this rowset's rows or its
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6620
     *            insert row, or (3) this rowset is
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6621
     *            <code>ResultSet.CONCUR_READ_ONLY</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6622
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6623
    public void updateBlob(int columnIndex, Blob b) throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6624
        // sanity check.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6625
        checkIndex(columnIndex);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6626
        // make sure the cursor is on a valid row
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6627
        checkCursor();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6628
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6629
        // SerialBlob will help in getting the byte array and storing it.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6630
        // We need to be checking DatabaseMetaData.locatorsUpdatorCopy()
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6631
        // or through RowSetMetaData.locatorsUpdatorCopy()
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6632
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6633
        if(dbmslocatorsUpdateCopy){
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6634
           getCurrentRow().setColumnObject(columnIndex, new SerialBlob(b));
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6635
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6636
        else{
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6637
           throw new SQLException(resBundle.handleGetObject("cachedrowsetimpl.opnotsupp").toString());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6638
        }
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
     * Sets the designated column in either the current row or the insert
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6643
     * row of this <code>CachedRowSetImpl</code> object with the given
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6644
     * <code>java.sql.Blob </code> value.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6645
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6646
     * This method updates a column value in either the current row or
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6647
     * the insert row of this rowset, but it does not update the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6648
     * database.  If the cursor is on a row in the rowset, the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6649
     * method {@link #updateRow} must be called to update the database.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6650
     * If the cursor is on the insert row, the method {@link #insertRow}
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6651
     * must be called, which will insert the new row into both this rowset
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6652
     * and the database. Both of these methods must be called before the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6653
     * cursor moves to another row.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6654
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6655
     * @param columnName a <code>String</code> object that must match the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6656
     *        SQL name of a column in this rowset, ignoring case
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6657
     * @param b the new column <code>Blob</code> value
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6658
     * @throws SQLException if (1) the given column name does not match the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6659
     *            name of a column in this rowset, (2) the cursor is not on
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6660
     *            one of this rowset's rows or its insert row, or (3) this
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6661
     *            rowset is <code>ResultSet.CONCUR_READ_ONLY</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6662
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6663
    public void updateBlob(String columnName, Blob b) throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6664
        updateBlob(getColIdxByName(columnName), b);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6665
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6666
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6667
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6668
     * Sets the designated column in either the current row or the insert
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6669
     * row of this <code>CachedRowSetImpl</code> object with the given
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6670
     * <code>java.sql.Array</code> values.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6671
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6672
     * This method updates a column value in either the current row or
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6673
     * the insert row of this rowset, but it does not update the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6674
     * database.  If the cursor is on a row in the rowset, the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6675
     * method {@link #updateRow} must be called to update the database.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6676
     * If the cursor is on the insert row, the method {@link #insertRow}
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6677
     * must be called, which will insert the new row into both this rowset
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6678
     * and the database. Both of these methods must be called before the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6679
     * cursor moves to another row.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6680
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6681
     * @param columnIndex the first column is <code>1</code>, the second
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6682
     *        is <code>2</code>, and so on; must be <code>1</code> or larger
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6683
     *        and equal to or less than the number of columns in this rowset
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6684
     * @param a the new column <code>Array</code> value
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6685
     * @throws SQLException if (1) the given column index is out of bounds,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6686
     *            (2) the cursor is not on one of this rowset's rows or its
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6687
     *            insert row, or (3) this rowset is
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6688
     *            <code>ResultSet.CONCUR_READ_ONLY</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6689
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6690
    public void updateArray(int columnIndex, Array a) throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6691
        // sanity check.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6692
        checkIndex(columnIndex);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6693
        // make sure the cursor is on a valid row
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6694
        checkCursor();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6695
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6696
        // SerialArray will help in getting the byte array and storing it.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6697
        // We need to be checking DatabaseMetaData.locatorsUpdatorCopy()
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6698
        // or through RowSetMetaData.locatorsUpdatorCopy()
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6699
        getCurrentRow().setColumnObject(columnIndex, new SerialArray(a));
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6700
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6701
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6702
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6703
     * Sets the designated column in either the current row or the insert
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6704
     * row of this <code>CachedRowSetImpl</code> object with the given
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6705
     * <code>java.sql.Array</code> value.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6706
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6707
     * This method updates a column value in either the current row or
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6708
     * the insert row of this rowset, but it does not update the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6709
     * database.  If the cursor is on a row in the rowset, the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6710
     * method {@link #updateRow} must be called to update the database.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6711
     * If the cursor is on the insert row, the method {@link #insertRow}
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6712
     * must be called, which will insert the new row into both this rowset
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6713
     * and the database. Both of these methods must be called before the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6714
     * cursor moves to another row.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6715
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6716
     * @param columnName a <code>String</code> object that must match the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6717
     *        SQL name of a column in this rowset, ignoring case
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6718
     * @param a the new column <code>Array</code> value
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6719
     * @throws SQLException if (1) the given column name does not match the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6720
     *            name of a column in this rowset, (2) the cursor is not on
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6721
     *            one of this rowset's rows or its insert row, or (3) this
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6722
     *            rowset is <code>ResultSet.CONCUR_READ_ONLY</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6723
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6724
    public void updateArray(String columnName, Array a) throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6725
        updateArray(getColIdxByName(columnName), a);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6726
    }
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
     * Retrieves the value of the designated column in this
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6731
     * <code>CachedRowSetImpl</code> object as a <code>java.net.URL</code> object
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6732
     * in the Java programming language.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6733
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6734
     * @return a java.net.URL object containing the resource reference described by
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6735
     * the URL
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6736
     * @throws SQLException if (1) the given column index is out of bounds,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6737
     * (2) the cursor is not on one of this rowset's rows or its
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6738
     * insert row, or (3) the designated column does not store an
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6739
     * SQL <code>DATALINK</code> value.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6740
     * @see #getURL(String)
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6741
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6742
    public java.net.URL getURL(int columnIndex) throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6743
        //throw new SQLException("Operation not supported");
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6744
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6745
        java.net.URL value;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6746
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6747
        // sanity check.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6748
        checkIndex(columnIndex);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6749
        // make sure the cursor is on a valid row
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6750
        checkCursor();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6751
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6752
        if (RowSetMD.getColumnType(columnIndex) != java.sql.Types.DATALINK) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6753
            throw new SQLException(resBundle.handleGetObject("cachedrowsetimpl.dtypemismt").toString());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6754
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6755
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6756
        setLastValueNull(false);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6757
        value = (java.net.URL)(getCurrentRow().getColumnObject(columnIndex));
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6758
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6759
        // check for SQL NULL
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6760
        if (value == null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6761
            setLastValueNull(true);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6762
            return null;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6763
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6764
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6765
        return value;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6766
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6767
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6768
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6769
     * Retrieves the value of the designated column in this
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6770
     * <code>CachedRowSetImpl</code> object as a <code>java.net.URL</code> object
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6771
     * in the Java programming language.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6772
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6773
     * @return a java.net.URL object containing the resource reference described by
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6774
     * the URL
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6775
     * @throws SQLException if (1) the given column name not the name of a column
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6776
     * in this rowset, or
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6777
     * (2) the cursor is not on one of this rowset's rows or its
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6778
     * insert row, or (3) the designated column does not store an
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6779
     * SQL <code>DATALINK</code> value.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6780
     * @see #getURL(int)
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6781
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6782
    public java.net.URL getURL(String columnName) throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6783
        return getURL(getColIdxByName(columnName));
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6784
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
     * The first warning reported by calls on this <code>CachedRowSetImpl</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6789
     * object is returned. Subsequent <code>CachedRowSetImpl</code> warnings will
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6790
     * be chained to this <code>SQLWarning</code>. All <code>RowSetWarnings</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6791
     * warnings are generated in the disconnected environment and remain a
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6792
     * seperate warning chain to that provided by the <code>getWarnings</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6793
     * method.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6794
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6795
     * <P>The warning chain is automatically cleared each time a new
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6796
     * row is read.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6797
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6798
     * <P><B>Note:</B> This warning chain only covers warnings caused
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6799
     * by <code>CachedRowSet</code> (and their child interface)
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6800
     * methods. All <code>SQLWarnings</code> can be obtained using the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6801
     * <code>getWarnings</code> method which tracks warnings generated
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6802
     * by the underlying JDBC driver.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6803
     * @return the first SQLWarning or null
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6804
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6805
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6806
    public RowSetWarning getRowSetWarnings() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6807
        try {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6808
            notifyCursorMoved();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6809
        } catch (SQLException e) {} // mask exception
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6810
        return rowsetWarning;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6811
    }
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
     * The function tries to isolate the tablename when only setCommand
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6816
     * is set and not setTablename is called provided there is only one table
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6817
     * name in the query else just leaves the setting of table name as such.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6818
     * If setTablename is set later it will over ride this table name
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6819
     * value so retrieved.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6820
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6821
     * @return the tablename if only one table in query else return ""
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6822
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6823
    private String buildTableName(String command) throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6824
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6825
        // If we have a query from one table,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6826
        // we set the table name implicitly
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6827
        // else user has to explicitly set the table name.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6828
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6829
        int indexFrom, indexComma;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6830
        String strTablename ="";
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6831
        command = command.trim();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6832
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6833
        // Query can be a select, insert or  update
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6834
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6835
        if(command.toLowerCase().startsWith("select")) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6836
            // look for "from" keyword, after that look for a
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6837
            // comma after from. If comma is there don't set
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6838
            // table name else isolate table name.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6839
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6840
            indexFrom = command.toLowerCase().indexOf("from");
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6841
            indexComma = command.indexOf(",", indexFrom);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6842
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6843
            if(indexComma == -1) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6844
                // implies only one table
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6845
                strTablename = (command.substring(indexFrom+"from".length(),command.length())).trim();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6846
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6847
                String tabName = strTablename;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6848
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6849
                int idxWhere = tabName.toLowerCase().indexOf("where");
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6850
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6851
                /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6852
                  * Adding the addtional check for conditions following the table name.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6853
                  * If a condition is found truncate it.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6854
                  **/
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6855
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6856
                if(idxWhere != -1)
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6857
                {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6858
                   tabName = tabName.substring(0,idxWhere).trim();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6859
                }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6860
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6861
                strTablename = tabName;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6862
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6863
            } else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6864
                //strTablename="";
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6865
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6866
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6867
        } else if(command.toLowerCase().startsWith("insert")) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6868
            //strTablename="";
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6869
        } else if(command.toLowerCase().startsWith("update")) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6870
            //strTablename="";
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6871
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6872
        return strTablename;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6873
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6874
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6875
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6876
     * Commits all changes performed by the <code>acceptChanges()</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6877
     * methods
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6878
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6879
     * @see java.sql.Connection#commit
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6880
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6881
    public void commit() throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6882
        conn.commit();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6883
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6884
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6885
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6886
     * Rolls back all changes performed by the <code>acceptChanges()</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6887
     * methods
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6888
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6889
     * @see java.sql.Connection#rollback
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6890
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6891
    public void rollback() throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6892
        conn.rollback();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6893
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6894
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6895
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6896
     * Rolls back all changes performed by the <code>acceptChanges()</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6897
     * to the last <code>Savepoint</code> transaction marker.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6898
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6899
     * @see java.sql.Connection#rollback(Savepoint)
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6900
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6901
    public void rollback(Savepoint s) throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6902
        conn.rollback(s);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6903
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6904
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6905
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6906
     * Unsets the designated parameter to the given int array.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6907
     * This was set using <code>setMatchColumn</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6908
     * as the column which will form the basis of the join.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6909
     * <P>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6910
     * The parameter value unset by this method should be same
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6911
     * as was set.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6912
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6913
     * @param columnIdxes the index into this rowset
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6914
     *        object's internal representation of parameter values
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6915
     * @throws SQLException if an error occurs or the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6916
     *  parameter index is out of bounds or if the columnIdx is
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6917
     *  not the same as set using <code>setMatchColumn(int [])</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6918
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6919
    public void unsetMatchColumn(int[] columnIdxes) throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6920
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6921
         int i_val;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6922
         for( int j= 0 ;j < columnIdxes.length; j++) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6923
            i_val = (Integer.parseInt(iMatchColumns.get(j).toString()));
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6924
            if(columnIdxes[j] != i_val) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6925
               throw new SQLException(resBundle.handleGetObject("cachedrowsetimpl.matchcols").toString());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6926
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6927
         }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6928
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6929
         for( int i = 0;i < columnIdxes.length ;i++) {
11129
f9ad1aadf3fa 7116445: Miscellaneous warnings in the JDBC/RowSet classes
lancea
parents: 9537
diff changeset
  6930
            iMatchColumns.set(i, -1);
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6931
         }
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
     * Unsets the designated parameter to the given String array.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6936
     * This was set using <code>setMatchColumn</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6937
     * as the column which will form the basis of the join.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6938
     * <P>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6939
     * The parameter value unset by this method should be same
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6940
     * as was set.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6941
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6942
     * @param columnIdxes the index into this rowset
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6943
     *        object's internal representation of parameter values
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6944
     * @throws SQLException if an error occurs or the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6945
     *  parameter index is out of bounds or if the columnName is
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6946
     *  not the same as set using <code>setMatchColumn(String [])</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6947
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6948
    public void unsetMatchColumn(String[] columnIdxes) throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6949
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6950
        for(int j = 0 ;j < columnIdxes.length; j++) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6951
           if( !columnIdxes[j].equals(strMatchColumns.get(j)) ){
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6952
              throw new SQLException(resBundle.handleGetObject("cachedrowsetimpl.matchcols").toString());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6953
           }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6954
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6955
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6956
        for(int i = 0 ; i < columnIdxes.length; i++) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6957
           strMatchColumns.set(i,null);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6958
        }
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
     * Retrieves the column name as <code>String</code> array
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6963
     * that was set using <code>setMatchColumn(String [])</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6964
     * for this rowset.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6965
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6966
     * @return a <code>String</code> array object that contains the column names
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6967
     *         for the rowset which has this the match columns
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6968
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6969
     * @throws SQLException if an error occurs or column name is not set
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6970
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6971
    public String[] getMatchColumnNames() throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6972
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6973
        String []str_temp = new String[strMatchColumns.size()];
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6974
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6975
        if( strMatchColumns.get(0) == null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6976
           throw new SQLException(resBundle.handleGetObject("cachedrowsetimpl.setmatchcols").toString());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6977
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6978
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6979
        strMatchColumns.copyInto(str_temp);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6980
        return str_temp;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6981
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6982
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6983
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6984
     * Retrieves the column id as <code>int</code> array that was set using
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6985
     * <code>setMatchColumn(int [])</code> for this rowset.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6986
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6987
     * @return a <code>int</code> array object that contains the column ids
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6988
     *         for the rowset which has this as the match columns.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6989
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6990
     * @throws SQLException if an error occurs or column index is not set
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6991
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6992
    public int[] getMatchColumnIndexes() throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6993
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6994
        Integer []int_temp = new Integer[iMatchColumns.size()];
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6995
        int [] i_temp = new int[iMatchColumns.size()];
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6996
        int i_val;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6997
11129
f9ad1aadf3fa 7116445: Miscellaneous warnings in the JDBC/RowSet classes
lancea
parents: 9537
diff changeset
  6998
        i_val = iMatchColumns.get(0);
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
  6999
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7000
        if( i_val == -1 ) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7001
           throw new SQLException(resBundle.handleGetObject("cachedrowsetimpl.setmatchcols").toString());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7002
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7003
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7004
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7005
        iMatchColumns.copyInto(int_temp);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7006
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7007
        for(int i = 0; i < int_temp.length; i++) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7008
           i_temp[i] = (int_temp[i]).intValue();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7009
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7010
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7011
        return i_temp;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7012
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7013
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7014
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7015
     * Sets the designated parameter to the given int array.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7016
     * This forms the basis of the join for the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7017
     * <code>JoinRowSet</code> as the column which will form the basis of the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7018
     * join.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7019
     * <P>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7020
     * The parameter value set by this method is stored internally and
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7021
     * will be supplied as the appropriate parameter in this rowset's
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7022
     * command when the method <code>getMatchColumnIndexes</code> is called.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7023
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7024
     * @param columnIdxes the indexes into this rowset
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7025
     *        object's internal representation of parameter values; the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7026
     *        first parameter is 0, the second is 1, and so on; must be
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7027
     *        <code>0</code> or greater
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7028
     * @throws SQLException if an error occurs or the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7029
     *                         parameter index is out of bounds
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7030
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7031
    public void setMatchColumn(int[] columnIdxes) throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7032
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7033
        for(int j = 0 ; j < columnIdxes.length; j++) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7034
           if( columnIdxes[j] < 0 ) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7035
              throw new SQLException(resBundle.handleGetObject("cachedrowsetimpl.matchcols1").toString());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7036
           }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7037
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7038
        for(int i = 0 ;i < columnIdxes.length; i++) {
11129
f9ad1aadf3fa 7116445: Miscellaneous warnings in the JDBC/RowSet classes
lancea
parents: 9537
diff changeset
  7039
           iMatchColumns.add(i,columnIdxes[i]);
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7040
        }
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
     * Sets the designated parameter to the given String array.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7045
     *  This forms the basis of the join for the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7046
     * <code>JoinRowSet</code> as the column which will form the basis of the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7047
     * join.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7048
     * <P>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7049
     * The parameter value set by this method is stored internally and
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7050
     * will be supplied as the appropriate parameter in this rowset's
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7051
     * command when the method <code>getMatchColumn</code> is called.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7052
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7053
     * @param columnNames the name of the column into this rowset
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7054
     *        object's internal representation of parameter values
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7055
     * @throws SQLException if an error occurs or the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7056
     *  parameter index is out of bounds
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7057
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7058
    public void setMatchColumn(String[] columnNames) throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7059
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7060
        for(int j = 0; j < columnNames.length; j++) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7061
           if( columnNames[j] == null || columnNames[j].equals("")) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7062
              throw new SQLException(resBundle.handleGetObject("cachedrowsetimpl.matchcols2").toString());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7063
           }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7064
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7065
        for( int i = 0; i < columnNames.length; i++) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7066
           strMatchColumns.add(i,columnNames[i]);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7067
        }
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
     * Sets the designated parameter to the given <code>int</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7073
     * object.  This forms the basis of the join for the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7074
     * <code>JoinRowSet</code> as the column which will form the basis of the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7075
     * join.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7076
     * <P>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7077
     * The parameter value set by this method is stored internally and
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7078
     * will be supplied as the appropriate parameter in this rowset's
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7079
     * command when the method <code>getMatchColumn</code> is called.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7080
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7081
     * @param columnIdx the index into this rowset
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7082
     *        object's internal representation of parameter values; the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7083
     *        first parameter is 0, the second is 1, and so on; must be
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7084
     *        <code>0</code> or greater
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7085
     * @throws SQLException if an error occurs or the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7086
     *                         parameter index is out of bounds
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7087
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7088
    public void setMatchColumn(int columnIdx) throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7089
        // validate, if col is ok to be set
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7090
        if(columnIdx < 0) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7091
            throw new SQLException(resBundle.handleGetObject("cachedrowsetimpl.matchcols1").toString());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7092
        } else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7093
            // set iMatchColumn
11129
f9ad1aadf3fa 7116445: Miscellaneous warnings in the JDBC/RowSet classes
lancea
parents: 9537
diff changeset
  7094
            iMatchColumns.set(0, columnIdx);
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7095
            //strMatchColumn = null;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7096
        }
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
     * Sets the designated parameter to the given <code>String</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7101
     * object.  This forms the basis of the join for the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7102
     * <code>JoinRowSet</code> as the column which will form the basis of the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7103
     * join.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7104
     * <P>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7105
     * The parameter value set by this method is stored internally and
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7106
     * will be supplied as the appropriate parameter in this rowset's
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7107
     * command when the method <code>getMatchColumn</code> is called.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7108
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7109
     * @param columnName the name of the column into this rowset
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7110
     *        object's internal representation of parameter values
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7111
     * @throws SQLException if an error occurs or the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7112
     *  parameter index is out of bounds
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7113
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7114
    public void setMatchColumn(String columnName) throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7115
        // 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
  7116
        if(columnName == null || (columnName= columnName.trim()).equals("") ) {
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7117
            throw new SQLException(resBundle.handleGetObject("cachedrowsetimpl.matchcols2").toString());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7118
        } else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7119
            // set strMatchColumn
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7120
            strMatchColumns.set(0, columnName);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7121
            //iMatchColumn = -1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7122
        }
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
     * Unsets the designated parameter to the given <code>int</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7127
     * object.  This was set using <code>setMatchColumn</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7128
     * as the column which will form the basis of the join.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7129
     * <P>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7130
     * The parameter value unset by this method should be same
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7131
     * as was set.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7132
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7133
     * @param columnIdx the index into this rowset
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7134
     *        object's internal representation of parameter values
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7135
     * @throws SQLException if an error occurs or the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7136
     *  parameter index is out of bounds or if the columnIdx is
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7137
     *  not the same as set using <code>setMatchColumn(int)</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7138
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7139
    public void unsetMatchColumn(int columnIdx) throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7140
        // 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
  7141
        if(! iMatchColumns.get(0).equals(Integer.valueOf(columnIdx) )  ) {
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7142
            throw new SQLException(resBundle.handleGetObject("cachedrowsetimpl.unsetmatch").toString());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7143
        } else if(strMatchColumns.get(0) != null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7144
            throw new SQLException(resBundle.handleGetObject("cachedrowsetimpl.unsetmatch1").toString());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7145
        } else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7146
                // that is, we are unsetting it.
11129
f9ad1aadf3fa 7116445: Miscellaneous warnings in the JDBC/RowSet classes
lancea
parents: 9537
diff changeset
  7147
               iMatchColumns.set(0, -1);
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7148
        }
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
     * Unsets the designated parameter to the given <code>String</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7153
     * object.  This was set using <code>setMatchColumn</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7154
     * as the column which will form the basis of the join.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7155
     * <P>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7156
     * The parameter value unset by this method should be same
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7157
     * as was set.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7158
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7159
     * @param columnName the index into this rowset
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7160
     *        object's internal representation of parameter values
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7161
     * @throws SQLException if an error occurs or the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7162
     *  parameter index is out of bounds or if the columnName is
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7163
     *  not the same as set using <code>setMatchColumn(String)</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7164
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7165
    public void unsetMatchColumn(String columnName) throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7166
        // check if we are unsetting the same column
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7167
        columnName = columnName.trim();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7168
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7169
        if(!((strMatchColumns.get(0)).equals(columnName))) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7170
            throw new SQLException(resBundle.handleGetObject("cachedrowsetimpl.unsetmatch").toString());
11129
f9ad1aadf3fa 7116445: Miscellaneous warnings in the JDBC/RowSet classes
lancea
parents: 9537
diff changeset
  7171
        } else if(iMatchColumns.get(0) > 0) {
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7172
            throw new SQLException(resBundle.handleGetObject("cachedrowsetimpl.unsetmatch2").toString());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7173
        } else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7174
            strMatchColumns.set(0, null);   // that is, we are unsetting it.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7175
        }
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
     * Notifies registered listeners that a RowSet object in the given RowSetEvent
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7180
     * object has populated a number of additional rows. The <code>numRows</code> parameter
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7181
     * ensures that this event will only be fired every <code>numRow</code>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7182
     * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7183
     * The source of the event can be retrieved with the method event.getSource.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7184
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7185
     * @param event a <code>RowSetEvent</code> object that contains the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7186
     *     <code>RowSet</code> object that is the source of the events
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7187
     * @param numRows when populating, the number of rows interval on which the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7188
     *     <code>CachedRowSet</code> populated should fire; the default value
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7189
     *     is zero; cannot be less than <code>fetchSize</code> or zero
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7190
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7191
    public void rowSetPopulated(RowSetEvent event, int numRows) throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7192
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7193
        if( numRows < 0 || numRows < getFetchSize()) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7194
           throw new SQLException(resBundle.handleGetObject("cachedrowsetimpl.numrows").toString());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7195
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7196
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7197
        if(size() % numRows == 0) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7198
            RowSetEvent event_temp = new RowSetEvent(this);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7199
            event = event_temp;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7200
            notifyRowSetChanged();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7201
        }
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
     * Populates this <code>CachedRowSet</code> object with data from
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7206
     * the given <code>ResultSet</code> object. While related to the <code>populate(ResultSet)</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7207
     * method, an additional parameter is provided to allow starting position within
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7208
     * the <code>ResultSet</code> from where to populate the CachedRowSet
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7209
     * instance.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7210
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7211
     * This method is an alternative to the method <code>execute</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7212
     * for filling the rowset with data.  The method <code>populate</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7213
     * does not require that the properties needed by the method
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7214
     * <code>execute</code>, such as the <code>command</code> property,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7215
     * be set. This is true because the method <code>populate</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7216
     * is given the <code>ResultSet</code> object from
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7217
     * which to get data and thus does not need to use the properties
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7218
     * required for setting up a connection and executing this
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7219
     * <code>CachedRowSetImpl</code> object's command.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7220
     * <P>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7221
     * After populating this rowset with data, the method
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7222
     * <code>populate</code> sets the rowset's metadata and
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7223
     * then sends a <code>RowSetChangedEvent</code> object
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7224
     * to all registered listeners prior to returning.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7225
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7226
     * @param data the <code>ResultSet</code> object containing the data
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7227
     *             to be read into this <code>CachedRowSetImpl</code> object
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7228
     * @param start the integer specifing the position in the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7229
     *        <code>ResultSet</code> object to popultate the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7230
     *        <code>CachedRowSetImpl</code> object.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7231
     * @throws SQLException if an error occurs; or the max row setting is
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7232
     *          violated while populating the RowSet.Also id the start position
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7233
     *          is negative.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7234
     * @see #execute
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7235
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7236
     public void populate(ResultSet data, int start) throws SQLException{
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7237
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7238
        int rowsFetched;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7239
        Row currentRow;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7240
        int numCols;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7241
        int i;
9257
53e6d7bc31b0 7035615: Address lint warnings for javax.sql.rowset & com.sun.rowset
lancea
parents: 6697
diff changeset
  7242
        Map<String, Class<?>> map = getTypeMap();
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7243
        Object obj;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7244
        int mRows;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7245
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7246
        cursorPos = 0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7247
        if(populatecallcount == 0){
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7248
            if(start < 0){
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7249
               throw new SQLException(resBundle.handleGetObject("cachedrowsetimpl.startpos").toString());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7250
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7251
            if(getMaxRows() == 0){
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7252
               data.absolute(start);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7253
               while(data.next()){
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7254
                   totalRows++;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7255
               }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7256
               totalRows++;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7257
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7258
            startPos = start;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7259
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7260
        populatecallcount = populatecallcount +1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7261
        resultSet = data;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7262
        if((endPos - startPos) >= getMaxRows() && (getMaxRows() > 0)){
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7263
            endPos = prevEndPos;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7264
            pagenotend = false;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7265
            return;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7266
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7267
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7268
        if((maxRowsreached != getMaxRows() || maxRowsreached != totalRows) && pagenotend) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7269
           startPrev = start - getPageSize();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7270
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7271
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7272
        if( pageSize == 0){
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7273
           prevEndPos = endPos;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7274
           endPos = start + getMaxRows() ;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7275
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7276
        else{
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7277
            prevEndPos = endPos;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7278
            endPos = start + getPageSize();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7279
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7280
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7281
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7282
        if (start == 1){
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7283
            resultSet.beforeFirst();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7284
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7285
        else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7286
            resultSet.absolute(start -1);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7287
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7288
        if( pageSize == 0) {
9257
53e6d7bc31b0 7035615: Address lint warnings for javax.sql.rowset & com.sun.rowset
lancea
parents: 6697
diff changeset
  7289
           rvh = new Vector<Object>(getMaxRows());
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7290
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7291
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7292
        else{
9257
53e6d7bc31b0 7035615: Address lint warnings for javax.sql.rowset & com.sun.rowset
lancea
parents: 6697
diff changeset
  7293
            rvh = new Vector<Object>(getPageSize());
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7294
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7295
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7296
        if (data == null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7297
            throw new SQLException(resBundle.handleGetObject("cachedrowsetimpl.populate").toString());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7298
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7299
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7300
        // get the meta data for this ResultSet
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7301
        RSMD = data.getMetaData();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7302
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7303
        // set up the metadata
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7304
        RowSetMD = new RowSetMetaDataImpl();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7305
        initMetaData(RowSetMD, RSMD);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7306
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7307
        // release the meta-data so that aren't tempted to use it.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7308
        RSMD = null;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7309
        numCols = RowSetMD.getColumnCount();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7310
        mRows = this.getMaxRows();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7311
        rowsFetched = 0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7312
        currentRow = null;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7313
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7314
        if(!data.next() && mRows == 0){
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7315
            endPos = prevEndPos;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7316
            pagenotend = false;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7317
            return;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7318
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7319
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7320
        data.previous();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7321
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7322
        while ( data.next()) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7323
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7324
            currentRow = new Row(numCols);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7325
          if(pageSize == 0){
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7326
            if ( rowsFetched >= mRows && mRows > 0) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7327
                rowsetWarning.setNextException(new SQLException("Populating rows "
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7328
                + "setting has exceeded max row setting"));
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7329
                break;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7330
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7331
          }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7332
          else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7333
              if ( (rowsFetched >= pageSize) ||( maxRowsreached >= mRows && mRows > 0)) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7334
                rowsetWarning.setNextException(new SQLException("Populating rows "
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7335
                + "setting has exceeded max row setting"));
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7336
                break;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7337
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7338
          }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7339
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7340
            for ( i = 1; i <= numCols; i++) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7341
                /*
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7342
                 * check if the user has set a map. If no map
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7343
                 * is set then use plain getObject. This lets
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7344
                 * us work with drivers that do not support
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7345
                 * getObject with a map in fairly sensible way
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7346
                 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7347
                if (map == null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7348
                    obj = data.getObject(i);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7349
                } else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7350
                    obj = data.getObject(i, map);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7351
                }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7352
                /*
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7353
                 * the following block checks for the various
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7354
                 * types that we have to serialize in order to
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7355
                 * store - right now only structs have been tested
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7356
                 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7357
                if (obj instanceof Struct) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7358
                    obj = new SerialStruct((Struct)obj, map);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7359
                } else if (obj instanceof SQLData) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7360
                    obj = new SerialStruct((SQLData)obj, map);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7361
                } else if (obj instanceof Blob) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7362
                    obj = new SerialBlob((Blob)obj);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7363
                } else if (obj instanceof Clob) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7364
                    obj = new SerialClob((Clob)obj);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7365
                } else if (obj instanceof java.sql.Array) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7366
                    obj = new SerialArray((java.sql.Array)obj, map);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7367
                }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7368
11129
f9ad1aadf3fa 7116445: Miscellaneous warnings in the JDBC/RowSet classes
lancea
parents: 9537
diff changeset
  7369
                currentRow.initColumnObject(i, obj);
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7370
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7371
            rowsFetched++;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7372
            maxRowsreached++;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7373
            rvh.add(currentRow);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7374
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7375
        numRows = rowsFetched ;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7376
        // Also rowsFetched should be equal to rvh.size()
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7377
        // notify any listeners that the rowset has changed
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7378
        notifyRowSetChanged();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7379
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
     * The nextPage gets the next page, that is a <code>CachedRowSetImpl</code> object
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7384
     * containing the number of rows specified by page size.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7385
     * @return boolean value true indicating whether there are more pages to come and
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7386
     *         false indicating that this is the last page.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7387
     * @throws SQLException if an error occurs or this called before calling populate.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7388
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7389
     public boolean nextPage() throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7390
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7391
         if (populatecallcount == 0){
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7392
             throw new SQLException(resBundle.handleGetObject("cachedrowsetimpl.nextpage").toString());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7393
         }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7394
         // Fix for 6554186
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7395
         onFirstPage = false;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7396
         if(callWithCon){
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7397
            crsReader.setStartPosition(endPos);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7398
            crsReader.readData((RowSetInternal)this);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7399
            resultSet = null;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7400
         }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7401
         else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7402
            populate(resultSet,endPos);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7403
         }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7404
         return pagenotend;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7405
     }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7406
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7407
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7408
     * This is the setter function for setting the size of the page, which specifies
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7409
     * how many rows have to be retrived at a time.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7410
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7411
     * @param size which is the page size
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7412
     * @throws SQLException if size is less than zero or greater than max rows.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7413
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7414
     public void setPageSize (int size) throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7415
        if (size < 0) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7416
            throw new SQLException(resBundle.handleGetObject("cachedrowsetimpl.pagesize").toString());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7417
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7418
        if (size > getMaxRows() && getMaxRows() != 0) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7419
            throw new SQLException(resBundle.handleGetObject("cachedrowsetimpl.pagesize1").toString());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7420
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7421
        pageSize = size;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7422
     }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7423
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7424
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7425
     * This is the getter function for the size of the page.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7426
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7427
     * @return an integer that is the page size.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7428
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7429
    public int getPageSize() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7430
        return pageSize;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7431
    }
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
     * Retrieves the data present in the page prior to the page from where it is
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7436
     * called.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7437
     * @return boolean value true if it retrieves the previous page, flase if it
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7438
     *         is on the first page.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7439
     * @throws SQLException if it is called before populate is called or ResultSet
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7440
     *         is of type <code>ResultSet.TYPE_FORWARD_ONLY</code> or if an error
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7441
     *         occurs.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7442
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7443
    public boolean previousPage() throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7444
        int pS;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7445
        int mR;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7446
        int rem;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7447
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7448
        pS = getPageSize();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7449
        mR = maxRowsreached;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7450
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7451
        if (populatecallcount == 0){
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7452
             throw new SQLException(resBundle.handleGetObject("cachedrowsetimpl.nextpage").toString());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7453
         }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7454
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7455
        if( !callWithCon){
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7456
           if(resultSet.getType() == ResultSet.TYPE_FORWARD_ONLY){
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7457
               throw new SQLException (resBundle.handleGetObject("cachedrowsetimpl.fwdonly").toString());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7458
           }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7459
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7460
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7461
        pagenotend = true;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7462
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7463
        if(startPrev < startPos ){
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7464
                onFirstPage = true;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7465
               return false;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7466
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7467
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7468
        if(onFirstPage){
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7469
            return false;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7470
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7471
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7472
        rem = mR % pS;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7473
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7474
        if(rem == 0){
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7475
            maxRowsreached -= (2 * pS);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7476
            if(callWithCon){
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7477
                crsReader.setStartPosition(startPrev);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7478
                crsReader.readData((RowSetInternal)this);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7479
                resultSet = null;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7480
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7481
            else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7482
               populate(resultSet,startPrev);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7483
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7484
            return true;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7485
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7486
        else
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7487
        {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7488
            maxRowsreached -= (pS + rem);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7489
            if(callWithCon){
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7490
                crsReader.setStartPosition(startPrev);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7491
                crsReader.readData((RowSetInternal)this);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7492
                resultSet = null;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7493
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7494
            else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7495
               populate(resultSet,startPrev);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7496
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7497
            return true;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7498
        }
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
     * Goes to the page number passed as the parameter
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7503
     * @param page , the page loaded on a call to this function
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7504
     * @return true if the page exists false otherwise
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7505
     * @throws SQLException if an error occurs
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7506
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7507
    /*
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7508
    public boolean absolutePage(int page) throws SQLException{
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7509
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7510
        boolean isAbs = true, retVal = true;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7511
        int counter;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7512
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7513
        if( page <= 0 ){
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7514
            throw new SQLException("Absolute positoin is invalid");
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7515
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7516
        counter = 0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7517
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7518
        firstPage();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7519
        counter++;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7520
        while((counter < page) && isAbs) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7521
            isAbs = nextPage();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7522
            counter ++;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7523
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7524
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7525
        if( !isAbs && counter < page){
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7526
            retVal = false;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7527
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7528
        else if(counter == page){
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7529
            retVal = true;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7530
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7531
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7532
       return retVal;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7533
    }
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
     * Goes to the page number passed as the parameter  from the current page.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7539
     * The parameter can take postive or negative value accordingly.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7540
     * @param page , the page loaded on a call to this function
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7541
     * @return true if the page exists false otherwise
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7542
     * @throws SQLException if an error occurs
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7543
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7544
    /*
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7545
    public boolean relativePage(int page) throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7546
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7547
        boolean isRel = true,retVal = true;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7548
        int counter;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7549
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7550
        if(page > 0){
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7551
           counter  = 0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7552
           while((counter < page) && isRel){
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7553
              isRel = nextPage();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7554
              counter++;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7555
           }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7556
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7557
           if(!isRel && counter < page){
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7558
               retVal = false;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7559
           }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7560
           else if( counter == page){
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7561
               retVal = true;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7562
           }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7563
           return retVal;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7564
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7565
        else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7566
            counter = page;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7567
            isRel = true;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7568
            while((counter < 0) && isRel){
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7569
                isRel = previousPage();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7570
                counter++;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7571
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7572
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7573
            if( !isRel && counter < 0){
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7574
                retVal = false;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7575
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7576
            else if(counter == 0){
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7577
                retVal = true;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7578
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7579
            return retVal;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7580
        }
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
     * Retrieves the first page of data as specified by the page size.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7586
     * @return boolean value true if present on first page, false otherwise
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7587
     * @throws SQLException if it called before populate or ResultSet is of
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7588
     *         type <code>ResultSet.TYPE_FORWARD_ONLY</code> or an error occurs
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7589
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7590
    /*
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7591
    public boolean firstPage() throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7592
           if (populatecallcount == 0){
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7593
             throw new SQLException("Populate the data before calling ");
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7594
           }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7595
           if( !callWithCon){
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7596
              if(resultSet.getType() == ResultSet.TYPE_FORWARD_ONLY) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7597
                  throw new SQLException("Result of type forward only");
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7598
              }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7599
           }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7600
           endPos = 0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7601
           maxRowsreached = 0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7602
           pagenotend = true;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7603
           if(callWithCon){
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7604
               crsReader.setStartPosition(startPos);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7605
               crsReader.readData((RowSetInternal)this);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7606
               resultSet = null;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7607
           }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7608
           else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7609
              populate(resultSet,startPos);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7610
           }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7611
           onFirstPage = true;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7612
           return onFirstPage;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7613
    }
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
     * Retrives the last page of data as specified by the page size.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7618
     * @return boolean value tur if present on the last page, false otherwise
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7619
     * @throws SQLException if called before populate or if an error occurs.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7620
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7621
     /*
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7622
    public boolean lastPage() throws SQLException{
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7623
          int pS;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7624
          int mR;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7625
          int quo;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7626
          int rem;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7627
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7628
          pS = getPageSize();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7629
          mR = getMaxRows();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7630
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7631
          if(pS == 0){
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7632
              onLastPage = true;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7633
              return onLastPage;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7634
          }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7635
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7636
          if(getMaxRows() == 0){
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7637
              mR = totalRows;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7638
          }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7639
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7640
          if (populatecallcount == 0){
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7641
             throw new SQLException("Populate the data before calling ");
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7642
         }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7643
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7644
         onFirstPage = false;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7645
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7646
         if((mR % pS) == 0){
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7647
             quo = mR / pS;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7648
             int start = startPos + (pS * (quo - 1));
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7649
             maxRowsreached = mR - pS;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7650
             if(callWithCon){
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7651
                 crsReader.setStartPosition(start);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7652
                 crsReader.readData((RowSetInternal)this);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7653
                 resultSet = null;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7654
             }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7655
             else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7656
                populate(resultSet,start);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7657
             }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7658
             onLastPage = true;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7659
             return onLastPage;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7660
         }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7661
        else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7662
              quo = mR /pS;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7663
              rem = mR % pS;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7664
              int start = startPos + (pS * quo);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7665
             maxRowsreached = mR - (rem);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7666
             if(callWithCon){
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7667
                 crsReader.setStartPosition(start);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7668
                 crsReader.readData((RowSetInternal)this);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7669
                 resultSet = null;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7670
             }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7671
             else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7672
                populate(resultSet,start);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7673
             }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7674
             onLastPage = true;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7675
             return onLastPage;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7676
         }
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
     * Sets the status for the row on which the cursor is positioned. The insertFlag is used
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7682
     * to mention the toggle status for this row
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7683
     * @param insertFlag if it is true  - marks this row as inserted
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7684
     *                   if it is false - marks it as not a newly inserted row
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7685
     * @throws SQLException if an error occurs while doing this operation
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7686
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7687
    public void setRowInserted(boolean insertFlag) throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7688
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7689
        checkCursor();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7690
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7691
        if(onInsertRow == true)
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7692
          throw new SQLException(resBundle.handleGetObject("cachedrowsetimpl.invalidop").toString());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7693
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7694
        if( insertFlag ) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7695
          ((Row)getCurrentRow()).setInserted();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7696
        } else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7697
          ((Row)getCurrentRow()).clearInserted();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7698
        }
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
     * Retrieves the value of the designated <code>SQL XML</code> parameter as a
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7703
     * <code>SQLXML</code> object in the Java programming language.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7704
     * @param columnIndex the first column is 1, the second is 2, ...
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7705
     * @return a SQLXML object that maps an SQL XML value
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7706
     * @throws SQLException if a database access error occurs
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7707
     * @since 6.0
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7708
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7709
    public SQLXML getSQLXML(int columnIndex) throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7710
        throw new SQLFeatureNotSupportedException(resBundle.handleGetObject("cachedrowsetimpl.opnotysupp").toString());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7711
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7712
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7713
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7714
     * Retrieves the value of the designated <code>SQL XML</code> parameter as a
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7715
     * <code>SQLXML</code> object in the Java programming language.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7716
     * @param colName the name of the column from which to retrieve the value
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7717
     * @return a SQLXML object that maps an SQL XML value
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7718
     * @throws SQLException if a database access error occurs
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7719
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7720
    public SQLXML getSQLXML(String colName) throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7721
        throw new SQLFeatureNotSupportedException(resBundle.handleGetObject("cachedrowsetimpl.opnotysupp").toString());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7722
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7723
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7724
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7725
     * Retrieves the value of the designated column in the current row of this
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7726
     * <code>ResultSet</code> object as a java.sql.RowId object in the Java
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7727
     * programming language.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7728
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7729
     * @param columnIndex the first column is 1, the second 2, ...
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7730
     * @return the column value if the value is a SQL <code>NULL</code> the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7731
     *     value returned is <code>null</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7732
     * @throws SQLException if a database access error occurs
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7733
     * @since 6.0
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7734
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7735
    public RowId getRowId(int columnIndex) throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7736
        throw new SQLFeatureNotSupportedException(resBundle.handleGetObject("cachedrowsetimpl.opnotysupp").toString());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7737
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7738
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7739
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7740
     * Retrieves the value of the designated column in the current row of this
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7741
     * <code>ResultSet</code> object as a java.sql.RowId object in the Java
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7742
     * programming language.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7743
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7744
     * @param columnName the name of the column
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7745
     * @return the column value if the value is a SQL <code>NULL</code> the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7746
     *     value returned is <code>null</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7747
     * @throws SQLException if a database access error occurs
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7748
     * @since 6.0
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7749
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7750
    public RowId getRowId(String columnName) throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7751
        throw new SQLFeatureNotSupportedException(resBundle.handleGetObject("cachedrowsetimpl.opnotysupp").toString());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7752
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7753
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7754
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7755
     * Updates the designated column with a <code>RowId</code> value. The updater
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7756
     * methods are used to update column values in the current row or the insert
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7757
     * row. The updater methods do not update the underlying database; instead
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7758
     * the <code>updateRow<code> or <code>insertRow</code> methods are called
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7759
     * to update the database.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7760
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7761
     * @param columnIndex the first column is 1, the second 2, ...
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7762
     * @param x the column value
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7763
     * @throws SQLException if a database access occurs
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7764
     * @since 6.0
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7765
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7766
    public void updateRowId(int columnIndex, RowId x) throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7767
        throw new SQLFeatureNotSupportedException(resBundle.handleGetObject("cachedrowsetimpl.opnotysupp").toString());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7768
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7769
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7770
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7771
     * Updates the designated column with a <code>RowId</code> value. The updater
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7772
     * methods are used to update column values in the current row or the insert
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7773
     * row. The updater methods do not update the underlying database; instead
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7774
     * the <code>updateRow<code> or <code>insertRow</code> methods are called
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7775
     * to update the database.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7776
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7777
     * @param columnName the name of the column
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7778
     * @param x the column value
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7779
     * @throws SQLException if a database access occurs
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7780
     * @since 6.0
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7781
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7782
    public void updateRowId(String columnName, RowId x) throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7783
        throw new SQLFeatureNotSupportedException(resBundle.handleGetObject("cachedrowsetimpl.opnotysupp").toString());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7784
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7785
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7786
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7787
     * Retrieves the holdability of this ResultSet object
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7788
     * @return  either ResultSet.HOLD_CURSORS_OVER_COMMIT or ResultSet.CLOSE_CURSORS_AT_COMMIT
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7789
     * @throws SQLException if a database error occurs
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7790
     * @since 6.0
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7791
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7792
    public int getHoldability() throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7793
        throw new SQLFeatureNotSupportedException(resBundle.handleGetObject("cachedrowsetimpl.opnotysupp").toString());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7794
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7795
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7796
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7797
     * Retrieves whether this ResultSet object has been closed. A ResultSet is closed if the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7798
     * method close has been called on it, or if it is automatically closed.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7799
     * @return true if this ResultSet object is closed; false if it is still open
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7800
     * @throws SQLException if a database access error occurs
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7801
     * @since 6.0
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7802
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7803
    public boolean isClosed() throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7804
        throw new SQLFeatureNotSupportedException(resBundle.handleGetObject("cachedrowsetimpl.opnotysupp").toString());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7805
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7806
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7807
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7808
     * This method is used for updating columns that support National Character sets.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7809
     * It can be used for updating NCHAR,NVARCHAR and LONGNVARCHAR columns.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7810
     * @param columnIndex the first column is 1, the second 2, ...
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7811
     * @param nString the value for the column to be updated
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7812
     * @throws SQLException if a database access error occurs
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7813
     * @since 6.0
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7814
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7815
    public void updateNString(int columnIndex, String nString) throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7816
        throw new SQLFeatureNotSupportedException(resBundle.handleGetObject("cachedrowsetimpl.opnotysupp").toString());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7817
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7818
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7819
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7820
     * This method is used for updating columns that support National Character sets.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7821
     * It can be used for updating NCHAR,NVARCHAR and LONGNVARCHAR columns.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7822
     * @param columnName name of the Column
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7823
     * @param nString the value for the column to be updated
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7824
     * @throws SQLException if a database access error occurs
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7825
     * @since 6.0
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7826
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7827
    public void updateNString(String columnName, String nString) throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7828
        throw new SQLFeatureNotSupportedException(resBundle.handleGetObject("cachedrowsetimpl.opnotysupp").toString());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7829
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7830
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7831
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7832
    /*o
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7833
     * This method is used for updating SQL <code>NCLOB</code>  type that maps
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7834
     * to <code>java.sql.Types.NCLOB</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7835
     * @param columnIndex the first column is 1, the second 2, ...
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7836
     * @param nClob the value for the column to be updated
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7837
     * @throws SQLException if a database access error occurs
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7838
     * @since 6.0
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7839
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7840
    public void updateNClob(int columnIndex, NClob nClob) throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7841
        throw new SQLFeatureNotSupportedException(resBundle.handleGetObject("cachedrowsetimpl.opnotysupp").toString());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7842
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7843
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7844
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7845
     * This method is used for updating SQL <code>NCLOB</code>  type that maps
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7846
     * to <code>java.sql.Types.NCLOB</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7847
     * @param columnName name of the column
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7848
     * @param nClob the value for the column to be updated
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7849
     * @throws SQLException if a database access error occurs
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7850
     * @since 6.0
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7851
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7852
    public void updateNClob(String columnName, NClob nClob) throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7853
       throw new SQLFeatureNotSupportedException(resBundle.handleGetObject("cachedrowsetimpl.opnotysupp").toString());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7854
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7855
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7856
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7857
     * Retrieves the value of the designated column in the current row
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7858
     * of this <code>ResultSet</code> object as a <code>NClob</code> object
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7859
     * in the Java programming language.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7860
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7861
     * @param i the first column is 1, the second is 2, ...
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7862
     * @return a <code>NClob</code> object representing the SQL
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7863
     *         <code>NCLOB</code> value in the specified column
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7864
     * @exception SQLException if a database access error occurs
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7865
     * @since 6.0
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7866
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7867
    public NClob getNClob(int i) throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7868
        throw new SQLFeatureNotSupportedException(resBundle.handleGetObject("cachedrowsetimpl.opnotysupp").toString());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7869
    }
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
     * Retrieves the value of the designated column in the current row
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7874
     * of this <code>ResultSet</code> object as a <code>NClob</code> object
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7875
     * in the Java programming language.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7876
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7877
     * @param colName the name of the column from which to retrieve the value
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7878
     * @return a <code>NClob</code> object representing the SQL <code>NCLOB</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7879
     * value in the specified column
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7880
     * @exception SQLException if a database access error occurs
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7881
     * @since 6.0
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7882
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7883
    public NClob getNClob(String colName) throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7884
        throw new SQLFeatureNotSupportedException(resBundle.handleGetObject("cachedrowsetimpl.opnotysupp").toString());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7885
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7886
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7887
    public <T> T unwrap(java.lang.Class<T> iface) throws java.sql.SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7888
        return null;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7889
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7890
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7891
    public boolean isWrapperFor(Class<?> interfaces) throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7892
        return false;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7893
    }
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
      * 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
  7898
      * SQL <code>XML</code> value when it sends it to the database.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7899
      * @param parameterIndex index of the first parameter is 1, the second is 2, ...
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7900
      * @param xmlObject a <code>SQLXML</code> object that maps an SQL <code>XML</code> value
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7901
      * @throws SQLException if a database access error occurs
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7902
      * @since 1.6
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7903
      */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7904
     public void setSQLXML(int parameterIndex, SQLXML xmlObject) throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7905
         throw new SQLFeatureNotSupportedException(resBundle.handleGetObject("cachedrowsetimpl.opnotysupp").toString());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7906
     }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7907
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7908
   /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7909
     * 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
  7910
     * <code>SQL XML</code> value when it sends it to the database.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7911
     * @param parameterName the name of the parameter
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7912
     * @param xmlObject a <code>SQLXML</code> object that maps an <code>SQL XML</code> value
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7913
     * @throws SQLException if a database access error occurs
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7914
     * @since 1.6
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7915
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7916
    public void setSQLXML(String parameterName, SQLXML xmlObject) throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7917
         throw new SQLFeatureNotSupportedException(resBundle.handleGetObject("cachedrowsetimpl.opnotysupp").toString());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7918
     }
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
     * Sets the designated parameter to the given <code>java.sql.RowId</code> object. The
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7923
     * driver converts this to a SQL <code>ROWID</code> value when it sends it
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7924
     * to the database
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7925
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7926
     * @param parameterIndex the first parameter is 1, the second is 2, ...
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7927
     * @param x the parameter value
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7928
     * @throws SQLException if a database access error occurs
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7929
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7930
     * @since 1.6
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7931
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7932
    public void setRowId(int parameterIndex, RowId x) throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7933
         throw new SQLFeatureNotSupportedException(resBundle.handleGetObject("cachedrowsetimpl.opnotysupp").toString());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7934
     }
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
    * Sets the designated parameter to the given <code>java.sql.RowId</code> object. The
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7939
    * driver converts this to a SQL <code>ROWID</code> when it sends it to the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7940
    * database.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7941
    *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7942
    * @param parameterName the name of the parameter
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7943
    * @param x the parameter value
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7944
    * @throws SQLException if a database access error occurs
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7945
    * @since 1.6
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7946
    */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7947
   public void setRowId(String parameterName, RowId x) throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7948
         throw new SQLFeatureNotSupportedException(resBundle.handleGetObject("cachedrowsetimpl.opnotysupp").toString());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7949
     }
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
     * Sets the designated parameter to a <code>Reader</code> object. The
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7954
     * <code>Reader</code> reads the data till end-of-file is reached. The
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7955
     * driver does the necessary conversion from Java character format to
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7956
     * the national character set in the database.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7957
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7958
     * <P><B>Note:</B> This stream object can either be a standard
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7959
     * Java stream object or your own subclass that implements the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7960
     * standard interface.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7961
     * <P><B>Note:</B> Consult your JDBC driver documentation to determine if
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7962
     * it might be more efficient to use a version of
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7963
     * <code>setNCharacterStream</code> which takes a length parameter.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7964
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7965
     * @param parameterIndex of the first parameter is 1, the second is 2, ...
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7966
     * @param value the parameter value
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7967
     * @throws SQLException if the driver does not support national
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7968
     *         character sets;  if the driver can detect that a data conversion
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7969
     *  error could occur ; if a database access error occurs; or
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7970
     * this method is called on a closed <code>PreparedStatement</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7971
     * @throws SQLFeatureNotSupportedException  if the JDBC driver does not support this method
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7972
     * @since 1.6
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7973
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7974
     public void setNCharacterStream(int parameterIndex, Reader value) throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7975
        throw new SQLFeatureNotSupportedException(resBundle.handleGetObject("cachedrowsetimpl.featnotsupp").toString());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7976
     }
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
    * Sets the designated parameter to a <code>java.sql.NClob</code> object. The object
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7981
    * implements the <code>java.sql.NClob</code> interface. This <code>NClob</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7982
    * object maps to a SQL <code>NCLOB</code>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7983
    * @param parameterName the name of the column to be set
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7984
    * @param value the parameter value
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7985
    * @throws SQLException if the driver does not support national
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7986
    *         character sets;  if the driver can detect that a data conversion
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7987
    *  error could occur; or if a database access error occurs
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7988
    * @since 1.6
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7989
    */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7990
    public void setNClob(String parameterName, NClob value) throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7991
         throw new SQLFeatureNotSupportedException(resBundle.handleGetObject("cachedrowsetimpl.opnotysupp").toString());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7992
     }
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
     * Retrieves the value of the designated column in the current row
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7997
     * of this <code>ResultSet</code> object as a
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7998
     * <code>java.io.Reader</code> object.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  7999
     * It is intended for use when
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8000
     * accessing  <code>NCHAR</code>,<code>NVARCHAR</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8001
     * and <code>LONGNVARCHAR</code> columns.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8002
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8003
     * @return a <code>java.io.Reader</code> object that contains the column
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8004
     * value; if the value is SQL <code>NULL</code>, the value returned is
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8005
     * <code>null</code> in the Java programming language.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8006
     * @param columnIndex the first column is 1, the second is 2, ...
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8007
     * @exception SQLException if a database access error occurs
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8008
     * @since 1.6
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8009
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8010
    public java.io.Reader getNCharacterStream(int columnIndex) throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8011
       throw new SQLFeatureNotSupportedException(resBundle.handleGetObject("cachedrowsetimpl.opnotysupp").toString());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8012
     }
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
     * Retrieves the value of the designated column in the current row
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8017
     * of this <code>ResultSet</code> object as a
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8018
     * <code>java.io.Reader</code> object.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8019
     * It is intended for use when
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8020
     * accessing  <code>NCHAR</code>,<code>NVARCHAR</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8021
     * and <code>LONGNVARCHAR</code> columns.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8022
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8023
     * @param columnName the name of the column
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8024
     * @return a <code>java.io.Reader</code> object that contains the column
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8025
     * value; if the value is SQL <code>NULL</code>, the value returned is
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8026
     * <code>null</code> in the Java programming language
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8027
     * @exception SQLException if a database access error occurs
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8028
     * @since 1.6
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8029
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8030
    public java.io.Reader getNCharacterStream(String columnName) throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8031
       throw new SQLFeatureNotSupportedException(resBundle.handleGetObject("cachedrowsetimpl.opnotysupp").toString());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8032
     }
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
     * Updates the designated column with a <code>java.sql.SQLXML</code> value.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8037
     * The updater
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8038
     * methods are used to update column values in the current row or the insert
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8039
     * row. The updater methods do not update the underlying database; instead
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8040
     * the <code>updateRow</code> or <code>insertRow</code> methods are called
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8041
     * to update the database.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8042
     * @param columnIndex the first column is 1, the second 2, ...
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8043
     * @param xmlObject the value for the column to be updated
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8044
     * @throws SQLException if a database access error occurs
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8045
     * @since 1.6
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8046
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8047
    public void updateSQLXML(int columnIndex, SQLXML xmlObject) throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8048
        throw new SQLFeatureNotSupportedException(resBundle.handleGetObject("cachedrowsetimpl.opnotysupp").toString());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8049
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8050
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8051
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8052
     * Updates the designated column with a <code>java.sql.SQLXML</code> value.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8053
     * The updater
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8054
     * methods are used to update column values in the current row or the insert
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8055
     * row. The updater methods do not update the underlying database; instead
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8056
     * the <code>updateRow</code> or <code>insertRow</code> methods are called
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8057
     * to update the database.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8058
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8059
     * @param columnName the name of the column
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8060
     * @param xmlObject the column value
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8061
     * @throws SQLException if a database access occurs
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8062
     * @since 1.6
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8063
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8064
    public void updateSQLXML(String columnName, SQLXML xmlObject) throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8065
        throw new SQLFeatureNotSupportedException(resBundle.handleGetObject("cachedrowsetimpl.opnotysupp").toString());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8066
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8067
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8068
     /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8069
     * Retrieves the value of the designated column in the current row
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8070
     * of this <code>ResultSet</code> object as
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8071
     * a <code>String</code> in the Java programming language.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8072
     * It is intended for use when
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8073
     * accessing  <code>NCHAR</code>,<code>NVARCHAR</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8074
     * and <code>LONGNVARCHAR</code> columns.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8075
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8076
     * @param columnIndex the first column is 1, the second is 2, ...
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8077
     * @return the column value; if the value is SQL <code>NULL</code>, the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8078
     * value returned is <code>null</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8079
     * @exception SQLException if a database access error occurs
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8080
     * @since 1.6
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8081
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8082
    public String getNString(int columnIndex) throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8083
        throw new SQLFeatureNotSupportedException(resBundle.handleGetObject("cachedrowsetimpl.opnotysupp").toString());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8084
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8085
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8086
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8087
     * Retrieves the value of the designated column in the current row
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8088
     * of this <code>ResultSet</code> object as
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8089
     * a <code>String</code> in the Java programming language.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8090
     * It is intended for use when
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8091
     * accessing  <code>NCHAR</code>,<code>NVARCHAR</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8092
     * and <code>LONGNVARCHAR</code> columns.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8093
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8094
     * @param columnName the SQL name of the column
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8095
     * @return the column value; if the value is SQL <code>NULL</code>, the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8096
     * value returned is <code>null</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8097
     * @exception SQLException if a database access error occurs
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8098
     * @since 1.6
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8099
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8100
    public String getNString(String columnName) throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8101
        throw new SQLFeatureNotSupportedException(resBundle.handleGetObject("cachedrowsetimpl.opnotysupp").toString());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8102
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8103
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8104
     /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8105
       * Updates the designated column with a character stream value, which will
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8106
       * have the specified number of bytes. The driver does the necessary conversion
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8107
       * from Java character format to the national character set in the database.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8108
       * It is intended for use when updating NCHAR,NVARCHAR and LONGNVARCHAR columns.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8109
       * The updater methods are used to update column values in the current row or
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8110
       * the insert row. The updater methods do not update the underlying database;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8111
       * instead the updateRow or insertRow methods are called to update the database.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8112
       *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8113
       * @param columnIndex - the first column is 1, the second is 2, ...
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8114
       * @param x - the new column value
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8115
       * @param length - the length of the stream
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8116
       * @exception SQLException if a database access error occurs
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8117
       * @since 1.6
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8118
       */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8119
       public void updateNCharacterStream(int columnIndex,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8120
                            java.io.Reader x,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8121
                            long length)
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8122
                            throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8123
          throw new SQLFeatureNotSupportedException(resBundle.handleGetObject("cachedrowsetimpl.opnotysupp").toString());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8124
       }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8125
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8126
     /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8127
       * Updates the designated column with a character stream value, which will
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8128
       * have the specified number of bytes. The driver does the necessary conversion
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8129
       * from Java character format to the national character set in the database.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8130
       * It is intended for use when updating NCHAR,NVARCHAR and LONGNVARCHAR columns.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8131
       * The updater methods are used to update column values in the current row or
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8132
       * the insert row. The updater methods do not update the underlying database;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8133
       * instead the updateRow or insertRow methods are called to update the database.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8134
       *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8135
       * @param columnName - name of the Column
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8136
       * @param x - the new column value
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8137
       * @param length - the length of the stream
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8138
       * @exception SQLException if a database access error occurs
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8139
       * @since 1.6
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8140
       */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8141
       public void updateNCharacterStream(String columnName,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8142
                            java.io.Reader x,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8143
                            long length)
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8144
                            throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8145
          throw new SQLFeatureNotSupportedException(resBundle.handleGetObject("cachedrowsetimpl.opnotysupp").toString());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8146
       }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8147
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8148
     /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8149
     * Updates the designated column with a character stream value.   The
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8150
     * driver does the necessary conversion from Java character format to
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8151
     * the national character set in the database.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8152
     * It is intended for use when
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8153
     * updating  <code>NCHAR</code>,<code>NVARCHAR</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8154
     * and <code>LONGNVARCHAR</code> columns.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8155
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8156
     * The updater methods are used to update column values in the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8157
     * current row or the insert row.  The updater methods do not
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8158
     * update the underlying database; instead the <code>updateRow</code> or
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8159
     * <code>insertRow</code> methods are called to update the database.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8160
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8161
     * <P><B>Note:</B> Consult your JDBC driver documentation to determine if
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8162
     * it might be more efficient to use a version of
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8163
     * <code>updateNCharacterStream</code> which takes a length parameter.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8164
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8165
     * @param columnIndex the first column is 1, the second is 2, ...
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8166
     * @param x the new column value
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8167
     * @exception SQLException if a database access error occurs,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8168
     * 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
  8169
     * @exception SQLFeatureNotSupportedException if the JDBC driver does not support
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8170
     * this method
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8171
     * @since 1.6
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8172
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8173
    public void updateNCharacterStream(int columnIndex,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8174
                             java.io.Reader x) throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8175
        throw new SQLFeatureNotSupportedException(resBundle.handleGetObject("cachedrowsetimpl.featnotsupp").toString());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8176
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8177
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8178
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8179
     * Updates the designated column with a character stream value.  The
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8180
     * driver does the necessary conversion from Java character format to
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8181
     * the national character set in the database.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8182
     * It is intended for use when
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8183
     * updating  <code>NCHAR</code>,<code>NVARCHAR</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8184
     * and <code>LONGNVARCHAR</code> columns.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8185
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8186
     * The updater methods are used to update column values in the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8187
     * current row or the insert row.  The updater methods do not
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8188
     * update the underlying database; instead the <code>updateRow</code> or
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8189
     * <code>insertRow</code> methods are called to update the database.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8190
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8191
     * <P><B>Note:</B> Consult your JDBC driver documentation to determine if
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8192
     * it might be more efficient to use a version of
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8193
     * <code>updateNCharacterStream</code> which takes a length parameter.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8194
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8195
     * @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
  8196
bel is the name of the column
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8197
     * @param reader the <code>java.io.Reader</code> object containing
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8198
     *        the new column value
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8199
     * @exception SQLException if a database access error occurs,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8200
     * 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
  8201
      * @exception SQLFeatureNotSupportedException if the JDBC driver does not support
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8202
     * this method
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8203
     * @since 1.6
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8204
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8205
    public void updateNCharacterStream(String columnLabel,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8206
                             java.io.Reader reader) throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8207
        throw new SQLFeatureNotSupportedException(resBundle.handleGetObject("cachedrowsetimpl.featnotsupp").toString());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8208
    }
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
     * Updates the designated column using the given input stream, which
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8214
     * will have the specified number of bytes.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8215
     * When a very large ASCII value is input to a <code>LONGVARCHAR</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8216
     * parameter, it may be more practical to send it via a
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8217
     * <code>java.io.InputStream</code>. Data will be read from the stream
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8218
     * as needed until end-of-file is reached.  The JDBC driver will
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8219
     * do any necessary conversion from ASCII to the database char format.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8220
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8221
     * <P><B>Note:</B> This stream object can either be a standard
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8222
     * Java stream object or your own subclass that implements the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8223
     * standard interface.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8224
     * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8225
     * The updater methods are used to update column values in the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8226
     * current row or the insert row.  The updater methods do not
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8227
     * update the underlying database; instead the <code>updateRow</code> or
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8228
     * <code>insertRow</code> methods are called to update the database.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8229
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8230
     * @param columnIndex the first column is 1, the second is 2, ...
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8231
     * @param inputStream An object that contains the data to set the parameter
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8232
     * value to.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8233
     * @param length the number of bytes in the parameter data.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8234
     * @exception SQLException if a database access error occurs,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8235
     * the result set concurrency is <code>CONCUR_READ_ONLY</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8236
     * or this method is called on a closed result set
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8237
     * @exception SQLFeatureNotSupportedException if the JDBC driver does not support
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8238
     * this method
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8239
     * @since 1.6
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8240
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8241
    public void updateBlob(int columnIndex, InputStream inputStream, long length) throws SQLException{
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8242
        throw new SQLFeatureNotSupportedException(resBundle.handleGetObject("cachedrowsetimpl.featnotsupp").toString());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8243
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8244
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8245
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8246
     * Updates the designated column using the given input stream, which
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8247
     * will have the specified number of bytes.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8248
     * When a very large ASCII value is input to a <code>LONGVARCHAR</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8249
     * parameter, it may be more practical to send it via a
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8250
     * <code>java.io.InputStream</code>. Data will be read from the stream
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8251
     * as needed until end-of-file is reached.  The JDBC driver will
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8252
     * do any necessary conversion from ASCII to the database char format.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8253
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8254
     * <P><B>Note:</B> This stream object can either be a standard
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8255
     * Java stream object or your own subclass that implements the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8256
     * standard interface.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8257
     * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8258
     * The updater methods are used to update column values in the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8259
     * current row or the insert row.  The updater methods do not
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8260
     * update the underlying database; instead the <code>updateRow</code> or
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8261
     * <code>insertRow</code> methods are called to update the database.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8262
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8263
     * @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
  8264
     * @param inputStream An object that contains the data to set the parameter
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8265
     * value to.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8266
     * @param length the number of bytes in the parameter data.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8267
     * @exception SQLException if a database access error occurs,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8268
     * the result set concurrency is <code>CONCUR_READ_ONLY</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8269
     * or this method is called on a closed result set
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8270
     * @exception SQLFeatureNotSupportedException if the JDBC driver does not support
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8271
     * this method
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8272
     * @since 1.6
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8273
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8274
    public void updateBlob(String columnLabel, InputStream inputStream, long length) throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8275
        throw new SQLFeatureNotSupportedException(resBundle.handleGetObject("cachedrowsetimpl.featnotsupp").toString());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8276
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8277
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8278
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8279
     * Updates the designated column using the given input stream.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8280
     * When a very large ASCII value is input to a <code>LONGVARCHAR</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8281
     * parameter, it may be more practical to send it via a
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8282
     * <code>java.io.InputStream</code>. Data will be read from the stream
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8283
     * as needed until end-of-file is reached.  The JDBC driver will
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8284
     * do any necessary conversion from ASCII to the database char format.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8285
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8286
     * <P><B>Note:</B> This stream object can either be a standard
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8287
     * Java stream object or your own subclass that implements the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8288
     * standard interface.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8289
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8290
     *  <P><B>Note:</B> Consult your JDBC driver documentation to determine if
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8291
     * it might be more efficient to use a version of
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8292
     * <code>updateBlob</code> which takes a length parameter.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8293
     * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8294
     * The updater methods are used to update column values in the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8295
     * current row or the insert row.  The updater methods do not
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8296
     * update the underlying database; instead the <code>updateRow</code> or
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8297
     * <code>insertRow</code> methods are called to update the database.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8298
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8299
     * @param columnIndex the first column is 1, the second is 2, ...
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8300
     * @param inputStream An object that contains the data to set the parameter
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8301
     * value to.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8302
     * @exception SQLException if a database access error occurs,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8303
     * the result set concurrency is <code>CONCUR_READ_ONLY</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8304
     * or this method is called on a closed result set
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8305
     * @exception SQLFeatureNotSupportedException if the JDBC driver does not support
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8306
     * this method
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8307
     * @since 1.6
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8308
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8309
    public void updateBlob(int columnIndex, InputStream inputStream) throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8310
        throw new SQLFeatureNotSupportedException(resBundle.handleGetObject("cachedrowsetimpl.featnotsupp").toString());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8311
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8312
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8313
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8314
     * Updates the designated column using the given input stream.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8315
     * When a very large ASCII value is input to a <code>LONGVARCHAR</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8316
     * parameter, it may be more practical to send it via a
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8317
     * <code>java.io.InputStream</code>. Data will be read from the stream
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8318
     * as needed until end-of-file is reached.  The JDBC driver will
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8319
     * do any necessary conversion from ASCII to the database char format.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8320
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8321
     * <P><B>Note:</B> This stream object can either be a standard
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8322
     * Java stream object or your own subclass that implements the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8323
     * standard interface.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8324
     *   <P><B>Note:</B> Consult your JDBC driver documentation to determine if
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8325
     * it might be more efficient to use a version of
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8326
     * <code>updateBlob</code> which takes a length parameter.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8327
     * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8328
     * The updater methods are used to update column values in the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8329
     * current row or the insert row.  The updater methods do not
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8330
     * update the underlying database; instead the <code>updateRow</code> or
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8331
     * <code>insertRow</code> methods are called to update the database.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8332
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8333
     * @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
  8334
bel is the name of the column
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8335
     * @param inputStream An object that contains the data to set the parameter
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8336
     * value to.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8337
     * @exception SQLException if a database access error occurs,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8338
     * the result set concurrency is <code>CONCUR_READ_ONLY</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8339
     * or this method is called on a closed result set
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8340
     * @exception SQLFeatureNotSupportedException if the JDBC driver does not support
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8341
     * this method
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8342
     * @since 1.6
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8343
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8344
    public void updateBlob(String columnLabel, InputStream inputStream) throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8345
        throw new SQLFeatureNotSupportedException(resBundle.handleGetObject("cachedrowsetimpl.featnotsupp").toString());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8346
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8347
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8348
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8349
     * Updates the designated column using the given <code>Reader</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8350
     * object, which is the given number of characters long.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8351
     * When a very large UNICODE value is input to a <code>LONGVARCHAR</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8352
     * parameter, it may be more practical to send it via a
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8353
     * <code>java.io.Reader</code> object. The data will be read from the stream
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8354
     * as needed until end-of-file is reached.  The JDBC driver will
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8355
     * do any necessary conversion from UNICODE to the database char format.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8356
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8357
     * <P><B>Note:</B> This stream object can either be a standard
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8358
     * Java stream object or your own subclass that implements the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8359
     * standard interface.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8360
     * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8361
     * The updater methods are used to update column values in the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8362
     * current row or the insert row.  The updater methods do not
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8363
     * update the underlying database; instead the <code>updateRow</code> or
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8364
     * <code>insertRow</code> methods are called to update the database.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8365
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8366
     * @param columnIndex the first column is 1, the second is 2, ...
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8367
     * @param reader An object that contains the data to set the parameter value to.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8368
     * @param length the number of characters in the parameter data.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8369
     * @exception SQLException if a database access error occurs,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8370
     * the result set concurrency is <code>CONCUR_READ_ONLY</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8371
     * or this method is called on a closed result set
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8372
     * @exception SQLFeatureNotSupportedException if the JDBC driver does not support
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8373
     * this method
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8374
     * @since 1.6
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8375
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8376
    public void updateClob(int columnIndex,  Reader reader, long length) throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8377
        throw new SQLFeatureNotSupportedException(resBundle.handleGetObject("cachedrowsetimpl.featnotsupp").toString());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8378
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8379
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8380
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8381
     * Updates the designated column using the given <code>Reader</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8382
     * object, which is the given number of characters long.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8383
     * When a very large UNICODE value is input to a <code>LONGVARCHAR</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8384
     * parameter, it may be more practical to send it via a
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8385
     * <code>java.io.Reader</code> object. The data will be read from the stream
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8386
     * as needed until end-of-file is reached.  The JDBC driver will
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8387
     * do any necessary conversion from UNICODE to the database char format.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8388
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8389
     * <P><B>Note:</B> This stream object can either be a standard
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8390
     * Java stream object or your own subclass that implements the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8391
     * standard interface.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8392
     * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8393
     * The updater methods are used to update column values in the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8394
     * current row or the insert row.  The updater methods do not
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8395
     * update the underlying database; instead the <code>updateRow</code> or
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8396
     * <code>insertRow</code> methods are called to update the database.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8397
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8398
     * @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
  8399
     * @param reader An object that contains the data to set the parameter value to.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8400
     * @param length the number of characters in the parameter data.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8401
     * @exception SQLException if a database access error occurs,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8402
     * the result set concurrency is <code>CONCUR_READ_ONLY</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8403
     * or this method is called on a closed result set
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8404
     * @exception SQLFeatureNotSupportedException if the JDBC driver does not support
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8405
     * this method
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8406
     * @since 1.6
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8407
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8408
    public void updateClob(String columnLabel,  Reader reader, long length) throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8409
        throw new SQLFeatureNotSupportedException(resBundle.handleGetObject("cachedrowsetimpl.featnotsupp").toString());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8410
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8411
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8412
   /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8413
     * Updates the designated column using the given <code>Reader</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8414
     * object.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8415
     * When a very large UNICODE value is input to a <code>LONGVARCHAR</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8416
     * parameter, it may be more practical to send it via a
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8417
     * <code>java.io.Reader</code> object. The data will be read from the stream
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8418
     * as needed until end-of-file is reached.  The JDBC driver will
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8419
     * do any necessary conversion from UNICODE to the database char format.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8420
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8421
     * <P><B>Note:</B> This stream object can either be a standard
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8422
     * Java stream object or your own subclass that implements the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8423
     * standard interface.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8424
     *   <P><B>Note:</B> Consult your JDBC driver documentation to determine if
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8425
     * it might be more efficient to use a version of
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8426
     * <code>updateClob</code> which takes a length parameter.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8427
     * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8428
     * The updater methods are used to update column values in the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8429
     * current row or the insert row.  The updater methods do not
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8430
     * update the underlying database; instead the <code>updateRow</code> or
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8431
     * <code>insertRow</code> methods are called to update the database.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8432
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8433
     * @param columnIndex the first column is 1, the second is 2, ...
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8434
     * @param reader An object that contains the data to set the parameter value to.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8435
     * @exception SQLException if a database access error occurs,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8436
     * the result set concurrency is <code>CONCUR_READ_ONLY</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8437
     * or this method is called on a closed result set
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8438
     * @exception SQLFeatureNotSupportedException if the JDBC driver does not support
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8439
     * this method
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8440
     * @since 1.6
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8441
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8442
    public void updateClob(int columnIndex,  Reader reader) throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8443
        throw new SQLFeatureNotSupportedException(resBundle.handleGetObject("cachedrowsetimpl.featnotsupp").toString());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8444
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8445
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8446
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8447
     * Updates the designated column using the given <code>Reader</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8448
     * object.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8449
     * When a very large UNICODE value is input to a <code>LONGVARCHAR</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8450
     * parameter, it may be more practical to send it via a
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8451
     * <code>java.io.Reader</code> object. The data will be read from the stream
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8452
     * as needed until end-of-file is reached.  The JDBC driver will
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8453
     * do any necessary conversion from UNICODE to the database char format.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8454
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8455
     * <P><B>Note:</B> This stream object can either be a standard
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8456
     * Java stream object or your own subclass that implements the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8457
     * standard interface.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8458
     *  <P><B>Note:</B> Consult your JDBC driver documentation to determine if
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8459
     * it might be more efficient to use a version of
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8460
     * <code>updateClob</code> which takes a length parameter.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8461
     * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8462
     * The updater methods are used to update column values in the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8463
     * current row or the insert row.  The updater methods do not
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8464
     * update the underlying database; instead the <code>updateRow</code> or
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8465
     * <code>insertRow</code> methods are called to update the database.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8466
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8467
     * @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
  8468
bel is the name of the column
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8469
     * @param reader An object that contains the data to set the parameter value to.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8470
     * @exception SQLException if a database access error occurs,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8471
     * the result set concurrency is <code>CONCUR_READ_ONLY</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8472
     * or this method is called on a closed result set
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8473
     * @exception SQLFeatureNotSupportedException if the JDBC driver does not support
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8474
     * this method
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8475
     * @since 1.6
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8476
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8477
    public void updateClob(String columnLabel,  Reader reader) throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8478
        throw new SQLFeatureNotSupportedException(resBundle.handleGetObject("cachedrowsetimpl.featnotsupp").toString());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8479
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8480
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8481
   /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8482
     * Updates the designated column using the given <code>Reader</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8483
     * object, which is the given number of characters long.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8484
     * When a very large UNICODE value is input to a <code>LONGVARCHAR</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8485
     * parameter, it may be more practical to send it via a
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8486
     * <code>java.io.Reader</code> object. The data will be read from the stream
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8487
     * as needed until end-of-file is reached.  The JDBC driver will
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8488
     * do any necessary conversion from UNICODE to the database char format.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8489
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8490
     * <P><B>Note:</B> This stream object can either be a standard
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8491
     * Java stream object or your own subclass that implements the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8492
     * standard interface.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8493
     * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8494
     * The updater methods are used to update column values in the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8495
     * current row or the insert row.  The updater methods do not
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8496
     * update the underlying database; instead the <code>updateRow</code> or
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8497
     * <code>insertRow</code> methods are called to update the database.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8498
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8499
     * @param columnIndex the first column is 1, the second 2, ...
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8500
     * @param reader An object that contains the data to set the parameter value to.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8501
     * @param length the number of characters in the parameter data.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8502
     * @throws SQLException if the driver does not support national
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8503
     *         character sets;  if the driver can detect that a data conversion
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8504
     *  error could occur; this method is called on a closed result set,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8505
     * if a database access error occurs or
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8506
     * the result set concurrency is <code>CONCUR_READ_ONLY</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8507
     * @exception SQLFeatureNotSupportedException if the JDBC driver does not support
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8508
     * this method
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8509
     * @since 1.6
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8510
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8511
    public void updateNClob(int columnIndex,  Reader reader, long length) throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8512
        throw new SQLFeatureNotSupportedException(resBundle.handleGetObject("cachedrowsetimpl.featnotsupp").toString());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8513
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8514
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8515
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8516
     * Updates the designated column using the given <code>Reader</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8517
     * object, which is the given number of characters long.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8518
     * When a very large UNICODE value is input to a <code>LONGVARCHAR</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8519
     * parameter, it may be more practical to send it via a
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8520
     * <code>java.io.Reader</code> object. The data will be read from the stream
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8521
     * as needed until end-of-file is reached.  The JDBC driver will
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8522
     * do any necessary conversion from UNICODE to the database char format.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8523
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8524
     * <P><B>Note:</B> This stream object can either be a standard
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8525
     * Java stream object or your own subclass that implements the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8526
     * standard interface.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8527
     * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8528
     * The updater methods are used to update column values in the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8529
     * current row or the insert row.  The updater methods do not
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8530
     * update the underlying database; instead the <code>updateRow</code> or
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8531
     * <code>insertRow</code> methods are called to update the database.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8532
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8533
     * @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
  8534
     * @param reader An object that contains the data to set the parameter value to.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8535
     * @param length the number of characters in the parameter data.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8536
     * @throws SQLException if the driver does not support national
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8537
     *         character sets;  if the driver can detect that a data conversion
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8538
     *  error could occur; this method is called on a closed result set;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8539
     *  if a database access error occurs or
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8540
     * the result set concurrency is <code>CONCUR_READ_ONLY</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8541
     * @exception SQLFeatureNotSupportedException if the JDBC driver does not support
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8542
     * this method
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8543
     * @since 1.6
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8544
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8545
    public void updateNClob(String columnLabel,  Reader reader, long length) throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8546
        throw new SQLFeatureNotSupportedException(resBundle.handleGetObject("cachedrowsetimpl.featnotsupp").toString());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8547
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8548
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8549
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8550
     * Updates the designated column using the given <code>Reader</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8551
     * object.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8552
     * When a very large UNICODE value is input to a <code>LONGVARCHAR</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8553
     * parameter, it may be more practical to send it via a
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8554
     * <code>java.io.Reader</code> object. The data will be read from the stream
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8555
     * as needed until end-of-file is reached.  The JDBC driver will
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8556
     * do any necessary conversion from UNICODE to the database char format.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8557
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8558
     * <P><B>Note:</B> This stream object can either be a standard
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8559
     * Java stream object or your own subclass that implements the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8560
     * standard interface.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8561
     * <P><B>Note:</B> Consult your JDBC driver documentation to determine if
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8562
     * it might be more efficient to use a version of
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8563
     * <code>updateNClob</code> which takes a length parameter.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8564
     * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8565
     * The updater methods are used to update column values in the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8566
     * current row or the insert row.  The updater methods do not
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8567
     * update the underlying database; instead the <code>updateRow</code> or
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8568
     * <code>insertRow</code> methods are called to update the database.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8569
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8570
     * @param columnIndex the first column is 1, the second 2, ...
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8571
     * @param reader An object that contains the data to set the parameter value to.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8572
     * @throws SQLException if the driver does not support national
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8573
     *         character sets;  if the driver can detect that a data conversion
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8574
     *  error could occur; this method is called on a closed result set,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8575
     * if a database access error occurs or
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8576
     * the result set concurrency is <code>CONCUR_READ_ONLY</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8577
     * @exception SQLFeatureNotSupportedException if the JDBC driver does not support
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8578
     * this method
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8579
     * @since 1.6
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8580
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8581
    public void updateNClob(int columnIndex,  Reader reader) throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8582
        throw new SQLFeatureNotSupportedException(resBundle.handleGetObject("cachedrowsetimpl.featnotsupp").toString());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8583
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8584
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8585
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8586
     * Updates the designated column using the given <code>Reader</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8587
     * object.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8588
     * When a very large UNICODE value is input to a <code>LONGVARCHAR</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8589
     * parameter, it may be more practical to send it via a
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8590
     * <code>java.io.Reader</code> object. The data will be read from the stream
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8591
     * as needed until end-of-file is reached.  The JDBC driver will
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8592
     * do any necessary conversion from UNICODE to the database char format.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8593
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8594
     * <P><B>Note:</B> This stream object can either be a standard
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8595
     * Java stream object or your own subclass that implements the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8596
     * standard interface.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8597
     * <P><B>Note:</B> Consult your JDBC driver documentation to determine if
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8598
     * it might be more efficient to use a version of
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8599
     * <code>updateNClob</code> which takes a length parameter.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8600
     * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8601
     * The updater methods are used to update column values in the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8602
     * current row or the insert row.  The updater methods do not
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8603
     * update the underlying database; instead the <code>updateRow</code> or
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8604
     * <code>insertRow</code> methods are called to update the database.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8605
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8606
     * @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
  8607
bel is the name of the column
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8608
     * @param reader An object that contains the data to set the parameter value to.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8609
     * @throws SQLException if the driver does not support national
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8610
     *         character sets;  if the driver can detect that a data conversion
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8611
     *  error could occur; this method is called on a closed result set;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8612
     *  if a database access error occurs or
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8613
     * the result set concurrency is <code>CONCUR_READ_ONLY</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8614
     * @exception SQLFeatureNotSupportedException if the JDBC driver does not support
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8615
     * this method
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8616
     * @since 1.6
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8617
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8618
    public void updateNClob(String columnLabel,  Reader reader) throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8619
        throw new SQLFeatureNotSupportedException(resBundle.handleGetObject("cachedrowsetimpl.featnotsupp").toString());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8620
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8621
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8622
        /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8623
     * Updates the designated column with an ascii stream value, which will have
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8624
     * the specified number of bytes.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8625
     * The updater methods are used to update column values in the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8626
     * current row or the insert row.  The updater methods do not
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8627
     * update the underlying database; instead the <code>updateRow</code> or
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8628
     * <code>insertRow</code> methods are called to update the database.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8629
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8630
     * @param columnIndex the first column is 1, the second is 2, ...
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8631
     * @param x the new column value
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8632
     * @param length the length of the stream
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8633
     * @exception SQLException if a database access error occurs,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8634
     * the result set concurrency is <code>CONCUR_READ_ONLY</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8635
     * or this method is called on a closed result set
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8636
     * @exception SQLFeatureNotSupportedException if the JDBC driver does not support
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8637
     * this method
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8638
     * @since 1.6
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8639
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8640
    public void updateAsciiStream(int columnIndex,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8641
                           java.io.InputStream x,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8642
                           long length) throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8643
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
     * Updates the designated column with a binary stream value, which will have
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8648
     * the specified number of bytes.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8649
     * The updater methods are used to update column values in the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8650
     * current row or the insert row.  The updater methods do not
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8651
     * update the underlying database; instead the <code>updateRow</code> or
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8652
     * <code>insertRow</code> methods are called to update the database.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8653
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8654
     * @param columnIndex the first column is 1, the second is 2, ...
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8655
     * @param x the new column value
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8656
     * @param length the length of the stream
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8657
     * @exception SQLException if a database access error occurs,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8658
     * the result set concurrency is <code>CONCUR_READ_ONLY</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8659
     * or this method is called on a closed result set
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8660
     * @exception SQLFeatureNotSupportedException if the JDBC driver does not support
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8661
     * this method
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8662
     * @since 1.6
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8663
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8664
    public void updateBinaryStream(int columnIndex,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8665
                            java.io.InputStream x,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8666
                            long length) throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8667
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8668
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8669
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8670
     * Updates the designated column with a character stream value, which will have
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8671
     * the specified number of bytes.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8672
     * The updater methods are used to update column values in the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8673
     * current row or the insert row.  The updater methods do not
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8674
     * update the underlying database; instead the <code>updateRow</code> or
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8675
     * <code>insertRow</code> methods are called to update the database.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8676
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8677
     * @param columnIndex the first column is 1, the second is 2, ...
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8678
     * @param x the new column value
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8679
     * @param length the length of the stream
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8680
     * @exception SQLException if a database access error occurs,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8681
     * the result set concurrency is <code>CONCUR_READ_ONLY</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8682
     * or this method is called on a closed result set
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8683
     * @exception SQLFeatureNotSupportedException if the JDBC driver does not support
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8684
     * this method
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8685
     * @since 1.6
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8686
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8687
    public void updateCharacterStream(int columnIndex,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8688
                             java.io.Reader x,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8689
                             long length) throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8690
        throw new SQLFeatureNotSupportedException(resBundle.handleGetObject("cachedrowsetimpl.featnotsupp").toString());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8691
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8692
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8693
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8694
     * Updates the designated column with a character stream value, which will have
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8695
     * the specified number of bytes.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8696
     * The updater methods are used to update column values in the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8697
     * current row or the insert row.  The updater methods do not
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8698
     * update the underlying database; instead the <code>updateRow</code> or
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8699
     * <code>insertRow</code> methods are called to update the database.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8700
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8701
     * @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
  8702
bel is the name of the column
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8703
     * @param reader the <code>java.io.Reader</code> object containing
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8704
     *        the new column value
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8705
     * @param length the length of the stream
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8706
     * @exception SQLException if a database access error occurs,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8707
     * the result set concurrency is <code>CONCUR_READ_ONLY</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8708
     * or this method is called on a closed result set
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8709
     * @exception SQLFeatureNotSupportedException if the JDBC driver does not support
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8710
     * this method
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8711
     * @since 1.6
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8712
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8713
    public void updateCharacterStream(String columnLabel,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8714
                             java.io.Reader reader,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8715
                             long length) throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8716
        throw new SQLFeatureNotSupportedException(resBundle.handleGetObject("cachedrowsetimpl.featnotsupp").toString());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8717
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8718
     /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8719
     * Updates the designated column with an ascii stream value, which will have
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8720
     * the specified number of bytes..
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8721
     * The updater methods are used to update column values in the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8722
     * current row or the insert row.  The updater methods do not
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8723
     * update the underlying database; instead the <code>updateRow</code> or
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8724
     * <code>insertRow</code> methods are called to update the database.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8725
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8726
     * @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
  8727
     * @param x the new column value
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8728
     * @param length the length of the stream
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8729
     * @exception SQLException if a database access error occurs,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8730
     * the result set concurrency is <code>CONCUR_READ_ONLY</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8731
     * or this method is called on a closed result set
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8732
     * @exception SQLFeatureNotSupportedException if the JDBC driver does not support
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8733
     * this method
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8734
     * @since 1.6
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8735
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8736
    public void updateAsciiStream(String columnLabel,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8737
                           java.io.InputStream x,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8738
                           long length) throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8739
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8740
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8741
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8742
     * Updates the designated column with a binary stream value, which will have
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8743
     * the specified number of bytes.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8744
     * The updater methods are used to update column values in the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8745
     * current row or the insert row.  The updater methods do not
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8746
     * update the underlying database; instead the <code>updateRow</code> or
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8747
     * <code>insertRow</code> methods are called to update the database.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8748
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8749
     * @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
  8750
     * @param x the new column value
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8751
     * @param length the length of the stream
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8752
     * @exception SQLException if a database access error occurs,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8753
     * the result set concurrency is <code>CONCUR_READ_ONLY</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8754
     * or this method is called on a closed result set
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8755
     * @exception SQLFeatureNotSupportedException if the JDBC driver does not support
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8756
     * this method
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8757
     * @since 1.6
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8758
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8759
    public void updateBinaryStream(String columnLabel,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8760
                            java.io.InputStream x,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8761
                            long length) throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8762
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8763
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8764
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8765
     * Updates the designated column with a binary stream value.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8766
     * The updater methods are used to update column values in the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8767
     * current row or the insert row.  The updater methods do not
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8768
     * update the underlying database; instead the <code>updateRow</code> or
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8769
     * <code>insertRow</code> methods are called to update the database.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8770
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8771
     * <P><B>Note:</B> Consult your JDBC driver documentation to determine if
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8772
     * it might be more efficient to use a version of
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8773
     * <code>updateBinaryStream</code> which takes a length parameter.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8774
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8775
     * @param columnIndex the first column is 1, the second is 2, ...
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8776
     * @param x the new column value
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8777
     * @exception SQLException if a database access error occurs,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8778
     * the result set concurrency is <code>CONCUR_READ_ONLY</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8779
     * or this method is called on a closed result set
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8780
     * @exception SQLFeatureNotSupportedException if the JDBC driver does not support
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8781
     * this method
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8782
     * @since 1.6
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8783
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8784
    public void updateBinaryStream(int columnIndex,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8785
                            java.io.InputStream x) throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8786
        throw new SQLFeatureNotSupportedException(resBundle.handleGetObject("cachedrowsetimpl.featnotsupp").toString());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8787
    }
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
     * Updates the designated column with a binary stream value.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8792
     * The updater methods are used to update column values in the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8793
     * current row or the insert row.  The updater methods do not
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8794
     * update the underlying database; instead the <code>updateRow</code> or
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8795
     * <code>insertRow</code> methods are called to update the database.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8796
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8797
     * <P><B>Note:</B> Consult your JDBC driver documentation to determine if
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8798
     * it might be more efficient to use a version of
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8799
     * <code>updateBinaryStream</code> which takes a length parameter.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8800
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8801
     * @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
  8802
bel is the name of the column
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8803
     * @param x the new column value
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8804
     * @exception SQLException if a database access error occurs,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8805
     * the result set concurrency is <code>CONCUR_READ_ONLY</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8806
     * or this method is called on a closed result set
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8807
     * @exception SQLFeatureNotSupportedException if the JDBC driver does not support
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8808
     * this method
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8809
     * @since 1.6
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8810
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8811
    public void updateBinaryStream(String columnLabel,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8812
                            java.io.InputStream x) throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8813
        throw new SQLFeatureNotSupportedException(resBundle.handleGetObject("cachedrowsetimpl.featnotsupp").toString());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8814
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8815
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8816
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8817
     * Updates the designated column with a character stream value.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8818
     * The updater methods are used to update column values in the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8819
     * current row or the insert row.  The updater methods do not
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8820
     * update the underlying database; instead the <code>updateRow</code> or
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8821
     * <code>insertRow</code> methods are called to update the database.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8822
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8823
     * <P><B>Note:</B> Consult your JDBC driver documentation to determine if
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8824
     * it might be more efficient to use a version of
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8825
     * <code>updateCharacterStream</code> which takes a length parameter.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8826
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8827
     * @param columnIndex the first column is 1, the second is 2, ...
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8828
     * @param x the new column value
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8829
     * @exception SQLException if a database access error occurs,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8830
     * the result set concurrency is <code>CONCUR_READ_ONLY</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8831
     * or this method is called on a closed result set
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8832
     * @exception SQLFeatureNotSupportedException if the JDBC driver does not support
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8833
     * this method
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8834
     * @since 1.6
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8835
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8836
    public void updateCharacterStream(int columnIndex,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8837
                             java.io.Reader x) throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8838
        throw new SQLFeatureNotSupportedException(resBundle.handleGetObject("cachedrowsetimpl.featnotsupp").toString());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8839
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8840
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8841
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8842
     * Updates the designated column with a character stream value.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8843
     * The updater methods are used to update column values in the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8844
     * current row or the insert row.  The updater methods do not
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8845
     * update the underlying database; instead the <code>updateRow</code> or
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8846
     * <code>insertRow</code> methods are called to update the database.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8847
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8848
     * <P><B>Note:</B> Consult your JDBC driver documentation to determine if
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8849
     * it might be more efficient to use a version of
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8850
     * <code>updateCharacterStream</code> which takes a length parameter.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8851
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8852
     * @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
  8853
bel is the name of the column
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8854
     * @param reader the <code>java.io.Reader</code> object containing
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8855
     *        the new column value
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8856
     * @exception SQLException if a database access error occurs,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8857
     * the result set concurrency is <code>CONCUR_READ_ONLY</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8858
     * or this method is called on a closed result set
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8859
     * @exception SQLFeatureNotSupportedException if the JDBC driver does not support
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8860
     * this method
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8861
     * @since 1.6
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8862
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8863
    public void updateCharacterStream(String columnLabel,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8864
                             java.io.Reader reader) throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8865
        throw new SQLFeatureNotSupportedException(resBundle.handleGetObject("cachedrowsetimpl.featnotsupp").toString());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8866
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8867
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8868
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8869
     * Updates the designated column with an ascii stream value.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8870
     * The updater methods are used to update column values in the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8871
     * current row or the insert row.  The updater methods do not
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8872
     * update the underlying database; instead the <code>updateRow</code> or
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8873
     * <code>insertRow</code> methods are called to update the database.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8874
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8875
     * <P><B>Note:</B> Consult your JDBC driver documentation to determine if
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8876
     * it might be more efficient to use a version of
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8877
     * <code>updateAsciiStream</code> which takes a length parameter.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8878
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8879
     * @param columnIndex the first column is 1, the second is 2, ...
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8880
     * @param x the new column value
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8881
     * @exception SQLException if a database access error occurs,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8882
     * the result set concurrency is <code>CONCUR_READ_ONLY</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8883
     * or this method is called on a closed result set
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8884
     * @exception SQLFeatureNotSupportedException if the JDBC driver does not support
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8885
     * this method
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8886
     * @since 1.6
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8887
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8888
    public void updateAsciiStream(int columnIndex,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8889
                           java.io.InputStream x) throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8890
        throw new SQLFeatureNotSupportedException(resBundle.handleGetObject("cachedrowsetimpl.featnotsupp").toString());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8891
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8892
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8893
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8894
     * Updates the designated column with an ascii stream value.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8895
     * The updater methods are used to update column values in the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8896
     * current row or the insert row.  The updater methods do not
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8897
     * update the underlying database; instead the <code>updateRow</code> or
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8898
     * <code>insertRow</code> methods are called to update the database.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8899
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8900
     * <P><B>Note:</B> Consult your JDBC driver documentation to determine if
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8901
     * it might be more efficient to use a version of
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8902
     * <code>updateAsciiStream</code> which takes a length parameter.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8903
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8904
     * @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
  8905
bel is the name of the column
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8906
     * @param x the new column value
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8907
     * @exception SQLException if a database access error occurs,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8908
     * the result set concurrency is <code>CONCUR_READ_ONLY</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8909
     * or this method is called on a closed result set
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8910
     * @exception SQLFeatureNotSupportedException if the JDBC driver does not support
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8911
     * this method
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8912
     * @since 1.6
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8913
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8914
    public void updateAsciiStream(String columnLabel,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8915
                           java.io.InputStream x) throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8916
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
  * Sets the designated parameter to the given <code>java.net.URL</code> value.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8921
  * The driver converts this to an SQL <code>DATALINK</code> value
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8922
  * when it sends it to the database.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8923
  *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8924
  * @param parameterIndex the first parameter is 1, the second is 2, ...
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8925
  * @param x the <code>java.net.URL</code> object to be set
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8926
  * @exception SQLException if a database access error occurs or
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8927
  * this method is called on a closed <code>PreparedStatement</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8928
  * @throws SQLFeatureNotSupportedException  if the JDBC driver does not support this method
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8929
  * @since 1.4
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8930
  */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8931
  public void setURL(int parameterIndex, java.net.URL x) throws SQLException{
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8932
        throw new SQLFeatureNotSupportedException(resBundle.handleGetObject("cachedrowsetimpl.featnotsupp").toString());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8933
   }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8934
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8935
  /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8936
  * Sets the designated parameter to a <code>Reader</code> object.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8937
  * This method differs from the <code>setCharacterStream (int, Reader)</code> method
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8938
  * because it informs the driver that the parameter value should be sent to
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8939
  * the server as a <code>NCLOB</code>.  When the <code>setCharacterStream</code> method is used, the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8940
  * driver may have to do extra work to determine whether the parameter
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8941
  * data should be sent to the server as a <code>LONGNVARCHAR</code> or a <code>NCLOB</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8942
  * <P><B>Note:</B> Consult your JDBC driver documentation to determine if
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8943
  * it might be more efficient to use a version of
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8944
  * <code>setNClob</code> which takes a length parameter.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8945
  *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8946
  * @param parameterIndex index of the first parameter is 1, the second is 2, ...
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8947
  * @param reader An object that contains the data to set the parameter value to.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8948
  * @throws SQLException if parameterIndex does not correspond to a parameter
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8949
  * marker in the SQL statement;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8950
  * if the driver does not support national character sets;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8951
  * if the driver can detect that a data conversion
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8952
  *  error could occur;  if a database access error occurs or
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8953
  * this method is called on a closed <code>PreparedStatement</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8954
  * @throws SQLFeatureNotSupportedException  if the JDBC driver does not support this method
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8955
  *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8956
  * @since 1.6
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8957
  */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8958
  public void setNClob(int parameterIndex, Reader reader)
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8959
    throws SQLException{
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8960
        throw new SQLFeatureNotSupportedException(resBundle.handleGetObject("cachedrowsetimpl.featnotsupp").toString());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8961
   }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8962
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8963
  /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8964
  * 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
  8965
             * of characters specified by length otherwise a <code>SQLException</code> will be
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8966
            * generated when the <code>CallableStatement</code> is executed.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8967
            * This method differs from the <code>setCharacterStream (int, Reader, int)</code> method
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8968
            * because it informs the driver that the parameter value should be sent to
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8969
            * the server as a <code>NCLOB</code>.  When the <code>setCharacterStream</code> method is used, the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8970
            * driver may have to do extra work to determine whether the parameter
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8971
            * data should be send to the server as a <code>LONGNVARCHAR</code> or a <code>NCLOB</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8972
            *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8973
            * @param parameterName the name of the parameter to be set
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8974
            * @param reader An object that contains the data to set the parameter value to.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8975
            * @param length the number of characters in the parameter data.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8976
            * @throws SQLException if parameterIndex does not correspond to a parameter
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8977
            * marker in the SQL statement; if the length specified is less than zero;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8978
            * if the driver does not support national
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8979
            *         character sets;  if the driver can detect that a data conversion
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8980
            *  error could occur; if a database access error occurs or
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8981
            * this method is called on a closed <code>CallableStatement</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8982
            * @exception SQLFeatureNotSupportedException if the JDBC driver does not support
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8983
            * this method
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8984
            * @since 1.6
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8985
            */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8986
            public void setNClob(String parameterName, Reader reader, long length)
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8987
    throws SQLException{
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8988
        throw new SQLFeatureNotSupportedException(resBundle.handleGetObject("cachedrowsetimpl.featnotsupp").toString());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8989
   }
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
  * Sets the designated parameter to a <code>Reader</code> object.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8994
  * This method differs from the <code>setCharacterStream (int, Reader)</code> method
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8995
  * because it informs the driver that the parameter value should be sent to
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8996
  * the server as a <code>NCLOB</code>.  When the <code>setCharacterStream</code> method is used, the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8997
  * driver may have to do extra work to determine whether the parameter
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8998
  * data should be send to the server as a <code>LONGNVARCHAR</code> or a <code>NCLOB</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  8999
  * <P><B>Note:</B> Consult your JDBC driver documentation to determine if
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9000
  * it might be more efficient to use a version of
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9001
  * <code>setNClob</code> which takes a length parameter.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9002
  *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9003
  * @param parameterName the name of the parameter
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9004
  * @param reader An object that contains the data to set the parameter value to.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9005
  * @throws SQLException if the driver does not support national character sets;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9006
  * if the driver can detect that a data conversion
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9007
  *  error could occur;  if a database access error occurs or
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9008
  * this method is called on a closed <code>CallableStatement</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9009
  * @throws SQLFeatureNotSupportedException  if the JDBC driver does not support this method
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9010
  *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9011
  * @since 1.6
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9012
  */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9013
  public void setNClob(String parameterName, Reader reader)
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9014
    throws SQLException{
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9015
        throw new SQLFeatureNotSupportedException(resBundle.handleGetObject("cachedrowsetimpl.featnotsupp").toString());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9016
   }
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
     * Sets the designated parameter to a <code>Reader</code> object.  The reader must contain  the number
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9021
     * of characters specified by length otherwise a <code>SQLException</code> will be
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9022
     * generated when the <code>PreparedStatement</code> is executed.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9023
     * This method differs from the <code>setCharacterStream (int, Reader, int)</code> method
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9024
     * because it informs the driver that the parameter value should be sent to
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9025
     * the server as a <code>NCLOB</code>.  When the <code>setCharacterStream</code> method is used, the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9026
     * driver may have to do extra work to determine whether the parameter
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9027
     * data should be sent to the server as a <code>LONGNVARCHAR</code> or a <code>NCLOB</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9028
     * @param parameterIndex index of the first parameter is 1, the second is 2, ...
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9029
     * @param reader An object that contains the data to set the parameter value to.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9030
     * @param length the number of characters in the parameter data.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9031
     * @throws SQLException if parameterIndex does not correspond to a parameter
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9032
     * marker in the SQL statement; if the length specified is less than zero;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9033
     * if the driver does not support national character sets;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9034
     * if the driver can detect that a data conversion
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9035
     *  error could occur;  if a database access error occurs or
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9036
     * this method is called on a closed <code>PreparedStatement</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9037
     * @throws SQLFeatureNotSupportedException  if the JDBC driver does not support this method
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9038
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9039
     * @since 1.6
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9040
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9041
     public void setNClob(int parameterIndex, Reader reader, long length)
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9042
       throws SQLException{
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9043
        throw new SQLFeatureNotSupportedException(resBundle.handleGetObject("cachedrowsetimpl.featnotsupp").toString());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9044
   }
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
     * Sets the designated parameter to a <code>java.sql.NClob</code> object. The driver converts this to
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9049
a
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9050
     * SQL <code>NCLOB</code> value when it sends it to the database.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9051
     * @param parameterIndex of the first parameter is 1, the second is 2, ...
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9052
     * @param value the parameter value
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9053
     * @throws SQLException if the driver does not support national
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9054
     *         character sets;  if the driver can detect that a data conversion
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9055
     *  error could occur ; or if a database access error occurs
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9056
     * @since 1.6
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9057
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9058
     public void setNClob(int parameterIndex, NClob value) throws SQLException{
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9059
        throw new SQLFeatureNotSupportedException(resBundle.handleGetObject("cachedrowsetimpl.featnotsupp").toString());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9060
   }
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
  * Sets the designated paramter to the given <code>String</code> object.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9065
  * The driver converts this to a SQL <code>NCHAR</code> or
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9066
  * <code>NVARCHAR</code> or <code>LONGNVARCHAR</code> value
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9067
  * (depending on the argument's
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9068
  * size relative to the driver's limits on <code>NVARCHAR</code> values)
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9069
  * when it sends it to the database.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9070
  *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9071
  * @param parameterIndex of the first parameter is 1, the second is 2, ...
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9072
  * @param value the parameter value
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9073
  * @throws SQLException if the driver does not support national
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9074
  *         character sets;  if the driver can detect that a data conversion
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9075
  *  error could occur ; or if a database access error occurs
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9076
  * @since 1.6
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9077
  */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9078
  public void setNString(int parameterIndex, String value) throws SQLException{
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9079
        throw new SQLFeatureNotSupportedException(resBundle.handleGetObject("cachedrowsetimpl.featnotsupp").toString());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9080
   }
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
  * Sets the designated paramter to the given <code>String</code> object.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9085
  * The driver converts this to a SQL <code>NCHAR</code> or
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9086
  * <code>NVARCHAR</code> or <code>LONGNVARCHAR</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9087
  * @param parameterName the name of the column to be set
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9088
  * @param value the parameter value
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9089
  * @throws SQLException if the driver does not support national
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9090
  *         character sets;  if the driver can detect that a data conversion
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9091
  *  error could occur; or if a database access error occurs
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9092
  * @since 1.6
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9093
  */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9094
 public void setNString(String parameterName, String value)
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9095
         throws SQLException{
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9096
        throw new SQLFeatureNotSupportedException(resBundle.handleGetObject("cachedrowsetimpl.featnotsupp").toString());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9097
   }
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
  * Sets the designated parameter to a <code>Reader</code> object. The
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9102
  * <code>Reader</code> reads the data till end-of-file is reached. The
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9103
  * driver does the necessary conversion from Java character format to
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9104
  * the national character set in the database.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9105
  * @param parameterIndex of the first parameter is 1, the second is 2, ...
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9106
  * @param value the parameter value
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9107
  * @param length the number of characters in the parameter data.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9108
  * @throws SQLException if the driver does not support national
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9109
  *         character sets;  if the driver can detect that a data conversion
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9110
  *  error could occur ; or if a database access error occurs
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9111
  * @since 1.6
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9112
  */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9113
  public void setNCharacterStream(int parameterIndex, Reader value, long length) throws SQLException{
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9114
        throw new SQLFeatureNotSupportedException(resBundle.handleGetObject("cachedrowsetimpl.featnotsupp").toString());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9115
   }
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
  * Sets the designated parameter to a <code>Reader</code> object. The
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9120
  * <code>Reader</code> reads the data till end-of-file is reached. The
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9121
  * driver does the necessary conversion from Java character format to
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9122
  * the national character set in the database.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9123
  * @param parameterName the name of the column to be set
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9124
  * @param value the parameter value
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9125
  * @param length the number of characters in the parameter data.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9126
  * @throws SQLException if the driver does not support national
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9127
  *         character sets;  if the driver can detect that a data conversion
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9128
  *  error could occur; or if a database access error occurs
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9129
  * @since 1.6
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9130
  */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9131
 public void setNCharacterStream(String parameterName, Reader value, long length)
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9132
         throws SQLException{
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9133
        throw new SQLFeatureNotSupportedException(resBundle.handleGetObject("cachedrowsetimpl.featnotsupp").toString());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9134
   }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9135
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9136
  /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9137
  * Sets the designated parameter to a <code>Reader</code> object. The
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9138
  * <code>Reader</code> reads the data till end-of-file is reached. The
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9139
  * driver does the necessary conversion from Java character format to
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9140
  * the national character set in the database.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9141
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9142
  * <P><B>Note:</B> This stream object can either be a standard
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9143
  * Java stream object or your own subclass that implements the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9144
  * standard interface.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9145
  * <P><B>Note:</B> Consult your JDBC driver documentation to determine if
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9146
  * it might be more efficient to use a version of
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9147
  * <code>setNCharacterStream</code> which takes a length parameter.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9148
  *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9149
  * @param parameterName the name of the parameter
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9150
  * @param value the parameter value
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9151
  * @throws SQLException if the driver does not support national
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9152
  *         character sets;  if the driver can detect that a data conversion
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9153
  *  error could occur ; if a database access error occurs; or
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9154
  * this method is called on a closed <code>CallableStatement</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9155
  * @throws SQLFeatureNotSupportedException  if the JDBC driver does not support this method
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9156
  * @since 1.6
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9157
  */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9158
  public void setNCharacterStream(String parameterName, Reader value) throws SQLException{
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9159
        throw new SQLFeatureNotSupportedException(resBundle.handleGetObject("cachedrowsetimpl.featnotsupp").toString());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9160
   }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9161
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9162
  /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9163
    * Sets the designated parameter to the given <code>java.sql.Timestamp</code> value,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9164
    * using the given <code>Calendar</code> object.  The driver uses
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9165
    * the <code>Calendar</code> object to construct an SQL <code>TIMESTAMP</code> value,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9166
    * which the driver then sends to the database.  With a
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9167
    * a <code>Calendar</code> object, the driver can calculate the timestamp
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9168
    * taking into account a custom timezone.  If no
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9169
    * <code>Calendar</code> object is specified, the driver uses the default
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9170
    * timezone, which is that of the virtual machine running the application.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9171
    *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9172
    * @param parameterName the name of the parameter
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9173
    * @param x the parameter value
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9174
    * @param cal the <code>Calendar</code> object the driver will use
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9175
    *            to construct the timestamp
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9176
    * @exception SQLException if a database access error occurs or
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9177
    * this method is called on a closed <code>CallableStatement</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9178
    * @exception SQLFeatureNotSupportedException if the JDBC driver does not support
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9179
    * this method
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9180
    * @see #getTimestamp
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9181
    * @since 1.4
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9182
    */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9183
    public void setTimestamp(String parameterName, java.sql.Timestamp x, Calendar cal)
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9184
       throws SQLException{
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9185
        throw new SQLFeatureNotSupportedException(resBundle.handleGetObject("cachedrowsetimpl.featnotsupp").toString());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9186
   }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9187
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9188
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9189
    * 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
  9190
               * of characters specified by length otherwise a <code>SQLException</code> will be
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9191
               * generated when the <code>CallableStatement</code> is executed.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9192
              * This method differs from the <code>setCharacterStream (int, Reader, int)</code> method
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9193
              * because it informs the driver that the parameter value should be sent to
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9194
              * the server as a <code>CLOB</code>.  When the <code>setCharacterStream</code> method is used, the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9195
              * driver may have to do extra work to determine whether the parameter
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9196
              * data should be send to the server as a <code>LONGVARCHAR</code> or a <code>CLOB</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9197
              * @param parameterName the name of the parameter to be set
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9198
              * @param reader An object that contains the data to set the parameter value to.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9199
              * @param length the number of characters in the parameter data.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9200
              * @throws SQLException if parameterIndex does not correspond to a parameter
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9201
              * marker in the SQL statement; if the length specified is less than zero;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9202
              * a database access error occurs or
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9203
              * this method is called on a closed <code>CallableStatement</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9204
              * @exception SQLFeatureNotSupportedException if the JDBC driver does not support
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9205
              * this method
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9206
              *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9207
              * @since 1.6
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9208
              */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9209
      public  void setClob(String parameterName, Reader reader, long length)
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9210
      throws SQLException{
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9211
        throw new SQLFeatureNotSupportedException(resBundle.handleGetObject("cachedrowsetimpl.featnotsupp").toString());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9212
   }
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
    * Sets the designated parameter to the given <code>java.sql.Clob</code> object.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9217
    * The driver converts this to an SQL <code>CLOB</code> value when it
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9218
    * sends it to the database.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9219
    *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9220
    * @param parameterName the name of the parameter
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9221
    * @param x a <code>Clob</code> object that maps an SQL <code>CLOB</code> value
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9222
    * @exception SQLException if a database access error occurs or
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9223
    * this method is called on a closed <code>CallableStatement</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9224
    * @exception SQLFeatureNotSupportedException if the JDBC driver does not support
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9225
    * this method
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9226
    * @since 1.6
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9227
    */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9228
    public void setClob (String parameterName, Clob x) throws SQLException{
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9229
        throw new SQLFeatureNotSupportedException(resBundle.handleGetObject("cachedrowsetimpl.featnotsupp").toString());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9230
   }
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
    * Sets the designated parameter to a <code>Reader</code> object.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9235
    * This method differs from the <code>setCharacterStream (int, Reader)</code> method
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9236
    * because it informs the driver that the parameter value should be sent to
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9237
    * the server as a <code>CLOB</code>.  When the <code>setCharacterStream</code> method is used, the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9238
    * driver may have to do extra work to determine whether the parameter
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9239
    * data should be send to the server as a <code>LONGVARCHAR</code> or a <code>CLOB</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9240
    *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9241
    * <P><B>Note:</B> Consult your JDBC driver documentation to determine if
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9242
    * it might be more efficient to use a version of
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9243
    * <code>setClob</code> which takes a length parameter.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9244
    *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9245
    * @param parameterName the name of the parameter
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9246
    * @param reader An object that contains the data to set the parameter value to.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9247
    * @throws SQLException if a database access error occurs or this method is called on
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9248
    * a closed <code>CallableStatement</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9249
    *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9250
    * @throws SQLFeatureNotSupportedException  if the JDBC driver does not support this method
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9251
    * @since 1.6
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9252
    */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9253
    public void setClob(String parameterName, Reader reader)
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9254
      throws SQLException{
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9255
        throw new SQLFeatureNotSupportedException(resBundle.handleGetObject("cachedrowsetimpl.featnotsupp").toString());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9256
   }
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
    * Sets the designated parameter to the given <code>java.sql.Date</code> value
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9261
    * using the default time zone of the virtual machine that is running
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9262
    * the application.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9263
    * The driver converts this
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9264
    * to an SQL <code>DATE</code> value when it sends it to the database.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9265
    *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9266
    * @param parameterName the name of the parameter
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9267
    * @param x the parameter value
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9268
    * @exception SQLException if a database access error occurs or
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9269
    * this method is called on a closed <code>CallableStatement</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9270
    * @exception SQLFeatureNotSupportedException if the JDBC driver does not support
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9271
    * this method
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9272
    * @see #getDate
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9273
    * @since 1.4
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9274
    */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9275
    public void setDate(String parameterName, java.sql.Date x)
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9276
       throws SQLException{
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9277
        throw new SQLFeatureNotSupportedException(resBundle.handleGetObject("cachedrowsetimpl.featnotsupp").toString());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9278
   }
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
    * Sets the designated parameter to the given <code>java.sql.Date</code> value,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9283
    * using the given <code>Calendar</code> object.  The driver uses
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9284
    * the <code>Calendar</code> object to construct an SQL <code>DATE</code> value,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9285
    * which the driver then sends to the database.  With a
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9286
    * a <code>Calendar</code> object, the driver can calculate the date
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9287
    * taking into account a custom timezone.  If no
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9288
    * <code>Calendar</code> object is specified, the driver uses the default
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9289
    * timezone, which is that of the virtual machine running the application.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9290
    *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9291
    * @param parameterName the name of the parameter
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9292
    * @param x the parameter value
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9293
    * @param cal the <code>Calendar</code> object the driver will use
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9294
    *            to construct the date
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9295
    * @exception SQLException if a database access error occurs or
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9296
    * this method is called on a closed <code>CallableStatement</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9297
    * @exception SQLFeatureNotSupportedException if the JDBC driver does not support
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9298
    * this method
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9299
    * @see #getDate
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9300
    * @since 1.4
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9301
    */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9302
   public void setDate(String parameterName, java.sql.Date x, Calendar cal)
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9303
       throws SQLException{
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9304
        throw new SQLFeatureNotSupportedException(resBundle.handleGetObject("cachedrowsetimpl.featnotsupp").toString());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9305
   }
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
    * Sets the designated parameter to the given <code>java.sql.Time</code> value.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9310
    * The driver converts this
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9311
    * to an SQL <code>TIME</code> value when it sends it to the database.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9312
    *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9313
    * @param parameterName the name of the parameter
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9314
    * @param x the parameter value
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9315
    * @exception SQLException if a database access error occurs or
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9316
    * this method is called on a closed <code>CallableStatement</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9317
    * @exception SQLFeatureNotSupportedException if the JDBC driver does not support
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9318
    * this method
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9319
    * @see #getTime
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9320
    * @since 1.4
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9321
    */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9322
   public void setTime(String parameterName, java.sql.Time x)
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9323
       throws SQLException{
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9324
        throw new SQLFeatureNotSupportedException(resBundle.handleGetObject("cachedrowsetimpl.featnotsupp").toString());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9325
   }
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
    * Sets the designated parameter to the given <code>java.sql.Time</code> value,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9330
    * using the given <code>Calendar</code> object.  The driver uses
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9331
    * the <code>Calendar</code> object to construct an SQL <code>TIME</code> value,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9332
    * which the driver then sends to the database.  With a
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9333
    * a <code>Calendar</code> object, the driver can calculate the time
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9334
    * taking into account a custom timezone.  If no
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9335
    * <code>Calendar</code> object is specified, the driver uses the default
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9336
    * timezone, which is that of the virtual machine running the application.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9337
    *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9338
    * @param parameterName the name of the parameter
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9339
    * @param x the parameter value
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9340
    * @param cal the <code>Calendar</code> object the driver will use
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9341
    *            to construct the time
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9342
    * @exception SQLException if a database access error occurs or
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9343
    * this method is called on a closed <code>CallableStatement</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9344
    * @exception SQLFeatureNotSupportedException if the JDBC driver does not support
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9345
    * this method
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9346
    * @see #getTime
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9347
    * @since 1.4
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9348
    */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9349
   public void setTime(String parameterName, java.sql.Time x, Calendar cal)
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9350
       throws SQLException{
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9351
        throw new SQLFeatureNotSupportedException(resBundle.handleGetObject("cachedrowsetimpl.featnotsupp").toString());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9352
   }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9353
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9354
   /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9355
   * Sets the designated parameter to a <code>Reader</code> object.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9356
   * This method differs from the <code>setCharacterStream (int, Reader)</code> method
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9357
   * because it informs the driver that the parameter value should be sent to
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9358
   * the server as a <code>CLOB</code>.  When the <code>setCharacterStream</code> method is used, the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9359
   * driver may have to do extra work to determine whether the parameter
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9360
   * data should be sent to the server as a <code>LONGVARCHAR</code> or a <code>CLOB</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9361
   *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9362
   * <P><B>Note:</B> Consult your JDBC driver documentation to determine if
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9363
   * it might be more efficient to use a version of
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9364
   * <code>setClob</code> which takes a length parameter.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9365
   *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9366
   * @param parameterIndex index of the first parameter is 1, the second is 2, ...
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9367
   * @param reader An object that contains the data to set the parameter value to.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9368
   * @throws SQLException if a database access error occurs, this method is called on
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9369
   * a closed <code>PreparedStatement</code>or if parameterIndex does not correspond to a parameter
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9370
   * marker in the SQL statement
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9371
   *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9372
   * @throws SQLFeatureNotSupportedException  if the JDBC driver does not support this method
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9373
   * @since 1.6
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9374
   */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9375
   public void setClob(int parameterIndex, Reader reader)
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9376
     throws SQLException{
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9377
        throw new SQLFeatureNotSupportedException(resBundle.handleGetObject("cachedrowsetimpl.featnotsupp").toString());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9378
   }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9379
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9380
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9381
   * Sets the designated parameter to a <code>Reader</code> object.  The reader must contain  the number
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9382
   * of characters specified by length otherwise a <code>SQLException</code> will be
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9383
   * generated when the <code>PreparedStatement</code> is executed.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9384
   *This method differs from the <code>setCharacterStream (int, Reader, int)</code> method
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9385
   * because it informs the driver that the parameter value should be sent to
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9386
   * the server as a <code>CLOB</code>.  When the <code>setCharacterStream</code> method is used, the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9387
   * driver may have to do extra work to determine whether the parameter
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9388
   * data should be sent to the server as a <code>LONGVARCHAR</code> or a <code>CLOB</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9389
   * @param parameterIndex index of the first parameter is 1, the second is 2, ...
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9390
   * @param reader An object that contains the data to set the parameter value to.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9391
   * @param length the number of characters in the parameter data.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9392
   * @throws SQLException if a database access error occurs, this method is called on
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9393
   * a closed <code>PreparedStatement</code>, if parameterIndex does not correspond to a parameter
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9394
   * marker in the SQL statement, or if the length specified is less than zero.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9395
   *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9396
   * @throws SQLFeatureNotSupportedException  if the JDBC driver does not support this method
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9397
   * @since 1.6
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9398
   */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9399
   public void setClob(int parameterIndex, Reader reader, long length)
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9400
     throws SQLException{
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9401
        throw new SQLFeatureNotSupportedException(resBundle.handleGetObject("cachedrowsetimpl.featnotsupp").toString());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9402
   }
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
    * Sets the designated parameter to a <code>InputStream</code> object.  The inputstream must contain  the number
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9407
    * of characters specified by length otherwise a <code>SQLException</code> will be
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9408
    * generated when the <code>PreparedStatement</code> is executed.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9409
    * This method differs from the <code>setBinaryStream (int, InputStream, int)</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9410
    * method because it informs the driver that the parameter value should be
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9411
    * sent to the server as a <code>BLOB</code>.  When the <code>setBinaryStream</code> method is used,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9412
    * the driver may have to do extra work to determine whether the parameter
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9413
    * data should be sent to the server as a <code>LONGVARBINARY</code> or a <code>BLOB</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9414
    * @param parameterIndex index of the first parameter is 1,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9415
    * the second is 2, ...
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9416
    * @param inputStream An object that contains the data to set the parameter
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9417
    * value to.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9418
    * @param length the number of bytes in the parameter data.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9419
    * @throws SQLException if a database access error occurs,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9420
    * this method is called on a closed <code>PreparedStatement</code>,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9421
    * if parameterIndex does not correspond
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9422
    * to a parameter marker in the SQL statement,  if the length specified
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9423
    * is less than zero or if the number of bytes in the inputstream does not match
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9424
    * the specfied length.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9425
    * @throws SQLFeatureNotSupportedException  if the JDBC driver does not support this method
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9426
    *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9427
    * @since 1.6
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9428
    */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9429
    public void setBlob(int parameterIndex, InputStream inputStream, long length)
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9430
       throws SQLException{
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9431
        throw new SQLFeatureNotSupportedException(resBundle.handleGetObject("cachedrowsetimpl.featnotsupp").toString());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9432
   }
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
    * Sets the designated parameter to a <code>InputStream</code> object.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9437
    * This method differs from the <code>setBinaryStream (int, InputStream)</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9438
    * method because it informs the driver that the parameter value should be
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9439
    * sent to the server as a <code>BLOB</code>.  When the <code>setBinaryStream</code> method is used,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9440
    * the driver may have to do extra work to determine whether the parameter
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9441
    * data should be sent to the server as a <code>LONGVARBINARY</code> or a <code>BLOB</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9442
    *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9443
    * <P><B>Note:</B> Consult your JDBC driver documentation to determine if
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9444
    * it might be more efficient to use a version of
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9445
    * <code>setBlob</code> which takes a length parameter.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9446
    *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9447
    * @param parameterIndex index of the first parameter is 1,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9448
    * the second is 2, ...
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9449
    * @param inputStream An object that contains the data to set the parameter
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9450
    * value to.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9451
    * @throws SQLException if a database access error occurs,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9452
    * this method is called on a closed <code>PreparedStatement</code> or
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9453
    * if parameterIndex does not correspond
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9454
    * to a parameter marker in the SQL statement,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9455
    * @throws SQLFeatureNotSupportedException  if the JDBC driver does not support this method
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9456
    *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9457
    * @since 1.6
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9458
    */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9459
    public void setBlob(int parameterIndex, InputStream inputStream)
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9460
       throws SQLException{
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9461
        throw new SQLFeatureNotSupportedException(resBundle.handleGetObject("cachedrowsetimpl.featnotsupp").toString());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9462
   }
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
    * 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
  9467
     * of characters specified by length, otherwise a <code>SQLException</code> will be
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9468
     * generated when the <code>CallableStatement</code> is executed.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9469
     * This method differs from the <code>setBinaryStream (int, InputStream, int)</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9470
     * method because it informs the driver that the parameter value should be
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9471
     * sent to the server as a <code>BLOB</code>.  When the <code>setBinaryStream</code> method is used,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9472
     * the driver may have to do extra work to determine whether the parameter
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9473
     * data should be sent to the server as a <code>LONGVARBINARY</code> or a <code>BLOB</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9474
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9475
     * @param parameterName the name of the parameter to be set
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9476
     * the second is 2, ...
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9477
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9478
     * @param inputStream An object that contains the data to set the parameter
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9479
     * value to.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9480
     * @param length the number of bytes in the parameter data.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9481
     * @throws SQLException  if parameterIndex does not correspond
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9482
     * to a parameter marker in the SQL statement,  or if the length specified
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9483
     * is less than zero; if the number of bytes in the inputstream does not match
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9484
     * the specfied length; if a database access error occurs or
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9485
     * this method is called on a closed <code>CallableStatement</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9486
     * @exception SQLFeatureNotSupportedException if the JDBC driver does not support
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9487
     * this method
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9488
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9489
     * @since 1.6
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9490
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9491
     public void setBlob(String parameterName, InputStream inputStream, long length)
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9492
        throws SQLException{
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9493
        throw new SQLFeatureNotSupportedException(resBundle.handleGetObject("cachedrowsetimpl.featnotsupp").toString());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9494
   }
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
    * Sets the designated parameter to the given <code>java.sql.Blob</code> object.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9499
    * The driver converts this to an SQL <code>BLOB</code> value when it
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9500
    * sends it to the database.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9501
    *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9502
    * @param parameterName the name of the parameter
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9503
    * @param x a <code>Blob</code> object that maps an SQL <code>BLOB</code> value
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9504
    * @exception SQLException if a database access error occurs or
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9505
    * this method is called on a closed <code>CallableStatement</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9506
    * @exception SQLFeatureNotSupportedException if the JDBC driver does not support
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9507
    * this method
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9508
    * @since 1.6
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9509
    */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9510
   public void setBlob (String parameterName, Blob x) throws SQLException{
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9511
        throw new SQLFeatureNotSupportedException(resBundle.handleGetObject("cachedrowsetimpl.featnotsupp").toString());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9512
   }
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
    * Sets the designated parameter to a <code>InputStream</code> object.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9517
    * This method differs from the <code>setBinaryStream (int, InputStream)</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9518
    * method because it informs the driver that the parameter value should be
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9519
    * sent to the server as a <code>BLOB</code>.  When the <code>setBinaryStream</code> method is used,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9520
    * the driver may have to do extra work to determine whether the parameter
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9521
    * data should be send to the server as a <code>LONGVARBINARY</code> or a <code>BLOB</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9522
    *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9523
    * <P><B>Note:</B> Consult your JDBC driver documentation to determine if
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9524
    * it might be more efficient to use a version of
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9525
    * <code>setBlob</code> which takes a length parameter.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9526
    *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9527
    * @param parameterName the name of the parameter
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9528
    * @param inputStream An object that contains the data to set the parameter
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9529
    * value to.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9530
    * @throws SQLException if a database access error occurs or
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9531
    * this method is called on a closed <code>CallableStatement</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9532
    * @throws SQLFeatureNotSupportedException  if the JDBC driver does not support this method
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9533
    *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9534
    * @since 1.6
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9535
    */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9536
    public void setBlob(String parameterName, InputStream inputStream)
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9537
       throws SQLException{
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9538
        throw new SQLFeatureNotSupportedException(resBundle.handleGetObject("cachedrowsetimpl.featnotsupp").toString());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9539
   }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9540
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9541
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9542
    * Sets the value of the designated parameter with the given object. The second
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9543
    * argument must be an object type; for integral values, the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9544
    * <code>java.lang</code> equivalent objects should be used.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9545
    *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9546
    * <p>The given Java object will be converted to the given targetSqlType
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9547
    * before being sent to the database.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9548
    *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9549
    * If the object has a custom mapping (is of a class implementing the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9550
    * interface <code>SQLData</code>),
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9551
    * the JDBC driver should call the method <code>SQLData.writeSQL</code> to write it
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9552
    * to the SQL data stream.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9553
    * If, on the other hand, the object is of a class implementing
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9554
    * <code>Ref</code>, <code>Blob</code>, <code>Clob</code>,  <code>NClob</code>,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9555
    *  <code>Struct</code>, <code>java.net.URL</code>,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9556
    * or <code>Array</code>, the driver should pass it to the database as a
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9557
    * value of the corresponding SQL type.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9558
    * <P>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9559
    * Note that this method may be used to pass datatabase-
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9560
    * specific abstract data types.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9561
    *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9562
    * @param parameterName the name of the parameter
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9563
    * @param x the object containing the input parameter value
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9564
    * @param targetSqlType the SQL type (as defined in java.sql.Types) to be
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9565
    * sent to the database. The scale argument may further qualify this type.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9566
    * @param scale for java.sql.Types.DECIMAL or java.sql.Types.NUMERIC types,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9567
    *          this is the number of digits after the decimal point.  For all other
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9568
    *          types, this value will be ignored.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9569
    * @exception SQLException if a database access error occurs or
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9570
    * this method is called on a closed <code>CallableStatement</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9571
    * @exception SQLFeatureNotSupportedException if <code>targetSqlType</code> is
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9572
    * a <code>ARRAY</code>, <code>BLOB</code>, <code>CLOB</code>,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9573
    * <code>DATALINK</code>, <code>JAVA_OBJECT</code>, <code>NCHAR</code>,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9574
    * <code>NCLOB</code>, <code>NVARCHAR</code>, <code>LONGNVARCHAR</code>,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9575
    *  <code>REF</code>, <code>ROWID</code>, <code>SQLXML</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9576
    * or  <code>STRUCT</code> data type and the JDBC driver does not support
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9577
    * this data type
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9578
    * @see Types
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9579
    * @see #getObject
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9580
    * @since 1.4
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9581
    */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9582
    public void setObject(String parameterName, Object x, int targetSqlType, int scale)
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9583
       throws SQLException{
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9584
        throw new SQLFeatureNotSupportedException(resBundle.handleGetObject("cachedrowsetimpl.featnotsupp").toString());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9585
   }
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
    * Sets the value of the designated parameter with the given object.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9591
    * This method is like the method <code>setObject</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9592
    * above, except that it assumes a scale of zero.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9593
    *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9594
    * @param parameterName the name of the parameter
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9595
    * @param x the object containing the input parameter value
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9596
    * @param targetSqlType the SQL type (as defined in java.sql.Types) to be
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9597
    *                      sent to the database
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9598
    * @exception SQLException if a database access error occurs or
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9599
    * this method is called on a closed <code>CallableStatement</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9600
    * @exception SQLFeatureNotSupportedException if <code>targetSqlType</code> is
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9601
    * a <code>ARRAY</code>, <code>BLOB</code>, <code>CLOB</code>,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9602
    * <code>DATALINK</code>, <code>JAVA_OBJECT</code>, <code>NCHAR</code>,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9603
    * <code>NCLOB</code>, <code>NVARCHAR</code>, <code>LONGNVARCHAR</code>,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9604
    *  <code>REF</code>, <code>ROWID</code>, <code>SQLXML</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9605
    * or  <code>STRUCT</code> data type and the JDBC driver does not support
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9606
    * this data type
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9607
    * @see #getObject
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9608
    * @since 1.4
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9609
    */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9610
    public void setObject(String parameterName, Object x, int targetSqlType)
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9611
       throws SQLException{
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9612
        throw new SQLFeatureNotSupportedException(resBundle.handleGetObject("cachedrowsetimpl.featnotsupp").toString());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9613
   }
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
   * Sets the value of the designated parameter with the given object.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9618
   * The second parameter must be of type <code>Object</code>; therefore, the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9619
   * <code>java.lang</code> equivalent objects should be used for built-in types.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9620
   *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9621
   * <p>The JDBC specification specifies a standard mapping from
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9622
   * Java <code>Object</code> types to SQL types.  The given argument
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9623
   * will be converted to the corresponding SQL type before being
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9624
   * sent to the database.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9625
   *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9626
   * <p>Note that this method may be used to pass datatabase-
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9627
   * specific abstract data types, by using a driver-specific Java
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9628
   * type.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9629
   *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9630
   * If the object is of a class implementing the interface <code>SQLData</code>,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9631
   * the JDBC driver should call the method <code>SQLData.writeSQL</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9632
   * to write it to the SQL data stream.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9633
   * If, on the other hand, the object is of a class implementing
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9634
   * <code>Ref</code>, <code>Blob</code>, <code>Clob</code>,  <code>NClob</code>,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9635
   *  <code>Struct</code>, <code>java.net.URL</code>,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9636
   * or <code>Array</code>, the driver should pass it to the database as a
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9637
   * value of the corresponding SQL type.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9638
   * <P>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9639
   * This method throws an exception if there is an ambiguity, for example, if the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9640
   * object is of a class implementing more than one of the interfaces named above.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9641
   *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9642
   * @param parameterName the name of the parameter
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9643
   * @param x the object containing the input parameter value
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9644
   * @exception SQLException if a database access error occurs,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9645
   * this method is called on a closed <code>CallableStatement</code> or if the given
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9646
   *            <code>Object</code> parameter is ambiguous
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9647
   * @exception SQLFeatureNotSupportedException if the JDBC driver does not support
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9648
   * this method
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9649
   * @see #getObject
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9650
   * @since 1.4
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9651
   */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9652
   public void setObject(String parameterName, Object x) throws SQLException{
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9653
        throw new SQLFeatureNotSupportedException(resBundle.handleGetObject("cachedrowsetimpl.featnotsupp").toString());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9654
   }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9655
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9656
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9657
    * Sets the designated parameter to the given input stream, which will have
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9658
    * the specified number of bytes.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9659
    * When a very large ASCII value is input to a <code>LONGVARCHAR</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9660
    * parameter, it may be more practical to send it via a
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9661
    * <code>java.io.InputStream</code>. Data will be read from the stream
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9662
    * as needed until end-of-file is reached.  The JDBC driver will
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9663
    * do any necessary conversion from ASCII to the database char format.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9664
    *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9665
    * <P><B>Note:</B> This stream object can either be a standard
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9666
    * Java stream object or your own subclass that implements the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9667
    * standard interface.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9668
    *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9669
    * @param parameterName the name of the parameter
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9670
    * @param x the Java input stream that contains the ASCII parameter value
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9671
    * @param length the number of bytes in the stream
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9672
    * @exception SQLException if a database access error occurs or
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9673
    * this method is called on a closed <code>CallableStatement</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9674
    * @exception SQLFeatureNotSupportedException if the JDBC driver does not support
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9675
    * this method
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9676
    * @since 1.4
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9677
    */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9678
   public void setAsciiStream(String parameterName, java.io.InputStream x, int length)
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9679
       throws SQLException{
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9680
        throw new SQLFeatureNotSupportedException(resBundle.handleGetObject("cachedrowsetimpl.featnotsupp").toString());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9681
   }
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
    * Sets the designated parameter to the given input stream, which will have
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9686
    * the specified number of bytes.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9687
    * When a very large binary value is input to a <code>LONGVARBINARY</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9688
    * parameter, it may be more practical to send it via a
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9689
    * <code>java.io.InputStream</code> object. The data will be read from the stream
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9690
    * as needed until end-of-file is reached.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9691
    *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9692
    * <P><B>Note:</B> This stream object can either be a standard
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9693
    * Java stream object or your own subclass that implements the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9694
    * standard interface.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9695
    *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9696
    * @param parameterName the name of the parameter
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9697
    * @param x the java input stream which contains the binary parameter value
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9698
    * @param length the number of bytes in the stream
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9699
    * @exception SQLException if a database access error occurs or
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9700
    * this method is called on a closed <code>CallableStatement</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9701
    * @exception SQLFeatureNotSupportedException if the JDBC driver does not support
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9702
    * this method
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9703
    * @since 1.4
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9704
    */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9705
   public void setBinaryStream(String parameterName, java.io.InputStream x,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9706
                        int length) throws SQLException{
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9707
        throw new SQLFeatureNotSupportedException(resBundle.handleGetObject("cachedrowsetimpl.featnotsupp").toString());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9708
   }
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
    * Sets the designated parameter to the given <code>Reader</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9713
    * object, which is the given number of characters long.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9714
    * When a very large UNICODE value is input to a <code>LONGVARCHAR</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9715
    * parameter, it may be more practical to send it via a
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9716
    * <code>java.io.Reader</code> object. The data will be read from the stream
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9717
    * as needed until end-of-file is reached.  The JDBC driver will
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9718
    * do any necessary conversion from UNICODE to the database char format.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9719
    *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9720
    * <P><B>Note:</B> This stream object can either be a standard
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9721
    * Java stream object or your own subclass that implements the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9722
    * standard interface.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9723
    *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9724
    * @param parameterName the name of the parameter
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9725
    * @param reader the <code>java.io.Reader</code> object that
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9726
    *        contains the UNICODE data used as the designated parameter
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9727
    * @param length the number of characters in the stream
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9728
    * @exception SQLException if a database access error occurs or
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9729
    * this method is called on a closed <code>CallableStatement</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9730
    * @exception SQLFeatureNotSupportedException if the JDBC driver does not support
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9731
    * this method
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9732
    * @since 1.4
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9733
    */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9734
   public void setCharacterStream(String parameterName,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9735
                           java.io.Reader reader,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9736
                           int length) throws SQLException{
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9737
        throw new SQLFeatureNotSupportedException(resBundle.handleGetObject("cachedrowsetimpl.featnotsupp").toString());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9738
   }
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
   * Sets the designated parameter to the given input stream.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9743
   * When a very large ASCII value is input to a <code>LONGVARCHAR</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9744
   * parameter, it may be more practical to send it via a
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9745
   * <code>java.io.InputStream</code>. Data will be read from the stream
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9746
   * as needed until end-of-file is reached.  The JDBC driver will
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9747
   * do any necessary conversion from ASCII to the database char format.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9748
   *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9749
   * <P><B>Note:</B> This stream object can either be a standard
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9750
   * Java stream object or your own subclass that implements the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9751
   * standard interface.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9752
   * <P><B>Note:</B> Consult your JDBC driver documentation to determine if
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9753
   * it might be more efficient to use a version of
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9754
   * <code>setAsciiStream</code> which takes a length parameter.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9755
   *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9756
   * @param parameterName the name of the parameter
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9757
   * @param x the Java input stream that contains the ASCII parameter value
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9758
   * @exception SQLException if a database access error occurs or
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9759
   * this method is called on a closed <code>CallableStatement</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9760
   * @throws SQLFeatureNotSupportedException  if the JDBC driver does not support this method
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9761
     * @since 1.6
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9762
  */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9763
  public void setAsciiStream(String parameterName, java.io.InputStream x)
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9764
          throws SQLException{
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9765
        throw new SQLFeatureNotSupportedException(resBundle.handleGetObject("cachedrowsetimpl.featnotsupp").toString());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9766
   }
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
    * Sets the designated parameter to the given input stream.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9771
    * When a very large binary value is input to a <code>LONGVARBINARY</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9772
    * parameter, it may be more practical to send it via a
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9773
    * <code>java.io.InputStream</code> object. The data will be read from the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9774
    * stream as needed until end-of-file is reached.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9775
    *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9776
    * <P><B>Note:</B> This stream object can either be a standard
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9777
    * Java stream object or your own subclass that implements the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9778
    * standard interface.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9779
    * <P><B>Note:</B> Consult your JDBC driver documentation to determine if
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9780
    * it might be more efficient to use a version of
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9781
    * <code>setBinaryStream</code> which takes a length parameter.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9782
    *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9783
    * @param parameterName the name of the parameter
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9784
    * @param x the java input stream which contains the binary parameter value
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9785
    * @exception SQLException if a database access error occurs or
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9786
    * this method is called on a closed <code>CallableStatement</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9787
    * @throws SQLFeatureNotSupportedException  if the JDBC driver does not support this method
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9788
    * @since 1.6
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9789
    */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9790
   public void setBinaryStream(String parameterName, java.io.InputStream x)
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9791
   throws SQLException{
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9792
        throw new SQLFeatureNotSupportedException(resBundle.handleGetObject("cachedrowsetimpl.featnotsupp").toString());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9793
   }
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
    * Sets the designated parameter to the given <code>Reader</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9799
    * object.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9800
    * When a very large UNICODE value is input to a <code>LONGVARCHAR</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9801
    * parameter, it may be more practical to send it via a
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9802
    * <code>java.io.Reader</code> object. The data will be read from the stream
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9803
    * as needed until end-of-file is reached.  The JDBC driver will
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9804
    * do any necessary conversion from UNICODE to the database char format.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9805
    *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9806
    * <P><B>Note:</B> This stream object can either be a standard
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9807
    * Java stream object or your own subclass that implements the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9808
    * standard interface.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9809
    * <P><B>Note:</B> Consult your JDBC driver documentation to determine if
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9810
    * it might be more efficient to use a version of
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9811
    * <code>setCharacterStream</code> which takes a length parameter.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9812
    *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9813
    * @param parameterName the name of the parameter
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9814
    * @param reader the <code>java.io.Reader</code> object that contains the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9815
    *        Unicode data
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9816
    * @exception SQLException if a database access error occurs or
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9817
    * this method is called on a closed <code>CallableStatement</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9818
    * @throws SQLFeatureNotSupportedException  if the JDBC driver does not support this method
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9819
    * @since 1.6
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9820
    */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9821
   public void setCharacterStream(String parameterName,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9822
                         java.io.Reader reader) throws SQLException{
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9823
        throw new SQLFeatureNotSupportedException(resBundle.handleGetObject("cachedrowsetimpl.featnotsupp").toString());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9824
   }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9825
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9826
   /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9827
    * Sets the designated parameter to the given
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9828
    * <code>java.math.BigDecimal</code> value.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9829
    * The driver converts this to an SQL <code>NUMERIC</code> value when
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9830
    * it sends it to the database.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9831
    *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9832
    * @param parameterName the name of the parameter
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9833
    * @param x the parameter value
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9834
    * @exception SQLException if a database access error occurs or
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9835
    * this method is called on a closed <code>CallableStatement</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9836
    * @exception SQLFeatureNotSupportedException if the JDBC driver does not support
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9837
    * this method
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9838
    * @see #getBigDecimal
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9839
    * @since 1.4
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9840
    */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9841
   public void setBigDecimal(String parameterName, BigDecimal x) throws SQLException{
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9842
        throw new SQLFeatureNotSupportedException(resBundle.handleGetObject("cachedrowsetimpl.featnotsupp").toString());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9843
   }
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
    * Sets the designated parameter to the given Java <code>String</code> value.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9849
    * The driver converts this
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9850
    * to an SQL <code>VARCHAR</code> or <code>LONGVARCHAR</code> value
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9851
    * (depending on the argument's
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9852
    * size relative to the driver's limits on <code>VARCHAR</code> values)
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9853
    * when it sends it to the database.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9854
    *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9855
    * @param parameterName the name of the parameter
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9856
    * @param x the parameter value
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9857
    * @exception SQLException if a database access error occurs or
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9858
    * this method is called on a closed <code>CallableStatement</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9859
    * @exception SQLFeatureNotSupportedException if the JDBC driver does not support
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9860
    * this method
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9861
    * @see #getString
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9862
    * @since 1.4
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9863
    */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9864
   public void setString(String parameterName, String x) throws SQLException{
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9865
        throw new SQLFeatureNotSupportedException(resBundle.handleGetObject("cachedrowsetimpl.featnotsupp").toString());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9866
   }
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
    * Sets the designated parameter to the given Java array of bytes.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9872
    * The driver converts this to an SQL <code>VARBINARY</code> or
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9873
    * <code>LONGVARBINARY</code> (depending on the argument's size relative
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9874
    * to the driver's limits on <code>VARBINARY</code> values) when it sends
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9875
    * it to the database.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9876
    *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9877
    * @param parameterName the name of the parameter
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9878
    * @param x the parameter value
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9879
    * @exception SQLException if a database access error occurs or
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9880
    * this method is called on a closed <code>CallableStatement</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9881
    * @exception SQLFeatureNotSupportedException if the JDBC driver does not support
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9882
    * this method
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9883
    * @see #getBytes
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9884
    * @since 1.4
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9885
    */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9886
   public void setBytes(String parameterName, byte x[]) throws SQLException{
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9887
        throw new SQLFeatureNotSupportedException(resBundle.handleGetObject("cachedrowsetimpl.featnotsupp").toString());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9888
   }
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
    * Sets the designated parameter to the given <code>java.sql.Timestamp</code> value.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9894
    * The driver
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9895
    * converts this to an SQL <code>TIMESTAMP</code> value when it sends it to the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9896
    * database.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9897
    *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9898
    * @param parameterName the name of the parameter
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9899
    * @param x the parameter value
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9900
    * @exception SQLException if a database access error occurs or
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9901
    * this method is called on a closed <code>CallableStatement</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9902
    * @exception SQLFeatureNotSupportedException if the JDBC driver does not support
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9903
    * this method
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9904
    * @see #getTimestamp
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9905
    * @since 1.4
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9906
    */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9907
   public void setTimestamp(String parameterName, java.sql.Timestamp x)
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9908
       throws SQLException{
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9909
        throw new SQLFeatureNotSupportedException(resBundle.handleGetObject("cachedrowsetimpl.featnotsupp").toString());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9910
   }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9911
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9912
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9913
    * Sets the designated parameter to SQL <code>NULL</code>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9914
    *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9915
    * <P><B>Note:</B> You must specify the parameter's SQL type.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9916
    *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9917
    * @param parameterName the name of the parameter
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9918
    * @param sqlType the SQL type code defined in <code>java.sql.Types</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9919
    * @exception SQLException if a database access error occurs or
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9920
    * this method is called on a closed <code>CallableStatement</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9921
    * @exception SQLFeatureNotSupportedException if the JDBC driver does not support
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9922
    * this method
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9923
    * @since 1.4
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9924
    */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9925
   public void setNull(String parameterName, int sqlType) throws SQLException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9926
        throw new SQLFeatureNotSupportedException(resBundle.handleGetObject("cachedrowsetimpl.featnotsupp").toString());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9927
   }
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
    * Sets the designated parameter to SQL <code>NULL</code>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9932
    * This version of the method <code>setNull</code> should
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9933
    * be used for user-defined types and REF type parameters.  Examples
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9934
    * of user-defined types include: STRUCT, DISTINCT, JAVA_OBJECT, and
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9935
    * named array types.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9936
    *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9937
    * <P><B>Note:</B> To be portable, applications must give the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9938
    * SQL type code and the fully-qualified SQL type name when specifying
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9939
    * a NULL user-defined or REF parameter.  In the case of a user-defined type
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9940
    * the name is the type name of the parameter itself.  For a REF
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9941
    * parameter, the name is the type name of the referenced type.  If
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9942
    * a JDBC driver does not need the type code or type name information,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9943
    * it may ignore it.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9944
    *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9945
    * Although it is intended for user-defined and Ref parameters,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9946
    * this method may be used to set a null parameter of any JDBC type.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9947
    * If the parameter does not have a user-defined or REF type, the given
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9948
    * typeName is ignored.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9949
    *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9950
    *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9951
    * @param parameterName the name of the parameter
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9952
    * @param sqlType a value from <code>java.sql.Types</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9953
    * @param typeName the fully-qualified name of an SQL user-defined type;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9954
    *        ignored if the parameter is not a user-defined type or
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9955
    *        SQL <code>REF</code> value
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9956
    * @exception SQLException if a database access error occurs or
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9957
    * this method is called on a closed <code>CallableStatement</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9958
    * @exception SQLFeatureNotSupportedException if the JDBC driver does not support
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9959
    * this method
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9960
    * @since 1.4
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9961
    */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9962
   public void setNull (String parameterName, int sqlType, String typeName)
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9963
       throws SQLException{
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9964
        throw new SQLFeatureNotSupportedException(resBundle.handleGetObject("cachedrowsetimpl.featnotsupp").toString());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9965
   }
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
    * Sets the designated parameter to the given Java <code>boolean</code> value.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9971
    * The driver converts this
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9972
    * 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
  9973
    *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9974
    * @param parameterName the name of the parameter
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9975
    * @param x the parameter value
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9976
    * @exception SQLException if a database access error occurs or
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9977
    * this method is called on a closed <code>CallableStatement</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9978
    * @see #getBoolean
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9979
    * @exception SQLFeatureNotSupportedException if the JDBC driver does not support
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9980
    * this method
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9981
    * @since 1.4
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9982
    */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9983
   public void setBoolean(String parameterName, boolean x) throws SQLException{
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9984
        throw new SQLFeatureNotSupportedException(resBundle.handleGetObject("cachedrowsetimpl.featnotsupp").toString());
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9985
   }
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
    * Sets the designated parameter to the given Java <code>byte</code> value.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9991
    * The driver converts this
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9992
    * to an SQL <code>TINYINT</code> value when it sends it to the database.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9993
    *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9994
    * @param parameterName the name of the parameter
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9995
    * @param x the parameter value
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9996
    * @exception SQLException if a database access error occurs or
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9997
    * this method is called on a closed <code>CallableStatement</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9998
    * @exception SQLFeatureNotSupportedException if the JDBC driver does not support
90ce3da70b43 Initial load
duke
parents:
diff changeset
  9999
    * this method
90ce3da70b43 Initial load
duke
parents:
diff changeset
 10000
    * @see #getByte
90ce3da70b43 Initial load
duke
parents:
diff changeset
 10001
    * @since 1.4
90ce3da70b43 Initial load
duke
parents:
diff changeset
 10002
    */
90ce3da70b43 Initial load
duke
parents:
diff changeset
 10003
   public void setByte(String parameterName, byte x) throws SQLException{
90ce3da70b43 Initial load
duke
parents:
diff changeset
 10004
        throw new SQLFeatureNotSupportedException(resBundle.handleGetObject("cachedrowsetimpl.featnotsupp").toString());
90ce3da70b43 Initial load
duke
parents:
diff changeset
 10005
   }
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
    * Sets the designated parameter to the given Java <code>short</code> value.
90ce3da70b43 Initial load
duke
parents:
diff changeset
 10011
    * The driver converts this
90ce3da70b43 Initial load
duke
parents:
diff changeset
 10012
    * to an SQL <code>SMALLINT</code> value when it sends it to the database.
90ce3da70b43 Initial load
duke
parents:
diff changeset
 10013
    *
90ce3da70b43 Initial load
duke
parents:
diff changeset
 10014
    * @param parameterName the name of the parameter
90ce3da70b43 Initial load
duke
parents:
diff changeset
 10015
    * @param x the parameter value
90ce3da70b43 Initial load
duke
parents:
diff changeset
 10016
    * @exception SQLException if a database access error occurs or
90ce3da70b43 Initial load
duke
parents:
diff changeset
 10017
    * this method is called on a closed <code>CallableStatement</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
 10018
    * @exception SQLFeatureNotSupportedException if the JDBC driver does not support
90ce3da70b43 Initial load
duke
parents:
diff changeset
 10019
    * this method
90ce3da70b43 Initial load
duke
parents:
diff changeset
 10020
    * @see #getShort
90ce3da70b43 Initial load
duke
parents:
diff changeset
 10021
    * @since 1.4
90ce3da70b43 Initial load
duke
parents:
diff changeset
 10022
    */
90ce3da70b43 Initial load
duke
parents:
diff changeset
 10023
   public void setShort(String parameterName, short x) throws SQLException{
90ce3da70b43 Initial load
duke
parents:
diff changeset
 10024
        throw new SQLFeatureNotSupportedException(resBundle.handleGetObject("cachedrowsetimpl.featnotsupp").toString());
90ce3da70b43 Initial load
duke
parents:
diff changeset
 10025
   }
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
    * Sets the designated parameter to the given Java <code>int</code> value.
90ce3da70b43 Initial load
duke
parents:
diff changeset
 10030
    * The driver converts this
90ce3da70b43 Initial load
duke
parents:
diff changeset
 10031
    * to an SQL <code>INTEGER</code> value when it sends it to the database.
90ce3da70b43 Initial load
duke
parents:
diff changeset
 10032
    *
90ce3da70b43 Initial load
duke
parents:
diff changeset
 10033
    * @param parameterName the name of the parameter
90ce3da70b43 Initial load
duke
parents:
diff changeset
 10034
    * @param x the parameter value
90ce3da70b43 Initial load
duke
parents:
diff changeset
 10035
    * @exception SQLException if a database access error occurs or
90ce3da70b43 Initial load
duke
parents:
diff changeset
 10036
    * this method is called on a closed <code>CallableStatement</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
 10037
    * @exception SQLFeatureNotSupportedException if the JDBC driver does not support
90ce3da70b43 Initial load
duke
parents:
diff changeset
 10038
    * this method
90ce3da70b43 Initial load
duke
parents:
diff changeset
 10039
    * @see #getInt
90ce3da70b43 Initial load
duke
parents:
diff changeset
 10040
    * @since 1.4
90ce3da70b43 Initial load
duke
parents:
diff changeset
 10041
    */
90ce3da70b43 Initial load
duke
parents:
diff changeset
 10042
   public void setInt(String parameterName, int x) throws SQLException{
90ce3da70b43 Initial load
duke
parents:
diff changeset
 10043
        throw new SQLFeatureNotSupportedException(resBundle.handleGetObject("cachedrowsetimpl.featnotsupp").toString());
90ce3da70b43 Initial load
duke
parents:
diff changeset
 10044
   }
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
    * Sets the designated parameter to the given Java <code>long</code> value.
90ce3da70b43 Initial load
duke
parents:
diff changeset
 10049
    * The driver converts this
90ce3da70b43 Initial load
duke
parents:
diff changeset
 10050
    * to an SQL <code>BIGINT</code> value when it sends it to the database.
90ce3da70b43 Initial load
duke
parents:
diff changeset
 10051
    *
90ce3da70b43 Initial load
duke
parents:
diff changeset
 10052
    * @param parameterName the name of the parameter
90ce3da70b43 Initial load
duke
parents:
diff changeset
 10053
    * @param x the parameter value
90ce3da70b43 Initial load
duke
parents:
diff changeset
 10054
    * @exception SQLException if a database access error occurs or
90ce3da70b43 Initial load
duke
parents:
diff changeset
 10055
    * this method is called on a closed <code>CallableStatement</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
 10056
    * @exception SQLFeatureNotSupportedException if the JDBC driver does not support
90ce3da70b43 Initial load
duke
parents:
diff changeset
 10057
    * this method
90ce3da70b43 Initial load
duke
parents:
diff changeset
 10058
    * @see #getLong
90ce3da70b43 Initial load
duke
parents:
diff changeset
 10059
    * @since 1.4
90ce3da70b43 Initial load
duke
parents:
diff changeset
 10060
    */
90ce3da70b43 Initial load
duke
parents:
diff changeset
 10061
   public void setLong(String parameterName, long x) throws SQLException{
90ce3da70b43 Initial load
duke
parents:
diff changeset
 10062
        throw new SQLFeatureNotSupportedException(resBundle.handleGetObject("cachedrowsetimpl.featnotsupp").toString());
90ce3da70b43 Initial load
duke
parents:
diff changeset
 10063
   }
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
    * Sets the designated parameter to the given Java <code>float</code> value.
90ce3da70b43 Initial load
duke
parents:
diff changeset
 10068
    * The driver converts this
90ce3da70b43 Initial load
duke
parents:
diff changeset
 10069
    * to an SQL <code>FLOAT</code> value when it sends it to the database.
90ce3da70b43 Initial load
duke
parents:
diff changeset
 10070
    *
90ce3da70b43 Initial load
duke
parents:
diff changeset
 10071
    * @param parameterName the name of the parameter
90ce3da70b43 Initial load
duke
parents:
diff changeset
 10072
    * @param x the parameter value
90ce3da70b43 Initial load
duke
parents:
diff changeset
 10073
    * @exception SQLException if a database access error occurs or
90ce3da70b43 Initial load
duke
parents:
diff changeset
 10074
    * this method is called on a closed <code>CallableStatement</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
 10075
    * @exception SQLFeatureNotSupportedException if the JDBC driver does not support
90ce3da70b43 Initial load
duke
parents:
diff changeset
 10076
    * this method
90ce3da70b43 Initial load
duke
parents:
diff changeset
 10077
    * @see #getFloat
90ce3da70b43 Initial load
duke
parents:
diff changeset
 10078
    * @since 1.4
90ce3da70b43 Initial load
duke
parents:
diff changeset
 10079
    */
90ce3da70b43 Initial load
duke
parents:
diff changeset
 10080
   public void setFloat(String parameterName, float x) throws SQLException{
90ce3da70b43 Initial load
duke
parents:
diff changeset
 10081
        throw new SQLFeatureNotSupportedException(resBundle.handleGetObject("cachedrowsetimpl.featnotsupp").toString());
90ce3da70b43 Initial load
duke
parents:
diff changeset
 10082
   }
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
    * Sets the designated parameter to the given Java <code>double</code> value.
90ce3da70b43 Initial load
duke
parents:
diff changeset
 10087
    * The driver converts this
90ce3da70b43 Initial load
duke
parents:
diff changeset
 10088
    * to an SQL <code>DOUBLE</code> value when it sends it to the database.
90ce3da70b43 Initial load
duke
parents:
diff changeset
 10089
    *
90ce3da70b43 Initial load
duke
parents:
diff changeset
 10090
    * @param parameterName the name of the parameter
90ce3da70b43 Initial load
duke
parents:
diff changeset
 10091
    * @param x the parameter value
90ce3da70b43 Initial load
duke
parents:
diff changeset
 10092
    * @exception SQLException if a database access error occurs or
90ce3da70b43 Initial load
duke
parents:
diff changeset
 10093
    * this method is called on a closed <code>CallableStatement</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
 10094
    * @exception SQLFeatureNotSupportedException if the JDBC driver does not support
90ce3da70b43 Initial load
duke
parents:
diff changeset
 10095
    * this method
90ce3da70b43 Initial load
duke
parents:
diff changeset
 10096
    * @see #getDouble
90ce3da70b43 Initial load
duke
parents:
diff changeset
 10097
    * @since 1.4
90ce3da70b43 Initial load
duke
parents:
diff changeset
 10098
    */
90ce3da70b43 Initial load
duke
parents:
diff changeset
 10099
   public void setDouble(String parameterName, double x) throws SQLException{
90ce3da70b43 Initial load
duke
parents:
diff changeset
 10100
        throw new SQLFeatureNotSupportedException(resBundle.handleGetObject("cachedrowsetimpl.featnotsupp").toString());
90ce3da70b43 Initial load
duke
parents:
diff changeset
 10101
   }
90ce3da70b43 Initial load
duke
parents:
diff changeset
 10102
90ce3da70b43 Initial load
duke
parents:
diff changeset
 10103
   /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
 10104
     * This method re populates the resBundle
90ce3da70b43 Initial load
duke
parents:
diff changeset
 10105
     * during the deserialization process
90ce3da70b43 Initial load
duke
parents:
diff changeset
 10106
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
 10107
     */
6530
bfb7b294dd14 6680198: UnmarshalException caused by incompatible serialVersionUID
lancea
parents: 5506
diff changeset
 10108
    private void readObject(ObjectInputStream ois) throws IOException, ClassNotFoundException {
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
 10109
        // Default state initialization happens here
90ce3da70b43 Initial load
duke
parents:
diff changeset
 10110
        ois.defaultReadObject();
90ce3da70b43 Initial load
duke
parents:
diff changeset
 10111
        // Initialization of transient Res Bundle happens here .
90ce3da70b43 Initial load
duke
parents:
diff changeset
 10112
        try {
90ce3da70b43 Initial load
duke
parents:
diff changeset
 10113
           resBundle = JdbcRowSetResourceBundle.getJdbcRowSetResourceBundle();
90ce3da70b43 Initial load
duke
parents:
diff changeset
 10114
        } catch(IOException ioe) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
 10115
            throw new RuntimeException(ioe);
90ce3da70b43 Initial load
duke
parents:
diff changeset
 10116
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
 10117
90ce3da70b43 Initial load
duke
parents:
diff changeset
 10118
    }
6530
bfb7b294dd14 6680198: UnmarshalException caused by incompatible serialVersionUID
lancea
parents: 5506
diff changeset
 10119
6540
a4ae668f6125 6589685: JDBC 4.1 updates
lancea
parents: 6530
diff changeset
 10120
    //------------------------- JDBC 4.1 -----------------------------------
a4ae668f6125 6589685: JDBC 4.1 updates
lancea
parents: 6530
diff changeset
 10121
    public <T> T getObject(int columnIndex, Class<T> type) throws SQLException {
a4ae668f6125 6589685: JDBC 4.1 updates
lancea
parents: 6530
diff changeset
 10122
        throw new SQLFeatureNotSupportedException("Not supported yet.");
a4ae668f6125 6589685: JDBC 4.1 updates
lancea
parents: 6530
diff changeset
 10123
    }
a4ae668f6125 6589685: JDBC 4.1 updates
lancea
parents: 6530
diff changeset
 10124
a4ae668f6125 6589685: JDBC 4.1 updates
lancea
parents: 6530
diff changeset
 10125
    public <T> T getObject(String columnLabel, Class<T> type) throws SQLException {
a4ae668f6125 6589685: JDBC 4.1 updates
lancea
parents: 6530
diff changeset
 10126
        throw new SQLFeatureNotSupportedException("Not supported yet.");
a4ae668f6125 6589685: JDBC 4.1 updates
lancea
parents: 6530
diff changeset
 10127
    }
a4ae668f6125 6589685: JDBC 4.1 updates
lancea
parents: 6530
diff changeset
 10128
6530
bfb7b294dd14 6680198: UnmarshalException caused by incompatible serialVersionUID
lancea
parents: 5506
diff changeset
 10129
    static final long serialVersionUID =1884577171200622428L;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
 10130
}