Showing the changes to java/pkg/com/sun/rowset/JdbcRowSetImpl.java (1 of 18352 files). Show all
Unified · Split
| @@ -0,0 +1,7047 @@ | ||
| 1 | +/* | |
| 2 | + * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved. | |
| 3 | + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. | |
| 4 | + * | |
| 5 | + * This code is free software; you can redistribute it and/or modify it | |
| 6 | + * under the terms of the GNU General Public License version 2 only, as | |
| 7 | + * published by the Free Software Foundation. Oracle designates this | |
| 8 | + * particular file as subject to the "Classpath" exception as provided | |
| 9 | + * by Oracle in the LICENSE file that accompanied this code. | |
| 10 | + * | |
| 11 | + * This code is distributed in the hope that it will be useful, but WITHOUT | |
| 12 | + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |
| 13 | + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |
| 14 | + * version 2 for more details (a copy is included in the LICENSE file that | |
| 15 | + * accompanied this code). | |
| 16 | + * | |
| 17 | + * You should have received a copy of the GNU General Public License version | |
| 18 | + * 2 along with this work; if not, write to the Free Software Foundation, | |
| 19 | + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. | |
| 20 | + * | |
| 21 | + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA | |
| 22 | + * or visit www.oracle.com if you need additional information or have any | |
| 23 | + * questions. | |
| 24 | + */ | |
| 25 | + | |
| 26 | +package com.sun.rowset; | |
| 27 | + | |
| 28 | +import java.sql.*; | |
| 29 | +import javax.sql.*; | |
| 30 | +import javax.naming.*; | |
| 31 | +import java.io.*; | |
| 32 | +import java.math.*; | |
| 33 | +import java.util.*; | |
| 34 | +import java.beans.*; | |
| 35 | + | |
| 36 | +import javax.sql.rowset.*; | |
| 37 | + | |
| 38 | +/** | |
| 39 | + * The standard implementation of the <code>JdbcRowSet</code> interface. See the interface | |
| 40 | + * defintion for full behavior and implementation requirements. | |
| 41 | + * | |
| 42 | + * @author Jonathan Bruce, Amit Handa | |
| 43 | + */ | |
| 44 | + | |
| 45 | +public class JdbcRowSetImpl extends BaseRowSet implements JdbcRowSet, Joinable { | |
| 46 | + | |
| 47 | + /** | |
| 48 | + * The <code>Connection</code> object that is this rowset's | |
| 49 | + * current connection to the database. This field is set | |
| 50 | + * internally when the connection is established. | |
| 51 | + */ | |
| 52 | + private Connection conn; | |
| 53 | + | |
| 54 | + /** | |
| 55 | + * The <code>PreparedStatement</code> object that is this rowset's | |
| 56 | + * current command. This field is set internally when the method | |
| 57 | + * <code>execute</code> creates the <code>PreparedStatement</code> | |
| 58 | + * object. | |
| 59 | + */ | |
| 60 | + private PreparedStatement ps; | |
| 61 | + | |
| 62 | + /** | |
| 63 | + * The <code>ResultSet</code> object that is this rowset's | |
| 64 | + * current result set. This field is set internally when the method | |
| 65 | + * <code>execute</code> executes the rowset's command and thereby | |
| 66 | + * creates the rowset's <code>ResultSet</code> object. | |
| 67 | + */ | |
| 68 | + private ResultSet rs; | |
| 69 | + | |
| 70 | + /** | |
| 71 | + * The <code>RowSetMetaDataImpl</code> object that is contructed when | |
| 72 | + * a <code>ResultSet</code> object is passed to the <code>JdbcRowSet</code> | |
| 73 | + * constructor. This helps in constructing all metadata associated | |
| 74 | + * with the <code>ResultSet</code> object using the setter methods of | |
| 75 | + * <code>RowSetMetaDataImpl</code>. | |
| 76 | + */ | |
| 77 | + private RowSetMetaDataImpl rowsMD; | |
| 78 | + | |
| 79 | + /** | |
| 80 | + * The <code>ResultSetMetaData</code> object from which this | |
| 81 | + * <code>RowSetMetaDataImpl</code> is formed and which helps in getting | |
| 82 | + * the metadata information. | |
| 83 | + */ | |
| 84 | + private ResultSetMetaData resMD; | |
| 85 | + | |
| 86 | + /** | |
| 87 | + * The property that helps to fire the property changed event when certain | |
| 88 | + * properties are changed in the <code>JdbcRowSet</code> object. This property | |
| 89 | + * is being added to satisfy Rave requirements. | |
| 90 | + */ | |
| 91 | + private PropertyChangeSupport propertyChangeSupport; | |
| 92 | + | |
| 93 | + /** | |
| 94 | + * The Vector holding the Match Columns | |
| 95 | + */ | |
| 96 | + private Vector<Integer> iMatchColumns; | |
| 97 | + | |
| 98 | + /** | |
| 99 | + * The Vector that will hold the Match Column names. | |
| 100 | + */ | |
| 101 | + private Vector<String> strMatchColumns; | |
| 102 | + | |
| 103 | + | |
| 104 | + protected transient JdbcRowSetResourceBundle resBundle; | |
| 105 | + | |
| 106 | + /** | |
| 107 | + * Constructs a default <code>JdbcRowSet</code> object. | |
| 108 | + * The new instance of <code>JdbcRowSet</code> will serve as a proxy | |
| 109 | + * for the <code>ResultSet</code> object it creates, and by so doing, | |
| 110 | + * it will make it possible to use the result set as a JavaBeans | |
| 111 | + * component. | |
| 112 | + * <P> | |
| 113 | + * The following is true of a default <code>JdbcRowSet</code> instance: | |
| 114 | + * <UL> | |
| 115 | + * <LI>Does not show deleted rows | |
| 116 | + * <LI>Has no time limit for how long a driver may take to | |
| 117 | + * execute the rowset's command | |
| 118 | + * <LI>Has no limit for the number of rows it may contain | |
| 119 | + * <LI>Has no limit for the number of bytes a column may contain | |
| 120 | + * <LI>Has a scrollable cursor and does not show changes | |
| 121 | + * made by others | |
| 122 | + * <LI>Will not see uncommitted data (make "dirty" reads) | |
| 123 | + * <LI>Has escape processing turned on | |
| 124 | + * <LI>Has its connection's type map set to <code>null</code> | |
| 125 | + * <LI>Has an empty <code>Hashtable</code> object for storing any | |
| 126 | + * parameters that are set | |
| 127 | + * </UL> | |
| 128 | + * A newly created <code>JdbcRowSet</code> object must have its | |
| 129 | + * <code>execute</code> method invoked before other public methods | |
| 130 | + * are called on it; otherwise, such method calls will cause an | |
| 131 | + * exception to be thrown. | |
| 132 | + * | |
| 133 | + * @throws SQLException [1] if any of its public methods are called prior | |
| 134 | + * to calling the <code>execute</code> method; [2] if invalid JDBC driver | |
| 135 | + * properties are set or [3] if no connection to a data source exists. | |
| 136 | + */ | |
| 137 | + public JdbcRowSetImpl() { | |
| 138 | + conn = null; | |
| 139 | + ps = null; | |
| 140 | + rs = null; | |
| 141 | + | |
| 142 | + try { | |
| 143 | + resBundle = JdbcRowSetResourceBundle.getJdbcRowSetResourceBundle(); | |
| 144 | + } catch(IOException ioe) { | |
| 145 | + throw new RuntimeException(ioe); | |
| 146 | + } | |
| 147 | + | |
| 148 | + propertyChangeSupport = new PropertyChangeSupport(this); | |
| 149 | + | |
| 150 | + initParams(); | |
| 151 | + | |
| 152 | + // set the defaults | |
| 153 | + | |
| 154 | + try { | |
| 155 | + setShowDeleted(false); | |
| 156 | + } catch(SQLException sqle) { | |
| 157 | + System.err.println(resBundle.handleGetObject("jdbcrowsetimpl.setshowdeleted").toString() + | |
| 158 | + sqle.getLocalizedMessage()); | |
| 159 | + } | |
| 160 | + | |
| 161 | + try { | |
| 162 | + setQueryTimeout(0); | |
| 163 | + } catch(SQLException sqle) { | |
| 164 | + System.err.println(resBundle.handleGetObject("jdbcrowsetimpl.setquerytimeout").toString() + | |
| 165 | + sqle.getLocalizedMessage()); | |
| 166 | + } | |
| 167 | + | |
| 168 | + try { | |
| 169 | + setMaxRows(0); | |
| 170 | + } catch(SQLException sqle) { | |
| 171 | + System.err.println(resBundle.handleGetObject("jdbcrowsetimpl.setmaxrows").toString() + | |
| 172 | + sqle.getLocalizedMessage()); | |
| 173 | + } | |
| 174 | + | |
| 175 | + try { | |
| 176 | + setMaxFieldSize(0); | |
| 177 | + } catch(SQLException sqle) { | |
| 178 | + System.err.println(resBundle.handleGetObject("jdbcrowsetimpl.setmaxfieldsize").toString() + | |
| 179 | + sqle.getLocalizedMessage()); | |
| 180 | + } | |
| 181 | + | |
| 182 | + try { | |
| 183 | + setEscapeProcessing(true); | |
| 184 | + } catch(SQLException sqle) { | |
| 185 | + System.err.println(resBundle.handleGetObject("jdbcrowsetimpl.setescapeprocessing").toString() + | |
| 186 | + sqle.getLocalizedMessage()); | |
| 187 | + } | |
| 188 | + | |
| 189 | + try { | |
| 190 | + setConcurrency(ResultSet.CONCUR_UPDATABLE); | |
| 191 | + } catch (SQLException sqle) { | |
| 192 | + System.err.println(resBundle.handleGetObject("jdbcrowsetimpl.setconcurrency").toString() + | |
| 193 | + sqle.getLocalizedMessage()); | |
| 194 | + } | |
| 195 | + | |
| 196 | + setTypeMap(null); | |
| 197 | + | |
| 198 | + try { | |
| 199 | + setType(ResultSet.TYPE_SCROLL_INSENSITIVE); | |
| 200 | + } catch(SQLException sqle){ | |
| 201 | + System.err.println(resBundle.handleGetObject("jdbcrowsetimpl.settype").toString() + | |
| 202 | + sqle.getLocalizedMessage()); | |
| 203 | + } | |
| 204 | + | |
| 205 | + setReadOnly(true); | |
| 206 | + | |
| 207 | + try { | |
| 208 | + setTransactionIsolation(Connection.TRANSACTION_READ_COMMITTED); | |
| 209 | + } catch(SQLException sqle){ | |
| 210 | + System.err.println(resBundle.handleGetObject("jdbcrowsetimpl.settransactionisolation").toString() + | |
| 211 | + sqle.getLocalizedMessage()); | |
| 212 | + } | |
| 213 | + | |
| 214 | + //Instantiating the vector for MatchColumns | |
| 215 | + | |
| 216 | + iMatchColumns = new Vector<Integer>(10); | |
| 217 | + for(int i = 0; i < 10 ; i++) { | |
| 218 | + iMatchColumns.add(i,Integer.valueOf(-1)); | |
| 219 | + } | |
| 220 | + | |
| 221 | + strMatchColumns = new Vector<String>(10); | |
| 222 | + for(int j = 0; j < 10; j++) { | |
| 223 | + strMatchColumns.add(j,null); | |
| 224 | + } | |
| 225 | + } | |
| 226 | + | |
| 227 | + /** | |
| 228 | + * Constructs a default <code>JdbcRowSet</code> object given a | |
| 229 | + * valid <code>Connection</code> object. The new | |
| 230 | + * instance of <code>JdbcRowSet</code> will serve as a proxy for | |
| 231 | + * the <code>ResultSet</code> object it creates, and by so doing, | |
| 232 | + * it will make it possible to use the result set as a JavaBeans | |
| 233 | + * component. | |
| 234 | + * <P> | |
| 235 | + * The following is true of a default <code>JdbcRowSet</code> instance: | |
| 236 | + * <UL> | |
| 237 | + * <LI>Does not show deleted rows | |
| 238 | + * <LI>Has no time limit for how long a driver may take to | |
| 239 | + * execute the rowset's command | |
| 240 | + * <LI>Has no limit for the number of rows it may contain | |
| 241 | + * <LI>Has no limit for the number of bytes a column may contain | |
| 242 | + * <LI>Has a scrollable cursor and does not show changes | |
| 243 | + * made by others | |
| 244 | + * <LI>Will not see uncommitted data (make "dirty" reads) | |
| 245 | + * <LI>Has escape processing turned on | |
| 246 | + * <LI>Has its connection's type map set to <code>null</code> | |
| 247 | + * <LI>Has an empty <code>Hashtable</code> object for storing any | |
| 248 | + * parameters that are set | |
| 249 | + * </UL> | |
| 250 | + * A newly created <code>JdbcRowSet</code> object must have its | |
| 251 | + * <code>execute</code> method invoked before other public methods | |
| 252 | + * are called on it; otherwise, such method calls will cause an | |
| 253 | + * exception to be thrown. | |
| 254 | + * | |
| 255 | + * @throws SQLException [1] if any of its public methods are called prior | |
| 256 | + * to calling the <code>execute</code> method, [2] if invalid JDBC driver | |
| 257 | + * properties are set, or [3] if no connection to a data source exists. | |
| 258 | + */ | |
| 259 | + public JdbcRowSetImpl(Connection con) throws SQLException { | |
| 260 | + | |
| 261 | + conn = con; | |
| 262 | + ps = null; | |
| 263 | + rs = null; | |
| 264 | + | |
| 265 | + try { | |
| 266 | + resBundle = JdbcRowSetResourceBundle.getJdbcRowSetResourceBundle(); | |
| 267 | + } catch(IOException ioe) { | |
| 268 | + throw new RuntimeException(ioe); | |
| 269 | + } | |
| 270 | + | |
| 271 | + propertyChangeSupport = new PropertyChangeSupport(this); | |
| 272 | + | |
| 273 | + initParams(); | |
| 274 | + // set the defaults | |
| 275 | + setShowDeleted(false); | |
| 276 | + setQueryTimeout(0); | |
| 277 | + setMaxRows(0); | |
| 278 | + setMaxFieldSize(0); | |
| 279 | + | |
| 280 | + setParams(); | |
| 281 | + | |
| 282 | + setReadOnly(true); | |
| 283 | + setTransactionIsolation(Connection.TRANSACTION_READ_COMMITTED); | |
| 284 | + setEscapeProcessing(true); | |
| 285 | + setTypeMap(null); | |
| 286 | + | |
| 287 | + //Instantiating the vector for MatchColumns | |
| 288 | + | |
| 289 | + iMatchColumns = new Vector<Integer>(10); | |
| 290 | + for(int i = 0; i < 10 ; i++) { | |
| 291 | + iMatchColumns.add(i,Integer.valueOf(-1)); | |
| 292 | + } | |
| 293 | + | |
| 294 | + strMatchColumns = new Vector<String>(10); | |
| 295 | + for(int j = 0; j < 10; j++) { | |
| 296 | + strMatchColumns.add(j,null); | |
| 297 | + } | |
| 298 | + } | |
| 299 | + | |
| 300 | + /** | |
| 301 | + * Constructs a default <code>JdbcRowSet</code> object using the | |
| 302 | + * URL, username, and password arguments supplied. The new | |
| 303 | + * instance of <code>JdbcRowSet</code> will serve as a proxy for | |
| 304 | + * the <code>ResultSet</code> object it creates, and by so doing, | |
| 305 | + * it will make it possible to use the result set as a JavaBeans | |
| 306 | + * component. | |
| 307 | + * | |
| 308 | + * <P> | |
| 309 | + * The following is true of a default <code>JdbcRowSet</code> instance: | |
| 310 | + * <UL> | |
| 311 | + * <LI>Does not show deleted rows | |
| 312 | + * <LI>Has no time limit for how long a driver may take to | |
| 313 | + * execute the rowset's command | |
| 314 | + * <LI>Has no limit for the number of rows it may contain | |
| 315 | + * <LI>Has no limit for the number of bytes a column may contain | |
| 316 | + * <LI>Has a scrollable cursor and does not show changes | |
| 317 | + * made by others | |
| 318 | + * <LI>Will not see uncommitted data (make "dirty" reads) | |
| 319 | + * <LI>Has escape processing turned on | |
| 320 | + * <LI>Has its connection's type map set to <code>null</code> | |
| 321 | + * <LI>Has an empty <code>Hashtable</code> object for storing any | |
| 322 | + * parameters that are set | |
| 323 | + * </UL> | |
| 324 | + * | |
| 325 | + * @param url - a JDBC URL for the database to which this <code>JdbcRowSet</code> | |
| 326 | + * object will be connected. The form for a JDBC URL is | |
| 327 | + * <code>jdbc:subprotocol:subname</code>. | |
| 328 | + * @param user - the database user on whose behalf the connection | |
| 329 | + * is being made | |
| 330 | + * @param password - the user's password | |
| 331 | + * | |
| 332 | + * @throws SQLException if a database access error occurs | |
| 333 | + * | |
| 334 | + */ | |
| 335 | + public JdbcRowSetImpl(String url, String user, String password) throws SQLException { | |
| 336 | + conn = null; | |
| 337 | + ps = null; | |
| 338 | + rs = null; | |
| 339 | + | |
| 340 | + try { | |
| 341 | + resBundle = JdbcRowSetResourceBundle.getJdbcRowSetResourceBundle(); | |
| 342 | + } catch(IOException ioe) { | |
| 343 | + throw new RuntimeException(ioe); | |
| 344 | + } | |
| 345 | + | |
| 346 | + propertyChangeSupport = new PropertyChangeSupport(this); | |
| 347 | + | |
| 348 | + initParams(); | |
| 349 | + | |
| 350 | + // Pass the arguments to BaseRowSet | |
| 351 | + // setter methods now. | |
| 352 | + | |
| 353 | + setUsername(user); | |
| 354 | + setPassword(password); | |
| 355 | + setUrl(url); | |
| 356 | + | |
| 357 | + // set the defaults | |
| 358 | + setShowDeleted(false); | |
| 359 | + setQueryTimeout(0); | |
| 360 | + setMaxRows(0); | |
| 361 | + setMaxFieldSize(0); | |
| 362 | + | |
| 363 | + // to ensure connection to a db call connect now | |
| 364 | + // and associate a conn with "this" object | |
| 365 | + // in this case. | |
| 366 | + conn = connect(); | |
| 367 | + setParams(); | |
| 368 | + | |
| 369 | + setReadOnly(true); | |
| 370 | + setTransactionIsolation(Connection.TRANSACTION_READ_COMMITTED); | |
| 371 | + setEscapeProcessing(true); | |
| 372 | + setTypeMap(null); | |
| 373 | + | |
| 374 | + //Instantiating the vector for MatchColumns | |
| 375 | + | |
| 376 | + iMatchColumns = new Vector<Integer>(10); | |
| 377 | + for(int i = 0; i < 10 ; i++) { | |
| 378 | + iMatchColumns.add(i,Integer.valueOf(-1)); | |
| 379 | + } | |
| 380 | + | |
| 381 | + strMatchColumns = new Vector<String>(10); | |
| 382 | + for(int j = 0; j < 10; j++) { | |
| 383 | + strMatchColumns.add(j,null); | |
| 384 | + } | |
| 385 | + } | |
| 386 | + | |
| 387 | + | |
| 388 | + /** | |
| 389 | + * Constructs a <code>JdbcRowSet</code> object using the given valid | |
| 390 | + * <code>ResultSet</code> object. The new | |
| 391 | + * instance of <code>JdbcRowSet</code> will serve as a proxy for | |
| 392 | + * the <code>ResultSet</code> object, and by so doing, | |
| 393 | + * it will make it possible to use the result set as a JavaBeans | |
| 394 | + * component. | |
| 395 | + * | |
| 396 | + * <P> | |
| 397 | + * The following is true of a default <code>JdbcRowSet</code> instance: | |
| 398 | + * <UL> | |
| 399 | + * <LI>Does not show deleted rows | |
| 400 | + * <LI>Has no time limit for how long a driver may take to | |
| 401 | + * execute the rowset's command | |
| 402 | + * <LI>Has no limit for the number of rows it may contain | |
| 403 | + * <LI>Has no limit for the number of bytes a column may contain | |
| 404 | + * <LI>Has a scrollable cursor and does not show changes | |
| 405 | + * made by others | |
| 406 | + * <LI>Will not see uncommitted data (make "dirty" reads) | |
| 407 | + * <LI>Has escape processing turned on | |
| 408 | + * <LI>Has its connection's type map set to <code>null</code> | |
| 409 | + * <LI>Has an empty <code>Hashtable</code> object for storing any | |
| 410 | + * parameters that are set | |
| 411 | + * </UL> | |
| 412 | + * | |
| 413 | + * @param res a valid <code>ResultSet</code> object | |
| 414 | + * | |
| 415 | + * @throws SQLException if a database access occurs due to a non | |
| 416 | + * valid ResultSet handle. | |
| 417 | + */ | |
| 418 | + public JdbcRowSetImpl(ResultSet res) throws SQLException { | |
| 419 | + | |
| 420 | + // A ResultSet handle encapsulates a connection handle. | |
| 421 | + // But there is no way we can retrieve a Connection handle | |
| 422 | + // from a ResultSet object. | |
| 423 | + // So to avoid any anomalies we keep the conn = null | |
| 424 | + // The passed rs handle will be a wrapper around for | |
| 425 | + // "this" object's all operations. | |
| 426 | + conn = null; | |
| 427 | + | |
| 428 | + ps = null; | |
| 429 | + | |
| 430 | + rs = res; | |
| 431 | + | |
| 432 | + try { | |
| 433 | + resBundle = JdbcRowSetResourceBundle.getJdbcRowSetResourceBundle(); | |
| 434 | + } catch(IOException ioe) { | |
| 435 | + throw new RuntimeException(ioe); | |
| 436 | + } | |
| 437 | + | |
| 438 | + propertyChangeSupport = new PropertyChangeSupport(this); | |
| 439 | + | |
| 440 | + initParams(); | |
| 441 | + | |
| 442 | + // get the values from the resultset handle. | |
| 443 | + setShowDeleted(false); | |
| 444 | + setQueryTimeout(0); | |
| 445 | + setMaxRows(0); | |
| 446 | + setMaxFieldSize(0); | |
| 447 | + | |
| 448 | + setParams(); | |
| 449 | + | |
| 450 | + setReadOnly(true); | |
| 451 | + setTransactionIsolation(Connection.TRANSACTION_READ_COMMITTED); | |
| 452 | + setEscapeProcessing(true); | |
| 453 | + setTypeMap(null); | |
| 454 | + | |
| 455 | + // Get a handle to ResultSetMetaData | |
| 456 | + // Construct RowSetMetaData out of it. | |
| 457 | + | |
| 458 | + resMD = rs.getMetaData(); | |
| 459 | + | |
| 460 | + rowsMD = new RowSetMetaDataImpl(); | |
| 461 | + | |
| 462 | + initMetaData(rowsMD, resMD); | |
| 463 | + | |
| 464 | + //Instantiating the vector for MatchColumns | |
| 465 | + | |
| 466 | + iMatchColumns = new Vector<Integer>(10); | |
| 467 | + for(int i = 0; i < 10 ; i++) { | |
| 468 | + iMatchColumns.add(i,Integer.valueOf(-1)); | |
| 469 | + } | |
| 470 | + | |
| 471 | + strMatchColumns = new Vector<String>(10); | |
| 472 | + for(int j = 0; j < 10; j++) { | |
| 473 | + strMatchColumns.add(j,null); | |
| 474 | + } | |
| 475 | + } | |
| 476 | + | |
| 477 | + /** | |
| 478 | + * Initializes the given <code>RowSetMetaData</code> object with the values | |
| 479 | + * in the given <code>ResultSetMetaData</code> object. | |
| 480 | + * | |
| 481 | + * @param md the <code>RowSetMetaData</code> object for this | |
| 482 | + * <code>JdbcRowSetImpl</code> object, which will be set with | |
| 483 | + * values from rsmd | |
| 484 | + * @param rsmd the <code>ResultSetMetaData</code> object from which new | |
| 485 | + * values for md will be read | |
| 486 | + * @throws SQLException if an error occurs | |
| 487 | + */ | |
| 488 | + protected void initMetaData(RowSetMetaData md, ResultSetMetaData rsmd) throws SQLException { | |
| 489 | + int numCols = rsmd.getColumnCount(); | |
| 490 | + | |
| 491 | + md.setColumnCount(numCols); | |
| 492 | + for (int col=1; col <= numCols; col++) { | |
| 493 | + md.setAutoIncrement(col, rsmd.isAutoIncrement(col)); | |
| 494 | + md.setCaseSensitive(col, rsmd.isCaseSensitive(col)); | |
| 495 | + md.setCurrency(col, rsmd.isCurrency(col)); | |
| 496 | + md.setNullable(col, rsmd.isNullable(col)); | |
| 497 | + md.setSigned(col, rsmd.isSigned(col)); | |
| 498 | + md.setSearchable(col, rsmd.isSearchable(col)); | |
| 499 | + md.setColumnDisplaySize(col, rsmd.getColumnDisplaySize(col)); | |
| 500 | + md.setColumnLabel(col, rsmd.getColumnLabel(col)); | |
| 501 | + md.setColumnName(col, rsmd.getColumnName(col)); | |
| 502 | + md.setSchemaName(col, rsmd.getSchemaName(col)); | |
| 503 | + md.setPrecision(col, rsmd.getPrecision(col)); | |
| 504 | + md.setScale(col, rsmd.getScale(col)); | |
| 505 | + md.setTableName(col, rsmd.getTableName(col)); | |
| 506 | + md.setCatalogName(col, rsmd.getCatalogName(col)); | |
| 507 | + md.setColumnType(col, rsmd.getColumnType(col)); | |
| 508 | + md.setColumnTypeName(col, rsmd.getColumnTypeName(col)); | |
| 509 | + } | |
| 510 | + } | |
| 511 | + | |
| 512 | + | |
| 513 | + protected void checkState() throws SQLException { | |
| 514 | + | |
| 515 | + // If all the three i.e. conn, ps & rs are | |
| 516 | + // simultaneously null implies we are not connected | |
| 517 | + // to the db, implies undesirable state so throw exception | |
| 518 | + | |
| 519 | + if (conn == null && ps == null && rs == null ) { | |
| 520 | + throw new SQLException(resBundle.handleGetObject("jdbcrowsetimpl.invalstate").toString()); | |
| 521 | + } | |
| 522 | + } | |
| 523 | + | |
| 524 | + //--------------------------------------------------------------------- | |
| 525 | + // Reading and writing data | |
| 526 | + //--------------------------------------------------------------------- | |
| 527 | + | |
| 528 | + /** | |
| 529 | + * Creates the internal <code>ResultSet</code> object for which this | |
| 530 | + * <code>JdbcRowSet</code> object is a wrapper, effectively | |
| 531 | + * making the result set a JavaBeans component. | |
| 532 | + * <P> | |
| 533 | + * Certain properties must have been set before this method is called | |
| 534 | + * so that it can establish a connection to a database and execute the | |
| 535 | + * query that will create the result set. If a <code>DataSource</code> | |
| 536 | + * object will be used to create the connection, properties for the | |
| 537 | + * data source name, user name, and password must be set. If the | |
| 538 | + * <code>DriverManager</code> will be used, the properties for the | |
| 539 | + * URL, user name, and password must be set. In either case, the | |
| 540 | + * property for the command must be set. If the command has placeholder | |
| 541 | + * parameters, those must also be set. This method throws | |
| 542 | + * an exception if the required properties are not set. | |
| 543 | + * <P> | |
| 544 | + * Other properties have default values that may optionally be set | |
| 545 | + * to new values. The <code>execute</code> method will use the value | |
| 546 | + * for the command property to create a <code>PreparedStatement</code> | |
| 547 | + * object and set its properties (escape processing, maximum field | |
| 548 | + * size, maximum number of rows, and query timeout limit) to be those | |
| 549 | + * of this rowset. | |
| 550 | + * | |
| 551 | + * @throws SQLException if (1) a database access error occurs, | |
| 552 | + * (2) any required JDBC properties are not set, or (3) if an | |
| 553 | + * invalid connection exists. | |
| 554 | + */ | |
| 555 | + public void execute() throws SQLException { | |
| 556 | + /* | |
| 557 | + * To execute based on the properties: | |
| 558 | + * i) determine how to get a connection | |
| 559 | + * ii) prepare the statement | |
| 560 | + * iii) set the properties of the statement | |
| 561 | + * iv) parse the params. and set them | |
| 562 | + * v) execute the statement | |
| 563 | + * | |
| 564 | + * During all of this try to tolerate as many errors | |
| 565 | + * as possible, many drivers will not support all of | |
| 566 | + * the properties and will/should throw SQLException | |
| 567 | + * at us... | |
| 568 | + * | |
| 569 | + */ | |
| 570 | + | |
| 571 | + prepare(); | |
| 572 | + | |
| 573 | + // set the properties of our shiny new statement | |
| 574 | + setProperties(ps); | |
| 575 | + | |
| 576 | + | |
| 577 | + // set the parameters | |
| 578 | + decodeParams(getParams(), ps); | |
| 579 | + | |
| 580 | + | |
| 581 | + // execute the statement | |
| 582 | + rs = ps.executeQuery(); | |
| 583 | + | |
| 584 | + | |
| 585 | + // notify listeners | |
| 586 | + notifyRowSetChanged(); | |
| 587 | + | |
| 588 | + | |
| 589 | + } | |
| 590 | + | |
| 591 | + protected void setProperties(PreparedStatement ps) throws SQLException { | |
| 592 | + | |
| 593 | + try { | |
| 594 | + ps.setEscapeProcessing(getEscapeProcessing()); | |
| 595 | + } catch (SQLException ex) { | |
| 596 | + System.err.println(resBundle.handleGetObject("jdbcrowsetimpl.setescapeprocessing").toString() + | |
| 597 | + ex.getLocalizedMessage()); | |
| 598 | + } | |
| 599 | + | |
| 600 | + try { | |
| 601 | + ps.setMaxFieldSize(getMaxFieldSize()); | |
| 602 | + } catch (SQLException ex) { | |
| 603 | + System.err.println(resBundle.handleGetObject("jdbcrowsetimpl.setmaxfieldsize").toString() + | |
| 604 | + ex.getLocalizedMessage()); | |
| 605 | + } | |
| 606 | + | |
| 607 | + try { | |
| 608 | + ps.setMaxRows(getMaxRows()); | |
| 609 | + } catch (SQLException ex) { | |
| 610 | + System.err.println(resBundle.handleGetObject("jdbcrowsetimpl.setmaxrows").toString() + | |
| 611 | + ex.getLocalizedMessage()); | |
| 612 | + } | |
| 613 | + | |
| 614 | + try { | |
| 615 | + ps.setQueryTimeout(getQueryTimeout()); | |
| 616 | + } catch (SQLException ex) { | |
| 617 | + System.err.println(resBundle.handleGetObject("jdbcrowsetimpl.setquerytimeout").toString() + | |
| 618 | + ex.getLocalizedMessage()); | |
| 619 | + } | |
| 620 | + | |
| 621 | + } | |
| 622 | + | |
| 623 | + // An alternate solution is required instead of having the | |
| 624 | + // connect method as protected. | |
| 625 | + // This is a work around to assist Rave Team | |
| 626 | + // :ah | |
| 627 | + | |
| 628 | + protected Connection connect() throws SQLException { | |
| 629 | + | |
| 630 | + // Get a JDBC connection. | |
| 631 | + | |
| 632 | + // First check for Connection handle object as such if | |
| 633 | + // "this" initialized using conn. | |
| 634 | + | |
| 635 | + if(conn != null) { | |
| 636 | + return conn; | |
| 637 | + | |
| 638 | + } else if (getDataSourceName() != null) { | |
| 639 | + | |
| 640 | + // Connect using JNDI. | |
| 641 | + try { | |
| 642 | + Context ctx = new InitialContext(); | |
| 643 | + DataSource ds = (DataSource)ctx.lookup | |
| 644 | + (getDataSourceName()); | |
| 645 | + //return ds.getConnection(getUsername(),getPassword()); | |
| 646 | + | |
| 647 | + if(getUsername() != null && !getUsername().equals("")) { | |
| 648 | + return ds.getConnection(getUsername(),getPassword()); | |
| 649 | + } else { | |
| 650 | + return ds.getConnection(); | |
| 651 | + } | |
| 652 | + } | |
| 653 | + catch (javax.naming.NamingException ex) { | |
| 654 | + throw new SQLException(resBundle.handleGetObject("jdbcrowsetimpl.connect").toString()); | |
| 655 | + } | |
| 656 | + | |
| 657 | + } else if (getUrl() != null) { | |
| 658 | + // Check only for getUrl() != null because | |
| 659 | + // user, passwd can be null | |
| 660 | + // Connect using the driver manager. | |
| 661 | + | |
| 662 | + return DriverManager.getConnection | |
| 663 | + (getUrl(), getUsername(), getPassword()); | |
| 664 | + } | |
| 665 | + else { | |
| 666 | + return null; | |
| 667 | + } | |
| 668 | + | |
| 669 | + } | |
| 670 | + | |
| 671 | + | |
| 672 | + protected PreparedStatement prepare() throws SQLException { | |
| 673 | + // get a connection | |
| 674 | + conn = connect(); | |
| 675 | + | |
| 676 | + try { | |
| 677 | + | |
| 678 | + Map<String, Class<?>> aMap = getTypeMap(); | |
| 679 | + if( aMap != null) { | |
| 680 | + conn.setTypeMap(aMap); | |
| 681 | + } | |
| 682 | + ps = conn.prepareStatement(getCommand(),ResultSet.TYPE_SCROLL_INSENSITIVE,ResultSet.CONCUR_UPDATABLE); | |
| 683 | + } catch (SQLException ex) { | |
| 684 | + System.err.println(resBundle.handleGetObject("jdbcrowsetimpl.prepare").toString() + | |
| 685 | + ex.getLocalizedMessage()); | |
| 686 | + | |
| 687 | + if (ps != null) | |
| 688 | + ps.close(); | |
| 689 | + if (conn != null) | |
| 690 | + conn.close(); | |
| 691 | + | |
| 692 | + throw new SQLException(ex.getMessage()); | |
| 693 | + } | |
| 694 | + | |
| 695 | + return ps; | |
| 696 | + } | |
| 697 | + | |
| 698 | + private void decodeParams(Object[] params, PreparedStatement ps) | |
| 699 | + throws SQLException { | |
| 700 | + | |
| 701 | + // There is a corresponding decodeParams in JdbcRowSetImpl | |
| 702 | + // which does the same as this method. This is a design flaw. | |
| 703 | + // Update the CachedRowsetReader.decodeParams when you update | |
| 704 | + // this method. | |
| 705 | + | |
| 706 | + // Adding the same comments to CachedRowsetReader.decodeParams. | |
| 707 | + | |
| 708 | + int arraySize; | |
| 709 | + Object[] param = null; | |
| 710 | + | |
| 711 | + for (int i=0; i < params.length; i++) { | |
| 712 | + if (params[i] instanceof Object[]) { | |
| 713 | + param = (Object[])params[i]; | |
| 714 | + | |
| 715 | + if (param.length == 2) { | |
| 716 | + if (param[0] == null) { | |
| 717 | + ps.setNull(i + 1, ((Integer)param[1]).intValue()); | |
| 718 | + continue; | |
| 719 | + } | |
| 720 | + | |
| 721 | + if (param[0] instanceof java.sql.Date || | |
| 722 | + param[0] instanceof java.sql.Time || | |
| 723 | + param[0] instanceof java.sql.Timestamp) { | |
| 724 | + System.err.println(resBundle.handleGetObject("jdbcrowsetimpl.detecteddate")); | |
| 725 | + if (param[1] instanceof java.util.Calendar) { | |
| 726 | + System.err.println(resBundle.handleGetObject("jdbcrowsetimpl.detectedcalendar")); | |
| 727 | + ps.setDate(i + 1, (java.sql.Date)param[0], | |
| 728 | + (java.util.Calendar)param[1]); | |
| 729 | + continue; | |
| 730 | + } | |
| 731 | + else { | |
| 732 | + throw new SQLException(resBundle.handleGetObject("jdbcrowsetimpl.paramtype").toString()); | |
| 733 | + } | |
| 734 | + } | |
| 735 | + | |
| 736 | + if (param[0] instanceof Reader) { | |
| 737 | + ps.setCharacterStream(i + 1, (Reader)param[0], | |
| 738 | + ((Integer)param[1]).intValue()); | |
| 739 | + continue; | |
| 740 | + } | |
| 741 | + | |
| 742 | + /* | |
| 743 | + * What's left should be setObject(int, Object, scale) | |
| 744 | + */ | |
| 745 | + if (param[1] instanceof Integer) { | |
| 746 | + ps.setObject(i + 1, param[0], ((Integer)param[1]).intValue()); | |
| 747 | + continue; | |
| 748 | + } | |
| 749 | + | |
| 750 | + } else if (param.length == 3) { | |
| 751 | + | |
| 752 | + if (param[0] == null) { | |
| 753 | + ps.setNull(i + 1, ((Integer)param[1]).intValue(), | |
| 754 | + (String)param[2]); | |
| 755 | + continue; | |
| 756 | + } | |
| 757 | + | |
| 758 | + if (param[0] instanceof java.io.InputStream) { | |
| 759 | + switch (((Integer)param[2]).intValue()) { | |
| 760 | + case JdbcRowSetImpl.UNICODE_STREAM_PARAM: | |
| 761 | + ps.setUnicodeStream(i + 1, | |
| 762 | + (java.io.InputStream)param[0], | |
| 763 | + ((Integer)param[1]).intValue()); | |
| 764 | + case JdbcRowSetImpl.BINARY_STREAM_PARAM: | |
| 765 | + ps.setBinaryStream(i + 1, | |
| 766 | + (java.io.InputStream)param[0], | |
| 767 | + ((Integer)param[1]).intValue()); | |
| 768 | + case JdbcRowSetImpl.ASCII_STREAM_PARAM: | |
| 769 | + ps.setAsciiStream(i + 1, | |
| 770 | + (java.io.InputStream)param[0], | |
| 771 | + ((Integer)param[1]).intValue()); | |
| 772 | + default: | |
| 773 | + throw new SQLException(resBundle.handleGetObject("jdbcrowsetimpl.paramtype").toString()); | |
| 774 | + } | |
| 775 | + } | |
| 776 | + | |
| 777 | + /* | |
| 778 | + * no point at looking at the first element now; | |
| 779 | + * what's left must be the setObject() cases. | |
| 780 | + */ | |
| 781 | + if (param[1] instanceof Integer && param[2] instanceof Integer) { | |
| 782 | + ps.setObject(i + 1, param[0], ((Integer)param[1]).intValue(), | |
| 783 | + ((Integer)param[2]).intValue()); | |
| 784 | + continue; | |
| 785 | + } | |
| 786 | + | |
| 787 | + throw new SQLException(resBundle.handleGetObject("jdbcrowsetimpl.paramtype").toString()); | |
| 788 | + | |
| 789 | + } else { | |
| 790 | + // common case - this catches all SQL92 types | |
| 791 | + ps.setObject(i + 1, params[i]); | |
| 792 | + continue; | |
| 793 | + } | |
| 794 | + } else { | |
| 795 | + // Try to get all the params to be set here | |
| 796 | + ps.setObject(i + 1, params[i]); | |
| 797 | + | |
| 798 | + } | |
| 799 | + } | |
| 800 | + } | |
| 801 | + | |
| 802 | + /** | |
| 803 | + * Moves the cursor for this rowset's <code>ResultSet</code> | |
| 804 | + * object down one row from its current position. | |
| 805 | + * A <code>ResultSet</code> cursor is initially positioned | |
| 806 | + * before the first row; the first call to the method | |
| 807 | + * <code>next</code> makes the first row the current row; the | |
| 808 | + * second call makes the second row the current row, and so on. | |
| 809 | + * | |
| 810 | + * <P>If an input stream is open for the current row, a call | |
| 811 | + * to the method <code>next</code> will | |
| 812 | + * implicitly close it. A <code>ResultSet</code> object's | |
| 813 | + * warning chain is cleared when a new row is read. | |
| 814 | + * | |
| 815 | + * @return <code>true</code> if the new current row is valid; | |
| 816 | + * <code>false</code> if there are no more rows | |
| 817 | + * @throws SQLException if a database access error occurs | |
| 818 | + * or this rowset does not currently have a valid connection, | |
| 819 | + * prepared statement, and result set | |
| 820 | + */ | |
| 821 | + public boolean next() throws SQLException { | |
| 822 | + checkState(); | |
| 823 | + | |
| 824 | + boolean b = rs.next(); | |
| 825 | + notifyCursorMoved(); | |
| 826 | + return b; | |
| 827 | + } | |
| 828 | + | |
| 829 | + /** | |
| 830 | + * Releases this rowset's <code>ResultSet</code> object's database and | |
| 831 | + * JDBC resources immediately instead of waiting for | |
| 832 | + * this to happen when it is automatically closed. | |
| 833 | + * | |
| 834 | + * <P><B>Note:</B> A <code>ResultSet</code> object | |
| 835 | + * is automatically closed by the | |
| 836 | + * <code>Statement</code> object that generated it when | |
| 837 | + * that <code>Statement</code> object is closed, | |
| 838 | + * re-executed, or is used to retrieve the next result from a | |
| 839 | + * sequence of multiple results. A <code>ResultSet</code> object | |
| 840 | + * is also automatically closed when it is garbage collected. | |
| 841 | + * | |
| 842 | + * @throws SQLException if a database access error occurs | |
| 843 | + */ | |
| 844 | + public void close() throws SQLException { | |
| 845 | + if (rs != null) | |
| 846 | + rs.close(); | |
| 847 | + if (ps != null) | |
| 848 | + ps.close(); | |
| 849 | + if (conn != null) | |
| 850 | + conn.close(); | |
| 851 | + } | |
| 852 | + | |
| 853 | + /** | |
| 854 | + * Reports whether the last column read from this rowset's | |
| 855 | + * <code>ResultSet</code> object had a value of SQL <code>NULL</code>. | |
| 856 | + * Note that you must first call one of the <code>getXXX</code> methods | |
| 857 | + * on a column to try to read its value and then call | |
| 858 | + * the method <code>wasNull</code> to see if the value read was | |
| 859 | + * SQL <code>NULL</code>. | |
| 860 | + * | |
| 861 | + * @return <code>true</code> if the last column value read was SQL | |
| 862 | + * <code>NULL</code> and <code>false</code> otherwise | |
| 863 | + * @throws SQLException if a database access error occurs | |
| 864 | + * or this rowset does not have a currently valid connection, | |
| 865 | + * prepared statement, and result set | |
| 866 | + */ | |
| 867 | + public boolean wasNull() throws SQLException { | |
| 868 | + checkState(); | |
| 869 | + | |
| 870 | + return rs.wasNull(); | |
| 871 | + } | |
| 872 | + | |
| 873 | + //====================================================================== | |
| 874 | + // Methods for accessing results by column index | |
| 875 | + //====================================================================== | |
| 876 | + | |
| 877 | + /** | |
| 878 | + * Gets the value of the designated column in the current row | |
| 879 | + * of this rowset's <code>ResultSet</code> object as | |
| 880 | + * a <code>String</code>. | |
| 881 | + * | |
| 882 | + * @param columnIndex the first column is 1, the second is 2, and so on | |
| 883 | + * @return the column value; if the value is SQL <code>NULL</code>, the | |
| 884 | + * value returned is <code>null</code> | |
| 885 | + * @throws SQLException if (1) a database access error occurs | |
| 886 | + * or (2) this rowset does not currently have a valid connection, | |
| 887 | + * prepared statement, and result set | |
| 888 | + */ | |
| 889 | + public String getString(int columnIndex) throws SQLException { | |
| 890 | + checkState(); | |
| 891 | + | |
| 892 | + return rs.getString(columnIndex); | |
| 893 | + } | |
| 894 | + | |
| 895 | + /** | |
| 896 | + * Gets the value of the designated column in the current row | |
| 897 | + * of this rowset's <code>ResultSet</code> object as | |
| 898 | + * a <code>boolean</code>. | |
| 899 | + * | |
| 900 | + * @param columnIndex the first column is 1, the second is 2, and so on | |
| 901 | + * @return the column value; if the value is SQL <code>NULL</code>, the | |
| 902 | + * value returned is <code>false</code> | |
| 903 | + * @throws SQLException if (1) a database access error occurs | |
| 904 | + * or (2) this rowset does not have a currently valid connection, | |
| 905 | + * prepared statement, and result set | |
| 906 | + */ | |
| 907 | + public boolean getBoolean(int columnIndex) throws SQLException { | |
| 908 | + checkState(); | |
| 909 | + | |
| 910 | + return rs.getBoolean(columnIndex); | |
| 911 | + } | |
| 912 | + | |
| 913 | + /** | |
| 914 | + * Gets the value of the designated column in the current row | |
| 915 | + * of this rowset's <code>ResultSet</code> object as | |
| 916 | + * a <code>byte</code>. | |
| 917 | + * | |
| 918 | + * @param columnIndex the first column is 1, the second is 2, and so on | |
| 919 | + * @return the column value; if the value is SQL <code>NULL</code>, the | |
| 920 | + * value returned is <code>0</code> | |
| 921 | + * @throws SQLException if (1) a database access error occurs | |
| 922 | + * or (2) this rowset does not have a currently valid connection, | |
| 923 | + * prepared statement, and result set | |
| 924 | + */ | |
| 925 | + public byte getByte(int columnIndex) throws SQLException { | |
| 926 | + checkState(); | |
| 927 | + | |
| 928 | + return rs.getByte(columnIndex); | |
| 929 | + } | |
| 930 | + | |
| 931 | + /** | |
| 932 | + * Gets the value of the designated column in the current row | |
| 933 | + * of this rowset's <code>ResultSet</code> object as | |
| 934 | + * a <code>short</code>. | |
| 935 | + * | |
| 936 | + * @param columnIndex the first column is 1, the second is 2, and so on | |
| 937 | + * @return the column value; if the value is SQL <code>NULL</code>, the | |
| 938 | + * value returned is <code>0</code> | |
| 939 | + * @throws SQLException if (1) a database access error occurs | |
| 940 | + * or (2) this rowset does not have a currently valid connection, | |
| 941 | + * prepared statement, and result set | |
| 942 | + */ | |
| 943 | + public short getShort(int columnIndex) throws SQLException { | |
| 944 | + checkState(); | |
| 945 | + | |
| 946 | + return rs.getShort(columnIndex); | |
| 947 | + } | |
| 948 | + | |
| 949 | + /** | |
| 950 | + * Gets the value of the designated column in the current row | |
| 951 | + * of this rowset's <code>ResultSet</code> object as | |
| 952 | + * an <code>int</code>. | |
| 953 | + * | |
| 954 | + * @param columnIndex the first column is 1, the second is 2, and so on | |
| 955 | + * @return the column value; if the value is SQL <code>NULL</code>, the | |
| 956 | + * value returned is <code>0</code> | |
| 957 | + * @throws SQLException if (1) a database access error occurs | |
| 958 | + * or (2) this rowset does not have a currently valid connection, | |
| 959 | + * prepared statement, and result set | |
| 960 | + */ | |
| 961 | + public int getInt(int columnIndex) throws SQLException { | |
| 962 | + checkState(); | |
| 963 | + | |
| 964 | + return rs.getInt(columnIndex); | |
| 965 | + } | |
| 966 | + | |
| 967 | + /** | |
| 968 | + * Gets the value of the designated column in the current row | |
| 969 | + * of this rowset's <code>ResultSet</code> object as | |
| 970 | + * a <code>long</code>. | |
| 971 | + * | |
| 972 | + * @param columnIndex the first column is 1, the second is 2, and so on | |
| 973 | + * @return the column value; if the value is SQL <code>NULL</code>, the | |
| 974 | + * value returned is <code>0</code> | |
| 975 | + * @throws SQLException if (1) a database access error occurs | |
| 976 | + * or (2) this rowset does not have a currently valid connection, | |
| 977 | + * prepared statement, and result set | |
| 978 | + */ | |
| 979 | + public long getLong(int columnIndex) throws SQLException { | |
| 980 | + checkState(); | |
| 981 | + | |
| 982 | + return rs.getLong(columnIndex); | |
| 983 | + } | |
| 984 | + | |
| 985 | + /** | |
| 986 | + * Gets the value of the designated column in the current row | |
| 987 | + * of this rowset's <code>ResultSet</code> object as | |
| 988 | + * a <code>float</code>. | |
| 989 | + * | |
| 990 | + * @param columnIndex the first column is 1, the second is 2, and so on | |
| 991 | + * @return the column value; if the value is SQL <code>NULL</code>, the | |
| 992 | + * value returned is <code>0</code> | |
| 993 | + * @throws SQLException if (1) a database access error occurs | |
| 994 | + * or (2) this rowset does not have a currently valid connection, | |
| 995 | + * prepared statement, and result set | |
| 996 | + */ | |
| 997 | + public float getFloat(int columnIndex) throws SQLException { | |
| 998 | + checkState(); | |
| 999 | + | |
| 1000 | + return rs.getFloat(columnIndex); | |
| 1001 | + } | |
| 1002 | + | |
| 1003 | + /** | |
| 1004 | + * Gets the value of the designated column in the current row | |
| 1005 | + * of this rowset's <code>ResultSet</code> object as | |
| 1006 | + * a <code>double</code>. | |
| 1007 | + * | |
| 1008 | + * @param columnIndex the first column is 1, the second is 2, and so on | |
| 1009 | + * @return the column value; if the value is SQL <code>NULL</code>, the | |
| 1010 | + * value returned is <code>0</code> | |
| 1011 | + * @throws SQLException if (1) a database access error occurs | |
| 1012 | + * or (2) this rowset does not have a currently valid connection, | |
| 1013 | + * prepared statement, and result set | |
| 1014 | + */ | |
| 1015 | + public double getDouble(int columnIndex) throws SQLException { | |
| 1016 | + checkState(); | |
| 1017 | + | |
| 1018 | + return rs.getDouble(columnIndex); | |
| 1019 | + } | |
| 1020 | + | |
| 1021 | + /** | |
| 1022 | + * Gets the value of the designated column in the current row | |
| 1023 | + * of this rowset's <code>ResultSet</code> object as | |
| 1024 | + * a <code>java.sql.BigDecimal</code>. | |
| 1025 | + * | |
| 1026 | + * @param columnIndex the first column is 1, the second is 2, and so on | |
| 1027 | + * @param scale the number of digits to the right of the decimal point | |
| 1028 | + * @return the column value; if the value is SQL <code>NULL</code>, the | |
| 1029 | + * value returned is <code>null</code> | |
| 1030 | + * @throws SQLException if (1) database access error occurs | |
| 1031 | + * or (2) this rowset does not have a currently valid connection, | |
| 1032 | + * prepared statement, and result set | |
| 1033 | + * @deprecated | |
| 1034 | + */ | |
| 1035 | + public BigDecimal getBigDecimal(int columnIndex, int scale) throws SQLException { | |
| 1036 | + checkState(); | |
| 1037 | + | |
| 1038 | + return rs.getBigDecimal(columnIndex, scale); | |
| 1039 | + } | |
| 1040 | + | |
| 1041 | + /** | |
| 1042 | + * Gets the value of the designated column in the current row | |
| 1043 | + * of this rowset's <code>ResultSet</code> object as | |
| 1044 | + * a <code>byte</code> array in the Java programming language. | |
| 1045 | + * The bytes represent the raw values returned by the driver. | |
| 1046 | + * | |
| 1047 | + * @param columnIndex the first column is 1, the second is 2, and so on | |
| 1048 | + * @return the column value; if the value is SQL <code>NULL</code>, the | |
| 1049 | + * value returned is <code>null</code> | |
| 1050 | + * @throws SQLException if (1) a database access error occurs | |
| 1051 | + * or (2) this rowset does not have a currently valid connection, | |
| 1052 | + * prepared statement, and result set | |
| 1053 | + */ | |
| 1054 | + public byte[] getBytes(int columnIndex) throws SQLException { | |
| 1055 | + checkState(); | |
| 1056 | + | |
| 1057 | + return rs.getBytes(columnIndex); | |
| 1058 | + } | |
| 1059 | + | |
| 1060 | + /** | |
| 1061 | + * Gets the value of the designated column in the current row | |
| 1062 | + * of this rowset's <code>ResultSet</code> object as | |
| 1063 | + * a <code>java.sql.Date</code> object in the Java programming language. | |
| 1064 | + * | |
| 1065 | + * @param columnIndex the first column is 1, the second is 2, and so on | |
| 1066 | + * @return the column value; if the value is SQL <code>NULL</code>, the | |
| 1067 | + * value returned is <code>null</code> | |
| 1068 | + * @throws SQLException if (1) a database access error occurs | |
| 1069 | + * or (2) this rowset does not have a currently valid connection, | |
| 1070 | + * prepared statement, and result set | |
| 1071 | + */ | |
| 1072 | + public java.sql.Date getDate(int columnIndex) throws SQLException { | |
| 1073 | + checkState(); | |
| 1074 | + | |
| 1075 | + return rs.getDate(columnIndex); | |
| 1076 | + } | |
| 1077 | + | |
| 1078 | + /** | |
| 1079 | + * Gets the value of the designated column in the current row | |
| 1080 | + * of this rowset's <code>ResultSet</code> object as | |
| 1081 | + * a <code>java.sql.Time</code> object in the Java programming language. | |
| 1082 | + * | |
| 1083 | + * @param columnIndex the first column is 1, the second is 2, and so on | |
| 1084 | + * @return the column value; if the value is SQL <code>NULL</code>, the | |
| 1085 | + * value returned is <code>null</code> | |
| 1086 | + * @throws SQLException if (1) a database access error occurs | |
| 1087 | + * or (2) this rowset does not have a currently valid connection, | |
| 1088 | + * prepared statement, and result set | |
| 1089 | + */ | |
| 1090 | + public java.sql.Time getTime(int columnIndex) throws SQLException { | |
| 1091 | + checkState(); | |
| 1092 | + | |
| 1093 | + return rs.getTime(columnIndex); | |
| 1094 | + } | |
| 1095 | + | |
| 1096 | + /** | |
| 1097 | + * Gets the value of the designated column in the current row | |
| 1098 | + * of this rowset's <code>ResultSet</code> object as | |
| 1099 | + * a <code>java.sql.Timestamp</code> object in the Java programming language. | |
| 1100 | + * | |
| 1101 | + * @param columnIndex the first column is 1, the second is 2, and so on | |
| 1102 | + * @return the column value; if the value is SQL <code>NULL</code>, the | |
| 1103 | + * value returned is <code>null</code> | |
| 1104 | + * @throws SQLException if (1) a database access error occurs | |
| 1105 | + * or (2) this rowset does not have a currently valid connection, | |
| 1106 | + * prepared statement, and result set | |
| 1107 | + */ | |
| 1108 | + public java.sql.Timestamp getTimestamp(int columnIndex) throws SQLException { | |
| 1109 | + checkState(); | |
| 1110 | + | |
| 1111 | + return rs.getTimestamp(columnIndex); | |
| 1112 | + } | |
| 1113 | + | |
| 1114 | + /** | |
| 1115 | + * Gets the value of the designated column in the current row | |
| 1116 | + * of this rowset's <code>ResultSet</code> object as | |
| 1117 | + * a stream of ASCII characters. The value can then be read in chunks from the | |
| 1118 | + * stream. This method is particularly | |
| 1119 | + * suitable for retrieving large <code>LONGVARCHAR</code> values. | |
| 1120 | + * The JDBC driver will | |
| 1121 | + * do any necessary conversion from the database format into ASCII. | |
| 1122 | + * | |
| 1123 | + * <P><B>Note:</B> All the data in the returned stream must be | |
| 1124 | + * read prior to getting the value of any other column. The next | |
| 1125 | + * call to a <code>getXXX</code> method implicitly closes the stream. Also, a | |
| 1126 | + * stream may return <code>0</code> when the method | |
| 1127 | + * <code>InputStream.available</code> | |
| 1128 | + * is called whether there is data available or not. | |
| 1129 | + * | |
| 1130 | + * @param columnIndex the first column is 1, the second is 2, and so on | |
| 1131 | + * @return a Java input stream that delivers the database column value | |
| 1132 | + * as a stream of one-byte ASCII characters; | |
| 1133 | + * if the value is SQL <code>NULL</code>, the | |
| 1134 | + * value returned is <code>null</code> | |
| 1135 | + * @throws SQLException if (1) database access error occurs | |
| 1136 | + * (2) this rowset does not have a currently valid connection, | |
| 1137 | + * prepared statement, and result set | |
| 1138 | + */ | |
| 1139 | + public java.io.InputStream getAsciiStream(int columnIndex) throws SQLException { | |
| 1140 | + checkState(); | |
| 1141 | + | |
| 1142 | + return rs.getAsciiStream(columnIndex); | |
| 1143 | + } | |
| 1144 | + | |
| 1145 | + /** | |
| 1146 | + * Gets the value of the designated column in the current row | |
| 1147 | + * of this rowset's <code>ResultSet</code> object as | |
| 1148 | + * as a stream of Unicode characters. | |
| 1149 | + * The value can then be read in chunks from the | |
| 1150 | + * stream. This method is particularly | |
| 1151 | + * suitable for retrieving large<code>LONGVARCHAR</code>values. The JDBC driver will | |
| 1152 | + * do any necessary conversion from the database format into Unicode. | |
| 1153 | + * The byte format of the Unicode stream must be Java UTF-8, | |
| 1154 | + * as specified in the Java virtual machine specification. | |
| 1155 | + * | |
| 1156 | + * <P><B>Note:</B> All the data in the returned stream must be | |
| 1157 | + * read prior to getting the value of any other column. The next | |
| 1158 | + * call to a <code>getXXX</code> method implicitly closes the stream. Also, a | |
| 1159 | + * stream may return <code>0</code> when the method | |
| 1160 | + * <code>InputStream.available</code> | |
| 1161 | + * is called whether there is data available or not. | |
| 1162 | + * | |
| 1163 | + * @param columnIndex the first column is 1, the second is 2, and so on | |
| 1164 | + * @return a Java input stream that delivers the database column value | |
| 1165 | + * as a stream in Java UTF-8 byte format; | |
| 1166 | + * if the value is SQL <code>NULL</code>, the value returned is <code>null</code> | |
| 1167 | + * @throws SQLException if (1) a database access error occurs | |
| 1168 | + * or (2) this rowset does not have a currently valid connection, | |
| 1169 | + * prepared statement, and result set | |
| 1170 | + * @deprecated use <code>getCharacterStream</code> in place of | |
| 1171 | + * <code>getUnicodeStream</code> | |
| 1172 | + */ | |
| 1173 | + public java.io.InputStream getUnicodeStream(int columnIndex) throws SQLException { | |
| 1174 | + checkState(); | |
| 1175 | + | |
| 1176 | + return rs.getUnicodeStream(columnIndex); | |
| 1177 | + } | |
| 1178 | + | |
| 1179 | + /** | |
| 1180 | + * Gets the value of a column in the current row as a stream of | |
| 1181 | + * the value of the designated column in the current row | |
| 1182 | + * of this rowset's <code>ResultSet</code> object as a binary stream of | |
| 1183 | + * uninterpreted bytes. The value can then be read in chunks from the | |
| 1184 | + * stream. This method is particularly | |
| 1185 | + * suitable for retrieving large <code>LONGVARBINARY</code> values. | |
| 1186 | + * | |
| 1187 | + * <P><B>Note:</B> All the data in the returned stream must be | |
| 1188 | + * read prior to getting the value of any other column. The next | |
| 1189 | + * call to a <code>getXXX</code> method implicitly closes the stream. Also, a | |
| 1190 | + * stream may return <code>0</code> when the method | |
| 1191 | + * <code>InputStream.available</code> | |
| 1192 | + * is called whether there is data available or not. | |
| 1193 | + * | |
| 1194 | + * @param columnIndex the first column is 1, the second is 2, and so on | |
| 1195 | + * @return a Java input stream that delivers the database column value | |
| 1196 | + * as a stream of uninterpreted bytes; | |
| 1197 | + * if the value is SQL <code>NULL</code>, the value returned is <code>null</code> | |
| 1198 | + * @throws SQLException if (1) a database access error occurs | |
| 1199 | + * or (2) this rowset does not have a currently valid connection, | |
| 1200 | + * prepared statement, and result set | |
| 1201 | + */ | |
| 1202 | + public java.io.InputStream getBinaryStream(int columnIndex) throws SQLException { | |
| 1203 | + checkState(); | |
| 1204 | + | |
| 1205 | + return rs.getBinaryStream(columnIndex); | |
| 1206 | + } | |
| 1207 | + | |
| 1208 | + | |
| 1209 | + //====================================================================== | |
| 1210 | + // Methods for accessing results by column name | |
| 1211 | + //====================================================================== | |
| 1212 | + | |
| 1213 | + /** | |
| 1214 | + * Gets the value of the designated column in the current row | |
| 1215 | + * of this rowset's <code>ResultSet</code> object as | |
| 1216 | + * a <code>String</code>. | |
| 1217 | + * | |
| 1218 | + * @param columnName the SQL name of the column | |
| 1219 | + * @return the column value; if the value is SQL <code>NULL</code>, the | |
| 1220 | + * value returned is <code>null</code> | |
| 1221 | + * @throws SQLException if (1) a database access error occurs | |
| 1222 | + * or (2) this rowset does not have a currently valid connection, | |
| 1223 | + * prepared statement, and result set | |
| 1224 | + */ | |
| 1225 | + public String getString(String columnName) throws SQLException { | |
| 1226 | + return getString(findColumn(columnName)); | |
| 1227 | + } | |
| 1228 | + | |
| 1229 | + /** | |
| 1230 | + * Gets the value of the designated column in the current row | |
| 1231 | + * of this rowset's <code>ResultSet</code> object as | |
| 1232 | + * a <code>boolean</code>. | |
| 1233 | + * | |
| 1234 | + * @param columnName the SQL name of the column | |
| 1235 | + * @return the column value; if the value is SQL <code>NULL</code>, the | |
| 1236 | + * value returned is <code>false</code> | |
| 1237 | + * @throws SQLException if (1) a database access error occurs | |
| 1238 | + * or (2) this rowset does not have a currently valid connection, | |
| 1239 | + * prepared statement, and result set | |
| 1240 | + */ | |
| 1241 | + public boolean getBoolean(String columnName) throws SQLException { | |
| 1242 | + return getBoolean(findColumn(columnName)); | |
| 1243 | + } | |
| 1244 | + | |
| 1245 | + /** | |
| 1246 | + * Gets the value of the designated column in the current row | |
| 1247 | + * of this rowset's <code>ResultSet</code> object as | |
| 1248 | + * a <code>byte</code>. | |
| 1249 | + * | |
| 1250 | + * @param columnName the SQL name of the column | |
| 1251 | + * @return the column value; if the value is SQL <code>NULL</code>, the | |
| 1252 | + * value returned is <code>0</code> | |
| 1253 | + * @throws SQLException if (1) a database access error occurs | |
| 1254 | + * or (2) this rowset does not have a currently valid connection, | |
| 1255 | + * prepared statement, and result set | |
| 1256 | + */ | |
| 1257 | + public byte getByte(String columnName) throws SQLException { | |
| 1258 | + return getByte(findColumn(columnName)); | |
| 1259 | + } | |
| 1260 | + | |
| 1261 | + /** | |
| 1262 | + * Gets the value of the designated column in the current row | |
| 1263 | + * of this rowset's <code>ResultSet</code> object as | |
| 1264 | + * a <code>short</code>. | |
| 1265 | + * | |
| 1266 | + * @param columnName the SQL name of the column | |
| 1267 | + * @return the column value; if the value is SQL <code>NULL</code>, the | |
| 1268 | + * value returned is <code>0</code> | |
| 1269 | + * @throws SQLException if (1) a database access error occurs | |
| 1270 | + * or (2) this rowset does not have a currently valid connection, | |
| 1271 | + * prepared statement, and result set | |
| 1272 | + */ | |
| 1273 | + public short getShort(String columnName) throws SQLException { | |
| 1274 | + return getShort(findColumn(columnName)); | |
| 1275 | + } | |
| 1276 | + | |
| 1277 | + /** | |
| 1278 | + * Gets the value of the designated column in the current row | |
| 1279 | + * of this rowset's <code>ResultSet</code> object as | |
| 1280 | + * an <code>int</code>. | |
| 1281 | + * | |
| 1282 | + * @param columnName the SQL name of the column | |
| 1283 | + * @return the column value; if the value is SQL <code>NULL</code>, the | |
| 1284 | + * value returned is <code>0</code> | |
| 1285 | + * @throws SQLException if (1) a database access error occurs | |
| 1286 | + * or (2) this rowset does not have a currently valid connection, | |
| 1287 | + * prepared statement, and result set | |
| 1288 | + */ | |
| 1289 | + public int getInt(String columnName) throws SQLException { | |
| 1290 | + return getInt(findColumn(columnName)); | |
| 1291 | + } | |
| 1292 | + | |
| 1293 | + /** | |
| 1294 | + * Gets the value of the designated column in the current row | |
| 1295 | + * of this rowset's <code>ResultSet</code> object as | |
| 1296 | + * a <code>long</code>. | |
| 1297 | + * | |
| 1298 | + * @param columnName the SQL name of the column | |
| 1299 | + * @return the column value; if the value is SQL <code>NULL</code>, the | |
| 1300 | + * value returned is <code>0</code> | |
| 1301 | + * @throws SQLException if a database access error occurs | |
| 1302 | + * or this rowset does not have a currently valid connection, | |
| 1303 | + * prepared statement, and result set | |
| 1304 | + */ | |
| 1305 | + public long getLong(String columnName) throws SQLException { | |
| 1306 | + return getLong(findColumn(columnName)); | |
| 1307 | + } | |
| 1308 | + | |
| 1309 | + /** | |
| 1310 | + * Gets the value of the designated column in the current row | |
| 1311 | + * of this rowset's <code>ResultSet</code> object as | |
| 1312 | + * a <code>float</code>. | |
| 1313 | + * | |
| 1314 | + * @param columnName the SQL name of the column | |
| 1315 | + * @return the column value; if the value is SQL <code>NULL</code>, the | |
| 1316 | + * value returned is <code>0</code> | |
| 1317 | + * @throws SQLException if (1) a database access error occurs | |
| 1318 | + * or (2) this rowset does not have a currently valid connection, | |
| 1319 | + * prepared statement, and result set | |
| 1320 | + */ | |
| 1321 | + public float getFloat(String columnName) throws SQLException { | |
| 1322 | + return getFloat(findColumn(columnName)); | |
| 1323 | + } | |
| 1324 | + | |
| 1325 | + /** | |
| 1326 | + * Gets the value of the designated column in the current row | |
| 1327 | + * of this rowset's <code>ResultSet</code> object as | |
| 1328 | + * a <code>double</code>. | |
| 1329 | + * | |
| 1330 | + * @param columnName the SQL name of the column | |
| 1331 | + * @return the column value; if the value is SQL <code>NULL</code>, the | |
| 1332 | + * value returned is <code>0</code> | |
| 1333 | + * @throws SQLException if (1) a database access error occurs | |
| 1334 | + * or (2) this rowset does not have a currently valid connection, | |
| 1335 | + * prepared statement, and result set | |
| 1336 | + */ | |
| 1337 | + public double getDouble(String columnName) throws SQLException { | |
| 1338 | + return getDouble(findColumn(columnName)); | |
| 1339 | + } | |
| 1340 | + | |
| 1341 | + /** | |
| 1342 | + * Gets the value of the designated column in the current row | |
| 1343 | + * of this rowset's <code>ResultSet</code> object as | |
| 1344 | + * a <code>java.math.BigDecimal</code>. | |
| 1345 | + * | |
| 1346 | + * @param columnName the SQL name of the column | |
| 1347 | + * @param scale the number of digits to the right of the decimal point | |
| 1348 | + * @return the column value; if the value is SQL <code>NULL</code>, the | |
| 1349 | + * value returned is <code>null</code> | |
| 1350 | + * @throws SQLException if (1) adatabase access error occurs | |
| 1351 | + * or (2) this rowset does not have a currently valid connection, | |
| 1352 | + * prepared statement, and result set | |
| 1353 | + * @deprecated | |
| 1354 | + */ | |
| 1355 | + public BigDecimal getBigDecimal(String columnName, int scale) throws SQLException { | |
| 1356 | + return getBigDecimal(findColumn(columnName), scale); | |
| 1357 | + } | |
| 1358 | + | |
| 1359 | + /** | |
| 1360 | + * Gets the value of the designated column in the current row | |
| 1361 | + * of this rowset's <code>ResultSet</code> object as | |
| 1362 | + * a <code>byte</code> array in the Java programming language. | |
| 1363 | + * The bytes represent the raw values returned by the driver. | |
| 1364 | + * | |
| 1365 | + * @param columnName the SQL name of the column | |
| 1366 | + * @return the column value; if the value is SQL <code>NULL</code>, the | |
| 1367 | + * value returned is <code>null</code> | |
| 1368 | + * @throws SQLException if (1) a database access error occurs | |
| 1369 | + * or (2) this rowset does not have a currently valid connection, | |
| 1370 | + * prepared statement, and result set | |
| 1371 | + */ | |
| 1372 | + public byte[] getBytes(String columnName) throws SQLException { | |
| 1373 | + return getBytes(findColumn(columnName)); | |
| 1374 | + } | |
| 1375 | + | |
| 1376 | + /** | |
| 1377 | + * Gets the value of the designated column in the current row | |
| 1378 | + * of this rowset's <code>ResultSet</code> object as | |
| 1379 | + * a <code>java.sql.Date</code> object in the Java programming language. | |
| 1380 | + * | |
| 1381 | + * @param columnName the SQL name of the column | |
| 1382 | + * @return the column value; if the value is SQL <code>NULL</code>, the | |
| 1383 | + * value returned is <code>null</code> | |
| 1384 | + * @throws SQLException if (1) a database access error occurs | |
| 1385 | + * or (2) this rowset does not have a currently valid connection, | |
| 1386 | + * prepared statement, and result set | |
| 1387 | + */ | |
| 1388 | + public java.sql.Date getDate(String columnName) throws SQLException { | |
| 1389 | + return getDate(findColumn(columnName)); | |
| 1390 | + } | |
| 1391 | + | |
| 1392 | + /** | |
| 1393 | + * Gets the value of the designated column in the current row | |
| 1394 | + * of this rowset's <code>ResultSet</code> object as | |
| 1395 | + * a <code>java.sql.Time</code> object in the Java programming language. | |
| 1396 | + * | |
| 1397 | + * @param columnName the SQL name of the column | |
| 1398 | + * @return the column value; | |
| 1399 | + * if the value is SQL <code>NULL</code>, | |
| 1400 | + * the value returned is <code>null</code> | |
| 1401 | + * @throws SQLException if (1) a database access error occurs | |
| 1402 | + * or (2) this rowset does not have a currently valid connection, | |
| 1403 | + * prepared statement, and result set | |
| 1404 | + */ | |
| 1405 | + public java.sql.Time getTime(String columnName) throws SQLException { | |
| 1406 | + return getTime(findColumn(columnName)); | |
| 1407 | + } | |
| 1408 | + | |
| 1409 | + /** | |
| 1410 | + * Gets the value of the designated column in the current row | |
| 1411 | + * of this rowset's <code>ResultSet</code> object as | |
| 1412 | + * a <code>java.sql.Timestamp</code> object. | |
| 1413 | + * | |
| 1414 | + * @param columnName the SQL name of the column | |
| 1415 | + * @return the column value; if the value is SQL <code>NULL</code>, the | |
| 1416 | + * value returned is <code>null</code> | |
| 1417 | + * @throws SQLException if (1) a database access error occurs | |
| 1418 | + * or (2) this rowset does not have a currently valid connection, | |
| 1419 | + * prepared statement, and result set | |
| 1420 | + */ | |
| 1421 | + public java.sql.Timestamp getTimestamp(String columnName) throws SQLException { | |
| 1422 | + return getTimestamp(findColumn(columnName)); | |
| 1423 | + } | |
| 1424 | + | |
| 1425 | + /** | |
| 1426 | + * Gets the value of the designated column in the current row | |
| 1427 | + * of this rowset's <code>ResultSet</code> object as a stream of | |
| 1428 | + * ASCII characters. The value can then be read in chunks from the | |
| 1429 | + * stream. This method is particularly | |
| 1430 | + * suitable for retrieving large <code>LONGVARCHAR</code> values. | |
| 1431 | + * The JDBC driver will | |
| 1432 | + * do any necessary conversion from the database format into ASCII. | |
| 1433 | + * | |
| 1434 | + * <P><B>Note:</B> All the data in the returned stream must be | |
| 1435 | + * read prior to getting the value of any other column. The next | |
| 1436 | + * call to a <code>getXXX</code> method implicitly closes the stream. Also, a | |
| 1437 | + * stream may return <code>0</code> when the method <code>available</code> | |
| 1438 | + * is called whether there is data available or not. | |
| 1439 | + * | |
| 1440 | + * @param columnName the SQL name of the column | |
| 1441 | + * @return a Java input stream that delivers the database column value | |
| 1442 | + * as a stream of one-byte ASCII characters. | |
| 1443 | + * If the value is SQL <code>NULL</code>, | |
| 1444 | + * the value returned is <code>null</code>. | |
| 1445 | + * @throws SQLException if (1) a database access error occurs | |
| 1446 | + * or (2) this rowset does not have a currently valid connection, | |
| 1447 | + * prepared statement, and result set | |
| 1448 | + */ | |
| 1449 | + public java.io.InputStream getAsciiStream(String columnName) throws SQLException { | |
| 1450 | + return getAsciiStream(findColumn(columnName)); | |
| 1451 | + } | |
| 1452 | + | |
| 1453 | + /** | |
| 1454 | + * Gets the value of the designated column in the current row | |
| 1455 | + * of this rowset's <code>ResultSet</code> object as a stream of | |
| 1456 | + * Unicode characters. The value can then be read in chunks from the | |
| 1457 | + * stream. This method is particularly | |
| 1458 | + * suitable for retrieving large <code>LONGVARCHAR</code> values. | |
| 1459 | + * The JDBC driver will | |
| 1460 | + * do any necessary conversion from the database format into Unicode. | |
| 1461 | + * The byte format of the Unicode stream must be Java UTF-8, | |
| 1462 | + * as defined in the Java virtual machine specification. | |
| 1463 | + * | |
| 1464 | + * <P><B>Note:</B> All the data in the returned stream must be | |
| 1465 | + * read prior to getting the value of any other column. The next | |
| 1466 | + * call to a <code>getXXX</code> method implicitly closes the stream. Also, a | |
| 1467 | + * stream may return <code>0</code> when the method <code>available</code> | |
| 1468 | + * is called whether there is data available or not. | |
| 1469 | + * | |
| 1470 | + * @param columnName the SQL name of the column | |
| 1471 | + * @return a Java input stream that delivers the database column value | |
| 1472 | + * as a stream of two-byte Unicode characters. | |
| 1473 | + * If the value is SQL <code>NULL</code>, | |
| 1474 | + * the value returned is <code>null</code>. | |
| 1475 | + * @throws SQLException if (1) a database access error occurs | |
| 1476 | + * or (2) this rowset does not have a currently valid connection, | |
| 1477 | + * prepared statement, and result set | |
| 1478 | + * @deprecated | |
| 1479 | + */ | |
| 1480 | + public java.io.InputStream getUnicodeStream(String columnName) throws SQLException { | |
| 1481 | + return getUnicodeStream(findColumn(columnName)); | |
| 1482 | + } | |
| 1483 | + | |
| 1484 | + /** | |
| 1485 | + * Gets the value of the designated column in the current row | |
| 1486 | + * of this rowset's <code>ResultSet</code> object as a stream of uninterpreted | |
| 1487 | + * <code>byte</code>s. | |
| 1488 | + * The value can then be read in chunks from the | |
| 1489 | + * stream. This method is particularly | |
| 1490 | + * suitable for retrieving large <code>LONGVARBINARY</code> | |
| 1491 | + * values. | |
| 1492 | + * | |
| 1493 | + * <P><B>Note:</B> All the data in the returned stream must be | |
| 1494 | + * read prior to getting the value of any other column. The next | |
| 1495 | + * call to a <code>getXXX</code> method implicitly closes the stream. Also, a | |
| 1496 | + * stream may return <code>0</code> when the method <code>available</code> | |
| 1497 | + * is called whether there is data available or not. | |
| 1498 | + * | |
| 1499 | + * @param columnName the SQL name of the column | |
| 1500 | + * @return a Java input stream that delivers the database column value | |
| 1501 | + * as a stream of uninterpreted bytes; | |
| 1502 | + * if the value is SQL <code>NULL</code>, the result is <code>null</code> | |
| 1503 | + * @throws SQLException if (1) a database access error occurs | |
| 1504 | + * or (2) this rowset does not have a currently valid connection, | |
| 1505 | + * prepared statement, and result set | |
| 1506 | + */ | |
| 1507 | + public java.io.InputStream getBinaryStream(String columnName) throws SQLException { | |
| 1508 | + return getBinaryStream(findColumn(columnName)); | |
| 1509 | + } | |
| 1510 | + | |
| 1511 | + | |
| 1512 | + //===================================================================== | |
| 1513 | + // Advanced features: | |
| 1514 | + //===================================================================== | |
| 1515 | + | |
| 1516 | + /** | |
| 1517 | + * Returns the first warning reported by calls on this rowset's | |
| 1518 | + * <code>ResultSet</code> object. | |
| 1519 | + * Subsequent warnings on this rowset's <code>ResultSet</code> object | |
| 1520 | + * will be chained to the <code>SQLWarning</code> object that | |
| 1521 | + * this method returns. | |
| 1522 | + * | |
| 1523 | + * <P>The warning chain is automatically cleared each time a new | |
| 1524 | + * row is read. | |
| 1525 | + * | |
| 1526 | + * <P><B>Note:</B> This warning chain only covers warnings caused | |
| 1527 | + * by <code>ResultSet</code> methods. Any warning caused by | |
| 1528 | + * <code>Statement</code> methods | |
| 1529 | + * (such as reading OUT parameters) will be chained on the | |
| 1530 | + * <code>Statement</code> object. | |
| 1531 | + * | |
| 1532 | + * @return the first <code>SQLWarning</code> object reported or <code>null</code> | |
| 1533 | + * @throws SQLException if (1) a database access error occurs | |
| 1534 | + * or (2) this rowset does not have a currently valid connection, | |
| 1535 | + * prepared statement, and result set | |
| 1536 | + */ | |
| 1537 | + public SQLWarning getWarnings() throws SQLException { | |
| 1538 | + checkState(); | |
| 1539 | + | |
| 1540 | + return rs.getWarnings(); | |
| 1541 | + } | |
| 1542 | + | |
| 1543 | + /** | |
| 1544 | + * Clears all warnings reported on this rowset's <code>ResultSet</code> object. | |
| 1545 | + * After this method is called, the method <code>getWarnings</code> | |
| 1546 | + * returns <code>null</code> until a new warning is | |
| 1547 | + * reported for this rowset's <code>ResultSet</code> object. | |
| 1548 | + * | |
| 1549 | + * @throws SQLException if (1) a database access error occurs | |
| 1550 | + * or (2) this rowset does not have a currently valid connection, | |
| 1551 | + * prepared statement, and result set | |
| 1552 | + */ | |
| 1553 | + public void clearWarnings() throws SQLException { | |
| 1554 | + checkState(); | |
| 1555 | + | |
| 1556 | + rs.clearWarnings(); | |
| 1557 | + } | |
| 1558 | + | |
| 1559 | + /** | |
| 1560 | + * Gets the name of the SQL cursor used by this rowset's <code>ResultSet</code> | |
| 1561 | + * object. | |
| 1562 | + * | |
| 1563 | + * <P>In SQL, a result table is retrieved through a cursor that is | |
| 1564 | + * named. The current row of a result set can be updated or deleted | |
| 1565 | + * using a positioned update/delete statement that references the | |
| 1566 | + * cursor name. To insure that the cursor has the proper isolation | |
| 1567 | + * level to support update, the cursor's <code>select</code> statement should be | |
| 1568 | + * of the form 'select for update'. If the 'for update' clause is | |
| 1569 | + * omitted, the positioned updates may fail. | |
| 1570 | + * | |
| 1571 | + * <P>The JDBC API supports this SQL feature by providing the name of the | |
| 1572 | + * SQL cursor used by a <code>ResultSet</code> object. | |
| 1573 | + * The current row of a <code>ResultSet</code> object | |
| 1574 | + * is also the current row of this SQL cursor. | |
| 1575 | + * | |
| 1576 | + * <P><B>Note:</B> If positioned update is not supported, a | |
| 1577 | + * <code>SQLException</code> is thrown. | |
| 1578 | + * | |
| 1579 | + * @return the SQL name for this rowset's <code>ResultSet</code> object's cursor | |
| 1580 | + * @throws SQLException if (1) a database access error occurs | |
| 1581 | + * or (2) xthis rowset does not have a currently valid connection, | |
| 1582 | + * prepared statement, and result set | |
| 1583 | + */ | |
| 1584 | + public String getCursorName() throws SQLException { | |
| 1585 | + checkState(); | |
| 1586 | + | |
| 1587 | + return rs.getCursorName(); | |
| 1588 | + } | |
| 1589 | + | |
| 1590 | + /** | |
| 1591 | + * Retrieves the number, types and properties of | |
| 1592 | + * this rowset's <code>ResultSet</code> object's columns. | |
| 1593 | + * | |
| 1594 | + * @return the description of this rowset's <code>ResultSet</code> | |
| 1595 | + * object's columns | |
| 1596 | + * @throws SQLException if (1) a database access error occurs | |
| 1597 | + * or (2) this rowset does not have a currently valid connection, | |
| 1598 | + * prepared statement, and result set | |
| 1599 | + */ | |
| 1600 | + public ResultSetMetaData getMetaData() throws SQLException { | |
| 1601 | + | |
| 1602 | + checkState(); | |
| 1603 | + | |
| 1604 | + // It may be the case that JdbcRowSet might not have been | |
| 1605 | + // initialized with ResultSet handle and may be by PreparedStatement | |
| 1606 | + // internally when we set JdbcRowSet.setCommand(). | |
| 1607 | + // We may require all the basic properties of setEscapeProcessing | |
| 1608 | + // setMaxFieldSize etc. which an application can use before we call | |
| 1609 | + // execute. | |
| 1610 | + try { | |
| 1611 | + checkState(); | |
| 1612 | + } catch(SQLException sqle) { | |
| 1613 | + prepare(); | |
| 1614 | + // will return ResultSetMetaData | |
| 1615 | + return ps.getMetaData(); | |
| 1616 | + } | |
| 1617 | + return rs.getMetaData(); | |
| 1618 | + } | |
| 1619 | + | |
| 1620 | + /** | |
| 1621 | + * <p>Gets the value of the designated column in the current row | |
| 1622 | + * of this rowset's <code>ResultSet</code> object as | |
| 1623 | + * an <code>Object</code>. | |
| 1624 | + * | |
| 1625 | + * <p>This method will return the value of the given column as a | |
| 1626 | + * Java object. The type of the Java object will be the default | |
| 1627 | + * Java object type corresponding to the column's SQL type, | |
| 1628 | + * following the mapping for built-in types specified in the JDBC | |
| 1629 | + * specification. | |
| 1630 | + * | |
| 1631 | + * <p>This method may also be used to read datatabase-specific | |
| 1632 | + * abstract data types. | |
| 1633 | + * | |
| 1634 | + * In the JDBC 3.0 API, the behavior of method | |
| 1635 | + * <code>getObject</code> is extended to materialize | |
| 1636 | + * data of SQL user-defined types. When a column contains | |
| 1637 | + * a structured or distinct value, the behavior of this method is as | |
| 1638 | + * if it were a call to: <code>getObject(columnIndex, | |
| 1639 | + * this.getStatement().getConnection().getTypeMap())</code>. | |
| 1640 | + * | |
| 1641 | + * @param columnIndex the first column is 1, the second is 2, and so on | |
| 1642 | + * @return a <code>java.lang.Object</code> holding the column value | |
| 1643 | + * @throws SQLException if (1) a database access error occurs | |
| 1644 | + * or (2) this rowset does not currently have a valid connection, | |
| 1645 | + * prepared statement, and result set | |
| 1646 | + */ | |
| 1647 | + public Object getObject(int columnIndex) throws SQLException { | |
| 1648 | + checkState(); | |
| 1649 | + | |
| 1650 | + return rs.getObject(columnIndex); | |
| 1651 | + } | |
| 1652 | + | |
| 1653 | + /** | |
| 1654 | + * <p>Gets the value of the designated column in the current row | |
| 1655 | + * of this rowset's <code>ResultSet</code> object as | |
| 1656 | + * an <code>Object</code>. | |
| 1657 | + * | |
| 1658 | + * <p>This method will return the value of the given column as a | |
| 1659 | + * Java object. The type of the Java object will be the default | |
| 1660 | + * Java object type corresponding to the column's SQL type, | |
| 1661 | + * following the mapping for built-in types specified in the JDBC | |
| 1662 | + * specification. | |
| 1663 | + * | |
| 1664 | + * <p>This method may also be used to read datatabase-specific | |
| 1665 | + * abstract data types. | |
| 1666 | + * | |
| 1667 | + * In the JDBC 3.0 API, the behavior of the method | |
| 1668 | + * <code>getObject</code> is extended to materialize | |
| 1669 | + * data of SQL user-defined types. When a column contains | |
| 1670 | + * a structured or distinct value, the behavior of this method is as | |
| 1671 | + * if it were a call to: <code>getObject(columnIndex, | |
| 1672 | + * this.getStatement().getConnection().getTypeMap())</code>. | |
| 1673 | + * | |
| 1674 | + * @param columnName the SQL name of the column | |
| 1675 | + * @return a <code>java.lang.Object</code> holding the column value | |
| 1676 | + * @throws SQLException if (1) a database access error occurs | |
| 1677 | + * or (2) this rowset does not currently have a valid connection, | |
| 1678 | + * prepared statement, and result set | |
| 1679 | + */ | |
| 1680 | + public Object getObject(String columnName) throws SQLException { | |
| 1681 | + return getObject(findColumn(columnName)); | |
| 1682 | + } | |
| 1683 | + | |
| 1684 | + //---------------------------------------------------------------- | |
| 1685 | + | |
| 1686 | + /** | |
| 1687 | + * Maps the given <code>JdbcRowSetImpl</code> column name to its | |
| 1688 | + * <code>JdbcRowSetImpl</code> column index and reflects this on | |
| 1689 | + * the internal <code>ResultSet</code> object. | |
| 1690 | + * | |
| 1691 | + * @param columnName the name of the column | |
| 1692 | + * @return the column index of the given column name | |
| 1693 | + * @throws SQLException if (1) a database access error occurs | |
| 1694 | + * (2) this rowset does not have a currently valid connection, | |
| 1695 | + * prepared statement, and result set | |
| 1696 | + */ | |
| 1697 | + public int findColumn(String columnName) throws SQLException { | |
| 1698 | + checkState(); | |
| 1699 | + | |
| 1700 | + return rs.findColumn(columnName); | |
| 1701 | + } | |
| 1702 | + | |
| 1703 | + | |
| 1704 | + //--------------------------JDBC 2.0----------------------------------- | |
| 1705 | + | |
| 1706 | + //--------------------------------------------------------------------- | |
| 1707 | + // Getters and Setters | |
| 1708 | + //--------------------------------------------------------------------- | |
| 1709 | + | |
| 1710 | + /** | |
| 1711 | + * Gets the value of the designated column in the current row | |
| 1712 | + * of this rowset's <code>ResultSet</code> object as a | |
| 1713 | + * <code>java.io.Reader</code> object. | |
| 1714 | + * @return a <code>java.io.Reader</code> object that contains the column | |
| 1715 | + * value; if the value is SQL <code>NULL</code>, the value returned is | |
| 1716 | + * <code>null</code>. | |
| 1717 | + * @param columnIndex the first column is 1, the second is 2, and so on | |
| 1718 | + * | |
| 1719 | + */ | |
| 1720 | + public java.io.Reader getCharacterStream(int columnIndex) throws SQLException { | |
| 1721 | + checkState(); | |
| 1722 | + | |
| 1723 | + return rs.getCharacterStream(columnIndex); | |
| 1724 | + } | |
| 1725 | + | |
| 1726 | + /** | |
| 1727 | + * Gets the value of the designated column in the current row | |
| 1728 | + * of this rowset's <code>ResultSet</code> object as a | |
| 1729 | + * <code>java.io.Reader</code> object. | |
| 1730 | + * | |
| 1731 | + * @return a <code>java.io.Reader</code> object that contains the column | |
| 1732 | + * value; if the value is SQL <code>NULL</code>, the value returned is | |
| 1733 | + * <code>null</code>. | |
| 1734 | + * @param columnName the name of the column | |
| 1735 | + * @return the value in the specified column as a <code>java.io.Reader</code> | |
| 1736 | + * | |
| 1737 | + */ | |
| 1738 | + public java.io.Reader getCharacterStream(String columnName) throws SQLException { | |
| 1739 | + return getCharacterStream(findColumn(columnName)); | |
| 1740 | + } | |
| 1741 | + | |
| 1742 | + /** | |
| 1743 | + * Gets the value of the designated column in the current row | |
| 1744 | + * of this rowset's <code>ResultSet</code> object as a | |
| 1745 | + * <code>java.math.BigDecimal</code> with full precision. | |
| 1746 | + * | |
| 1747 | + * @param columnIndex the first column is 1, the second is 2, and so on | |
| 1748 | + * @return the column value (full precision); | |
| 1749 | + * if the value is SQL <code>NULL</code>, the value returned is | |
| 1750 | + * <code>null</code>. | |
| 1751 | + * @throws SQLException if a database access error occurs | |
| 1752 | + * or this rowset does not currently have a valid | |
| 1753 | + * connection, prepared statement, and result set | |
| 1754 | + */ | |
| 1755 | + public BigDecimal getBigDecimal(int columnIndex) throws SQLException { | |
| 1756 | + checkState(); | |
| 1757 | + | |
| 1758 | + return rs.getBigDecimal(columnIndex); | |
| 1759 | + } | |
| 1760 | + | |
| 1761 | + /** | |
| 1762 | + * Gets the value of the designated column in the current row | |
| 1763 | + * of this rowset's <code>ResultSet</code> object as a | |
| 1764 | + * <code>java.math.BigDecimal</code> with full precision. | |
| 1765 | + * | |
| 1766 | + * @param columnName the column name | |
| 1767 | + * @return the column value (full precision); | |
| 1768 | + * if the value is SQL <code>NULL</code>, the value returned is | |
| 1769 | + * <code>null</code>. | |
| 1770 | + * @throws SQLException if a database access error occurs | |
| 1771 | + * or this rowset does not currently have a valid | |
| 1772 | + * connection, prepared statement, and result set | |
| 1773 | + */ | |
| 1774 | + public BigDecimal getBigDecimal(String columnName) throws SQLException { | |
| 1775 | + return getBigDecimal(findColumn(columnName)); | |
| 1776 | + } | |
| 1777 | + | |
| 1778 | + //--------------------------------------------------------------------- | |
| 1779 | + // Traversal/Positioning | |
| 1780 | + //--------------------------------------------------------------------- | |
| 1781 | + | |
| 1782 | + /** | |
| 1783 | + * Indicates whether the cursor is before the first row in | |
| 1784 | + * this rowset's <code>ResultSet</code> object. | |
| 1785 | + * | |
| 1786 | + * @return <code>true</code> if the cursor is before the first row; | |
| 1787 | + * <code>false</code> if the cursor is at any other position or the | |
| 1788 | + * result set contains no rows | |
| 1789 | + * @throws SQLException if a database access error occurs | |
| 1790 | + * or this rowset does not currently have a valid | |
| 1791 | + * connection, prepared statement, and result set | |
| 1792 | + */ | |
| 1793 | + public boolean isBeforeFirst() throws SQLException { | |
| 1794 | + checkState(); | |
| 1795 | + | |
| 1796 | + return rs.isBeforeFirst(); | |
| 1797 | + } | |
| 1798 | + | |
| 1799 | + /** | |
| 1800 | + * Indicates whether the cursor is after the last row in | |
| 1801 | + * this rowset's <code>ResultSet</code> object. | |
| 1802 | + * | |
| 1803 | + * @return <code>true</code> if the cursor is after the last row; | |
| 1804 | + * <code>false</code> if the cursor is at any other position or the | |
| 1805 | + * result set contains no rows | |
| 1806 | + * @throws SQLException if a database access error occurs | |
| 1807 | + * or this rowset does not currently have a valid | |
| 1808 | + * connection, prepared statement, and result set | |
| 1809 | + */ | |
| 1810 | + public boolean isAfterLast() throws SQLException { | |
| 1811 | + checkState(); | |
| 1812 | + | |
| 1813 | + return rs.isAfterLast(); | |
| 1814 | + } | |
| 1815 | + | |
| 1816 | + /** | |
| 1817 | + * Indicates whether the cursor is on the first row of | |
| 1818 | + * this rowset's <code>ResultSet</code> object. | |
| 1819 | + * | |
| 1820 | + * @return <code>true</code> if the cursor is on the first row; | |
| 1821 | + * <code>false</code> otherwise | |
| 1822 | + * @throws SQLException if a database access error occurs | |
| 1823 | + * or this rowset does not currently have a valid | |
| 1824 | + * connection, prepared statement, and result set | |
| 1825 | + */ | |
| 1826 | + public boolean isFirst() throws SQLException { | |
| 1827 | + checkState(); | |
| 1828 | + | |
| 1829 | + return rs.isFirst(); | |
| 1830 | + } | |
| 1831 | + | |
| 1832 | + /** | |
| 1833 | + * Indicates whether the cursor is on the last row of | |
| 1834 | + * this rowset's <code>ResultSet</code> object. | |
| 1835 | + * Note: Calling the method <code>isLast</code> may be expensive | |
| 1836 | + * because the JDBC driver | |
| 1837 | + * might need to fetch ahead one row in order to determine | |
| 1838 | + * whether the current row is the last row in the result set. | |
| 1839 | + * | |
| 1840 | + * @return <code>true</code> if the cursor is on the last row; | |
| 1841 | + * <code>false</code> otherwise | |
| 1842 | + * @throws SQLException if a database access error occurs | |
| 1843 | + * or this rowset does not currently have a valid | |
| 1844 | + * connection, prepared statement, and result set | |
| 1845 | + * | |
| 1846 | + */ | |
| 1847 | + public boolean isLast() throws SQLException { | |
| 1848 | + checkState(); | |
| 1849 | + | |
| 1850 | + return rs.isLast(); | |
| 1851 | + } | |
| 1852 | + | |
| 1853 | + /** | |
| 1854 | + * Moves the cursor to the front of | |
| 1855 | + * this rowset's <code>ResultSet</code> object, just before the | |
| 1856 | + * first row. This method has no effect if the result set contains no rows. | |
| 1857 | + * | |
| 1858 | + * @throws SQLException if (1) a database access error occurs, | |
| 1859 | + * (2) the result set type is <code>TYPE_FORWARD_ONLY</code>, | |
| 1860 | + * or (3) this rowset does not currently have a valid | |
| 1861 | + * connection, prepared statement, and result set | |
| 1862 | + */ | |
| 1863 | + public void beforeFirst() throws SQLException { | |
| 1864 | + checkState(); | |
| 1865 | + | |
| 1866 | + rs.beforeFirst(); | |
| 1867 | + notifyCursorMoved(); | |
| 1868 | + } | |
| 1869 | + | |
| 1870 | + /** | |
| 1871 | + * Moves the cursor to the end of | |
| 1872 | + * this rowset's <code>ResultSet</code> object, just after the | |
| 1873 | + * last row. This method has no effect if the result set contains no rows. | |
| 1874 | + * @throws SQLException if (1) a database access error occurs, | |
| 1875 | + * (2) the result set type is <code>TYPE_FORWARD_ONLY</code>, | |
| 1876 | + * or (3) this rowset does not currently have a valid | |
| 1877 | + * connection, prepared statement, and result set | |
| 1878 | + */ | |
| 1879 | + public void afterLast() throws SQLException { | |
| 1880 | + checkState(); | |
| 1881 | + | |
| 1882 | + rs.afterLast(); | |
| 1883 | + notifyCursorMoved(); | |
| 1884 | + } | |
| 1885 | + | |
| 1886 | + /** | |
| 1887 | + * Moves the cursor to the first row in | |
| 1888 | + * this rowset's <code>ResultSet</code> object. | |
| 1889 | + * | |
| 1890 | + * @return <code>true</code> if the cursor is on a valid row; | |
| 1891 | + * <code>false</code> if there are no rows in the result set | |
| 1892 | + * @throws SQLException if (1) a database access error occurs, | |
| 1893 | + * (2) the result set type is <code>TYPE_FORWARD_ONLY</code>, | |
| 1894 | + * or (3) this rowset does not currently have a valid | |
| 1895 | + * connection, prepared statement, and result set | |
| 1896 | + */ | |
| 1897 | + public boolean first() throws SQLException { | |
| 1898 | + checkState(); | |
| 1899 | + | |
| 1900 | + boolean b = rs.first(); | |
| 1901 | + notifyCursorMoved(); | |
| 1902 | + return b; | |
| 1903 | + | |
| 1904 | + } | |
| 1905 | + | |
| 1906 | + /** | |
| 1907 | + * Moves the cursor to the last row in | |
| 1908 | + * this rowset's <code>ResultSet</code> object. | |
| 1909 | + * | |
| 1910 | + * @return <code>true</code> if the cursor is on a valid row; | |
| 1911 | + * <code>false</code> if there are no rows in the result set | |
| 1912 | + * @throws SQLException if (1) a database access error occurs, | |
| 1913 | + * (2) the result set type is <code>TYPE_FORWARD_ONLY</code>, | |
| 1914 | + * or (3) this rowset does not currently have a valid | |
| 1915 | + * connection, prepared statement, and result set | |
| 1916 | + */ | |
| 1917 | + public boolean last() throws SQLException { | |
| 1918 | + checkState(); | |
| 1919 | + | |
| 1920 | + boolean b = rs.last(); | |
| 1921 | + notifyCursorMoved(); | |
| 1922 | + return b; | |
| 1923 | + } | |
| 1924 | + | |
| 1925 | + /** | |
| 1926 | + * Retrieves the current row number. The first row is number 1, the | |
| 1927 | + * second is number 2, and so on. | |
| 1928 | + * | |
| 1929 | + * @return the current row number; <code>0</code> if there is no current row | |
| 1930 | + * @throws SQLException if a database access error occurs | |
| 1931 | + * or this rowset does not currently have a valid connection, | |
| 1932 | + * prepared statement, and result set | |
| 1933 | + */ | |
| 1934 | + public int getRow() throws SQLException { | |
| 1935 | + checkState(); | |
| 1936 | + | |
| 1937 | + return rs.getRow(); | |
| 1938 | + } | |
| 1939 | + | |
| 1940 | + /** | |
| 1941 | + * Moves the cursor to the given row number in | |
| 1942 | + * this rowset's internal <code>ResultSet</code> object. | |
| 1943 | + * | |
| 1944 | + * <p>If the row number is positive, the cursor moves to | |
| 1945 | + * the given row number with respect to the | |
| 1946 | + * beginning of the result set. The first row is row 1, the second | |
| 1947 | + * is row 2, and so on. | |
| 1948 | + * | |
| 1949 | + * <p>If the given row number is negative, the cursor moves to | |
| 1950 | + * an absolute row position with respect to | |
| 1951 | + * the end of the result set. For example, calling the method | |
| 1952 | + * <code>absolute(-1)</code> positions the | |
| 1953 | + * cursor on the last row, calling the method <code>absolute(-2)</code> | |
| 1954 | + * moves the cursor to the next-to-last row, and so on. | |
| 1955 | + * | |
| 1956 | + * <p>An attempt to position the cursor beyond the first/last row in | |
| 1957 | + * the result set leaves the cursor before the first row or after | |
| 1958 | + * the last row. | |
| 1959 | + * | |
| 1960 | + * <p><B>Note:</B> Calling <code>absolute(1)</code> is the same | |
| 1961 | + * as calling <code>first()</code>. Calling <code>absolute(-1)</code> | |
| 1962 | + * is the same as calling <code>last()</code>. | |
| 1963 | + * | |
| 1964 | + * @return <code>true</code> if the cursor is on the result set; | |
| 1965 | + * <code>false</code> otherwise | |
| 1966 | + * @throws SQLException if (1) a database access error occurs, | |
| 1967 | + * (2) the row is <code>0</code>, (3) the result set | |
| 1968 | + * type is <code>TYPE_FORWARD_ONLY</code>, or (4) this | |
| 1969 | + * rowset does not currently have a valid connection, | |
| 1970 | + * prepared statement, and result set | |
| 1971 | + */ | |
| 1972 | + public boolean absolute(int row) throws SQLException { | |
| 1973 | + checkState(); | |
| 1974 | + | |
| 1975 | + boolean b = rs.absolute(row); | |
| 1976 | + notifyCursorMoved(); | |
| 1977 | + return b; | |
| 1978 | + } | |
| 1979 | + | |
| 1980 | + /** | |
| 1981 | + * Moves the cursor a relative number of rows, either positive or negative. | |
| 1982 | + * Attempting to move beyond the first/last row in the | |
| 1983 | + * result set positions the cursor before/after the | |
| 1984 | + * the first/last row. Calling <code>relative(0)</code> is valid, but does | |
| 1985 | + * not change the cursor position. | |
| 1986 | + * | |
| 1987 | + * <p>Note: Calling the method <code>relative(1)</code> | |
| 1988 | + * is different from calling the method <code>next()</code> | |
| 1989 | + * because is makes sense to call <code>next()</code> when there | |
| 1990 | + * is no current row, | |
| 1991 | + * for example, when the cursor is positioned before the first row | |
| 1992 | + * or after the last row of the result set. | |
| 1993 | + * | |
| 1994 | + * @return <code>true</code> if the cursor is on a row; | |
| 1995 | + * <code>false</code> otherwise | |
| 1996 | + * @throws SQLException if (1) a database access error occurs, | |
| 1997 | + * (2) there is no current row, (3) the result set | |
| 1998 | + * type is <code>TYPE_FORWARD_ONLY</code>, or (4) this | |
| 1999 | + * rowset does not currently have a valid connection, | |
| 2000 | + * prepared statement, and result set | |
| 2001 | + */ | |
| 2002 | + public boolean relative(int rows) throws SQLException { | |
| 2003 | + checkState(); | |
| 2004 | + | |
| 2005 | + boolean b = rs.relative(rows); | |
| 2006 | + notifyCursorMoved(); | |
| 2007 | + return b; | |
| 2008 | + } | |
| 2009 | + | |
| 2010 | + /** | |
| 2011 | + * Moves the cursor to the previous row in this | |
| 2012 | + * <code>ResultSet</code> object. | |
| 2013 | + * | |
| 2014 | + * <p><B>Note:</B> Calling the method <code>previous()</code> is not the same as | |
| 2015 | + * calling the method <code>relative(-1)</code> because it | |
| 2016 | + * makes sense to call <code>previous()</code> when there is no current row. | |
| 2017 | + * | |
| 2018 | + * @return <code>true</code> if the cursor is on a valid row; | |
| 2019 | + * <code>false</code> if it is off the result set | |
| 2020 | + * @throws SQLException if (1) a database access error occurs, | |
| 2021 | + * (2) the result set type is <code>TYPE_FORWARD_ONLY</code>, | |
| 2022 | + * or (3) this rowset does not currently have a valid | |
| 2023 | + * connection, prepared statement, and result set | |
| 2024 | + */ | |
| 2025 | + public boolean previous() throws SQLException { | |
| 2026 | + checkState(); | |
| 2027 | + | |
| 2028 | + boolean b = rs.previous(); | |
| 2029 | + notifyCursorMoved(); | |
| 2030 | + return b; | |
| 2031 | + } | |
| 2032 | + | |
| 2033 | + /** | |
| 2034 | + * Gives a hint as to the direction in which the rows in this | |
| 2035 | + * <code>ResultSet</code> object will be processed. | |
| 2036 | + * The initial value is determined by the | |
| 2037 | + * <code>Statement</code> object | |
| 2038 | + * that produced this rowset's <code>ResultSet</code> object. | |
| 2039 | + * The fetch direction may be changed at any time. | |
| 2040 | + * | |
| 2041 | + * @throws SQLException if (1) a database access error occurs, | |
| 2042 | + * (2) the result set type is <code>TYPE_FORWARD_ONLY</code> | |
| 2043 | + * and the fetch direction is not <code>FETCH_FORWARD</code>, | |
| 2044 | + * or (3) this rowset does not currently have a valid | |
| 2045 | + * connection, prepared statement, and result set | |
| 2046 | + * @see java.sql.Statement#setFetchDirection | |
| 2047 | + */ | |
| 2048 | + public void setFetchDirection(int direction) throws SQLException { | |
| 2049 | + checkState(); | |
| 2050 | + | |
| 2051 | + rs.setFetchDirection(direction); | |
| 2052 | + } | |
| 2053 | + | |
| 2054 | + /** | |
| 2055 | + * Returns the fetch direction for this | |
| 2056 | + * <code>ResultSet</code> object. | |
| 2057 | + * | |
| 2058 | + * @return the current fetch direction for this rowset's | |
| 2059 | + * <code>ResultSet</code> object | |
| 2060 | + * @throws SQLException if a database access error occurs | |
| 2061 | + * or this rowset does not currently have a valid connection, | |
| 2062 | + * prepared statement, and result set | |
| 2063 | + */ | |
| 2064 | + public int getFetchDirection() throws SQLException { | |
| 2065 | + try { | |
| 2066 | + checkState(); | |
| 2067 | + } catch(SQLException sqle) { | |
| 2068 | + super.getFetchDirection(); | |
| 2069 | + } | |
| 2070 | + return rs.getFetchDirection(); | |
| 2071 | + } | |
| 2072 | + | |
| 2073 | + /** | |
| 2074 | + * Gives the JDBC driver a hint as to the number of rows that should | |
| 2075 | + * be fetched from the database when more rows are needed for this | |
| 2076 | + * <code>ResultSet</code> object. | |
| 2077 | + * If the fetch size specified is zero, the JDBC driver | |
| 2078 | + * ignores the value and is free to make its own best guess as to what | |
| 2079 | + * the fetch size should be. The default value is set by the | |
| 2080 | + * <code>Statement</code> object | |
| 2081 | + * that created the result set. The fetch size may be changed at any time. | |
| 2082 | + * | |
| 2083 | + * @param rows the number of rows to fetch | |
| 2084 | + * @throws SQLException if (1) a database access error occurs, (2) the | |
| 2085 | + * condition <code>0 <= rows <= this.getMaxRows()</code> is not | |
| 2086 | + * satisfied, or (3) this rowset does not currently have a valid | |
| 2087 | + * connection, prepared statement, and result set | |
| 2088 | + * | |
| 2089 | + */ | |
| 2090 | + public void setFetchSize(int rows) throws SQLException { | |
| 2091 | + checkState(); | |
| 2092 | + | |
| 2093 | + rs.setFetchSize(rows); | |
| 2094 | + } | |
| 2095 | + | |
| 2096 | + /** | |
| 2097 | + * | |
| 2098 | + * Returns the fetch size for this | |
| 2099 | + * <code>ResultSet</code> object. | |
| 2100 | + * | |
| 2101 | + * @return the current fetch size for this rowset's <code>ResultSet</code> object | |
| 2102 | + * @throws SQLException if a database access error occurs | |
| 2103 | + * or this rowset does not currently have a valid connection, | |
| 2104 | + * prepared statement, and result set | |
| 2105 | + */ | |
| 2106 | + public int getType() throws SQLException { | |
| 2107 | + try { | |
| 2108 | + checkState(); | |
| 2109 | + } catch(SQLException sqle) { | |
| 2110 | + return super.getType(); | |
| 2111 | + } | |
| 2112 | + | |
| 2113 | + // If the ResultSet has not been created, then return the default type | |
| 2114 | + // otherwise return the type from the ResultSet. | |
| 2115 | + if(rs == null) { | |
| 2116 | + return super.getType(); | |
| 2117 | + } else { | |
| 2118 | + int rstype = rs.getType(); | |
| 2119 | + return rstype; | |
| 2120 | + } | |
| 2121 | + | |
| 2122 | + | |
| 2123 | + } | |
| 2124 | + | |
| 2125 | + /** | |
| 2126 | + * Returns the concurrency mode of this rowset's <code>ResultSet</code> object. | |
| 2127 | + * The concurrency used is determined by the | |
| 2128 | + * <code>Statement</code> object that created the result set. | |
| 2129 | + * | |
| 2130 | + * @return the concurrency type, either <code>CONCUR_READ_ONLY</code> | |
| 2131 | + * or <code>CONCUR_UPDATABLE</code> | |
| 2132 | + * @throws SQLException if (1) a database access error occurs | |
| 2133 | + * or (2) this rowset does not currently have a valid connection, | |
| 2134 | + * prepared statement, and result set | |
| 2135 | + */ | |
| 2136 | + public int getConcurrency() throws SQLException { | |
| 2137 | + try { | |
| 2138 | + checkState(); | |
| 2139 | + } catch(SQLException sqle) { | |
| 2140 | + super.getConcurrency(); | |
| 2141 | + } | |
| 2142 | + return rs.getConcurrency(); | |
| 2143 | + } | |
| 2144 | + | |
| 2145 | + //--------------------------------------------------------------------- | |
| 2146 | + // Updates | |
| 2147 | + //--------------------------------------------------------------------- | |
| 2148 | + | |
| 2149 | + /** | |
| 2150 | + * Indicates whether the current row has been updated. The value returned | |
| 2151 | + * depends on whether or not the result set can detect updates. | |
| 2152 | + * | |
| 2153 | + * @return <code>true</code> if the row has been visibly updated | |
| 2154 | + * by the owner or another, and updates are detected | |
| 2155 | + * @throws SQLException if a database access error occurs | |
| 2156 | + * or this rowset does not currently have a valid connection, | |
| 2157 | + * prepared statement, and result set | |
| 2158 | + * @see java.sql.DatabaseMetaData#updatesAreDetected | |
| 2159 | + */ | |
| 2160 | + public boolean rowUpdated() throws SQLException { | |
| 2161 | + checkState(); | |
| 2162 | + | |
| 2163 | + return rs.rowUpdated(); | |
| 2164 | + } | |
| 2165 | + | |
| 2166 | + /** | |
| 2167 | + * Indicates whether the current row has had an insertion. | |
| 2168 | + * The value returned depends on whether or not this | |
| 2169 | + * <code>ResultSet</code> object can detect visible inserts. | |
| 2170 | + * | |
| 2171 | + * @return <code>true</code> if a row has had an insertion | |
| 2172 | + * and insertions are detected; <code>false</code> otherwise | |
| 2173 | + * @throws SQLException if a database access error occurs | |
| 2174 | + * or this rowset does not currently have a valid connection, | |
| 2175 | + * prepared statement, and result set | |
| 2176 | + * @see java.sql.DatabaseMetaData#insertsAreDetected | |
| 2177 | + * | |
| 2178 | + */ | |
| 2179 | + public boolean rowInserted() throws SQLException { | |
| 2180 | + checkState(); | |
| 2181 | + | |
| 2182 | + return rs.rowInserted(); | |
| 2183 | + } | |
| 2184 | + | |
| 2185 | + /** | |
| 2186 | + * Indicates whether a row has been deleted. A deleted row may leave | |
| 2187 | + * a visible "hole" in a result set. This method can be used to | |
| 2188 | + * detect holes in a result set. The value returned depends on whether | |
| 2189 | + * or not this rowset's <code>ResultSet</code> object can detect deletions. | |
| 2190 | + * | |
| 2191 | + * @return <code>true</code> if a row was deleted and deletions are detected; | |
| 2192 | + * <code>false</code> otherwise | |
| 2193 | + * @throws SQLException if a database access error occurs | |
| 2194 | + * or this rowset does not currently have a valid connection, | |
| 2195 | + * prepared statement, and result set | |
| 2196 | + * @see java.sql.DatabaseMetaData#deletesAreDetected | |
| 2197 | + */ | |
| 2198 | + public boolean rowDeleted() throws SQLException { | |
| 2199 | + checkState(); | |
| 2200 | + | |
| 2201 | + return rs.rowDeleted(); | |
| 2202 | + } | |
| 2203 | + | |
| 2204 | + /** | |
| 2205 | + * Gives a nullable column a null value. | |
| 2206 | + * | |
| 2207 | + * The <code>updateXXX</code> methods are used to update column values in the | |
| 2208 | + * current row or the insert row. The <code>updateXXX</code> methods do not | |
| 2209 | + * update the underlying database; instead the <code>updateRow</code> | |
| 2210 | + * or <code>insertRow</code> methods are called to update the database. | |
| 2211 | + * | |
| 2212 | + * @param columnIndex the first column is 1, the second is 2, and so on | |
| 2213 | + * @throws SQLException if a database access error occurs | |
| 2214 | + * or this rowset does not currently have a valid connection, | |
| 2215 | + * prepared statement, and result set | |
| 2216 | + */ | |
| 2217 | + public void updateNull(int columnIndex) throws SQLException { | |
| 2218 | + checkState(); | |
| 2219 | + | |
| 2220 | + // To check the type and concurrency of the ResultSet | |
| 2221 | + // to verify whether updates are possible or not | |
| 2222 | + checkTypeConcurrency(); | |
| 2223 | + | |
| 2224 | + rs.updateNull(columnIndex); | |
| 2225 | + } | |
| 2226 | + | |
| 2227 | + /** | |
| 2228 | + * Updates the designated column with a <code>boolean</code> value. | |
| 2229 | + * The <code>updateXXX</code> methods are used to update column values in the | |
| 2230 | + * current row or the insert row. The <code>updateXXX</code> methods do not | |
| 2231 | + * update the underlying database; instead the <code>updateRow</code> or | |
| 2232 | + * <code>insertRow</code> methods are called to update the database. | |
| 2233 | + * | |
| 2234 | + * @param columnIndex the first column is 1, the second is 2, and so on | |
| 2235 | + * @param x the new column value | |
| 2236 | + * @throws SQLException if a database access error occurs | |
| 2237 | + * or this rowset does not currently have a valid connection, | |
| 2238 | + * prepared statement, and result set | |
| 2239 | + * | |
| 2240 | + */ | |
| 2241 | + public void updateBoolean(int columnIndex, boolean x) throws SQLException { | |
| 2242 | + checkState(); | |
| 2243 | + | |
| 2244 | + // To check the type and concurrency of the ResultSet | |
| 2245 | + // to verify whether updates are possible or not | |
| 2246 | + checkTypeConcurrency(); | |
| 2247 | + | |
| 2248 | + rs.updateBoolean(columnIndex, x); | |
| 2249 | + } | |
| 2250 | + | |
| 2251 | + /** | |
| 2252 | + * Updates the designated column with a <code>byte</code> value. | |
| 2253 | + * The <code>updateXXX</code> methods are used to update column values in the | |
| 2254 | + * current row or the insert row. The <code>updateXXX</code> methods do not | |
| 2255 | + * update the underlying database; instead the <code>updateRow</code> or | |
| 2256 | + * <code>insertRow</code> methods are called to update the database. | |
| 2257 | + * | |
| 2258 | + * | |
| 2259 | + * @param columnIndex the first column is 1, the second is 2, and so on | |
| 2260 | + * @param x the new column value | |
| 2261 | + * @throws SQLException if a database access error occurs | |
| 2262 | + * or this rowset does not currently have a valid connection, | |
| 2263 | + * prepared statement, and result set | |
| 2264 | + * | |
| 2265 | + */ | |
| 2266 | + public void updateByte(int columnIndex, byte x) throws SQLException { | |
| 2267 | + checkState(); | |
| 2268 | + | |
| 2269 | + // To check the type and concurrency of the ResultSet | |
| 2270 | + // to verify whether updates are possible or not | |
| 2271 | + checkTypeConcurrency(); | |
| 2272 | + | |
| 2273 | + rs.updateByte(columnIndex, x); | |
| 2274 | + } | |
| 2275 | + | |
| 2276 | + /** | |
| 2277 | + * Updates the designated column with a <code>short</code> value. | |
| 2278 | + * The <code>updateXXX</code> methods are used to update column values in the | |
| 2279 | + * current row or the insert row. The <code>updateXXX</code> methods do not | |
| 2280 | + * update the underlying database; instead the <code>updateRow</code> or | |
| 2281 | + * <code>insertRow</code> methods are called to update the database. | |
| 2282 | + * | |
| 2283 | + * @param columnIndex the first column is 1, the second is 2, and so on | |
| 2284 | + * @param x the new column value | |
| 2285 | + * @throws SQLException if a database access error occurs | |
| 2286 | + * or this rowset does not currently have a valid connection, | |
| 2287 | + * prepared statement, and result set | |
| 2288 | + * | |
| 2289 | + */ | |
| 2290 | + public void updateShort(int columnIndex, short x) throws SQLException { | |
| 2291 | + checkState(); | |
| 2292 | + | |
| 2293 | + // To check the type and concurrency of the ResultSet | |
| 2294 | + // to verify whether updates are possible or not | |
| 2295 | + checkTypeConcurrency(); | |
| 2296 | + | |
| 2297 | + rs.updateShort(columnIndex, x); | |
| 2298 | + } | |
| 2299 | + | |
| 2300 | + /** | |
| 2301 | + * Updates the designated column with an <code>int</code> value. | |
| 2302 | + * The <code>updateXXX</code> methods are used to update column values in the | |
| 2303 | + * current row or the insert row. The <code>updateXXX</code> methods do not | |
| 2304 | + * update the underlying database; instead the <code>updateRow</code> or | |
| 2305 | + * <code>insertRow</code> methods are called to update the database. | |
| 2306 | + * | |
| 2307 | + * @param columnIndex the first column is 1, the second is 2, and so on | |
| 2308 | + * @param x the new column value | |
| 2309 | + * @throws SQLException if a database access error occurs | |
| 2310 | + * or this rowset does not currently have a valid connection, | |
| 2311 | + * prepared statement, and result set | |
| 2312 | + */ | |
| 2313 | + public void updateInt(int columnIndex, int x) throws SQLException { | |
| 2314 | + checkState(); | |
| 2315 | + | |
| 2316 | + // To check the type and concurrency of the ResultSet | |
| 2317 | + // to verify whether updates are possible or not | |
| 2318 | + checkTypeConcurrency(); | |
| 2319 | + | |
| 2320 | + rs.updateInt(columnIndex, x); | |
| 2321 | + } | |
| 2322 | + | |
| 2323 | + /** | |
| 2324 | + * Updates the designated column with a <code>long</code> value. | |
| 2325 | + * The <code>updateXXX</code> methods are used to update column values in the | |
| 2326 | + * current row or the insert row. The <code>updateXXX</code> methods do not | |
| 2327 | + * update the underlying database; instead the <code>updateRow</code> or | |
| 2328 | + * <code>insertRow</code> methods are called to update the database. | |
| 2329 | + * | |
| 2330 | + * @param columnIndex the first column is 1, the second is 2, and so on | |
| 2331 | + * @param x the new column value | |
| 2332 | + * @throws SQLException if a database access error occurs | |
| 2333 | + * or this rowset does not currently have a valid connection, | |
| 2334 | + * prepared statement, and result set | |
| 2335 | + * | |
| 2336 | + */ | |
| 2337 | + public void updateLong(int columnIndex, long x) throws SQLException { | |
| 2338 | + checkState(); | |
| 2339 | + | |
| 2340 | + // To check the type and concurrency of the ResultSet | |
| 2341 | + // to verify whether updates are possible or not | |
| 2342 | + checkTypeConcurrency(); | |
| 2343 | + | |
| 2344 | + rs.updateLong(columnIndex, x); | |
| 2345 | + } | |
| 2346 | + | |
| 2347 | + /** | |
| 2348 | + * Updates the designated column with a <code>float</code> value. | |
| 2349 | + * The <code>updateXXX</code> methods are used to update column values in the | |
| 2350 | + * current row or the insert row. The <code>updateXXX</code> methods do not | |
| 2351 | + * update the underlying database; instead the <code>updateRow</code> or | |
| 2352 | + * <code>insertRow</code> methods are called to update the database. | |
| 2353 | + * | |
| 2354 | + * @param columnIndex the first column is 1, the second is 2, and so on | |
| 2355 | + * @param x the new column value | |
| 2356 | + * @throws SQLException if a database access error occurs | |
| 2357 | + * or this rowset does not currently have a valid connection, | |
| 2358 | + * prepared statement, and result set | |
| 2359 | + * | |
| 2360 | + */ | |
| 2361 | + public void updateFloat(int columnIndex, float x) throws SQLException { | |
| 2362 | + checkState(); | |
| 2363 | + | |
| 2364 | + // To check the type and concurrency of the ResultSet | |
| 2365 | + // to verify whether updates are possible or not | |
| 2366 | + checkTypeConcurrency(); | |
| 2367 | + | |
| 2368 | + rs.updateFloat(columnIndex, x); | |
| 2369 | + } | |
| 2370 | + | |
| 2371 | + /** | |
| 2372 | + * Updates the designated column with a <code>double</code> value. | |
| 2373 | + * The <code>updateXXX</code> methods are used to update column values in the | |
| 2374 | + * current row or the insert row. The <code>updateXXX</code> methods do not | |
| 2375 | + * update the underlying database; instead the <code>updateRow</code> or | |
| 2376 | + * <code>insertRow</code> methods are called to update the database. | |
| 2377 | + * | |
| 2378 | + * @param columnIndex the first column is 1, the second is 2, and so on | |
| 2379 | + * @param x the new column value | |
| 2380 | + * @throws SQLException if a database access error occurs | |
| 2381 | + * or this rowset does not currently have a valid connection, | |
| 2382 | + * prepared statement, and result set | |
| 2383 | + * | |
| 2384 | + */ | |
| 2385 | + public void updateDouble(int columnIndex, double x) throws SQLException { | |
| 2386 | + checkState(); | |
| 2387 | + | |
| 2388 | + // To check the type and concurrency of the ResultSet | |
| 2389 | + // to verify whether updates are possible or not | |
| 2390 | + checkTypeConcurrency(); | |
| 2391 | + | |
| 2392 | + rs.updateDouble(columnIndex, x); | |
| 2393 | + } | |
| 2394 | + | |
| 2395 | + /** | |
| 2396 | + * Updates the designated column with a <code>java.math.BigDecimal</code> | |
| 2397 | + * value. | |
| 2398 | + * The <code>updateXXX</code> methods are used to update column values in the | |
| 2399 | + * current row or the insert row. The <code>updateXXX</code> methods do not | |
| 2400 | + * update the underlying database; instead the <code>updateRow</code> or | |
| 2401 | + * <code>insertRow</code> methods are called to update the database. | |
| 2402 | + * | |
| 2403 | + * @param columnIndex the first column is 1, the second is 2, and so on | |
| 2404 | + * @param x the new column value | |
| 2405 | + * @throws SQLException if a database access error occurs | |
| 2406 | + * or this rowset does not currently have a valid connection, | |
| 2407 | + * prepared statement, and result set | |
| 2408 | + * | |
| 2409 | + */ | |
| 2410 | + public void updateBigDecimal(int columnIndex, BigDecimal x) throws SQLException { | |
| 2411 | + checkState(); | |
| 2412 | + | |
| 2413 | + // To check the type and concurrency of the ResultSet | |
| 2414 | + // to verify whether updates are possible or not | |
| 2415 | + checkTypeConcurrency(); | |
| 2416 | + | |
| 2417 | + rs.updateBigDecimal(columnIndex, x); | |
| 2418 | + } | |
| 2419 | + | |
| 2420 | + /** | |
| 2421 | + * Updates the designated column with a <code>String</code> value. | |
| 2422 | + * The <code>updateXXX</code> methods are used to update column values in the | |
| 2423 | + * current row or the insert row. The <code>updateXXX</code> methods do not | |
| 2424 | + * update the underlying database; instead the <code>updateRow</code> or | |
| 2425 | + * <code>insertRow</code> methods are called to update the database. | |
| 2426 | + * | |
| 2427 | + * @param columnIndex the first column is 1, the second is 2, and so on | |
| 2428 | + * @param x the new column value | |
| 2429 | + * @throws SQLException if a database access error occurs | |
| 2430 | + * or this rowset does not currently have a valid connection, | |
| 2431 | + * prepared statement, and result set | |
| 2432 | + * | |
| 2433 | + */ | |
| 2434 | + public void updateString(int columnIndex, String x) throws SQLException { | |
| 2435 | + checkState(); | |
| 2436 | + | |
| 2437 | + // To check the type and concurrency of the ResultSet | |
| 2438 | + // to verify whether updates are possible or not | |
| 2439 | + checkTypeConcurrency(); | |
| 2440 | + | |
| 2441 | + rs.updateString(columnIndex, x); | |
| 2442 | + } | |
| 2443 | + | |
| 2444 | + /** | |
| 2445 | + * Updates the designated column with a <code>byte</code> array value. | |
| 2446 | + * The <code>updateXXX</code> methods are used to update column values in the | |
| 2447 | + * current row or the insert row. The <code>updateXXX</code> methods do not | |
| 2448 | + * update the underlying database; instead the <code>updateRow</code> or | |
| 2449 | + * <code>insertRow</code> methods are called to update the database. | |
| 2450 | + * | |
| 2451 | + * @param columnIndex the first column is 1, the second is 2, and so on | |
| 2452 | + * @param x the new column value | |
| 2453 | + * @throws SQLException if a database access error occurs | |
| 2454 | + * or this rowset does not currently have a valid connection, | |
| 2455 | + * prepared statement, and result set | |
| 2456 | + * | |
| 2457 | + */ | |
| 2458 | + public void updateBytes(int columnIndex, byte x[]) throws SQLException { | |
| 2459 | + checkState(); | |
| 2460 | + | |
| 2461 | + // To check the type and concurrency of the ResultSet | |
| 2462 | + // to verify whether updates are possible or not | |
| 2463 | + checkTypeConcurrency(); | |
| 2464 | + | |
| 2465 | + rs.updateBytes(columnIndex, x); | |
| 2466 | + } | |
| 2467 | + | |
| 2468 | + /** | |
| 2469 | + * Updates the designated column with a <code>java.sql.Date</code> value. | |
| 2470 | + * The <code>updateXXX</code> methods are used to update column values in the | |
| 2471 | + * current row or the insert row. The <code>updateXXX</code> methods do not | |
| 2472 | + * update the underlying database; instead the <code>updateRow</code> or | |
| 2473 | + * <code>insertRow</code> methods are called to update the database. | |
| 2474 | + * | |
| 2475 | + * @param columnIndex the first column is 1, the second is 2, and so on | |
| 2476 | + * @param x the new column value | |
| 2477 | + * @throws SQLException if a database access error occurs | |
| 2478 | + * or this rowset does not currently have a valid connection, | |
| 2479 | + * prepared statement, and result set | |
| 2480 | + * | |
| 2481 | + */ | |
| 2482 | + public void updateDate(int columnIndex, java.sql.Date x) throws SQLException { | |
| 2483 | + checkState(); | |
| 2484 | + | |
| 2485 | + // To check the type and concurrency of the ResultSet | |
| 2486 | + // to verify whether updates are possible or not | |
| 2487 | + checkTypeConcurrency(); | |
| 2488 | + | |
| 2489 | + rs.updateDate(columnIndex, x); | |
| 2490 | + } | |
| 2491 | + | |
| 2492 | + | |
| 2493 | + /** | |
| 2494 | + * Updates the designated column with a <code>java.sql.Time</code> value. | |
| 2495 | + * The <code>updateXXX</code> methods are used to update column values in the | |
| 2496 | + * current row or the insert row. The <code>updateXXX</code> methods do not | |
| 2497 | + * update the underlying database; instead the <code>updateRow</code> or | |
| 2498 | + * <code>insertRow</code> methods are called to update the database. | |
| 2499 | + * | |
| 2500 | + * @param columnIndex the first column is 1, the second is 2, and so on | |
| 2501 | + * @param x the new column value | |
| 2502 | + * @throws SQLException if a database access error occurs | |
| 2503 | + * or this rowset does not currently have a valid connection, | |
| 2504 | + * prepared statement, and result set | |
| 2505 | + * | |
| 2506 | + */ | |
| 2507 | + public void updateTime(int columnIndex, java.sql.Time x) throws SQLException { | |
| 2508 | + checkState(); | |
| 2509 | + | |
| 2510 | + // To check the type and concurrency of the ResultSet | |
| 2511 | + // to verify whether updates are possible or not | |
| 2512 | + checkTypeConcurrency(); | |
| 2513 | + | |
| 2514 | + rs.updateTime(columnIndex, x); | |
| 2515 | + } | |
| 2516 | + | |
| 2517 | + /** | |
| 2518 | + * Updates the designated column with a <code>java.sql.Timestamp</code> | |
| 2519 | + * value. | |
| 2520 | + * The <code>updateXXX</code> methods are used to update column values in the | |
| 2521 | + * current row or the insert row. The <code>updateXXX</code> methods do not | |
| 2522 | + * update the underlying database; instead the <code>updateRow</code> or | |
| 2523 | + * <code>insertRow</code> methods are called to update the database. | |
| 2524 | + * | |
| 2525 | + * @param columnIndex the first column is 1, the second is 2, and so on | |
| 2526 | + * @param x the new column value | |
| 2527 | + * @throws SQLException if a database access error occurs | |
| 2528 | + * or this rowset does not currently have a valid connection, | |
| 2529 | + * prepared statement, and result set | |
| 2530 | + * | |
| 2531 | + */ | |
| 2532 | + public void updateTimestamp(int columnIndex, java.sql.Timestamp x) throws SQLException { | |
| 2533 | + checkState(); | |
| 2534 | + | |
| 2535 | + // To check the type and concurrency of the ResultSet | |
| 2536 | + // to verify whether updates are possible or not | |
| 2537 | + checkTypeConcurrency(); | |
| 2538 | + | |
| 2539 | + rs.updateTimestamp(columnIndex, x); | |
| 2540 | + } | |
| 2541 | + | |
| 2542 | + /** | |
| 2543 | + * Updates the designated column with an ascii stream value. | |
| 2544 | + * The <code>updateXXX</code> methods are used to update column values in the | |
| 2545 | + * current row or the insert row. The <code>updateXXX</code> methods do not | |
| 2546 | + * update the underlying database; instead the <code>updateRow</code> or | |
| 2547 | + * <code>insertRow</code> methods are called to update the database. | |
| 2548 | + * | |
| 2549 | + * @param columnIndex the first column is 1, the second is 2, and so on | |
| 2550 | + * @param x the new column value | |
| 2551 | + * @param length the length of the stream | |
| 2552 | + * @throws SQLException if (1) a database access error occurs | |
| 2553 | + * (2) or this rowset does not currently have a valid connection, | |
| 2554 | + * prepared statement, and result set | |
| 2555 | + * | |
| 2556 | + */ | |
| 2557 | + public void updateAsciiStream(int columnIndex, java.io.InputStream x, int length) throws SQLException { | |
| 2558 | + checkState(); | |
| 2559 | + | |
| 2560 | + // To check the type and concurrency of the ResultSet | |
| 2561 | + // to verify whether updates are possible or not | |
| 2562 | + checkTypeConcurrency(); | |
| 2563 | + | |
| 2564 | + rs.updateAsciiStream(columnIndex, x, length); | |
| 2565 | + } | |
| 2566 | + | |
| 2567 | + /** | |
| 2568 | + * Updates the designated column with a binary stream value. | |
| 2569 | + * The <code>updateXXX</code> methods are used to update column values in the | |
| 2570 | + * current row or the insert row. The <code>updateXXX</code> methods do not | |
| 2571 | + * update the underlying database; instead the <code>updateRow</code> or | |
| 2572 | + * <code>insertRow</code> methods are called to update the database. | |
| 2573 | + * | |
| 2574 | + * @param columnIndex the first column is 1, the second is 2, and so on | |
| 2575 | + * @param x the new column value | |
| 2576 | + * @param length the length of the stream | |
| 2577 | + * @throws SQLException if a database access error occurs | |
| 2578 | + * or this rowset does not currently have a valid connection, | |
| 2579 | + * prepared statement, and result set | |
| 2580 | + * | |
| 2581 | + */ | |
| 2582 | + public void updateBinaryStream(int columnIndex, java.io.InputStream x, int length) throws SQLException { | |
| 2583 | + checkState(); | |
| 2584 | + | |
| 2585 | + // To check the type and concurrency of the ResultSet | |
| 2586 | + // to verify whether updates are possible or not | |
| 2587 | + checkTypeConcurrency(); | |
| 2588 | + | |
| 2589 | + rs.updateBinaryStream(columnIndex, x, length); | |
| 2590 | + } | |
| 2591 | + | |
| 2592 | + /** | |
| 2593 | + * Updates the designated column with a character stream value. | |
| 2594 | + * The <code>updateXXX</code> methods are used to update column values in the | |
| 2595 | + * current row or the insert row. The <code>updateXXX</code> methods do not | |
| 2596 | + * update the underlying database; instead the <code>updateRow</code> or | |
| 2597 | + * <code>insertRow</code> methods are called to update the database. | |
| 2598 | + * | |
| 2599 | + * @param columnIndex the first column is 1, the second is 2, and so on | |
| 2600 | + * @param x the new column value | |
| 2601 | + * @param length the length of the stream | |
| 2602 | + * @throws SQLException if a database access error occurs | |
| 2603 | + * or this rowset does not currently have a valid connection, | |
| 2604 | + * prepared statement, and result set | |
| 2605 | + * | |
| 2606 | + */ | |
| 2607 | + public void updateCharacterStream(int columnIndex, java.io.Reader x, int length) throws SQLException { | |
| 2608 | + checkState(); | |
| 2609 | + | |
| 2610 | + // To check the type and concurrency of the ResultSet | |
| 2611 | + // to verify whether updates are possible or not | |
| 2612 | + checkTypeConcurrency(); | |
| 2613 | + | |
| 2614 | + rs.updateCharacterStream(columnIndex, x, length); | |
| 2615 | + } | |
| 2616 | + | |
| 2617 | + /** | |
| 2618 | + * Updates the designated column with an <code>Object</code> value. | |
| 2619 | + * The <code>updateXXX</code> methods are used to update column values in the | |
| 2620 | + * current row or the insert row. The <code>updateXXX</code> methods do not | |
| 2621 | + * update the underlying database; instead the <code>updateRow</code> or | |
| 2622 | + * <code>insertRow</code> methods are called to update the database. | |
| 2623 | + * | |
| 2624 | + * @param columnIndex the first column is 1, the second is 2, and so on | |
| 2625 | + * @param x the new column value | |
| 2626 | + * @param scale for <code>java.sql.Types.DECIMAl</code> | |
| 2627 | + * or <code>java.sql.Types.NUMERIC</code> types, | |
| 2628 | + * this is the number of digits after the decimal point. For all other | |
| 2629 | + * types this value will be ignored. | |
| 2630 | + * @throws SQLException if a database access error occurs | |
| 2631 | + * or this rowset does not currently have a valid connection, | |
| 2632 | + * prepared statement, and result set | |
| 2633 | + * | |
| 2634 | + */ | |
| 2635 | + public void updateObject(int columnIndex, Object x, int scale) throws SQLException { | |
| 2636 | + checkState(); | |
| 2637 | + | |
| 2638 | + // To check the type and concurrency of the ResultSet | |
| 2639 | + // to verify whether updates are possible or not | |
| 2640 | + checkTypeConcurrency(); | |
| 2641 | + | |
| 2642 | + rs.updateObject(columnIndex, x, scale); | |
| 2643 | + } | |
| 2644 | + | |
| 2645 | + /** | |
| 2646 | + * Updates the designated column with an <code>Object</code> value. | |
| 2647 | + * The <code>updateXXX</code> methods are used to update column values in the | |
| 2648 | + * current row or the insert row. The <code>updateXXX</code> methods do not | |
| 2649 | + * update the underlying database; instead the <code>updateRow</code> or | |
| 2650 | + * <code>insertRow</code> methods are called to update the database. | |
| 2651 | + * | |
| 2652 | + * @param columnIndex the first column is 1, the second is 2, and so on | |
| 2653 | + * @param x the new column value | |
| 2654 | + * @throws SQLException if a database access error occurs | |
| 2655 | + * or this rowset does not currently have a valid connection, | |
| 2656 | + * prepared statement, and result set | |
| 2657 | + * | |
| 2658 | + */ | |
| 2659 | + public void updateObject(int columnIndex, Object x) throws SQLException { | |
| 2660 | + checkState(); | |
| 2661 | + | |
| 2662 | + // To check the type and concurrency of the ResultSet | |
| 2663 | + // to verify whether updates are possible or not | |
| 2664 | + checkTypeConcurrency(); | |
| 2665 | + | |
| 2666 | + rs.updateObject(columnIndex, x); | |
| 2667 | + } | |
| 2668 | + | |
| 2669 | + /** | |
| 2670 | + * Updates the designated column with a <code>null</code> value. | |
| 2671 | + * The <code>updateXXX</code> methods are used to update column values in the | |
| 2672 | + * current row or the insert row. The <code>updateXXX</code> methods do not | |
| 2673 | + * update the underlying database; instead the <code>updateRow</code> or | |
| 2674 | + * <code>insertRow</code> methods are called to update the database. | |
| 2675 | + * | |
| 2676 | + * @param columnName the name of the column | |
| 2677 | + * @throws SQLException if a database access error occurs | |
| 2678 | + * or this rowset does not currently have a valid connection, | |
| 2679 | + * prepared statement, and result set | |
| 2680 | + * | |
| 2681 | + */ | |
| 2682 | + public void updateNull(String columnName) throws SQLException { | |
| 2683 | + updateNull(findColumn(columnName)); | |
| 2684 | + } | |
| 2685 | + | |
| 2686 | + /** | |
| 2687 | + * Updates the designated column with a <code>boolean</code> value. | |
| 2688 | + * The <code>updateXXX</code> methods are used to update column values in the | |
| 2689 | + * current row or the insert row. The <code>updateXXX</code> methods do not | |
| 2690 | + * update the underlying database; instead the <code>updateRow</code> or | |
| 2691 | + * <code>insertRow</code> methods are called to update the database. | |
| 2692 | + * | |
| 2693 | + * @param columnName the name of the column | |
| 2694 | + * @param x the new column value | |
| 2695 | + * @throws SQLException if a database access error occurs | |
| 2696 | + * | |
| 2697 | + */ | |
| 2698 | + public void updateBoolean(String columnName, boolean x) throws SQLException { | |
| 2699 | + updateBoolean(findColumn(columnName), x); | |
| 2700 | + } | |
| 2701 | + | |
| 2702 | + /** | |
| 2703 | + * Updates the designated column with a <code>byte</code> value. | |
| 2704 | + * The <code>updateXXX</code> methods are used to update column values in the | |
| 2705 | + * current row or the insert row. The <code>updateXXX</code> methods do not | |
| 2706 | + * update the underlying database; instead the <code>updateRow</code> or | |
| 2707 | + * <code>insertRow</code> methods are called to update the database. | |
| 2708 | + * | |
| 2709 | + * @param columnName the name of the column | |
| 2710 | + * @param x the new column value | |
| 2711 | + * @throws SQLException if a database access error occurs | |
| 2712 | + * | |
| 2713 | + */ | |
| 2714 | + public void updateByte(String columnName, byte x) throws SQLException { | |
| 2715 | + updateByte(findColumn(columnName), x); | |
| 2716 | + } | |
| 2717 | + | |
| 2718 | + /** | |
| 2719 | + * Updates the designated column with a <code>short</code> value. | |
| 2720 | + * The <code>updateXXX</code> methods are used to update column values in the | |
| 2721 | + * current row or the insert row. The <code>updateXXX</code> methods do not | |
| 2722 | + * update the underlying database; instead the <code>updateRow</code> or | |
| 2723 | + * <code>insertRow</code> methods are called to update the database. | |
| 2724 | + * | |
| 2725 | + * @param columnName the name of the column | |
| 2726 | + * @param x the new column value | |
| 2727 | + * @throws SQLException if a database access error occurs | |
| 2728 | + * | |
| 2729 | + */ | |
| 2730 | + public void updateShort(String columnName, short x) throws SQLException { | |
| 2731 | + updateShort(findColumn(columnName), x); | |
| 2732 | + } | |
| 2733 | + | |
| 2734 | + /** | |
| 2735 | + * Updates the designated column with an <code>int</code> value. | |
| 2736 | + * The <code>updateXXX</code> methods are used to update column values in the | |
| 2737 | + * current row or the insert row. The <code>updateXXX</code> methods do not | |
| 2738 | + * update the underlying database; instead the <code>updateRow</code> or | |
| 2739 | + * <code>insertRow</code> methods are called to update the database. | |
| 2740 | + * | |
| 2741 | + * @param columnName the name of the column | |
| 2742 | + * @param x the new column value | |
| 2743 | + * @throws SQLException if a database access error occurs | |
| 2744 | + * | |
| 2745 | + */ | |
| 2746 | + public void updateInt(String columnName, int x) throws SQLException { | |
| 2747 | + updateInt(findColumn(columnName), x); | |
| 2748 | + } | |
| 2749 | + | |
| 2750 | + /** | |
| 2751 | + * Updates the designated column with a <code>long</code> value. | |
| 2752 | + * The <code>updateXXX</code> methods are used to update column values in the | |
| 2753 | + * current row or the insert row. The <code>updateXXX</code> methods do not | |
| 2754 | + * update the underlying database; instead the <code>updateRow</code> or | |
| 2755 | + * <code>insertRow</code> methods are called to update the database. | |
| 2756 | + * | |
| 2757 | + * @param columnName the name of the column | |
| 2758 | + * @param x the new column value | |
| 2759 | + * @throws SQLException if a database access error occurs | |
| 2760 | + * | |
| 2761 | + */ | |
| 2762 | + public void updateLong(String columnName, long x) throws SQLException { | |
| 2763 | + updateLong(findColumn(columnName), x); | |
| 2764 | + } | |
| 2765 | + | |
| 2766 | + /** | |
| 2767 | + * Updates the designated column with a <code>float </code> value. | |
| 2768 | + * The <code>updateXXX</code> methods are used to update column values in the | |
| 2769 | + * current row or the insert row. The <code>updateXXX</code> methods do not | |
| 2770 | + * update the underlying database; instead the <code>updateRow</code> or | |
| 2771 | + * <code>insertRow</code> methods are called to update the database. | |
| 2772 | + * | |
| 2773 | + * @param columnName the name of the column | |
| 2774 | + * @param x the new column value | |
| 2775 | + * @throws SQLException if a database access error occurs | |
| 2776 | + * | |
| 2777 | + */ | |
| 2778 | + public void updateFloat(String columnName, float x) throws SQLException { | |
| 2779 | + updateFloat(findColumn(columnName), x); | |
| 2780 | + } | |
| 2781 | + | |
| 2782 | + /** | |
| 2783 | + * Updates the designated column with a <code>double</code> value. | |
| 2784 | + * The <code>updateXXX</code> methods are used to update column values in the | |
| 2785 | + * current row or the insert row. The <code>updateXXX</code> methods do not | |
| 2786 | + * update the underlying database; instead the <code>updateRow</code> or | |
| 2787 | + * <code>insertRow</code> methods are called to update the database. | |
| 2788 | + * | |
| 2789 | + * @param columnName the name of the column | |
| 2790 | + * @param x the new column value | |
| 2791 | + * @throws SQLException if a database access error occurs | |
| 2792 | + * | |
| 2793 | + */ | |
| 2794 | + public void updateDouble(String columnName, double x) throws SQLException { | |
| 2795 | + updateDouble(findColumn(columnName), x); | |
| 2796 | + } | |
| 2797 | + | |
| 2798 | + /** | |
| 2799 | + * Updates the designated column with a <code>java.sql.BigDecimal</code> | |
| 2800 | + * value. | |
| 2801 | + * The <code>updateXXX</code> methods are used to update column values in the | |
| 2802 | + * current row or the insert row. The <code>updateXXX</code> methods do not | |
| 2803 | + * update the underlying database; instead the <code>updateRow</code> or | |
| 2804 | + * <code>insertRow</code> methods are called to update the database. | |
| 2805 | + * | |
| 2806 | + * @param columnName the name of the column | |
| 2807 | + * @param x the new column value | |
| 2808 | + * @throws SQLException if a database access error occurs | |
| 2809 | + * | |
| 2810 | + */ | |
| 2811 | + public void updateBigDecimal(String columnName, BigDecimal x) throws SQLException { | |
| 2812 | + updateBigDecimal(findColumn(columnName), x); | |
| 2813 | + } | |
| 2814 | + | |
| 2815 | + /** | |
| 2816 | + * Updates the designated column with a <code>String</code> value. | |
| 2817 | + * The <code>updateXXX</code> methods are used to update column values in the | |
| 2818 | + * current row or the insert row. The <code>updateXXX</code> methods do not | |
| 2819 | + * update the underlying database; instead the <code>updateRow</code> or | |
| 2820 | + * <code>insertRow</code> methods are called to update the database. | |
| 2821 | + * | |
| 2822 | + * @param columnName the name of the column | |
| 2823 | + * @param x the new column value | |
| 2824 | + * @throws SQLException if a database access error occurs | |
| 2825 | + * | |
| 2826 | + */ | |
| 2827 | + public void updateString(String columnName, String x) throws SQLException { | |
| 2828 | + updateString(findColumn(columnName), x); | |
| 2829 | + } | |
| 2830 | + | |
| 2831 | + /** | |
| 2832 | + * Updates the designated column with a <code>boolean</code> value. | |
| 2833 | + * The <code>updateXXX</code> methods are used to update column values in the | |
| 2834 | + * current row or the insert row. The <code>updateXXX</code> methods do not | |
| 2835 | + * update the underlying database; instead the <code>updateRow</code> or | |
| 2836 | + * <code>insertRow</code> methods are called to update the database. | |
| 2837 | + * | |
| 2838 | + * JDBC 2.0 | |
| 2839 | + * | |
| 2840 | + * Updates a column with a byte array value. | |
| 2841 | + * | |
| 2842 | + * The <code>updateXXX</code> methods are used to update column values in the | |
| 2843 | + * current row, or the insert row. The <code>updateXXX</code> methods do not | |
| 2844 | + * update the underlying database; instead the <code>updateRow</code> or <code>insertRow</code> | |
| 2845 | + * methods are called to update the database. | |
| 2846 | + * | |
| 2847 | + * @param columnName the name of the column | |
| 2848 | + * @param x the new column value | |
| 2849 | + * @throws SQLException if a database access error occurs | |
| 2850 | + * | |
| 2851 | + */ | |
| 2852 | + public void updateBytes(String columnName, byte x[]) throws SQLException { | |
| 2853 | + updateBytes(findColumn(columnName), x); | |
| 2854 | + } | |
| 2855 | + | |
| 2856 | + /** | |
| 2857 | + * Updates the designated column with a <code>java.sql.Date</code> value. | |
| 2858 | + * The <code>updateXXX</code> methods are used to update column values in the | |
| 2859 | + * current row or the insert row. The <code>updateXXX</code> methods do not | |
| 2860 | + * update the underlying database; instead the <code>updateRow</code> or | |
| 2861 | + * <code>insertRow</code> methods are called to update the database. | |
| 2862 | + * | |
| 2863 | + * @param columnName the name of the column | |
| 2864 | + * @param x the new column value | |
| 2865 | + * @throws SQLException if a database access error occurs | |
| 2866 | + * | |
| 2867 | + */ | |
| 2868 | + public void updateDate(String columnName, java.sql.Date x) throws SQLException { | |
| 2869 | + updateDate(findColumn(columnName), x); | |
| 2870 | + } | |
| 2871 | + | |
| 2872 | + /** | |
| 2873 | + * Updates the designated column with a <code>java.sql.Time</code> value. | |
| 2874 | + * The <code>updateXXX</code> methods are used to update column values in the | |
| 2875 | + * current row or the insert row. The <code>updateXXX</code> methods do not | |
| 2876 | + * update the underlying database; instead the <code>updateRow</code> or | |
| 2877 | + * <code>insertRow</code> methods are called to update the database. | |
| 2878 | + * | |
| 2879 | + * @param columnName the name of the column | |
| 2880 | + * @param x the new column value | |
| 2881 | + * @throws SQLException if a database access error occurs | |
| 2882 | + * | |
| 2883 | + */ | |
| 2884 | + public void updateTime(String columnName, java.sql.Time x) throws SQLException { | |
| 2885 | + updateTime(findColumn(columnName), x); | |
| 2886 | + } | |
| 2887 | + | |
| 2888 | + /** | |
| 2889 | + * Updates the designated column with a <code>java.sql.Timestamp</code> | |
| 2890 | + * value. | |
| 2891 | + * The <code>updateXXX</code> methods are used to update column values in the | |
| 2892 | + * current row or the insert row. The <code>updateXXX</code> methods do not | |
| 2893 | + * update the underlying database; instead the <code>updateRow</code> or | |
| 2894 | + * <code>insertRow</code> methods are called to update the database. | |
| 2895 | + * | |
| 2896 | + * @param columnName the name of the column | |
| 2897 | + * @param x the new column value | |
| 2898 | + * @throws SQLException if a database access error occurs | |
| 2899 | + * | |
| 2900 | + */ | |
| 2901 | + public void updateTimestamp(String columnName, java.sql.Timestamp x) throws SQLException { | |
| 2902 | + updateTimestamp(findColumn(columnName), x); | |
| 2903 | + } | |
| 2904 | + | |
| 2905 | + /** | |
| 2906 | + * Updates the designated column with an ascii stream value. | |
| 2907 | + * The <code>updateXXX</code> methods are used to update column values in the | |
| 2908 | + * current row or the insert row. The <code>updateXXX</code> methods do not | |
| 2909 | + * update the underlying database; instead the <code>updateRow</code> or | |
| 2910 | + * <code>insertRow</code> methods are called to update the database. | |
| 2911 | + * | |
| 2912 | + * @param columnName the name of the column | |
| 2913 | + * @param x the new column value | |
| 2914 | + * @param length the length of the stream | |
| 2915 | + * @throws SQLException if a database access error occurs | |
| 2916 | + * | |
| 2917 | + */ | |
| 2918 | + public void updateAsciiStream(String columnName, java.io.InputStream x, int length) throws SQLException { | |
| 2919 | + updateAsciiStream(findColumn(columnName), x, length); | |
| 2920 | + } | |
| 2921 | + | |
| 2922 | + /** | |
| 2923 | + * Updates the designated column with a binary stream value. | |
| 2924 | + * The <code>updateXXX</code> methods are used to update column values in the | |
| 2925 | + * current row or the insert row. The <code>updateXXX</code> methods do not | |
| 2926 | + * update the underlying database; instead the <code>updateRow</code> or | |
| 2927 | + * <code>insertRow</code> methods are called to update the database. | |
| 2928 | + * | |
| 2929 | + * @param columnName the name of the column | |
| 2930 | + * @param x the new column value | |
| 2931 | + * @param length the length of the stream | |
| 2932 | + * @throws SQLException if a database access error occurs | |
| 2933 | + * | |
| 2934 | + */ | |
| 2935 | + public void updateBinaryStream(String columnName, java.io.InputStream x, int length) throws SQLException { | |
| 2936 | + updateBinaryStream(findColumn(columnName), x, length); | |
| 2937 | + } | |
| 2938 | + | |
| 2939 | + /** | |
| 2940 | + * Updates the designated column with a character stream value. | |
| 2941 | + * The <code>updateXXX</code> methods are used to update column values | |
| 2942 | + * in the current row or the insert row. The <code>updateXXX</code> | |
| 2943 | + * methods do not update the underlying database; instead the | |
| 2944 | + * <code>updateRow</code> or <code>insertRow</code> methods are called | |
| 2945 | + * to update the database. | |
| 2946 | + * | |
| 2947 | + * @param columnName the name of the column | |
| 2948 | + * @param reader the new column <code>Reader</code> stream value | |
| 2949 | + * @param length the length of the stream | |
| 2950 | + * @throws SQLException if a database access error occurs | |
| 2951 | + * | |
| 2952 | + */ | |
| 2953 | + public void updateCharacterStream(String columnName, java.io.Reader reader, int length) throws SQLException { | |
| 2954 | + updateCharacterStream(findColumn(columnName), reader, length); | |
| 2955 | + } | |
| 2956 | + | |
| 2957 | + /** | |
| 2958 | + * Updates the designated column with an <code>Object</code> value. | |
| 2959 | + * The <code>updateXXX</code> methods are used to update column values in the | |
| 2960 | + * current row or the insert row. The <code>updateXXX</code> methods do not | |
| 2961 | + * update the underlying database; instead the <code>updateRow</code> or | |
| 2962 | + * <code>insertRow</code> methods are called to update the database. | |
| 2963 | + * | |
| 2964 | + * @param columnName the name of the column | |
| 2965 | + * @param x the new column value | |
| 2966 | + * @param scale for <code>java.sql.Types.DECIMAL</code> | |
| 2967 | + * or <code>java.sql.Types.NUMERIC</code> types, | |
| 2968 | + * this is the number of digits after the decimal point. For all other | |
| 2969 | + * types this value will be ignored. | |
| 2970 | + * @throws SQLException if a database access error occurs | |
| 2971 | + * | |
| 2972 | + */ | |
| 2973 | + public void updateObject(String columnName, Object x, int scale) throws SQLException { | |
| 2974 | + updateObject(findColumn(columnName), x, scale); | |
| 2975 | + } | |
| 2976 | + | |
| 2977 | + /** | |
| 2978 | + * Updates the designated column with an <code>Object</code> value. | |
| 2979 | + * The <code>updateXXX</code> methods are used to update column values in the | |
| 2980 | + * current row or the insert row. The <code>updateXXX</code> methods do not | |
| 2981 | + * update the underlying database; instead the <code>updateRow</code> or | |
| 2982 | + * <code>insertRow</code> methods are called to update the database. | |
| 2983 | + * | |
| 2984 | + * @param columnName the name of the column | |
| 2985 | + * @param x the new column value | |
| 2986 | + * @throws SQLException if a database access error occurs | |
| 2987 | + * | |
| 2988 | + */ | |
| 2989 | + public void updateObject(String columnName, Object x) throws SQLException { | |
| 2990 | + updateObject(findColumn(columnName), x); | |
| 2991 | + } | |
| 2992 | + | |
| 2993 | + /** | |
| 2994 | + * Inserts the contents of the insert row into this | |
| 2995 | + * <code>ResultSet</code> object and into the database | |
| 2996 | + * and also notifies listeners that a row has changed. | |
| 2997 | + * The cursor must be on the insert row when this method is called. | |
| 2998 | + * | |
| 2999 | + * @throws SQLException if (1) a database access error occurs, | |
| 3000 | + * (2) this method is called when the cursor is not | |
| 3001 | + * on the insert row, (3) not all non-nullable columns in | |
| 3002 | + * the insert row have been given a value, or (4) this | |
| 3003 | + * rowset does not currently have a valid connection, | |
| 3004 | + * prepared statement, and result set | |
| 3005 | + */ | |
| 3006 | + public void insertRow() throws SQLException { | |
| 3007 | + checkState(); | |
| 3008 | + | |
| 3009 | + rs.insertRow(); | |
| 3010 | + notifyRowChanged(); | |
| 3011 | + } | |
| 3012 | + | |
| 3013 | + /** | |
| 3014 | + * Updates the underlying database with the new contents of the | |
| 3015 | + * current row of this rowset's <code>ResultSet</code> object | |
| 3016 | + * and notifies listeners that a row has changed. | |
| 3017 | + * This method cannot be called when the cursor is on the insert row. | |
| 3018 | + * | |
| 3019 | + * @throws SQLException if (1) a database access error occurs, | |
| 3020 | + * (2) this method is called when the cursor is | |
| 3021 | + * on the insert row, (3) the concurrency of the result | |
| 3022 | + * set is <code>ResultSet.CONCUR_READ_ONLY</code>, or | |
| 3023 | + * (4) this rowset does not currently have a valid connection, | |
| 3024 | + * prepared statement, and result set | |
| 3025 | + */ | |
| 3026 | + public void updateRow() throws SQLException { | |
| 3027 | + checkState(); | |
| 3028 | + | |
| 3029 | + rs.updateRow(); | |
| 3030 | + notifyRowChanged(); | |
| 3031 | + } | |
| 3032 | + | |
| 3033 | + /** | |
| 3034 | + * Deletes the current row from this rowset's <code>ResultSet</code> object | |
| 3035 | + * and from the underlying database and also notifies listeners that a row | |
| 3036 | + * has changed. This method cannot be called when the cursor is on the insert | |
| 3037 | + * row. | |
| 3038 | + * | |
| 3039 | + * @throws SQLException if a database access error occurs | |
| 3040 | + * or if this method is called when the cursor is on the insert row | |
| 3041 | + * @throws SQLException if (1) a database access error occurs, | |
| 3042 | + * (2) this method is called when the cursor is before the | |
| 3043 | + * first row, after the last row, or on the insert row, | |
| 3044 | + * (3) the concurrency of this rowset's result | |
| 3045 | + * set is <code>ResultSet.CONCUR_READ_ONLY</code>, or | |
| 3046 | + * (4) this rowset does not currently have a valid connection, | |
| 3047 | + * prepared statement, and result set | |
| 3048 | + */ | |
| 3049 | + public void deleteRow() throws SQLException { | |
| 3050 | + checkState(); | |
| 3051 | + | |
| 3052 | + rs.deleteRow(); | |
| 3053 | + notifyRowChanged(); | |
| 3054 | + } | |
| 3055 | + | |
| 3056 | + /** | |
| 3057 | + * Refreshes the current row of this rowset's <code>ResultSet</code> | |
| 3058 | + * object with its most recent value in the database. This method | |
| 3059 | + * cannot be called when the cursor is on the insert row. | |
| 3060 | + * | |
| 3061 | + * <P>The <code>refreshRow</code> method provides a way for an | |
| 3062 | + * application to explicitly tell the JDBC driver to refetch | |
| 3063 | + * a row(s) from the database. An application may want to call | |
| 3064 | + * <code>refreshRow</code> when caching or prefetching is being | |
| 3065 | + * done by the JDBC driver to fetch the latest value of a row | |
| 3066 | + * from the database. The JDBC driver may actually refresh multiple | |
| 3067 | + * rows at once if the fetch size is greater than one. | |
| 3068 | + * | |
| 3069 | + * <P> All values are refetched subject to the transaction isolation | |
| 3070 | + * level and cursor sensitivity. If <code>refreshRow</code> is called after | |
| 3071 | + * calling an <code>updateXXX</code> method, but before calling | |
| 3072 | + * the method <code>updateRow</code>, then the | |
| 3073 | + * updates made to the row are lost. Calling the method | |
| 3074 | + * <code>refreshRow</code> frequently will likely slow performance. | |
| 3075 | + * | |
| 3076 | + * @throws SQLException if (1) a database access error occurs, | |
| 3077 | + * (2) this method is called when the cursor is | |
| 3078 | + * on the insert row, or (3) this rowset does not | |
| 3079 | + * currently have a valid connection, prepared statement, | |
| 3080 | + * and result set | |
| 3081 | + * | |
| 3082 | + */ | |
| 3083 | + public void refreshRow() throws SQLException { | |
| 3084 | + checkState(); | |
| 3085 | + | |
| 3086 | + rs.refreshRow(); | |
| 3087 | + } | |
| 3088 | + | |
| 3089 | + /** | |
| 3090 | + * Cancels the updates made to the current row in this | |
| 3091 | + * <code>ResultSet</code> object and notifies listeners that a row | |
| 3092 | + * has changed. This method may be called after calling an | |
| 3093 | + * <code>updateXXX</code> method(s) and before calling | |
| 3094 | + * the method <code>updateRow</code> to roll back | |
| 3095 | + * the updates made to a row. If no updates have been made or | |
| 3096 | + * <code>updateRow</code> has already been called, this method has no | |
| 3097 | + * effect. | |
| 3098 | + * | |
| 3099 | + * @throws SQLException if (1) a database access error occurs, | |
| 3100 | + * (2) this method is called when the cursor is | |
| 3101 | + * on the insert row, or (3) this rowset does not | |
| 3102 | + * currently have a valid connection, prepared statement, | |
| 3103 | + * and result set | |
| 3104 | + */ | |
| 3105 | + public void cancelRowUpdates() throws SQLException { | |
| 3106 | + checkState(); | |
| 3107 | + | |
| 3108 | + rs.cancelRowUpdates(); | |
| 3109 | + | |
| 3110 | + notifyRowChanged(); | |
| 3111 | + } | |
| 3112 | + | |
| 3113 | + /** | |
| 3114 | + * Moves the cursor to the insert row. The current cursor position is | |
| 3115 | + * remembered while the cursor is positioned on the insert row. | |
| 3116 | + * | |
| 3117 | + * The insert row is a special row associated with an updatable | |
| 3118 | + * result set. It is essentially a buffer where a new row may | |
| 3119 | + * be constructed by calling the <code>updateXXX</code> methods prior to | |
| 3120 | + * inserting the row into the result set. | |
| 3121 | + * | |
| 3122 | + * Only the <code>updateXXX</code>, <code>getXXX</code>, | |
| 3123 | + * and <code>insertRow</code> methods may be | |
| 3124 | + * called when the cursor is on the insert row. All of the columns in | |
| 3125 | + * a result set must be given a value each time this method is | |
| 3126 | + * called before calling <code>insertRow</code>. | |
| 3127 | + * An <code>updateXXX</code> method must be called before a | |
| 3128 | + * <code>getXXX</code> method can be called on a column value. | |
| 3129 | + * | |
| 3130 | + * @throws SQLException if (1) a database access error occurs, | |
| 3131 | + * (2) this rowset's <code>ResultSet</code> object is | |
| 3132 | + * not updatable, or (3) this rowset does not | |
| 3133 | + * currently have a valid connection, prepared statement, | |
| 3134 | + * and result set | |
| 3135 | + * | |
| 3136 | + */ | |
| 3137 | + public void moveToInsertRow() throws SQLException { | |
| 3138 | + checkState(); | |
| 3139 | + | |
| 3140 | + rs.moveToInsertRow(); | |
| 3141 | + } | |
| 3142 | + | |
| 3143 | + /** | |
| 3144 | + * Moves the cursor to the remembered cursor position, usually the | |
| 3145 | + * current row. This method has no effect if the cursor is not on | |
| 3146 | + * the insert row. | |
| 3147 | + * | |
| 3148 | + * @throws SQLException if (1) a database access error occurs, | |
| 3149 | + * (2) this rowset's <code>ResultSet</code> object is | |
| 3150 | + * not updatable, or (3) this rowset does not | |
| 3151 | + * currently have a valid connection, prepared statement, | |
| 3152 | + * and result set | |
| 3153 | + */ | |
| 3154 | + public void moveToCurrentRow() throws SQLException { | |
| 3155 | + checkState(); | |
| 3156 | + | |
| 3157 | + rs.moveToCurrentRow(); | |
| 3158 | + } | |
| 3159 | + | |
| 3160 | + /** | |
| 3161 | + * Returns the <code>Statement</code> object that produced this | |
| 3162 | + * <code>ResultSet</code> object. | |
| 3163 | + * If the result set was generated some other way, such as by a | |
| 3164 | + * <code>DatabaseMetaData</code> method, this method returns | |
| 3165 | + * <code>null</code>. | |
| 3166 | + * | |
| 3167 | + * @return the <code>Statment</code> object that produced | |
| 3168 | + * this rowset's <code>ResultSet</code> object or <code>null</code> | |
| 3169 | + * if the result set was produced some other way | |
| 3170 | + * @throws SQLException if a database access error occurs | |
| 3171 | + */ | |
| 3172 | + public java.sql.Statement getStatement() throws SQLException { | |
| 3173 | + | |
| 3174 | + if(rs != null) | |
| 3175 | + { | |
| 3176 | + return rs.getStatement(); | |
| 3177 | + } else { | |
| 3178 | + return null; | |
| 3179 | + } | |
| 3180 | + } | |
| 3181 | + | |
| 3182 | + /** | |
| 3183 | + * Returns the value of the designated column in the current row | |
| 3184 | + * of this rowset's <code>ResultSet</code> object as an <code>Object</code>. | |
| 3185 | + * This method uses the given <code>Map</code> object | |
| 3186 | + * for the custom mapping of the | |
| 3187 | + * SQL structured or distinct type that is being retrieved. | |
| 3188 | + * | |
| 3189 | + * @param i the first column is 1, the second is 2, and so on | |
| 3190 | + * @param map a <code>java.util.Map</code> object that contains the mapping | |
| 3191 | + * from SQL type names to classes in the Java programming language | |
| 3192 | + * @return an <code>Object</code> in the Java programming language | |
| 3193 | + * representing the SQL value | |
| 3194 | + * @throws SQLException if (1) a database access error occurs | |
| 3195 | + * or (2) this rowset does not currently have a valid connection, | |
| 3196 | + * prepared statement, and result set | |
| 3197 | + */ | |
| 3198 | + public Object getObject(int i, java.util.Map<String,Class<?>> map) | |
| 3199 | + throws SQLException | |
| 3200 | + { | |
| 3201 | + checkState(); | |
| 3202 | + | |
| 3203 | + return rs.getObject(i, map); | |
| 3204 | + } | |
| 3205 | + | |
| 3206 | + /** | |
| 3207 | + * Returns the value of the designated column in the current row | |
| 3208 | + * of this rowset's <code>ResultSet</code> object as a <code>Ref</code> object. | |
| 3209 | + * | |
| 3210 | + * @param i the first column is 1, the second is 2, and so on | |
| 3211 | + * @return a <code>Ref</code> object representing an SQL <code>REF</code> value | |
| 3212 | + * @throws SQLException if (1) a database access error occurs | |
| 3213 | + * or (2) this rowset does not currently have a valid connection, | |
| 3214 | + * prepared statement, and result set | |
| 3215 | + */ | |
| 3216 | + public Ref getRef(int i) throws SQLException { | |
| 3217 | + checkState(); | |
| 3218 | + | |
| 3219 | + return rs.getRef(i); | |
| 3220 | + } | |
| 3221 | + | |
| 3222 | + | |
| 3223 | + /** | |
| 3224 | + * Returns the value of the designated column in the current row | |
| 3225 | + * of this rowset's <code>ResultSet</code> object as a <code>Blob</code> object. | |
| 3226 | + * | |
| 3227 | + * @param i the first column is 1, the second is 2, and so on | |
| 3228 | + * @return a <code>Blob</code> object representing the SQL <code>BLOB</code> | |
| 3229 | + * value in the specified column | |
| 3230 | + * @throws SQLException if (1) a database access error occurs | |
| 3231 | + * or (2) this rowset does not currently have a valid connection, | |
| 3232 | + * prepared statement, and result set | |
| 3233 | + */ | |
| 3234 | + public Blob getBlob(int i) throws SQLException { | |
| 3235 | + checkState(); | |
| 3236 | + | |
| 3237 | + return rs.getBlob(i); | |
| 3238 | + } | |
| 3239 | + | |
| 3240 | + /** | |
| 3241 | + * Returns the value of the designated column in the current row | |
| 3242 | + * of this rowset's <code>ResultSet</code> object as a <code>Clob</code> object. | |
| 3243 | + * | |
| 3244 | + * @param i the first column is 1, the second is 2, and so on | |
| 3245 | + * @return a <code>Clob</code> object representing the SQL <code>CLOB</code> | |
| 3246 | + * value in the specified column | |
| 3247 | + * @throws SQLException if (1) a database access error occurs | |
| 3248 | + * or (2) this rowset does not currently have a valid connection, | |
| 3249 | + * prepared statement, and result set | |
| 3250 | + */ | |
| 3251 | + public Clob getClob(int i) throws SQLException { | |
| 3252 | + checkState(); | |
| 3253 | + | |
| 3254 | + return rs.getClob(i); | |
| 3255 | + } | |
| 3256 | + | |
| 3257 | + /** | |
| 3258 | + * Returns the value of the designated column in the current row | |
| 3259 | + * of this rowset's <code>ResultSet</code> object as an <code>Array</code> object. | |
| 3260 | + * | |
| 3261 | + * @param i the first column is 1, the second is 2, and so on. | |
| 3262 | + * @return an <code>Array</code> object representing the SQL <code>ARRAY</code> | |
| 3263 | + * value in the specified column | |
| 3264 | + * @throws SQLException if (1) a database access error occurs | |
| 3265 | + * or (2) this rowset does not currently have a valid connection, | |
| 3266 | + * prepared statement, and result set | |
| 3267 | + */ | |
| 3268 | + public Array getArray(int i) throws SQLException { | |
| 3269 | + checkState(); | |
| 3270 | + | |
| 3271 | + return rs.getArray(i); | |
| 3272 | + } | |
| 3273 | + | |
| 3274 | + /** | |
| 3275 | + * Returns the value of the designated column in the current row | |
| 3276 | + * of this rowset's <code>ResultSet</code> object as an <code>Object</code>. | |
| 3277 | + * This method uses the specified <code>Map</code> object for | |
| 3278 | + * custom mapping if appropriate. | |
| 3279 | + * | |
| 3280 | + * @param colName the name of the column from which to retrieve the value | |
| 3281 | + * @param map a <code>java.util.Map</code> object that contains the mapping | |
| 3282 | + * from SQL type names to classes in the Java programming language | |
| 3283 | + * @return an <code>Object</code> representing the SQL | |
| 3284 | + * value in the specified column | |
| 3285 | + * @throws SQLException if (1) a database access error occurs | |
| 3286 | + * or (2) this rowset does not currently have a valid connection, | |
| 3287 | + * prepared statement, and result set | |
| 3288 | + */ | |
| 3289 | + public Object getObject(String colName, java.util.Map<String,Class<?>> map) | |
| 3290 | + throws SQLException | |
| 3291 | + { | |
| 3292 | + return getObject(findColumn(colName), map); | |
| 3293 | + } | |
| 3294 | + | |
| 3295 | + /** | |
| 3296 | + * Returns the value of the designated column in the current row | |
| 3297 | + * of this rowset's <code>ResultSet</code> object as a <code>Ref</code> object. | |
| 3298 | + * | |
| 3299 | + * @param colName the column name | |
| 3300 | + * @return a <code>Ref</code> object representing the SQL <code>REF</code> value in | |
| 3301 | + * the specified column | |
| 3302 | + * @throws SQLException if (1) a database access error occurs | |
| 3303 | + * or (2) this rowset does not currently have a valid connection, | |
| 3304 | + * prepared statement, and result set | |
| 3305 | + */ | |
| 3306 | + public Ref getRef(String colName) throws SQLException { | |
| 3307 | + return getRef(findColumn(colName)); | |
| 3308 | + } | |
| 3309 | + | |
| 3310 | + /** | |
| 3311 | + * Returns the value of the designated column in the current row | |
| 3312 | + * of this rowset's <code>ResultSet</code> object as a <code>Blob</code> object. | |
| 3313 | + * | |
| 3314 | + * @param colName the name of the column from which to retrieve the value | |
| 3315 | + * @return a <code>Blob</code> object representing the SQL <code>BLOB</code> | |
| 3316 | + * value in the specified column | |
| 3317 | + * @throws SQLException if (1) a database access error occurs | |
| 3318 | + * or (2) this rowset does not currently have a valid connection, | |
| 3319 | + * prepared statement, and result set | |
| 3320 | + */ | |
| 3321 | + public Blob getBlob(String colName) throws SQLException { | |
| 3322 | + return getBlob(findColumn(colName)); | |
| 3323 | + } | |
| 3324 | + | |
| 3325 | + /** | |
| 3326 | + * Returns the value of the designated column in the current row | |
| 3327 | + * of this rowset's <code>ResultSet</code> object as a <code>Clob</code> object. | |
| 3328 | + * | |
| 3329 | + * @param colName the name of the column from which to retrieve the value | |
| 3330 | + * @return a <code>Clob</code> object representing the SQL <code>CLOB</code> | |
| 3331 | + * value in the specified column | |
| 3332 | + * @throws SQLException if (1) a database access error occurs | |
| 3333 | + * or (2) this rowset does not currently have a valid connection, | |
| 3334 | + * prepared statement, and result set | |
| 3335 | + */ | |
| 3336 | + public Clob getClob(String colName) throws SQLException { | |
| 3337 | + return getClob(findColumn(colName)); | |
| 3338 | + } | |
| 3339 | + | |
| 3340 | + /** | |
| 3341 | + * Returns the value of the designated column in the current row | |
| 3342 | + * of this rowset's <code>ResultSet</code> object as an <code>Array</code> object. | |
| 3343 | + * | |
| 3344 | + * @param colName the name of the column from which to retrieve the value | |
| 3345 | + * @return an <code>Array</code> object representing the SQL <code>ARRAY</code> | |
| 3346 | + * value in the specified column | |
| 3347 | + * @throws SQLException if (1) a database access error occurs | |
| 3348 | + * or (2) this rowset does not currently have a valid connection, | |
| 3349 | + * prepared statement, and result set | |
| 3350 | + */ | |
| 3351 | + public Array getArray(String colName) throws SQLException { | |
| 3352 | + return getArray(findColumn(colName)); | |
| 3353 | + } | |
| 3354 | + | |
| 3355 | + /** | |
| 3356 | + * Returns the value of the designated column in the current row | |
| 3357 | + * of this rowset's <code>ResultSet</code> object as a <code>java.sql.Date</code> | |
| 3358 | + * object. This method uses the given calendar to construct an appropriate | |
| 3359 | + * millisecond value for the date if the underlying database does not store | |
| 3360 | + * timezone information. | |
| 3361 | + * | |
| 3362 | + * @param columnIndex the first column is 1, the second is 2, and so on | |
| 3363 | + * @param cal the <code>java.util.Calendar</code> object | |
| 3364 | + * to use in constructing the date | |
| 3365 | + * @return the column value as a <code>java.sql.Date</code> object; | |
| 3366 | + * if the value is SQL <code>NULL</code>, | |
| 3367 | + * the value returned is <code>null</code> | |
| 3368 | + * @throws SQLException if (1) a database access error occurs | |
| 3369 | + * or (2) this rowset does not currently have a valid connection, | |
| 3370 | + * prepared statement, and result set | |
| 3371 | + */ | |
| 3372 | + public java.sql.Date getDate(int columnIndex, Calendar cal) throws SQLException { | |
| 3373 | + checkState(); | |
| 3374 | + | |
| 3375 | + return rs.getDate(columnIndex, cal); | |
| 3376 | + } | |
| 3377 | + | |
| 3378 | + /** | |
| 3379 | + * Returns the value of the designated column in the current row | |
| 3380 | + * of this rowset's <code>ResultSet</code> object as a <code>java.sql.Date</code> | |
| 3381 | + * object. This method uses the given calendar to construct an appropriate | |
| 3382 | + * millisecond value for the date if the underlying database does not store | |
| 3383 | + * timezone information. | |
| 3384 | + * | |
| 3385 | + * @param columnName the SQL name of the column from which to retrieve the value | |
| 3386 | + * @param cal the <code>java.util.Calendar</code> object | |
| 3387 | + * to use in constructing the date | |
| 3388 | + * @return the column value as a <code>java.sql.Date</code> object; | |
| 3389 | + * if the value is SQL <code>NULL</code>, | |
| 3390 | + * the value returned is <code>null</code> | |
| 3391 | + * @throws SQLException if a database access error occurs | |
| 3392 | + * or this rowset does not currently have a valid connection, | |
| 3393 | + * prepared statement, and result set | |
| 3394 | + * | |
| 3395 | + */ | |
| 3396 | + public java.sql.Date getDate(String columnName, Calendar cal) throws SQLException { | |
| 3397 | + return getDate(findColumn(columnName), cal); | |
| 3398 | + } | |
| 3399 | + | |
| 3400 | + /** | |
| 3401 | + * Returns the value of the designated column in the current row | |
| 3402 | + * of this rowset's <code>ResultSet</code> object as a <code>java.sql.Time</code> | |
| 3403 | + * object. This method uses the given calendar to construct an appropriate | |
| 3404 | + * millisecond value for the date if the underlying database does not store | |
| 3405 | + * timezone information. | |
| 3406 | + * | |
| 3407 | + * @param columnIndex the first column is 1, the second is 2, and so on | |
| 3408 | + * @param cal the <code>java.util.Calendar</code> object | |
| 3409 | + * to use in constructing the time | |
| 3410 | + * @return the column value as a <code>java.sql.Time</code> object; | |
| 3411 | + * if the value is SQL <code>NULL</code>, | |
| 3412 | + * the value returned is <code>null</code> in the Java programming language | |
| 3413 | + * @throws SQLException if a database access error occurs | |
| 3414 | + * or this rowset does not currently have a valid connection, | |
| 3415 | + * prepared statement, and result set | |
| 3416 | + */ | |
| 3417 | + public java.sql.Time getTime(int columnIndex, Calendar cal) throws SQLException { | |
| 3418 | + checkState(); | |
| 3419 | + | |
| 3420 | + return rs.getTime(columnIndex, cal); | |
| 3421 | + } | |
| 3422 | + | |
| 3423 | + /** | |
| 3424 | + * Returns the value of the designated column in the current row | |
| 3425 | + * of this rowset's <code>ResultSet</code> object as a <code>java.sql.Time</code> | |
| 3426 | + * object. This method uses the given calendar to construct an appropriate | |
| 3427 | + * millisecond value for the date if the underlying database does not store | |
| 3428 | + * timezone information. | |
| 3429 | + * | |
| 3430 | + * @param columnName the SQL name of the column | |
| 3431 | + * @param cal the <code>java.util.Calendar</code> object | |
| 3432 | + * to use in constructing the time | |
| 3433 | + * @return the column value as a <code>java.sql.Time</code> object; | |
| 3434 | + * if the value is SQL <code>NULL</code>, | |
| 3435 | + * the value returned is <code>null</code> in the Java programming language | |
| 3436 | + * @throws SQLException if a database access error occurs | |
| 3437 | + * or this rowset does not currently have a valid connection, | |
| 3438 | + * prepared statement, and result set | |
| 3439 | + */ | |
| 3440 | + public java.sql.Time getTime(String columnName, Calendar cal) throws SQLException { | |
| 3441 | + return getTime(findColumn(columnName), cal); | |
| 3442 | + } | |
| 3443 | + | |
| 3444 | + /** | |
| 3445 | + * Returns the value of the designated column in the current row | |
| 3446 | + * of this rowset's <code>ResultSet</code> object as a | |
| 3447 | + * <code>java.sql.Timestamp</code> object. | |
| 3448 | + * This method uses the given calendar to construct an appropriate millisecond | |
| 3449 | + * value for the timestamp if the underlying database does not store | |
| 3450 | + * timezone information. | |
| 3451 | + * | |
| 3452 | + * @param columnIndex the first column is 1, the second is 2, and so on | |
| 3453 | + * @param cal the <code>java.util.Calendar</code> object | |
| 3454 | + * to use in constructing the timestamp | |
| 3455 | + * @return the column value as a <code>java.sql.Timestamp</code> object; | |
| 3456 | + * if the value is SQL <code>NULL</code>, | |
| 3457 | + * the value returned is <code>null</code> | |
| 3458 | + * @throws SQLException if a database access error occurs | |
| 3459 | + * or this rowset does not currently have a valid connection, | |
| 3460 | + * prepared statement, and result set | |
| 3461 | + */ | |
| 3462 | + public java.sql.Timestamp getTimestamp(int columnIndex, Calendar cal) throws SQLException { | |
| 3463 | + checkState(); | |
| 3464 | + | |
| 3465 | + return rs.getTimestamp(columnIndex, cal); | |
| 3466 | + } | |
| 3467 | + | |
| 3468 | + /** | |
| 3469 | + * Returns the value of the designated column in the current row | |
| 3470 | + * of this rowset's <code>ResultSet</code> object as a | |
| 3471 | + * <code>java.sql.Timestamp</code> object. | |
| 3472 | + * This method uses the given calendar to construct an appropriate millisecond | |
| 3473 | + * value for the timestamp if the underlying database does not store | |
| 3474 | + * timezone information. | |
| 3475 | + * | |
| 3476 | + * @param columnName the SQL name of the column | |
| 3477 | + * @param cal the <code>java.util.Calendar</code> object | |
| 3478 | + * to use in constructing the timestamp | |
| 3479 | + * @return the column value as a <code>java.sql.Timestamp</code> object; | |
| 3480 | + * if the value is SQL <code>NULL</code>, | |
| 3481 | + * the value returned is <code>null</code> | |
| 3482 | + * @throws SQLException if a database access error occurs | |
| 3483 | + * or this rowset does not currently have a valid connection, | |
| 3484 | + * prepared statement, and result set | |
| 3485 | + */ | |
| 3486 | + public java.sql.Timestamp getTimestamp(String columnName, Calendar cal) throws SQLException { | |
| 3487 | + return getTimestamp(findColumn(columnName), cal); | |
| 3488 | + } | |
| 3489 | + | |
| 3490 | + | |
| 3491 | + /** | |
| 3492 | + * Sets the designated column in either the current row or the insert | |
| 3493 | + * row of this <code>JdbcRowSetImpl</code> object with the given | |
| 3494 | + * <code>double</code> value. | |
| 3495 | + * | |
| 3496 | + * This method updates a column value in either the current row or | |
| 3497 | + * the insert row of this rowset, but it does not update the | |
| 3498 | + * database. If the cursor is on a row in the rowset, the | |
| 3499 | + * method {@link #updateRow} must be called to update the database. | |
| 3500 | + * If the cursor is on the insert row, the method {@link #insertRow} | |
| 3501 | + * must be called, which will insert the new row into both this rowset | |
| 3502 | + * and the database. Both of these methods must be called before the | |
| 3503 | + * cursor moves to another row. | |
| 3504 | + * | |
| 3505 | + * @param columnIndex the first column is <code>1</code>, the second | |
| 3506 | + * is <code>2</code>, and so on; must be <code>1</code> or larger | |
| 3507 | + * and equal to or less than the number of columns in this rowset | |
| 3508 | + * @param ref the new <code>Ref</code> column value | |
| 3509 | + * @throws SQLException if (1) the given column index is out of bounds, | |
| 3510 | + * (2) the cursor is not on one of this rowset's rows or its | |
| 3511 | + * insert row, or (3) this rowset is | |
| 3512 | + * <code>ResultSet.CONCUR_READ_ONLY</code> | |
| 3513 | + */ | |
| 3514 | + public void updateRef(int columnIndex, java.sql.Ref ref) | |
| 3515 | + throws SQLException { | |
| 3516 | + checkState(); | |
| 3517 | + rs.updateRef(columnIndex, ref); | |
| 3518 | + } | |
| 3519 | + | |
| 3520 | + /** | |
| 3521 | + * Sets the designated column in either the current row or the insert | |
| 3522 | + * row of this <code>JdbcRowSetImpl</code> object with the given | |
| 3523 | + * <code>double</code> value. | |
| 3524 | + * | |
| 3525 | + * This method updates a column value in either the current row or | |
| 3526 | + * the insert row of this rowset, but it does not update the | |
| 3527 | + * database. If the cursor is on a row in the rowset, the | |
| 3528 | + * method {@link #updateRow} must be called to update the database. | |
| 3529 | + * If the cursor is on the insert row, the method {@link #insertRow} | |
| 3530 | + * must be called, which will insert the new row into both this rowset | |
| 3531 | + * and the database. Both of these methods must be called before the | |
| 3532 | + * cursor moves to another row. | |
| 3533 | + * | |
| 3534 | + * @param columnName a <code>String</code> object that must match the | |
| 3535 | + * SQL name of a column in this rowset, ignoring case | |
| 3536 | + * @param ref the new column value | |
| 3537 | + * @throws SQLException if (1) the given column name does not match the | |
| 3538 | + * name of a column in this rowset, (2) the cursor is not on | |
| 3539 | + * one of this rowset's rows or its insert row, or (3) this | |
| 3540 | + * rowset is <code>ResultSet.CONCUR_READ_ONLY</code> | |
| 3541 | + */ | |
| 3542 | + public void updateRef(String columnName, java.sql.Ref ref) | |
| 3543 | + throws SQLException { | |
| 3544 | + updateRef(findColumn(columnName), ref); | |
| 3545 | + } | |
| 3546 | + | |
| 3547 | + /** | |
| 3548 | + * Sets the designated column in either the current row or the insert | |
| 3549 | + * row of this <code>JdbcRowSetImpl</code> object with the given | |
| 3550 | + * <code>double</code> value. | |
| 3551 | + * | |
| 3552 | + * This method updates a column value in either the current row or | |
| 3553 | + * the insert row of this rowset, but it does not update the | |
| 3554 | + * database. If the cursor is on a row in the rowset, the | |
| 3555 | + * method {@link #updateRow} must be called to update the database. | |
| 3556 | + * If the cursor is on the insert row, the method {@link #insertRow} | |
| 3557 | + * must be called, which will insert the new row into both this rowset | |
| 3558 | + * and the database. Both of these methods must be called before the | |
| 3559 | + * cursor moves to another row. | |
| 3560 | + * | |
| 3561 | + * @param columnIndex the first column is <code>1</code>, the second | |
| 3562 | + * is <code>2</code>, and so on; must be <code>1</code> or larger | |
| 3563 | + * and equal to or less than the number of columns in this rowset | |
| 3564 | + * @param c the new column <code>Clob</code> value | |
| 3565 | + * @throws SQLException if (1) the given column index is out of bounds, | |
| 3566 | + * (2) the cursor is not on one of this rowset's rows or its | |
| 3567 | + * insert row, or (3) this rowset is | |
| 3568 | + * <code>ResultSet.CONCUR_READ_ONLY</code> | |
| 3569 | + */ | |
| 3570 | + public void updateClob(int columnIndex, Clob c) throws SQLException { | |
| 3571 | + checkState(); | |
| 3572 | + rs.updateClob(columnIndex, c); | |
| 3573 | + } | |
| 3574 | + | |
| 3575 | + | |
| 3576 | + /** | |
| 3577 | + * Sets the designated column in either the current row or the insert | |
| 3578 | + * row of this <code>JdbcRowSetImpl</code> object with the given | |
| 3579 | + * <code>double</code> value. | |
| 3580 | + * | |
| 3581 | + * This method updates a column value in either the current row or | |
| 3582 | + * the insert row of this rowset, but it does not update the | |
| 3583 | + * database. If the cursor is on a row in the rowset, the | |
| 3584 | + * method {@link #updateRow} must be called to update the database. | |
| 3585 | + * If the cursor is on the insert row, the method {@link #insertRow} | |
| 3586 | + * must be called, which will insert the new row into both this rowset | |
| 3587 | + * and the database. Both of these methods must be called before the | |
| 3588 | + * cursor moves to another row. | |
| 3589 | + * | |
| 3590 | + * @param columnName a <code>String</code> object that must match the | |
| 3591 | + * SQL name of a column in this rowset, ignoring case | |
| 3592 | + * @param c the new column <code>Clob</code> value | |
| 3593 | + * @throws SQLException if (1) the given column name does not match the | |
| 3594 | + * name of a column in this rowset, (2) the cursor is not on | |
| 3595 | + * one of this rowset's rows or its insert row, or (3) this | |
| 3596 | + * rowset is <code>ResultSet.CONCUR_READ_ONLY</code> | |
| 3597 | + */ | |
| 3598 | + public void updateClob(String columnName, Clob c) throws SQLException { | |
| 3599 | + updateClob(findColumn(columnName), c); | |
| 3600 | + } | |
| 3601 | + | |
| 3602 | + /** | |
| 3603 | + * Sets the designated column in either the current row or the insert | |
| 3604 | + * row of this <code>JdbcRowSetImpl</code> object with the given | |
| 3605 | + * <code>java.sql.Blob</code> value. | |
| 3606 | + * | |
| 3607 | + * This method updates a column value in either the current row or | |
| 3608 | + * the insert row of this rowset, but it does not update the | |
| 3609 | + * database. If the cursor is on a row in the rowset, the | |
| 3610 | + * method {@link #updateRow} must be called to update the database. | |
| 3611 | + * If the cursor is on the insert row, the method {@link #insertRow} | |
| 3612 | + * must be called, which will insert the new row into both this rowset | |
| 3613 | + * and the database. Both of these methods must be called before the | |
| 3614 | + * cursor moves to another row. | |
| 3615 | + * | |
| 3616 | + * @param columnIndex the first column is <code>1</code>, the second | |
| 3617 | + * is <code>2</code>, and so on; must be <code>1</code> or larger | |
| 3618 | + * and equal to or less than the number of columns in this rowset | |
| 3619 | + * @param b the new column <code>Blob</code> value | |
| 3620 | + * @throws SQLException if (1) the given column index is out of bounds, | |
| 3621 | + * (2) the cursor is not on one of this rowset's rows or its | |
| 3622 | + * insert row, or (3) this rowset is | |
| 3623 | + * <code>ResultSet.CONCUR_READ_ONLY</code> | |
| 3624 | + */ | |
| 3625 | + public void updateBlob(int columnIndex, Blob b) throws SQLException { | |
| 3626 | + checkState(); | |
| 3627 | + rs.updateBlob(columnIndex, b); | |
| 3628 | + } | |
| 3629 | + | |
| 3630 | + /** | |
| 3631 | + * Sets the designated column in either the current row or the insert | |
| 3632 | + * row of this <code>JdbcRowSetImpl</code> object with the given | |
| 3633 | + * <code>java.sql.Blob </code> value. | |
| 3634 | + * | |
| 3635 | + * This method updates a column value in either the current row or | |
| 3636 | + * the insert row of this rowset, but it does not update the | |
| 3637 | + * database. If the cursor is on a row in the rowset, the | |
| 3638 | + * method {@link #updateRow} must be called to update the database. | |
| 3639 | + * If the cursor is on the insert row, the method {@link #insertRow} | |
| 3640 | + * must be called, which will insert the new row into both this rowset | |
| 3641 | + * and the database. Both of these methods must be called before the | |
| 3642 | + * cursor moves to another row. | |
| 3643 | + * | |
| 3644 | + * @param columnName a <code>String</code> object that must match the | |
| 3645 | + * SQL name of a column in this rowset, ignoring case | |
| 3646 | + * @param b the new column <code>Blob</code> value | |
| 3647 | + * @throws SQLException if (1) the given column name does not match the | |
| 3648 | + * name of a column in this rowset, (2) the cursor is not on | |
| 3649 | + * one of this rowset's rows or its insert row, or (3) this | |
| 3650 | + * rowset is <code>ResultSet.CONCUR_READ_ONLY</code> | |
| 3651 | + */ | |
| 3652 | + public void updateBlob(String columnName, Blob b) throws SQLException { | |
| 3653 | + updateBlob(findColumn(columnName), b); | |
| 3654 | + } | |
| 3655 | + | |
| 3656 | + /** | |
| 3657 | + * Sets the designated column in either the current row or the insert | |
| 3658 | + * row of this <code>JdbcRowSetImpl</code> object with the given | |
| 3659 | + * <code>java.sql.Array</code> values. | |
| 3660 | + * | |
| 3661 | + * This method updates a column value in either the current row or | |
| 3662 | + * the insert row of this rowset, but it does not update the | |
| 3663 | + * database. If the cursor is on a row in the rowset, the | |
| 3664 | + * method {@link #updateRow} must be called to update the database. | |
| 3665 | + * If the cursor is on the insert row, the method {@link #insertRow} | |
| 3666 | + * must be called, which will insert the new row into both this rowset | |
| 3667 | + * and the database. Both of these methods must be called before the | |
| 3668 | + * cursor moves to another row. | |
| 3669 | + * | |
| 3670 | + * @param columnIndex the first column is <code>1</code>, the second | |
| 3671 | + * is <code>2</code>, and so on; must be <code>1</code> or larger | |
| 3672 | + * and equal to or less than the number of columns in this rowset | |
| 3673 | + * @param a the new column <code>Array</code> value | |
| 3674 | + * @throws SQLException if (1) the given column index is out of bounds, | |
| 3675 | + * (2) the cursor is not on one of this rowset's rows or its | |
| 3676 | + * insert row, or (3) this rowset is | |
| 3677 | + * <code>ResultSet.CONCUR_READ_ONLY</code> | |
| 3678 | + */ | |
| 3679 | + public void updateArray(int columnIndex, Array a) throws SQLException { | |
| 3680 | + checkState(); | |
| 3681 | + rs.updateArray(columnIndex, a); | |
| 3682 | + } | |
| 3683 | + | |
| 3684 | + /** | |
| 3685 | + * Sets the designated column in either the current row or the insert | |
| 3686 | + * row of this <code>JdbcRowSetImpl</code> object with the given | |
| 3687 | + * <code>java.sql.Array</code> value. | |
| 3688 | + * | |
| 3689 | + * This method updates a column value in either the current row or | |
| 3690 | + * the insert row of this rowset, but it does not update the | |
| 3691 | + * database. If the cursor is on a row in the rowset, the | |
| 3692 | + * method {@link #updateRow} must be called to update the database. | |
| 3693 | + * If the cursor is on the insert row, the method {@link #insertRow} | |
| 3694 | + * must be called, which will insert the new row into both this rowset | |
| 3695 | + * and the database. Both of these methods must be called before the | |
| 3696 | + * cursor moves to another row. | |
| 3697 | + * | |
| 3698 | + * @param columnName a <code>String</code> object that must match the | |
| 3699 | + * SQL name of a column in this rowset, ignoring case | |
| 3700 | + * @param a the new column <code>Array</code> value | |
| 3701 | + * @throws SQLException if (1) the given column name does not match the | |
| 3702 | + * name of a column in this rowset, (2) the cursor is not on | |
| 3703 | + * one of this rowset's rows or its insert row, or (3) this | |
| 3704 | + * rowset is <code>ResultSet.CONCUR_READ_ONLY</code> | |
| 3705 | + */ | |
| 3706 | + public void updateArray(String columnName, Array a) throws SQLException { | |
| 3707 | + updateArray(findColumn(columnName), a); | |
| 3708 | + } | |
| 3709 | + | |
| 3710 | + /** | |
| 3711 | + * Provide interface coverage for getURL(int) in ResultSet->RowSet | |
| 3712 | + */ | |
| 3713 | + public java.net.URL getURL(int columnIndex) throws SQLException { | |
| 3714 | + checkState(); | |
| 3715 | + return rs.getURL(columnIndex); | |
| 3716 | + } | |
| 3717 | + | |
| 3718 | + /** | |
| 3719 | + * Provide interface coverage for getURL(String) in ResultSet->RowSet | |
| 3720 | + */ | |
| 3721 | + public java.net.URL getURL(String columnName) throws SQLException { | |
| 3722 | + return getURL(findColumn(columnName)); | |
| 3723 | + } | |
| 3724 | + | |
| 3725 | + /** | |
| 3726 | + * Return the RowSetWarning object for the current row of a | |
| 3727 | + * <code>JdbcRowSetImpl</code> | |
| 3728 | + */ | |
| 3729 | + public RowSetWarning getRowSetWarnings() throws SQLException { | |
| 3730 | + return null; | |
| 3731 | + } | |
| 3732 | + /** | |
| 3733 | + * Unsets the designated parameter to the given int array. | |
| 3734 | + * This was set using <code>setMatchColumn</code> | |
| 3735 | + * as the column which will form the basis of the join. | |
| 3736 | + * <P> | |
| 3737 | + * The parameter value unset by this method should be same | |
| 3738 | + * as was set. | |
| 3739 | + * | |
| 3740 | + * @param columnIdxes the index into this rowset | |
| 3741 | + * object's internal representation of parameter values | |
| 3742 | + * @throws SQLException if an error occurs or the | |
| 3743 | + * parameter index is out of bounds or if the columnIdx is | |
| 3744 | + * not the same as set using <code>setMatchColumn(int [])</code> | |
| 3745 | + */ | |
| 3746 | + public void unsetMatchColumn(int[] columnIdxes) throws SQLException { | |
| 3747 | + | |
| 3748 | + int i_val; | |
| 3749 | + for( int j= 0 ;j < columnIdxes.length; j++) { | |
| 3750 | + i_val = (Integer.parseInt(iMatchColumns.get(j).toString())); | |
| 3751 | + if(columnIdxes[j] != i_val) { | |
| 3752 | + throw new SQLException(resBundle.handleGetObject("jdbcrowsetimpl.matchcols").toString()); | |
| 3753 | + } | |
| 3754 | + } | |
| 3755 | + | |
| 3756 | + for( int i = 0;i < columnIdxes.length ;i++) { | |
| 3757 | + iMatchColumns.set(i,Integer.valueOf(-1)); | |
| 3758 | + } | |
| 3759 | + } | |
| 3760 | + | |
| 3761 | + /** | |
| 3762 | + * Unsets the designated parameter to the given String array. | |
| 3763 | + * This was set using <code>setMatchColumn</code> | |
| 3764 | + * as the column which will form the basis of the join. | |
| 3765 | + * <P> | |
| 3766 | + * The parameter value unset by this method should be same | |
| 3767 | + * as was set. | |
| 3768 | + * | |
| 3769 | + * @param columnIdxes the index into this rowset | |
| 3770 | + * object's internal representation of parameter values | |
| 3771 | + * @throws SQLException if an error occurs or the | |
| 3772 | + * parameter index is out of bounds or if the columnName is | |
| 3773 | + * not the same as set using <code>setMatchColumn(String [])</code> | |
| 3774 | + */ | |
| 3775 | + public void unsetMatchColumn(String[] columnIdxes) throws SQLException { | |
| 3776 | + | |
| 3777 | + for(int j = 0 ;j < columnIdxes.length; j++) { | |
| 3778 | + if( !columnIdxes[j].equals(strMatchColumns.get(j)) ){ | |
| 3779 | + throw new SQLException(resBundle.handleGetObject("jdbcrowsetimpl.matchcols").toString()); | |
| 3780 | + } | |
| 3781 | + } | |
| 3782 | + | |
| 3783 | + for(int i = 0 ; i < columnIdxes.length; i++) { | |
| 3784 | + strMatchColumns.set(i,null); | |
| 3785 | + } | |
| 3786 | + } | |
| 3787 | + | |
| 3788 | + /** | |
| 3789 | + * Retrieves the column name as <code>String</code> array | |
| 3790 | + * that was set using <code>setMatchColumn(String [])</code> | |
| 3791 | + * for this rowset. | |
| 3792 | + * | |
| 3793 | + * @return a <code>String</code> array object that contains the column names | |
| 3794 | + * for the rowset which has this the match columns | |
| 3795 | + * | |
| 3796 | + * @throws SQLException if an error occurs or column name is not set | |
| 3797 | + */ | |
| 3798 | + public String[] getMatchColumnNames() throws SQLException { | |
| 3799 | + | |
| 3800 | + String []str_temp = new String[strMatchColumns.size()]; | |
| 3801 | + | |
| 3802 | + if( strMatchColumns.get(0) == null) { | |
| 3803 | + throw new SQLException(resBundle.handleGetObject("jdbcrowsetimpl.setmatchcols").toString()); | |
| 3804 | + } | |
| 3805 | + | |
| 3806 | + strMatchColumns.copyInto(str_temp); | |
| 3807 | + return str_temp; | |
| 3808 | + } | |
| 3809 | + | |
| 3810 | + /** | |
| 3811 | + * Retrieves the column id as <code>int</code> array that was set using | |
| 3812 | + * <code>setMatchColumn(int [])</code> for this rowset. | |
| 3813 | + * | |
| 3814 | + * @return a <code>int</code> array object that contains the column ids | |
| 3815 | + * for the rowset which has this as the match columns. | |
| 3816 | + * | |
| 3817 | + * @throws SQLException if an error occurs or column index is not set | |
| 3818 | + */ | |
| 3819 | + public int[] getMatchColumnIndexes() throws SQLException { | |
| 3820 | + | |
| 3821 | + Integer []int_temp = new Integer[iMatchColumns.size()]; | |
| 3822 | + int [] i_temp = new int[iMatchColumns.size()]; | |
| 3823 | + int i_val; | |
| 3824 | + | |
| 3825 | + i_val = ((Integer)iMatchColumns.get(0)).intValue(); | |
| 3826 | + | |
| 3827 | + if( i_val == -1 ) { | |
| 3828 | + throw new SQLException(resBundle.handleGetObject("jdbcrowsetimpl.setmatchcols").toString()); | |
| 3829 | + } | |
| 3830 | + | |
| 3831 | + | |
| 3832 | + iMatchColumns.copyInto(int_temp); | |
| 3833 | + | |
| 3834 | + for(int i = 0; i < int_temp.length; i++) { | |
| 3835 | + i_temp[i] = (int_temp[i]).intValue(); | |
| 3836 | + } | |
| 3837 | + | |
| 3838 | + return i_temp; | |
| 3839 | + } | |
| 3840 | + | |
| 3841 | + /** | |
| 3842 | + * Sets the designated parameter to the given int array. | |
| 3843 | + * This forms the basis of the join for the | |
| 3844 | + * <code>JoinRowSet</code> as the column which will form the basis of the | |
| 3845 | + * join. | |
| 3846 | + * <P> | |
| 3847 | + * The parameter value set by this method is stored internally and | |
| 3848 | + * will be supplied as the appropriate parameter in this rowset's | |
| 3849 | + * command when the method <code>getMatchColumnIndexes</code> is called. | |
| 3850 | + * | |
| 3851 | + * @param columnIdxes the indexes into this rowset | |
| 3852 | + * object's internal representation of parameter values; the | |
| 3853 | + * first parameter is 0, the second is 1, and so on; must be | |
| 3854 | + * <code>0</code> or greater | |
| 3855 | + * @throws SQLException if an error occurs or the | |
| 3856 | + * parameter index is out of bounds | |
| 3857 | + */ | |
| 3858 | + public void setMatchColumn(int[] columnIdxes) throws SQLException { | |
| 3859 | + | |
| 3860 | + for(int j = 0 ; j < columnIdxes.length; j++) { | |
| 3861 | + if( columnIdxes[j] < 0 ) { | |
| 3862 | + throw new SQLException(resBundle.handleGetObject("jdbcrowsetimpl.matchcols1").toString()); | |
| 3863 | + } | |
| 3864 | + } | |
| 3865 | + for(int i = 0 ;i < columnIdxes.length; i++) { | |
| 3866 | + iMatchColumns.add(i,Integer.valueOf(columnIdxes[i])); | |
| 3867 | + } | |
| 3868 | + } | |
| 3869 | + | |
| 3870 | + /** | |
| 3871 | + * Sets the designated parameter to the given String array. | |
| 3872 | + * This forms the basis of the join for the | |
| 3873 | + * <code>JoinRowSet</code> as the column which will form the basis of the | |
| 3874 | + * join. | |
| 3875 | + * <P> | |
| 3876 | + * The parameter value set by this method is stored internally and | |
| 3877 | + * will be supplied as the appropriate parameter in this rowset's | |
| 3878 | + * command when the method <code>getMatchColumn</code> is called. | |
| 3879 | + * | |
| 3880 | + * @param columnNames the name of the column into this rowset | |
| 3881 | + * object's internal representation of parameter values | |
| 3882 | + * @throws SQLException if an error occurs or the | |
| 3883 | + * parameter index is out of bounds | |
| 3884 | + */ | |
| 3885 | + public void setMatchColumn(String[] columnNames) throws SQLException { | |
| 3886 | + | |
| 3887 | + for(int j = 0; j < columnNames.length; j++) { | |
| 3888 | + if( columnNames[j] == null || columnNames[j].equals("")) { | |
| 3889 | + throw new SQLException(resBundle.handleGetObject("jdbcrowsetimpl.matchcols2").toString()); | |
| 3890 | + } | |
| 3891 | + } | |
| 3892 | + for( int i = 0; i < columnNames.length; i++) { | |
| 3893 | + strMatchColumns.add(i,columnNames[i]); | |
| 3894 | + } | |
| 3895 | + } | |
| 3896 | + | |
| 3897 | + | |
| 3898 | + /** | |
| 3899 | + * Sets the designated parameter to the given <code>int</code> | |
| 3900 | + * object. This forms the basis of the join for the | |
| 3901 | + * <code>JoinRowSet</code> as the column which will form the basis of the | |
| 3902 | + * join. | |
| 3903 | + * <P> | |
| 3904 | + * The parameter value set by this method is stored internally and | |
| 3905 | + * will be supplied as the appropriate parameter in this rowset's | |
| 3906 | + * command when the method <code>getMatchColumn</code> is called. | |
| 3907 | + * | |
| 3908 | + * @param columnIdx the index into this rowset | |
| 3909 | + * object's internal representation of parameter values; the | |
| 3910 | + * first parameter is 0, the second is 1, and so on; must be | |
| 3911 | + * <code>0</code> or greater | |
| 3912 | + * @throws SQLException if an error occurs or the | |
| 3913 | + * parameter index is out of bounds | |
| 3914 | + */ | |
| 3915 | + public void setMatchColumn(int columnIdx) throws SQLException { | |
| 3916 | + // validate, if col is ok to be set | |
| 3917 | + if(columnIdx < 0) { | |
| 3918 | + throw new SQLException(resBundle.handleGetObject("jdbcrowsetimpl.matchcols1").toString()); | |
| 3919 | + } else { | |
| 3920 | + // set iMatchColumn | |
| 3921 | + iMatchColumns.set(0, Integer.valueOf(columnIdx)); | |
| 3922 | + //strMatchColumn = null; | |
| 3923 | + } | |
| 3924 | + } | |
| 3925 | + | |
| 3926 | + /** | |
| 3927 | + * Sets the designated parameter to the given <code>String</code> | |
| 3928 | + * object. This forms the basis of the join for the | |
| 3929 | + * <code>JoinRowSet</code> as the column which will form the basis of the | |
| 3930 | + * join. | |
| 3931 | + * <P> | |
| 3932 | + * The parameter value set by this method is stored internally and | |
| 3933 | + * will be supplied as the appropriate parameter in this rowset's | |
| 3934 | + * command when the method <code>getMatchColumn</code> is called. | |
| 3935 | + * | |
| 3936 | + * @param columnName the name of the column into this rowset | |
| 3937 | + * object's internal representation of parameter values | |
| 3938 | + * @throws SQLException if an error occurs or the | |
| 3939 | + * parameter index is out of bounds | |
| 3940 | + */ | |
| 3941 | + public void setMatchColumn(String columnName) throws SQLException { | |
| 3942 | + // validate, if col is ok to be set | |
| 3943 | + if(columnName == null || (columnName= columnName.trim()).equals("")) { | |
| 3944 | + throw new SQLException(resBundle.handleGetObject("jdbcrowsetimpl.matchcols2").toString()); | |
| 3945 | + } else { | |
| 3946 | + // set strMatchColumn | |
| 3947 | + strMatchColumns.set(0, columnName); | |
| 3948 | + //iMatchColumn = -1; | |
| 3949 | + } | |
| 3950 | + } | |
| 3951 | + | |
| 3952 | + /** | |
| 3953 | + * Unsets the designated parameter to the given <code>int</code> | |
| 3954 | + * object. This was set using <code>setMatchColumn</code> | |
| 3955 | + * as the column which will form the basis of the join. | |
| 3956 | + * <P> | |
| 3957 | + * The parameter value unset by this method should be same | |
| 3958 | + * as was set. | |
| 3959 | + * | |
| 3960 | + * @param columnIdx the index into this rowset | |
| 3961 | + * object's internal representation of parameter values | |
| 3962 | + * @throws SQLException if an error occurs or the | |
| 3963 | + * parameter index is out of bounds or if the columnIdx is | |
| 3964 | + * not the same as set using <code>setMatchColumn(int)</code> | |
| 3965 | + */ | |
| 3966 | + public void unsetMatchColumn(int columnIdx) throws SQLException { | |
| 3967 | + // check if we are unsetting the SAME column | |
| 3968 | + if(! iMatchColumns.get(0).equals(Integer.valueOf(columnIdx) ) ) { | |
| 3969 | + throw new SQLException(resBundle.handleGetObject("jdbcrowsetimpl.unsetmatch").toString()); | |
| 3970 | + } else if(strMatchColumns.get(0) != null) { | |
| 3971 | + throw new SQLException(resBundle.handleGetObject("jdbcrowsetimpl.usecolname").toString()); | |
| 3972 | + } else { | |
| 3973 | + // that is, we are unsetting it. | |
| 3974 | + iMatchColumns.set(0, Integer.valueOf(-1)); | |
| 3975 | + } | |
| 3976 | + } | |
| 3977 | + | |
| 3978 | + /** | |
| 3979 | + * Unsets the designated parameter to the given <code>String</code> | |
| 3980 | + * object. This was set using <code>setMatchColumn</code> | |
| 3981 | + * as the column which will form the basis of the join. | |
| 3982 | + * <P> | |
| 3983 | + * The parameter value unset by this method should be same | |
| 3984 | + * as was set. | |
| 3985 | + * | |
| 3986 | + * @param columnName the index into this rowset | |
| 3987 | + * object's internal representation of parameter values | |
| 3988 | + * @throws SQLException if an error occurs or the | |
| 3989 | + * parameter index is out of bounds or if the columnName is | |
| 3990 | + * not the same as set using <code>setMatchColumn(String)</code> | |
| 3991 | + * | |
| 3992 | + */ | |
| 3993 | + public void unsetMatchColumn(String columnName) throws SQLException { | |
| 3994 | + // check if we are unsetting the same column | |
| 3995 | + columnName = columnName.trim(); | |
| 3996 | + | |
| 3997 | + if(!((strMatchColumns.get(0)).equals(columnName))) { | |
| 3998 | + throw new SQLException(resBundle.handleGetObject("jdbcrowsetimpl.unsetmatch").toString()); | |
| 3999 | + } else if( ((Integer)(iMatchColumns.get(0))).intValue() > 0) { | |
| 4000 | + throw new SQLException(resBundle.handleGetObject("jdbcrowsetimpl.usecolid").toString()); | |
| 4001 | + } else { | |
| 4002 | + strMatchColumns.set(0, null); // that is, we are unsetting it. | |
| 4003 | + } | |
| 4004 | + } | |
| 4005 | + | |
| 4006 | + /** | |
| 4007 | + * Retrieves the <code>DatabaseMetaData</code> associated with | |
| 4008 | + * the connection handle associated this this | |
| 4009 | + * <code>JdbcRowSet</code> object. | |
| 4010 | + * | |
| 4011 | + * @return the <code>DatabaseMetadata</code> associated | |
| 4012 | + * with the rowset's connection. | |
| 4013 | + * @throws SQLException if a database access error occurs | |
| 4014 | + */ | |
| 4015 | + public DatabaseMetaData getDatabaseMetaData() throws SQLException { | |
| 4016 | + Connection con = connect(); | |
| 4017 | + return con.getMetaData(); | |
| 4018 | + } | |
| 4019 | + | |
| 4020 | + /** | |
| 4021 | + * Retrieves the <code>ParameterMetaData</code> associated with | |
| 4022 | + * the connection handle associated this this | |
| 4023 | + * <code>JdbcRowSet</code> object. | |
| 4024 | + * | |
| 4025 | + * @return the <code>ParameterMetadata</code> associated | |
| 4026 | + * with the rowset's connection. | |
| 4027 | + * @throws SQLException if a database access error occurs | |
| 4028 | + */ | |
| 4029 | + public ParameterMetaData getParameterMetaData() throws SQLException { | |
| 4030 | + prepare(); | |
| 4031 | + return (ps.getParameterMetaData()); | |
| 4032 | + } | |
| 4033 | + | |
| 4034 | + /** | |
| 4035 | + * Commits all updates in this <code>JdbcRowSet</code> object by | |
| 4036 | + * wrapping the internal <code>Connection</code> object and calling | |
| 4037 | + * its <code>commit</code> method. | |
| 4038 | + * This method sets this <code>JdbcRowSet</code> object's private field | |
| 4039 | + * <code>rs</code> to <code>null</code> after saving its value to another | |
| 4040 | + * object, but only if the <code>ResultSet</code> | |
| 4041 | + * constant <code>HOLD_CURSORS_OVER_COMMIT</code> has not been set. | |
| 4042 | + * (The field <code>rs</code> is this <code>JdbcRowSet</code> object's | |
| 4043 | + * <code>ResultSet</code> object.) | |
| 4044 | + * | |
| 4045 | + * @throws SQLException if autoCommit is set to true or if a database | |
| 4046 | + * access error occurs | |
| 4047 | + */ | |
| 4048 | + public void commit() throws SQLException { | |
| 4049 | + conn.commit(); | |
| 4050 | + | |
| 4051 | + // Checking the holadbility value and making the result set handle null | |
| 4052 | + // Added as per Rave requirements | |
| 4053 | + | |
| 4054 | + if( conn.getHoldability() != HOLD_CURSORS_OVER_COMMIT) { | |
| 4055 | + ResultSet oldVal = rs; | |
| 4056 | + rs = null; | |
| 4057 | + // propertyChangeSupport.firePropertyChange("ResultSet",oldVal,rs); | |
| 4058 | + } | |
| 4059 | + } | |
| 4060 | + | |
| 4061 | + /** | |
| 4062 | + * Sets auto-commit on the internal <code>Connection</code> object with this | |
| 4063 | + * <code>JdbcRowSet</code> | |
| 4064 | + * | |
| 4065 | + * @throws SQLException if a database access error occurs | |
| 4066 | + */ | |
| 4067 | + public void setAutoCommit(boolean autoCommit) throws SQLException { | |
| 4068 | + // The connection object should be there | |
| 4069 | + // in order to commit the connection handle on or off. | |
| 4070 | + | |
| 4071 | + if(conn != null) { | |
| 4072 | + conn.setAutoCommit(autoCommit); | |
| 4073 | + } else { | |
| 4074 | + // Coming here means the connection object is null. | |
| 4075 | + // So generate a connection handle internally, since | |
| 4076 | + // a JdbcRowSet is always connected to a db, it is fine | |
| 4077 | + // to get a handle to the connection. | |
| 4078 | + | |
| 4079 | + // Get hold of a connection handle | |
| 4080 | + // and change the autcommit as passesd. | |
| 4081 | + conn = connect(); | |
| 4082 | + | |
| 4083 | + // After setting the below the conn.getAutoCommit() | |
| 4084 | + // should return the same value. | |
| 4085 | + conn.setAutoCommit(autoCommit); | |
| 4086 | + | |
| 4087 | + } | |
| 4088 | + } | |
| 4089 | + | |
| 4090 | + /** | |
| 4091 | + * Returns the auto-commit status with this <code>JdbcRowSet</code>. | |
| 4092 | + * | |
| 4093 | + * @return true if auto commit is true; false otherwise | |
| 4094 | + * @throws SQLException if a database access error occurs | |
| 4095 | + */ | |
| 4096 | + public boolean getAutoCommit() throws SQLException { | |
| 4097 | + return conn.getAutoCommit(); | |
| 4098 | + } | |
| 4099 | + | |
| 4100 | + /** | |
| 4101 | + * Rolls back all the updates in this <code>JdbcRowSet</code> object by | |
| 4102 | + * wrapping the internal <code>Connection</code> object and calling its | |
| 4103 | + * <code>rollback</code> method. | |
| 4104 | + * This method sets this <code>JdbcRowSet</code> object's private field | |
| 4105 | + * <code>rs</code> to <code>null</code> after saving its value to another object. | |
| 4106 | + * (The field <code>rs</code> is this <code>JdbcRowSet</code> object's | |
| 4107 | + * internal <code>ResultSet</code> object.) | |
| 4108 | + * | |
| 4109 | + * @throws SQLException if autoCommit is set to true or a database | |
| 4110 | + * access error occurs | |
| 4111 | + */ | |
| 4112 | + public void rollback() throws SQLException { | |
| 4113 | + conn.rollback(); | |
| 4114 | + | |
| 4115 | + // Makes the result ste handle null after rollback | |
| 4116 | + // Added as per Rave requirements | |
| 4117 | + | |
| 4118 | + ResultSet oldVal = rs; | |
| 4119 | + rs = null; | |
| 4120 | + // propertyChangeSupport.firePropertyChange("ResultSet", oldVal,rs); | |
| 4121 | + } | |
| 4122 | + | |
| 4123 | + | |
| 4124 | + /** | |
| 4125 | + * Rollbacks all the updates in the <code>JdbcRowSet</code> back to the | |
| 4126 | + * last <code>Savepoint</code> transaction marker. Wraps the internal | |
| 4127 | + * <code>Connection</code> object and call it's rollback method | |
| 4128 | + * | |
| 4129 | + * @param s the <code>Savepoint</code> transaction marker to roll the | |
| 4130 | + * transaction to. | |
| 4131 | + * @throws SQLException if autoCommit is set to true; or ia a database | |
| 4132 | + * access error occurs | |
| 4133 | + */ | |
| 4134 | + public void rollback(Savepoint s) throws SQLException { | |
| 4135 | + conn.rollback(s); | |
| 4136 | + } | |
| 4137 | + | |
| 4138 | + // Setting the ResultSet Type and Concurrency | |
| 4139 | + protected void setParams() throws SQLException { | |
| 4140 | + if(rs == null) { | |
| 4141 | + setType(ResultSet.TYPE_SCROLL_INSENSITIVE); | |
| 4142 | + setConcurrency(ResultSet.CONCUR_UPDATABLE); | |
| 4143 | + } | |
| 4144 | + else { | |
| 4145 | + setType(rs.getType()); | |
| 4146 | + setConcurrency(rs.getConcurrency()); | |
| 4147 | + } | |
| 4148 | + } | |
| 4149 | + | |
| 4150 | + | |
| 4151 | + // Checking ResultSet Type and Concurrency | |
| 4152 | + private void checkTypeConcurrency() throws SQLException { | |
| 4153 | + if(rs.getType() == TYPE_FORWARD_ONLY || | |
| 4154 | + rs.getConcurrency() == CONCUR_READ_ONLY) { | |
| 4155 | + throw new SQLException(resBundle.handleGetObject("jdbcrowsetimpl.resnotupd").toString()); | |
| 4156 | + } | |
| 4157 | + } | |
| 4158 | + | |
| 4159 | + // Returns a Connection Handle | |
| 4160 | + // Added as per Rave requirements | |
| 4161 | + | |
| 4162 | + /** | |
| 4163 | + * Gets this <code>JdbcRowSet</code> object's Connection property | |
| 4164 | + * | |
| 4165 | + * | |
| 4166 | + * @return the <code>Connection</code> object associated with this rowset; | |
| 4167 | + */ | |
| 4168 | + | |
| 4169 | + protected Connection getConnection() { | |
| 4170 | + return conn; | |
| 4171 | + } | |
| 4172 | + | |
| 4173 | + // Sets the connection handle with the parameter | |
| 4174 | + // Added as per rave requirements | |
| 4175 | + | |
| 4176 | + /** | |
| 4177 | + * Sets this <code>JdbcRowSet</code> object's connection property | |
| 4178 | + * to the given <code>Connection</code> object. | |
| 4179 | + * | |
| 4180 | + * @param connection the <code>Connection</code> object. | |
| 4181 | + */ | |
| 4182 | + | |
| 4183 | + protected void setConnection(Connection connection) { | |
| 4184 | + conn = connection; | |
| 4185 | + } | |
| 4186 | + | |
| 4187 | + // Returns a PreparedStatement Handle | |
| 4188 | + // Added as per Rave requirements | |
| 4189 | + | |
| 4190 | + /** | |
| 4191 | + * Gets this <code>JdbcRowSet</code> object's PreparedStatement property | |
| 4192 | + * | |
| 4193 | + * | |
| 4194 | + * @return the <code>PreparedStatement</code> object associated with this rowset; | |
| 4195 | + */ | |
| 4196 | + | |
| 4197 | + protected PreparedStatement getPreparedStatement() { | |
| 4198 | + return ps; | |
| 4199 | + } | |
| 4200 | + | |
| 4201 | + //Sets the prepared statement handle to the parameter | |
| 4202 | + // Added as per Rave requirements | |
| 4203 | + | |
| 4204 | + /** | |
| 4205 | + * Sets this <code>JdbcRowSet</code> object's preparedtsatement property | |
| 4206 | + * to the given <code>PreparedStatemennt</code> object. | |
| 4207 | + * | |
| 4208 | + * @param preparedStatement the <code>PreparedStatement</code> object | |
| 4209 | + * | |
| 4210 | + */ | |
| 4211 | + protected void setPreparedStatement(PreparedStatement preparedStatement) { | |
| 4212 | + ps = preparedStatement; | |
| 4213 | + } | |
| 4214 | + | |
| 4215 | + // Returns a ResultSet handle | |
| 4216 | + // Added as per Rave requirements | |
| 4217 | + | |
| 4218 | + /** | |
| 4219 | + * Gets this <code>JdbcRowSet</code> object's ResultSet property | |
| 4220 | + * | |
| 4221 | + * | |
| 4222 | + * @return the <code>ResultSet</code> object associated with this rowset; | |
| 4223 | + */ | |
| 4224 | + | |
| 4225 | + protected ResultSet getResultSet() throws SQLException { | |
| 4226 | + | |
| 4227 | + checkState(); | |
| 4228 | + | |
| 4229 | + return rs; | |
| 4230 | + } | |
| 4231 | + | |
| 4232 | + // Sets the result set handle to the parameter | |
| 4233 | + // Added as per Rave requirements | |
| 4234 | + | |
| 4235 | + /** | |
| 4236 | + * Sets this <code>JdbcRowSet</code> object's resultset property | |
| 4237 | + * to the given <code>ResultSet</code> object. | |
| 4238 | + * | |
| 4239 | + * @param resultSet the <code>ResultSet</code> object | |
| 4240 | + * | |
| 4241 | + */ | |
| 4242 | + protected void setResultSet(ResultSet resultSet) { | |
| 4243 | + rs = resultSet; | |
| 4244 | + } | |
| 4245 | + | |
| 4246 | + | |
| 4247 | + // Over riding the setCommand from BaseRowSet for | |
| 4248 | + // firing the propertyChangeSupport Event for | |
| 4249 | + // Rave requirements when this property's value | |
| 4250 | + // changes. | |
| 4251 | + | |
| 4252 | + /** | |
| 4253 | + * Sets this <code>JdbcRowSet</code> object's <code>command</code> property to | |
| 4254 | + * the given <code>String</code> object and clears the parameters, if any, | |
| 4255 | + * that were set for the previous command. In addition, | |
| 4256 | + * if the <code>command</code> property has previously been set to a | |
| 4257 | + * non-null value and it is | |
| 4258 | + * different from the <code>String</code> object supplied, | |
| 4259 | + * this method sets this <code>JdbcRowSet</code> object's private fields | |
| 4260 | + * <code>ps</code> and <code>rs</code> to <code>null</code>. | |
| 4261 | + * (The field <code>ps</code> is its <code>PreparedStatement</code> object, and | |
| 4262 | + * the field <code>rs</code> is its <code>ResultSet</code> object.) | |
| 4263 | + * <P> | |
| 4264 | + * The <code>command</code> property may not be needed if the <code>RowSet</code> | |
| 4265 | + * object gets its data from a source that does not support commands, | |
| 4266 | + * such as a spreadsheet or other tabular file. | |
| 4267 | + * Thus, this property is optional and may be <code>null</code>. | |
| 4268 | + * | |
| 4269 | + * @param command a <code>String</code> object containing an SQL query | |
| 4270 | + * that will be set as this <code>RowSet</code> object's command | |
| 4271 | + * property; may be <code>null</code> but may not be an empty string | |
| 4272 | + * @throws SQLException if an empty string is provided as the command value | |
| 4273 | + * @see #getCommand | |
| 4274 | + */ | |
| 4275 | + public void setCommand(String command) throws SQLException { | |
| 4276 | + String oldVal; | |
| 4277 | + | |
| 4278 | + if (getCommand() != null) { | |
| 4279 | + if(!getCommand().equals(command)) { | |
| 4280 | + oldVal = getCommand(); | |
| 4281 | + super.setCommand(command); | |
| 4282 | + ps = null; | |
| 4283 | + rs = null; | |
| 4284 | + propertyChangeSupport.firePropertyChange("command", oldVal,command); | |
| 4285 | + } | |
| 4286 | + } | |
| 4287 | + else { | |
| 4288 | + super.setCommand(command); | |
| 4289 | + propertyChangeSupport.firePropertyChange("command", null,command); | |
| 4290 | + } | |
| 4291 | + } | |
| 4292 | + | |
| 4293 | + // Over riding the setDataSourceName from BaseRowSet for | |
| 4294 | + // firing the propertyChangeSupport Event for | |
| 4295 | + // Rave requirements when this property's values | |
| 4296 | + // changes. | |
| 4297 | + | |
| 4298 | + /** | |
| 4299 | + * Sets the <code>dataSourceName</code> property for this <code>JdbcRowSet</code> | |
| 4300 | + * object to the given logical name and sets this <code>JdbcRowSet</code> object's | |
| 4301 | + * Url property to <code>null</code>. In addition, if the <code>dataSourceName</code> | |
| 4302 | + * property has previously been set and is different from the one supplied, | |
| 4303 | + * this method sets this <code>JdbcRowSet</code> object's private fields | |
| 4304 | + * <code>ps</code>, <code>rs</code>, and <code>conn</code> to <code>null</code>. | |
| 4305 | + * (The field <code>ps</code> is its <code>PreparedStatement</code> object, | |
| 4306 | + * the field <code>rs</code> is its <code>ResultSet</code> object, and | |
| 4307 | + * the field <code>conn</code> is its <code>Connection</code> object.) | |
| 4308 | + * <P> | |
| 4309 | + * The name supplied to this method must have been bound to a | |
| 4310 | + * <code>DataSource</code> object in a JNDI naming service so that an | |
| 4311 | + * application can do a lookup using that name to retrieve the | |
| 4312 | + * <code>DataSource</code> object bound to it. The <code>DataSource</code> | |
| 4313 | + * object can then be used to establish a connection to the data source it | |
| 4314 | + * represents. | |
| 4315 | + * <P> | |
| 4316 | + * Users should set either the Url property or the dataSourceName property. | |
| 4317 | + * If both properties are set, the driver will use the property set most recently. | |
| 4318 | + * | |
| 4319 | + * @param dsName a <code>String</code> object with the name that can be supplied | |
| 4320 | + * to a naming service based on JNDI technology to retrieve the | |
| 4321 | + * <code>DataSource</code> object that can be used to get a connection; | |
| 4322 | + * may be <code>null</code> | |
| 4323 | + * @throws SQLException if there is a problem setting the | |
| 4324 | + * <code>dataSourceName</code> property | |
| 4325 | + * @see #getDataSourceName | |
| 4326 | + */ | |
| 4327 | + public void setDataSourceName(String dsName) throws SQLException{ | |
| 4328 | + String oldVal; | |
| 4329 | + | |
| 4330 | + if(getDataSourceName() != null) { | |
| 4331 | + if(!getDataSourceName().equals(dsName)) { | |
| 4332 | + oldVal = getDataSourceName(); | |
| 4333 | + super.setDataSourceName(dsName); | |
| 4334 | + conn = null; | |
| 4335 | + ps = null; | |
| 4336 | + rs = null; | |
| 4337 | + propertyChangeSupport.firePropertyChange("dataSourceName",oldVal,dsName); | |
| 4338 | + } | |
| 4339 | + } | |
| 4340 | + else { | |
| 4341 | + super.setDataSourceName(dsName); | |
| 4342 | + propertyChangeSupport.firePropertyChange("dataSourceName",null,dsName); | |
| 4343 | + } | |
| 4344 | + } | |
| 4345 | + | |
| 4346 | + // Over riding the setUrl from BaseRowSet for | |
| 4347 | + // firing the propertyChangeSupport Event for | |
| 4348 | + // Rave requirements when this property's values | |
| 4349 | + // changes. | |
| 4350 | + | |
| 4351 | + /** | |
| 4352 | + * Sets the Url property for this <code>JdbcRowSet</code> object | |
| 4353 | + * to the given <code>String</code> object and sets the dataSource name | |
| 4354 | + * property to <code>null</code>. In addition, if the Url property has | |
| 4355 | + * previously been set to a non <code>null</code> value and its value | |
| 4356 | + * is different from the value to be set, | |
| 4357 | + * this method sets this <code>JdbcRowSet</code> object's private fields | |
| 4358 | + * <code>ps</code>, <code>rs</code>, and <code>conn</code> to <code>null</code>. | |
| 4359 | + * (The field <code>ps</code> is its <code>PreparedStatement</code> object, | |
| 4360 | + * the field <code>rs</code> is its <code>ResultSet</code> object, and | |
| 4361 | + * the field <code>conn</code> is its <code>Connection</code> object.) | |
| 4362 | + * <P> | |
| 4363 | + * The Url property is a JDBC URL that is used when | |
| 4364 | + * the connection is created using a JDBC technology-enabled driver | |
| 4365 | + * ("JDBC driver") and the <code>DriverManager</code>. | |
| 4366 | + * The correct JDBC URL for the specific driver to be used can be found | |
| 4367 | + * in the driver documentation. Although there are guidelines for for how | |
| 4368 | + * a JDBC URL is formed, | |
| 4369 | + * a driver vendor can specify any <code>String</code> object except | |
| 4370 | + * one with a length of <code>0</code> (an empty string). | |
| 4371 | + * <P> | |
| 4372 | + * Setting the Url property is optional if connections are established using | |
| 4373 | + * a <code>DataSource</code> object instead of the <code>DriverManager</code>. | |
| 4374 | + * The driver will use either the URL property or the | |
| 4375 | + * dataSourceName property to create a connection, whichever was | |
| 4376 | + * specified most recently. If an application uses a JDBC URL, it | |
| 4377 | + * must load a JDBC driver that accepts the JDBC URL before it uses the | |
| 4378 | + * <code>RowSet</code> object to connect to a database. The <code>RowSet</code> | |
| 4379 | + * object will use the URL internally to create a database connection in order | |
| 4380 | + * to read or write data. | |
| 4381 | + * | |
| 4382 | + * @param url a <code>String</code> object that contains the JDBC URL | |
| 4383 | + * that will be used to establish the connection to a database for this | |
| 4384 | + * <code>RowSet</code> object; may be <code>null</code> but must not | |
| 4385 | + * be an empty string | |
| 4386 | + * @throws SQLException if an error occurs setting the Url property or the | |
| 4387 | + * parameter supplied is a string with a length of <code>0</code> (an | |
| 4388 | + * empty string) | |
| 4389 | + * @see #getUrl | |
| 4390 | + */ | |
| 4391 | + | |
| 4392 | + public void setUrl(String url) throws SQLException { | |
| 4393 | + String oldVal; | |
| 4394 | + | |
| 4395 | + if(getUrl() != null) { | |
| 4396 | + if(!getUrl().equals(url)) { | |
| 4397 | + oldVal = getUrl(); | |
| 4398 | + super.setUrl(url); | |
| 4399 | + conn = null; | |
| 4400 | + ps = null; | |
| 4401 | + rs = null; | |
| 4402 | + propertyChangeSupport.firePropertyChange("url", oldVal, url); | |
| 4403 | + } | |
| 4404 | + } | |
| 4405 | + else { | |
| 4406 | + super.setUrl(url); | |
| 4407 | + propertyChangeSupport.firePropertyChange("url", null, url); | |
| 4408 | + } | |
| 4409 | + } | |
| 4410 | + | |
| 4411 | + // Over riding the setUsername from BaseRowSet for | |
| 4412 | + // firing the propertyChangeSupport Event for | |
| 4413 | + // Rave requirements when this property's values | |
| 4414 | + // changes. | |
| 4415 | + | |
| 4416 | + /** | |
| 4417 | + * Sets the username property for this <code>JdbcRowSet</code> object | |
| 4418 | + * to the given user name. Because it | |
| 4419 | + * is not serialized, the username property is set at run time before | |
| 4420 | + * calling the method <code>execute</code>. In addition, | |
| 4421 | + * if the <code>username</code> property is already set with a | |
| 4422 | + * non-null value and that value is different from the <code>String</code> | |
| 4423 | + * object to be set, | |
| 4424 | + * this method sets this <code>JdbcRowSet</code> object's private fields | |
| 4425 | + * <code>ps</code>, <code>rs</code>, and <code>conn</code> to <code>null</code>. | |
| 4426 | + * (The field <code>ps</code> is its <code>PreparedStatement</code> object, | |
| 4427 | + * <code>rs</code> is its <code>ResultSet</code> object, and | |
| 4428 | + * <code>conn</code> is its <code>Connection</code> object.) | |
| 4429 | + * Setting these fields to <code>null</code> ensures that only current | |
| 4430 | + * values will be used. | |
| 4431 | + * | |
| 4432 | + * @param uname the <code>String</code> object containing the user name that | |
| 4433 | + * is supplied to the data source to create a connection. It may be null. | |
| 4434 | + * @see #getUsername | |
| 4435 | + */ | |
| 4436 | + public void setUsername(String uname) { | |
| 4437 | + String oldVal; | |
| 4438 | + | |
| 4439 | + if( getUsername() != null) { | |
| 4440 | + if(!getUsername().equals(uname)) { | |
| 4441 | + oldVal = getUsername(); | |
| 4442 | + super.setUsername(uname); | |
| 4443 | + conn = null; | |
| 4444 | + ps = null; | |
| 4445 | + rs = null; | |
| 4446 | + propertyChangeSupport.firePropertyChange("username",oldVal,uname); | |
| 4447 | + } | |
| 4448 | + } | |
| 4449 | + else{ | |
| 4450 | + super.setUsername(uname); | |
| 4451 | + propertyChangeSupport.firePropertyChange("username",null,uname); | |
| 4452 | + } | |
| 4453 | + } | |
| 4454 | + | |
| 4455 | + // Over riding the setPassword from BaseRowSet for | |
| 4456 | + // firing the propertyChangeSupport Event for | |
| 4457 | + // Rave requirements when this property's values | |
| 4458 | + // changes. | |
| 4459 | + | |
| 4460 | + /** | |
| 4461 | + * Sets the password property for this <code>JdbcRowSet</code> object | |
| 4462 | + * to the given <code>String</code> object. Because it | |
| 4463 | + * is not serialized, the password property is set at run time before | |
| 4464 | + * calling the method <code>execute</code>. Its default valus is | |
| 4465 | + * <code>null</code>. In addition, | |
| 4466 | + * if the <code>password</code> property is already set with a | |
| 4467 | + * non-null value and that value is different from the one being set, | |
| 4468 | + * this method sets this <code>JdbcRowSet</code> object's private fields | |
| 4469 | + * <code>ps</code>, <code>rs</code>, and <code>conn</code> to <code>null</code>. | |
| 4470 | + * (The field <code>ps</code> is its <code>PreparedStatement</code> object, | |
| 4471 | + * <code>rs</code> is its <code>ResultSet</code> object, and | |
| 4472 | + * <code>conn</code> is its <code>Connection</code> object.) | |
| 4473 | + * Setting these fields to <code>null</code> ensures that only current | |
| 4474 | + * values will be used. | |
| 4475 | + * | |
| 4476 | + * @param password the <code>String</code> object that represents the password | |
| 4477 | + * that must be supplied to the database to create a connection | |
| 4478 | + */ | |
| 4479 | + public void setPassword(String password) { | |
| 4480 | + String oldVal; | |
| 4481 | + | |
| 4482 | + if ( getPassword() != null) { | |
| 4483 | + if(!getPassword().equals(password)) { | |
| 4484 | + oldVal = getPassword(); | |
| 4485 | + super.setPassword(password); | |
| 4486 | + conn = null; | |
| 4487 | + ps = null; | |
| 4488 | + rs = null; | |
| 4489 | + propertyChangeSupport.firePropertyChange("password",oldVal,password); | |
| 4490 | + } | |
| 4491 | + } | |
| 4492 | + else{ | |
| 4493 | + super.setPassword(password); | |
| 4494 | + propertyChangeSupport.firePropertyChange("password",null,password); | |
| 4495 | + } | |
| 4496 | + } | |
| 4497 | + | |
| 4498 | + /** | |
| 4499 | + * Sets the type for this <code>RowSet</code> object to the specified type. | |
| 4500 | + * The default type is <code>ResultSet.TYPE_SCROLL_INSENSITIVE</code>. | |
| 4501 | + * | |
| 4502 | + * @param type one of the following constants: | |
| 4503 | + * <code>ResultSet.TYPE_FORWARD_ONLY</code>, | |
| 4504 | + * <code>ResultSet.TYPE_SCROLL_INSENSITIVE</code>, or | |
| 4505 | + * <code>ResultSet.TYPE_SCROLL_SENSITIVE</code> | |
| 4506 | + * @throws SQLException if the parameter supplied is not one of the | |
| 4507 | + * following constants: | |
| 4508 | + * <code>ResultSet.TYPE_FORWARD_ONLY</code> or | |
| 4509 | + * <code>ResultSet.TYPE_SCROLL_INSENSITIVE</code> | |
| 4510 | + * <code>ResultSet.TYPE_SCROLL_SENSITIVE</code> | |
| 4511 | + * @see #getConcurrency | |
| 4512 | + * @see #getType | |
| 4513 | + */ | |
| 4514 | + | |
| 4515 | + public void setType(int type) throws SQLException { | |
| 4516 | + | |
| 4517 | + int oldVal; | |
| 4518 | + | |
| 4519 | + try { | |
| 4520 | + oldVal = getType(); | |
| 4521 | + }catch(SQLException ex) { | |
| 4522 | + oldVal = 0; | |
| 4523 | + } | |
| 4524 | + | |
| 4525 | + if(oldVal != type) { | |
| 4526 | + super.setType(type); | |
| 4527 | + propertyChangeSupport.firePropertyChange("type",oldVal,type); | |
| 4528 | + } | |
| 4529 | + | |
| 4530 | + } | |
| 4531 | + | |
| 4532 | + /** | |
| 4533 | + * Sets the concurrency for this <code>RowSet</code> object to | |
| 4534 | + * the specified concurrency. The default concurrency for any <code>RowSet</code> | |
| 4535 | + * object (connected or disconnected) is <code>ResultSet.CONCUR_UPDATABLE</code>, | |
| 4536 | + * but this method may be called at any time to change the concurrency. | |
| 4537 | + * | |
| 4538 | + * @param concur one of the following constants: | |
| 4539 | + * <code>ResultSet.CONCUR_READ_ONLY</code> or | |
| 4540 | + * <code>ResultSet.CONCUR_UPDATABLE</code> | |
| 4541 | + * @throws SQLException if the parameter supplied is not one of the | |
| 4542 | + * following constants: | |
| 4543 | + * <code>ResultSet.CONCUR_UPDATABLE</code> or | |
| 4544 | + * <code>ResultSet.CONCUR_READ_ONLY</code> | |
| 4545 | + * @see #getConcurrency | |
| 4546 | + * @see #isReadOnly | |
| 4547 | + */ | |
| 4548 | + public void setConcurrency(int concur) throws SQLException { | |
| 4549 | + | |
| 4550 | + int oldVal; | |
| 4551 | + | |
| 4552 | + try { | |
| 4553 | + oldVal = getConcurrency(); | |
| 4554 | + }catch(NullPointerException ex) { | |
| 4555 | + oldVal = 0; | |
| 4556 | + } | |
| 4557 | + | |
| 4558 | + if(oldVal != concur) { | |
| 4559 | + super.setConcurrency(concur); | |
| 4560 | + propertyChangeSupport.firePropertyChange("concurrency",oldVal,concur); | |
| 4561 | + } | |
| 4562 | + | |
| 4563 | + } | |
| 4564 | + | |
| 4565 | + /** | |
| 4566 | + * Sets the transaction isolation property for this JDBC <code>RowSet</code> object to the given | |
| 4567 | + * constant. The DBMS will use this transaction isolation level for | |
| 4568 | + * transactions if it can. | |
| 4569 | + * <p> | |
| 4570 | + * For <code>RowSet</code> implementations such as | |
| 4571 | + * the <code>CachedRowSet</code> that operate in a disconnected environment, | |
| 4572 | + * the <code>SyncProvider</code> object being used | |
| 4573 | + * offers complementary locking and data integrity options. The | |
| 4574 | + * options described below are pertinent only to connected <code>RowSet</code> | |
| 4575 | + * objects (<code>JdbcRowSet</code> objects). | |
| 4576 | + * | |
| 4577 | + * @param transIso one of the following constants, listed in ascending order: | |
| 4578 | + * <code>Connection.TRANSACTION_NONE</code>, | |
| 4579 | + * <code>Connection.TRANSACTION_READ_UNCOMMITTED</code>, | |
| 4580 | + * <code>Connection.TRANSACTION_READ_COMMITTED</code>, | |
| 4581 | + * <code>Connection.TRANSACTION_REPEATABLE_READ</code>, or | |
| 4582 | + * <code>Connection.TRANSACTION_SERIALIZABLE</code> | |
| 4583 | + * @throws SQLException if the given parameter is not one of the Connection | |
| 4584 | + * constants | |
| 4585 | + * @see javax.sql.rowset.spi.SyncFactory | |
| 4586 | + * @see javax.sql.rowset.spi.SyncProvider | |
| 4587 | + * @see #getTransactionIsolation | |
| 4588 | + */ | |
| 4589 | + public void setTransactionIsolation(int transIso) throws SQLException { | |
| 4590 | + | |
| 4591 | + int oldVal; | |
| 4592 | + | |
| 4593 | + try { | |
| 4594 | + oldVal = getTransactionIsolation(); | |
| 4595 | + }catch(NullPointerException ex) { | |
| 4596 | + oldVal = 0; | |
| 4597 | + } | |
| 4598 | + | |
| 4599 | + if(oldVal != transIso) { | |
| 4600 | + super.setTransactionIsolation(transIso); | |
| 4601 | + propertyChangeSupport.firePropertyChange("transactionIsolation",oldVal,transIso); | |
| 4602 | + } | |
| 4603 | + | |
| 4604 | + } | |
| 4605 | + | |
| 4606 | + /** | |
| 4607 | + * Sets the maximum number of rows that this <code>RowSet</code> object may contain to | |
| 4608 | + * the given number. If this limit is exceeded, the excess rows are | |
| 4609 | + * silently dropped. | |
| 4610 | + * | |
| 4611 | + * @param mRows an <code>int</code> indicating the current maximum number | |
| 4612 | + * of rows; zero means that there is no limit | |
| 4613 | + * @throws SQLException if an error occurs internally setting the | |
| 4614 | + * maximum limit on the number of rows that a JDBC <code>RowSet</code> object | |
| 4615 | + * can contain; or if <i>max</i> is less than <code>0</code>; or | |
| 4616 | + * if <i>max</i> is less than the <code>fetchSize</code> of the | |
| 4617 | + * <code>RowSet</code> | |
| 4618 | + */ | |
| 4619 | + public void setMaxRows(int mRows) throws SQLException { | |
| 4620 | + | |
| 4621 | + int oldVal; | |
| 4622 | + | |
| 4623 | + try { | |
| 4624 | + oldVal = getMaxRows(); | |
| 4625 | + }catch(NullPointerException ex) { | |
| 4626 | + oldVal = 0; | |
| 4627 | + } | |
| 4628 | + | |
| 4629 | + if(oldVal != mRows) { | |
| 4630 | + super.setMaxRows(mRows); | |
| 4631 | + propertyChangeSupport.firePropertyChange("maxRows",oldVal,mRows); | |
| 4632 | + } | |
| 4633 | + | |
| 4634 | + } | |
| 4635 | + | |
| 4636 | + /** | |
| 4637 | + * Retrieves the value of the designated <code>SQL XML</code> parameter as a | |
| 4638 | + * <code>SQLXML</code> object in the Java programming language. | |
| 4639 | + * @param columnIndex the first column is 1, the second is 2, ... | |
| 4640 | + * @return a SQLXML object that maps an SQL XML value | |
| 4641 | + * @throws SQLException if a database access error occurs | |
| 4642 | + * @since 6.0 | |
| 4643 | + */ | |
| 4644 | + public SQLXML getSQLXML(int columnIndex) throws SQLException { | |
| 4645 | + throw new SQLFeatureNotSupportedException(resBundle.handleGetObject("jdbcrowsetimpl.featnotsupp").toString()); | |
| 4646 | + } | |
| 4647 | + | |
| 4648 | + /** | |
| 4649 | + * Retrieves the value of the designated <code>SQL XML</code> parameter as a | |
| 4650 | + * <code>SQLXML</code> object in the Java programming language. | |
| 4651 | + * @param colName the name of the column from which to retrieve the value | |
| 4652 | + * @return a SQLXML object that maps an SQL XML value | |
| 4653 | + * @throws SQLException if a database access error occurs | |
| 4654 | + */ | |
| 4655 | + public SQLXML getSQLXML(String colName) throws SQLException { | |
| 4656 | + throw new SQLFeatureNotSupportedException(resBundle.handleGetObject("jdbcrowsetimpl.featnotsupp").toString()); | |
| 4657 | + } | |
| 4658 | + | |
| 4659 | + /** | |
| 4660 | + * Retrieves the value of the designated column in the current row of this | |
| 4661 | + * <code>ResultSet</code> object as a java.sql.RowId object in the Java | |
| 4662 | + * programming language. | |
| 4663 | + * | |
| 4664 | + * @param columnIndex the first column is 1, the second 2, ... | |
| 4665 | + * @return the column value if the value is a SQL <code>NULL</code> the | |
| 4666 | + * value returned is <code>null</code> | |
| 4667 | + * @throws SQLException if a database access error occurs | |
| 4668 | + * @since 6.0 | |
| 4669 | + */ | |
| 4670 | + public RowId getRowId(int columnIndex) throws SQLException { | |
| 4671 | + throw new SQLFeatureNotSupportedException(resBundle.handleGetObject("jdbcrowsetimpl.featnotsupp").toString()); | |
| 4672 | + } | |
| 4673 | + | |
| 4674 | + /** | |
| 4675 | + * Retrieves the value of the designated column in the current row of this | |
| 4676 | + * <code>ResultSet</code> object as a java.sql.RowId object in the Java | |
| 4677 | + * programming language. | |
| 4678 | + * | |
| 4679 | + * @param columnName the name of the column | |
| 4680 | + * @return the column value if the value is a SQL <code>NULL</code> the | |
| 4681 | + * value returned is <code>null</code> | |
| 4682 | + * @throws SQLException if a database access error occurs | |
| 4683 | + * @since 6.0 | |
| 4684 | + */ | |
| 4685 | + public RowId getRowId(String columnName) throws SQLException { | |
| 4686 | + throw new SQLFeatureNotSupportedException(resBundle.handleGetObject("jdbcrowsetimpl.featnotsupp").toString()); | |
| 4687 | + } | |
| 4688 | + | |
| 4689 | + /** | |
| 4690 | + * Updates the designated column with a <code>RowId</code> value. The updater | |
| 4691 | + * methods are used to update column values in the current row or the insert | |
| 4692 | + * row. The updater methods do not update the underlying database; instead | |
| 4693 | + * the <code>updateRow<code> or <code>insertRow</code> methods are called | |
| 4694 | + * to update the database. | |
| 4695 | + * | |
| 4696 | + * @param columnIndex the first column is 1, the second 2, ... | |
| 4697 | + * @param x the column value | |
| 4698 | + * @throws SQLException if a database access occurs | |
| 4699 | + * @since 6.0 | |
| 4700 | + */ | |
| 4701 | + public void updateRowId(int columnIndex, RowId x) throws SQLException { | |
| 4702 | + throw new SQLFeatureNotSupportedException(resBundle.handleGetObject("jdbcrowsetimpl.featnotsupp").toString()); | |
| 4703 | + } | |
| 4704 | + | |
| 4705 | + /** | |
| 4706 | + * Updates the designated column with a <code>RowId</code> value. The updater | |
| 4707 | + * methods are used to update column values in the current row or the insert | |
| 4708 | + * row. The updater methods do not update the underlying database; instead | |
| 4709 | + * the <code>updateRow<code> or <code>insertRow</code> methods are called | |
| 4710 | + * to update the database. | |
| 4711 | + * | |
| 4712 | + * @param columnName the name of the column | |
| 4713 | + * @param x the column value | |
| 4714 | + * @throws SQLException if a database access occurs | |
| 4715 | + * @since 6.0 | |
| 4716 | + */ | |
| 4717 | + public void updateRowId(String columnName, RowId x) throws SQLException { | |
| 4718 | + throw new SQLFeatureNotSupportedException(resBundle.handleGetObject("jdbcrowsetimpl.featnotsupp").toString()); | |
| 4719 | + } | |
| 4720 | + | |
| 4721 | + /** | |
| 4722 | + * Retrieves the holdability of this ResultSet object | |
| 4723 | + * @return either ResultSet.HOLD_CURSORS_OVER_COMMIT or ResultSet.CLOSE_CURSORS_AT_COMMIT | |
| 4724 | + * @throws SQLException if a database error occurs | |
| 4725 | + * @since 6.0 | |
| 4726 | + */ | |
| 4727 | + public int getHoldability() throws SQLException { | |
| 4728 | + throw new SQLFeatureNotSupportedException(resBundle.handleGetObject("jdbcrowsetimpl.featnotsupp").toString()); | |
| 4729 | + } | |
| 4730 | + | |
| 4731 | + /** | |
| 4732 | + * Retrieves whether this ResultSet object has been closed. A ResultSet is closed if the | |
| 4733 | + * method close has been called on it, or if it is automatically closed. | |
| 4734 | + * @return true if this ResultSet object is closed; false if it is still open | |
| 4735 | + * @throws SQLException if a database access error occurs | |
| 4736 | + * @since 6.0 | |
| 4737 | + */ | |
| 4738 | + public boolean isClosed() throws SQLException { | |
| 4739 | + throw new SQLFeatureNotSupportedException(resBundle.handleGetObject("jdbcrowsetimpl.featnotsupp").toString()); | |
| 4740 | + } | |
| 4741 | + | |
| 4742 | + /** | |
| 4743 | + * This method is used for updating columns that support National Character sets. | |
| 4744 | + * It can be used for updating NCHAR,NVARCHAR and LONGNVARCHAR columns. | |
| 4745 | + * @param columnIndex the first column is 1, the second 2, ... | |
| 4746 | + * @param nString the value for the column to be updated | |
| 4747 | + * @throws SQLException if a database access error occurs | |
| 4748 | + * @since 6.0 | |
| 4749 | + */ | |
| 4750 | + public void updateNString(int columnIndex, String nString) throws SQLException { | |
| 4751 | + throw new SQLFeatureNotSupportedException(resBundle.handleGetObject("jdbcrowsetimpl.featnotsupp").toString()); | |
| 4752 | + } | |
| 4753 | + | |
| 4754 | + /** | |
| 4755 | + * This method is used for updating columns that support National Character sets. | |
| 4756 | + * It can be used for updating NCHAR,NVARCHAR and LONGNVARCHAR columns. | |
| 4757 | + * @param columnName name of the Column | |
| 4758 | + * @param nString the value for the column to be updated | |
| 4759 | + * @throws SQLException if a database access error occurs | |
| 4760 | + * @since 6.0 | |
| 4761 | + */ | |
| 4762 | + public void updateNString(String columnName, String nString) throws SQLException { | |
| 4763 | + throw new SQLFeatureNotSupportedException(resBundle.handleGetObject("jdbcrowsetimpl.featnotsupp").toString()); | |
| 4764 | + } | |
| 4765 | + | |
| 4766 | + | |
| 4767 | + /*o | |
| 4768 | + * This method is used for updating SQL <code>NCLOB</code> type that maps | |
| 4769 | + * to <code>java.sql.Types.NCLOB</code> | |
| 4770 | + * @param columnIndex the first column is 1, the second 2, ... | |
| 4771 | + * @param nClob the value for the column to be updated | |
| 4772 | + * @throws SQLException if a database access error occurs | |
| 4773 | + * @since 6.0 | |
| 4774 | + */ | |
| 4775 | + public void updateNClob(int columnIndex, NClob nClob) throws SQLException { | |
| 4776 | + throw new SQLFeatureNotSupportedException(resBundle.handleGetObject("jdbcrowsetimpl.featnotsupp").toString()); | |
| 4777 | + } | |
| 4778 | + | |
| 4779 | + /** | |
| 4780 | + * This method is used for updating SQL <code>NCLOB</code> type that maps | |
| 4781 | + * to <code>java.sql.Types.NCLOB</code> | |
| 4782 | + * @param columnName name of the column | |
| 4783 | + * @param nClob the value for the column to be updated | |
| 4784 | + * @throws SQLException if a database access error occurs | |
| 4785 | + * @since 6.0 | |
| 4786 | + */ | |
| 4787 | + public void updateNClob(String columnName, NClob nClob) throws SQLException { | |
| 4788 | + throw new SQLFeatureNotSupportedException(resBundle.handleGetObject("jdbcrowsetimpl.featnotsupp").toString()); | |
| 4789 | + } | |
| 4790 | + | |
| 4791 | + /** | |
| 4792 | + * Retrieves the value of the designated column in the current row | |
| 4793 | + * of this <code>ResultSet</code> object as a <code>NClob</code> object | |
| 4794 | + * in the Java programming language. | |
| 4795 | + * | |
| 4796 | + * @param i the first column is 1, the second is 2, ... | |
| 4797 | + * @return a <code>NClob</code> object representing the SQL | |
| 4798 | + * <code>NCLOB</code> value in the specified column | |
| 4799 | + * @exception SQLException if a database access error occurs | |
| 4800 | + * @since 6.0 | |
| 4801 | + */ | |
| 4802 | + public NClob getNClob(int i) throws SQLException { | |
| 4803 | + throw new SQLFeatureNotSupportedException(resBundle.handleGetObject("jdbcrowsetimpl.featnotsupp").toString()); | |
| 4804 | + } | |
| 4805 | + | |
| 4806 | + | |
| 4807 | + /** | |
| 4808 | + * Retrieves the value of the designated column in the current row | |
| 4809 | + * of this <code>ResultSet</code> object as a <code>NClob</code> object | |
| 4810 | + * in the Java programming language. | |
| 4811 | + * | |
| 4812 | + * @param colName the name of the column from which to retrieve the value | |
| 4813 | + * @return a <code>NClob</code> object representing the SQL <code>NCLOB</code> | |
| 4814 | + * value in the specified column | |
| 4815 | + * @exception SQLException if a database access error occurs | |
| 4816 | + * @since 6.0 | |
| 4817 | + */ | |
| 4818 | + public NClob getNClob(String colName) throws SQLException { | |
| 4819 | + throw new SQLFeatureNotSupportedException(resBundle.handleGetObject("jdbcrowsetimpl.featnotsupp").toString()); | |
| 4820 | + } | |
| 4821 | + | |
| 4822 | + public <T> T unwrap(java.lang.Class<T> iface) throws java.sql.SQLException{ | |
| 4823 | + return null; | |
| 4824 | + } | |
| 4825 | + | |
| 4826 | + public boolean isWrapperFor(Class<?> interfaces) throws SQLException { | |
| 4827 | + return false; | |
| 4828 | + } | |
| 4829 | + | |
| 4830 | + /** | |
| 4831 | + * Sets the designated parameter to the given <code>java.sql.SQLXML</code> object. The driver converts this to an | |
| 4832 | + * SQL <code>XML</code> value when it sends it to the database. | |
| 4833 | + * @param parameterIndex index of the first parameter is 1, the second is 2, ... | |
| 4834 | + * @param xmlObject a <code>SQLXML</code> object that maps an SQL <code>XML</code> value | |
| 4835 | + * @throws SQLException if a database access error occurs | |
| 4836 | + * @since 1.6 | |
| 4837 | + */ | |
| 4838 | + public void setSQLXML(int parameterIndex, SQLXML xmlObject) throws SQLException { | |
| 4839 | + throw new SQLFeatureNotSupportedException(resBundle.handleGetObject("jdbcrowsetimpl.featnotsupp").toString()); | |
| 4840 | + } | |
| 4841 | + | |
| 4842 | + /** | |
| 4843 | + * Sets the designated parameter to the given <code>java.sql.SQLXML</code> object. The driver converts this to an | |
| 4844 | + * <code>SQL XML</code> value when it sends it to the database. | |
| 4845 | + * @param parameterName the name of the parameter | |
| 4846 | + * @param xmlObject a <code>SQLXML</code> object that maps an <code>SQL XML</code> value | |
| 4847 | + * @throws SQLException if a database access error occurs | |
| 4848 | + * @since 1.6 | |
| 4849 | + */ | |
| 4850 | + public void setSQLXML(String parameterName, SQLXML xmlObject) throws SQLException { | |
| 4851 | + throw new SQLFeatureNotSupportedException(resBundle.handleGetObject("jdbcrowsetimpl.featnotsupp").toString()); | |
| 4852 | + } | |
| 4853 | + | |
| 4854 | + /** | |
| 4855 | + * Sets the designated parameter to the given <code>java.sql.RowId</code> object. The | |
| 4856 | + * driver converts this to a SQL <code>ROWID</code> value when it sends it | |
| 4857 | + * to the database | |
| 4858 | + * | |
| 4859 | + * @param parameterIndex the first parameter is 1, the second is 2, ... | |
| 4860 | + * @param x the parameter value | |
| 4861 | + * @throws SQLException if a database access error occurs | |
| 4862 | + * | |
| 4863 | + * @since 1.6 | |
| 4864 | + */ | |
| 4865 | + public void setRowId(int parameterIndex, RowId x) throws SQLException { | |
| 4866 | + throw new SQLFeatureNotSupportedException(resBundle.handleGetObject("jdbcrowsetimpl.featnotsupp").toString()); | |
| 4867 | + } | |
| 4868 | + | |
| 4869 | + /** | |
| 4870 | + * Sets the designated parameter to the given <code>java.sql.RowId</code> object. The | |
| 4871 | + * driver converts this to a SQL <code>ROWID</code> when it sends it to the | |
| 4872 | + * database. | |
| 4873 | + * | |
| 4874 | + * @param parameterName the name of the parameter | |
| 4875 | + * @param x the parameter value | |
| 4876 | + * @throws SQLException if a database access error occurs | |
| 4877 | + * @since 1.6 | |
| 4878 | + */ | |
| 4879 | + public void setRowId(String parameterName, RowId x) throws SQLException { | |
| 4880 | + throw new SQLFeatureNotSupportedException(resBundle.handleGetObject("jdbcrowsetimpl.featnotsupp").toString()); | |
| 4881 | + } | |
| 4882 | + | |
| 4883 | + | |
| 4884 | + /** | |
| 4885 | + * Sets the designated paramter to the given <code>String</code> object. | |
| 4886 | + * The driver converts this to a SQL <code>NCHAR</code> or | |
| 4887 | + * <code>NVARCHAR</code> or <code>LONGNVARCHAR</code> value | |
| 4888 | + * (depending on the argument's | |
| 4889 | + * size relative to the driver's limits on <code>NVARCHAR</code> values) | |
| 4890 | + * when it sends it to the database. | |
| 4891 | + * | |
| 4892 | + * @param parameterIndex of the first parameter is 1, the second is 2, ... | |
| 4893 | + * @param value the parameter value | |
| 4894 | + * @throws SQLException if the driver does not support national | |
| 4895 | + * character sets; if the driver can detect that a data conversion | |
| 4896 | + * error could occur ; or if a database access error occurs | |
| 4897 | + * @since 1.6 | |
| 4898 | + */ | |
| 4899 | + public void setNString(int parameterIndex, String value) throws SQLException { | |
| 4900 | + throw new SQLFeatureNotSupportedException(resBundle.handleGetObject("jdbcrowsetimpl.featnotsupp").toString()); | |
| 4901 | + } | |
| 4902 | + | |
| 4903 | + | |
| 4904 | + /** | |
| 4905 | + * Sets the designated parameter in this <code>RowSet</code> object's command | |
| 4906 | + * to a <code>Reader</code> object. The | |
| 4907 | + * <code>Reader</code> reads the data till end-of-file is reached. The | |
| 4908 | + * driver does the necessary conversion from Java character format to | |
| 4909 | + * the national character set in the database. | |
| 4910 | + | |
| 4911 | + * <P><B>Note:</B> This stream object can either be a standard | |
| 4912 | + * Java stream object or your own subclass that implements the | |
| 4913 | + * standard interface. | |
| 4914 | + * <P><B>Note:</B> Consult your JDBC driver documentation to determine if | |
| 4915 | + * it might be more efficient to use a version of | |
| 4916 | + * <code>setNCharacterStream</code> which takes a length parameter. | |
| 4917 | + * | |
| 4918 | + * @param parameterIndex of the first parameter is 1, the second is 2, ... | |
| 4919 | + * @param value the parameter value | |
| 4920 | + * @throws SQLException if the driver does not support national | |
| 4921 | + * character sets; if the driver can detect that a data conversion | |
| 4922 | + * error could occur ; if a database access error occurs; or | |
| 4923 | + * this method is called on a closed <code>PreparedStatement</code> | |
| 4924 | + * @throws SQLFeatureNotSupportedException if the JDBC driver does not support this method | |
| 4925 | + * @since 1.6 | |
| 4926 | + */ | |
| 4927 | + public void setNCharacterStream(int parameterIndex, Reader value) throws SQLException { | |
| 4928 | + throw new SQLFeatureNotSupportedException(resBundle.handleGetObject("jdbcrowsetimpl.featnotsupp").toString()); | |
| 4929 | + } | |
| 4930 | + | |
| 4931 | + /** | |
| 4932 | + * Sets the designated parameter to a <code>java.sql.NClob</code> object. The object | |
| 4933 | + * implements the <code>java.sql.NClob</code> interface. This <code>NClob</code> | |
| 4934 | + * object maps to a SQL <code>NCLOB</code>. | |
| 4935 | + * @param parameterName the name of the column to be set | |
| 4936 | + * @param value the parameter value | |
| 4937 | + * @throws SQLException if the driver does not support national | |
| 4938 | + * character sets; if the driver can detect that a data conversion | |
| 4939 | + * error could occur; or if a database access error occurs | |
| 4940 | + * @since 1.6 | |
| 4941 | + */ | |
| 4942 | + public void setNClob(String parameterName, NClob value) throws SQLException { | |
| 4943 | + throw new SQLFeatureNotSupportedException(resBundle.handleGetObject("jdbcrowsetimpl.featnotsupp").toString()); | |
| 4944 | + } | |
| 4945 | + | |
| 4946 | + | |
| 4947 | + /** | |
| 4948 | + * Retrieves the value of the designated column in the current row | |
| 4949 | + * of this <code>ResultSet</code> object as a | |
| 4950 | + * <code>java.io.Reader</code> object. | |
| 4951 | + * It is intended for use when | |
| 4952 | + * accessing <code>NCHAR</code>,<code>NVARCHAR</code> | |
| 4953 | + * and <code>LONGNVARCHAR</code> columns. | |
| 4954 | + * | |
| 4955 | + * @return a <code>java.io.Reader</code> object that contains the column | |
| 4956 | + * value; if the value is SQL <code>NULL</code>, the value returned is | |
| 4957 | + * <code>null</code> in the Java programming language. | |
| 4958 | + * @param columnIndex the first column is 1, the second is 2, ... | |
| 4959 | + * @exception SQLException if a database access error occurs | |
| 4960 | + * @since 1.6 | |
| 4961 | + */ | |
| 4962 | + public java.io.Reader getNCharacterStream(int columnIndex) throws SQLException { | |
| 4963 | + throw new SQLFeatureNotSupportedException(resBundle.handleGetObject("jdbcrowsetimpl.featnotsupp").toString()); | |
| 4964 | + } | |
| 4965 | + | |
| 4966 | + | |
| 4967 | + /** | |
| 4968 | + * Retrieves the value of the designated column in the current row | |
| 4969 | + * of this <code>ResultSet</code> object as a | |
| 4970 | + * <code>java.io.Reader</code> object. | |
| 4971 | + * It is intended for use when | |
| 4972 | + * accessing <code>NCHAR</code>,<code>NVARCHAR</code> | |
| 4973 | + * and <code>LONGNVARCHAR</code> columns. | |
| 4974 | + * | |
| 4975 | + * @param columnName the name of the column | |
| 4976 | + * @return a <code>java.io.Reader</code> object that contains the column | |
| 4977 | + * value; if the value is SQL <code>NULL</code>, the value returned is | |
| 4978 | + * <code>null</code> in the Java programming language | |
| 4979 | + * @exception SQLException if a database access error occurs | |
| 4980 | + * @since 1.6 | |
| 4981 | + */ | |
| 4982 | + public java.io.Reader getNCharacterStream(String columnName) throws SQLException { | |
| 4983 | + throw new SQLFeatureNotSupportedException(resBundle.handleGetObject("jdbcrowsetimpl.featnotsupp").toString()); | |
| 4984 | + } | |
| 4985 | + | |
| 4986 | + /** | |
| 4987 | + * Updates the designated column with a <code>java.sql.SQLXML</code> value. | |
| 4988 | + * The updater | |
| 4989 | + * methods are used to update column values in the current row or the insert | |
| 4990 | + * row. The updater methods do not update the underlying database; instead | |
| 4991 | + * the <code>updateRow</code> or <code>insertRow</code> methods are called | |
| 4992 | + * to update the database. | |
| 4993 | + * @param columnIndex the first column is 1, the second 2, ... | |
| 4994 | + * @param xmlObject the value for the column to be updated | |
| 4995 | + * @throws SQLException if a database access error occurs | |
| 4996 | + * @since 1.6 | |
| 4997 | + */ | |
| 4998 | + public void updateSQLXML(int columnIndex, SQLXML xmlObject) throws SQLException { | |
| 4999 | + throw new SQLFeatureNotSupportedException(resBundle.handleGetObject("jdbcrowsetimpl.featnotsupp").toString()); | |
2048 more lines aren’t shown here.