Showing the changes to java/pkg/com/sun/rowset/FilteredRowSetImpl.java (1 of 18352 files). Show all
Unified · Split
| @@ -0,0 +1,1768 @@ | |||
| 1 | /* | ||
| 2 | * Copyright (c) 2003, 2010, 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.io.*; | ||
| 29 | import java.util.*; | ||
| 30 | import java.sql.*; | ||
| 31 | import javax.sql.*; | ||
| 32 | import java.math.*; | ||
| 33 | |||
| 34 | import javax.sql.rowset.*; | ||
| 35 | import javax.sql.rowset.spi.*; | ||
| 36 | import javax.sql.rowset.serial.*; | ||
| 37 | import com.sun.rowset.providers.*; | ||
| 38 | import com.sun.rowset.internal.*; | ||
| 39 | |||
| 40 | /** | ||
| 41 | * The standard implementation of the <code>FilteredRowSet</code> interface. See the interface | ||
| 42 | * defintion for full behaviour and implementation requirements. | ||
| 43 | * | ||
| 44 | * @see javax.sql.rowset.Predicate | ||
| 45 | * @author Jonathan Bruce, Amit Handa | ||
| 46 | */ | ||
| 47 | |||
| 48 | public class FilteredRowSetImpl extends WebRowSetImpl implements Serializable, Cloneable, FilteredRowSet { | ||
| 49 | |||
| 50 | private Predicate p; | ||
| 51 | |||
| 52 | private boolean onInsertRow = false; | ||
| 53 | |||
| 54 | |||
| 55 | /** | ||
| 56 | * Construct a <code>FilteredRowSet</code> | ||
| 57 | */ | ||
| 58 | public FilteredRowSetImpl() throws SQLException { | ||
| 59 | super(); | ||
| 60 | } | ||
| 61 | |||
| 62 | /** | ||
| 63 | * Construct a <code>FilteredRowSet</code> with a specified synchronization | ||
| 64 | * provider. | ||
| 65 | * | ||
| 66 | * @param env a Hashtable containing a desired synchconizatation provider | ||
| 67 | * name-value pair. | ||
| 68 | */ | ||
| 69 | public FilteredRowSetImpl(Hashtable env) throws SQLException { | ||
| 70 | super(env); | ||
| 71 | } | ||
| 72 | |||
| 73 | /** | ||
| 74 | * Apply the predicate for this filter | ||
| 75 | * | ||
| 76 | * @param p an implementation of the predicate interface | ||
| 77 | */ | ||
| 78 | public void setFilter(Predicate p) throws SQLException { | ||
| 79 | this.p = p; | ||
| 80 | } | ||
| 81 | |||
| 82 | /** | ||
| 83 | * Retrieve the filter active for this <code>FilteredRowSet</code> | ||
| 84 | * | ||
| 85 | * @return a <code>Predicate</code> object instance | ||
| 86 | */ | ||
| 87 | public Predicate getFilter() { | ||
| 88 | return this.p; | ||
| 89 | } | ||
| 90 | |||
| 91 | /** | ||
| 92 | * Over-riding <code>internalNext()</code> implementation. This method | ||
| 93 | * applies the filter on the <code>RowSet</code> each time the cursor is advanced or | ||
| 94 | * manipulated. It moves the cursor to the next row according to the set | ||
| 95 | * predicate and returns <code>true</code> if the cursor is still within the rowset or | ||
| 96 | * <code>false</code> if the cursor position is over the last row | ||
| 97 | * | ||
| 98 | * @return true if over the valid row in the rowset; false if over the last | ||
| 99 | * row | ||
| 100 | */ | ||
| 101 | protected boolean internalNext() throws SQLException { | ||
| 102 | // CachedRowSetImpl.next() internally calls | ||
| 103 | // this(crs).internalNext() NOTE: this holds crs object | ||
| 104 | // So when frs.next() is called, | ||
| 105 | // internally this(frs).internalNext() will be called | ||
| 106 | // which will be nothing but this method. | ||
| 107 | // because this holds frs object | ||
| 108 | |||
| 109 | // keep on doing super.internalNext() | ||
| 110 | // rather than doing it once. | ||
| 111 | |||
| 112 | |||
| 113 | // p.evaluate will help us in changing the cursor | ||
| 114 | // and checking the next value by returning true or false. | ||
| 115 | // to fit the filter | ||
| 116 | |||
| 117 | // So while() loop will have a "random combination" of | ||
| 118 | // true and false returned depending upon the records | ||
| 119 | // are in or out of filter. | ||
| 120 | // We need to traverse from present cursorPos till end, | ||
| 121 | // whether true or false and check each row for "filter" | ||
| 122 | // "till we get a "true" | ||
| 123 | |||
| 124 | |||
| 125 | boolean bool = false; | ||
| 126 | |||
| 127 | for(int rows=this.getRow(); rows<=this.size();rows++) { | ||
| 128 | bool = super.internalNext(); | ||
| 129 | |||
| 130 | if( p == null) { | ||
| 131 | return bool; | ||
| 132 | } | ||
| 133 | if(p.evaluate(this)){ | ||
| 134 | break; | ||
| 135 | } | ||
| 136 | |||
| 137 | } | ||
| 138 | |||
| 139 | return bool; | ||
| 140 | } | ||
| 141 | |||
| 142 | |||
| 143 | /** | ||
| 144 | * Over-riding <code>internalPrevious()</code> implementation. This method | ||
| 145 | * applies the filter on the <code>RowSet</code> each time the cursor is moved backward or | ||
| 146 | * manipulated. It moves the cursor to the previous row according to the set | ||
| 147 | * predicate and returns <code>true</code> if the cursor is still within the rowset or | ||
| 148 | * <code>false</code> if the cursor position is over the last row | ||
| 149 | * | ||
| 150 | * @return true if over the valid row in the rowset; false if over the last | ||
| 151 | * row | ||
| 152 | */ | ||
| 153 | protected boolean internalPrevious() throws SQLException { | ||
| 154 | boolean bool = false; | ||
| 155 | // with previous move backwards, | ||
| 156 | // i.e. from any record towards first record | ||
| 157 | |||
| 158 | for(int rows=this.getRow(); rows>0;rows--) { | ||
| 159 | |||
| 160 | bool = super.internalPrevious(); | ||
| 161 | |||
| 162 | if( p == null) { | ||
| 163 | return bool; | ||
| 164 | } | ||
| 165 | |||
| 166 | if(p.evaluate(this)){ | ||
| 167 | break; | ||
| 168 | } | ||
| 169 | |||
| 170 | } | ||
| 171 | |||
| 172 | return bool; | ||
| 173 | } | ||
| 174 | |||
| 175 | |||
| 176 | /** | ||
| 177 | * Over-riding <code>internalFirst()</code> implementation. This method | ||
| 178 | * applies the filter on the <code>RowSet</code> each time the cursor is moved to first | ||
| 179 | * row. It moves the cursor to the first row according to the set | ||
| 180 | * predicate and returns <code>true</code> if the cursor is still within the rowset or | ||
| 181 | * <code>false</code> if the cursor position is over the last row | ||
| 182 | * | ||
| 183 | * @return true if over the valid row in the rowset; false if over the last | ||
| 184 | * row | ||
| 185 | */ | ||
| 186 | protected boolean internalFirst() throws SQLException { | ||
| 187 | |||
| 188 | // from first till present cursor position(go forward), | ||
| 189 | // find the actual first which matches the filter. | ||
| 190 | |||
| 191 | boolean bool = super.internalFirst(); | ||
| 192 | |||
| 193 | if( p == null) { | ||
| 194 | return bool; | ||
| 195 | } | ||
| 196 | |||
| 197 | while(bool) { | ||
| 198 | |||
| 199 | if(p.evaluate(this)){ | ||
| 200 | break; | ||
| 201 | } | ||
| 202 | bool = super.internalNext(); | ||
| 203 | } | ||
| 204 | return bool; | ||
| 205 | } | ||
| 206 | |||
| 207 | |||
| 208 | /** | ||
| 209 | * Over-riding <code>internalLast()</code> implementation. This method | ||
| 210 | * applies the filter on the <code>RowSet</code> each time the cursor is moved to | ||
| 211 | * last row. It moves the cursor to the last row according to the set | ||
| 212 | * predicate and returns <code>true</code> if the cursor is still within the rowset or | ||
| 213 | * <code>false</code> if the cursor position is over the last row | ||
| 214 | * | ||
| 215 | * @return true if over the valid row in the rowset; false if over the last | ||
| 216 | * row | ||
| 217 | */ | ||
| 218 | protected boolean internalLast() throws SQLException { | ||
| 219 | // from last to the present cursor position(go backward), | ||
| 220 | // find the actual last which matches the filter. | ||
| 221 | |||
| 222 | boolean bool = super.internalLast(); | ||
| 223 | |||
| 224 | if( p == null) { | ||
| 225 | return bool; | ||
| 226 | } | ||
| 227 | |||
| 228 | while(bool) { | ||
| 229 | |||
| 230 | if(p.evaluate(this)){ | ||
| 231 | break; | ||
| 232 | } | ||
| 233 | |||
| 234 | bool = super.internalPrevious(); | ||
| 235 | |||
| 236 | } | ||
| 237 | return bool; | ||
| 238 | |||
| 239 | } // end internalLast() | ||
| 240 | /** | ||
| 241 | * Moves the cursor the specified number of rows from the current | ||
| 242 | * position, with a positive number moving it forward and a | ||
| 243 | * negative number moving it backward. | ||
| 244 | * <P> | ||
| 245 | * If the number is positive, the cursor moves the specified number of | ||
| 246 | * rows toward the end of the rowset, starting at the current row. | ||
| 247 | * For example, the following command, in which | ||
| 248 | * <code>crs</code> is a <code>CachedRowSetImpl</code> object with 100 rows, | ||
| 249 | * moves the cursor forward four rows from the current row. If the | ||
| 250 | * current row is 50, the cursor would move to row 54. | ||
| 251 | * <PRE><code> | ||
| 252 | * | ||
| 253 | * crs.relative(4); | ||
| 254 | * | ||
| 255 | * </code> </PRE> | ||
| 256 | * <P> | ||
| 257 | * If the number is negative, the cursor moves back toward the beginning | ||
| 258 | * the specified number of rows, starting at the current row. | ||
| 259 | * For example, calling the method | ||
| 260 | * <code>absolute(-1)</code> positions the cursor on the last row, | ||
| 261 | * <code>absolute(-2)</code> moves it on the next-to-last row, and so on. | ||
| 262 | * If the <code>CachedRowSetImpl</code> object <code>crs</code> has five rows, | ||
| 263 | * the following command moves the cursor to the fourth-to-last row, which | ||
| 264 | * in the case of a rowset with five rows, is also the second row | ||
| 265 | * from the beginning. | ||
| 266 | * <PRE><code> | ||
| 267 | * | ||
| 268 | * crs.absolute(-4); | ||
| 269 | * | ||
| 270 | * </code> </PRE> | ||
| 271 | * | ||
| 272 | * If the number specified is larger than the number of rows, the cursor | ||
| 273 | * will move to the position after the last row. If the number specified | ||
| 274 | * would move the cursor one or more rows before the first row, the cursor | ||
| 275 | * moves to the position before the first row. In both cases, this method | ||
| 276 | * throws an <code>SQLException</code>. | ||
| 277 | * <P> | ||
| 278 | * Note: Calling <code>absolute(1)</code> is the same as calling the | ||
| 279 | * method <code>first()</code>. Calling <code>absolute(-1)</code> is the | ||
| 280 | * same as calling <code>last()</code>. Calling <code>relative(0)</code> | ||
| 281 | * is valid, but it does not change the cursor position. | ||
| 282 | * | ||
| 283 | * @param rows an <code>int</code> indicating the number of rows to move | ||
| 284 | * the cursor, starting at the current row; a positive number | ||
| 285 | * moves the cursor forward; a negative number moves the cursor | ||
| 286 | * backward; must not move the cursor past the valid | ||
| 287 | * rows | ||
| 288 | * @return <code>true</code> if the cursor is on a row in this | ||
| 289 | * <code>CachedRowSetImpl</code> object; <code>false</code> | ||
| 290 | * otherwise | ||
| 291 | * @throws SQLException if the rowset is type <code>ResultSet.TYPE_FORWARD_ONLY</code> | ||
| 292 | */ | ||
| 293 | public boolean relative(int rows) throws SQLException { | ||
| 294 | |||
| 295 | boolean retval; | ||
| 296 | boolean bool = false; | ||
| 297 | boolean boolval = false; | ||
| 298 | |||
| 299 | if(getType() == ResultSet.TYPE_FORWARD_ONLY) { | ||
| 300 | throw new SQLException(resBundle.handleGetObject("filteredrowsetimpl.relative").toString()); | ||
| 301 | } | ||
| 302 | |||
| 303 | if( rows > 0 ) { | ||
| 304 | |||
| 305 | int i = 0; | ||
| 306 | while( i < (rows)) { | ||
| 307 | |||
| 308 | if( isAfterLast() ) { | ||
| 309 | return false; | ||
| 310 | } | ||
| 311 | bool = internalNext(); | ||
| 312 | i++; | ||
| 313 | } | ||
| 314 | |||
| 315 | retval = bool; | ||
| 316 | } else { | ||
| 317 | int j = rows; | ||
| 318 | while( (j) < 0 ) { | ||
| 319 | |||
| 320 | if( isBeforeFirst() ) { | ||
| 321 | return false; | ||
| 322 | } | ||
| 323 | boolval = internalPrevious(); | ||
| 324 | j++; | ||
| 325 | } | ||
| 326 | retval = boolval; | ||
| 327 | } | ||
| 328 | if(rows != 0) | ||
| 329 | notifyCursorMoved(); | ||
| 330 | return retval; | ||
| 331 | } | ||
| 332 | |||
| 333 | /** | ||
| 334 | * Moves this <code>CachedRowSetImpl</code> object's cursor to the row number | ||
| 335 | * specified. | ||
| 336 | * | ||
| 337 | * <p>If the number is positive, the cursor moves to an absolute row with | ||
| 338 | * respect to the beginning of the rowset. The first row is row 1, the second | ||
| 339 | * is row 2, and so on. For example, the following command, in which | ||
| 340 | * <code>crs</code> is a <code>CachedRowSetImpl</code> object, moves the cursor | ||
| 341 | * to the fourth row, starting from the beginning of the rowset. | ||
| 342 | * <PRE><code> | ||
| 343 | * | ||
| 344 | * crs.absolute(4); | ||
| 345 | * | ||
| 346 | * </code> </PRE> | ||
| 347 | * <P> | ||
| 348 | * If the number is negative, the cursor moves to an absolute row position | ||
| 349 | * with respect to the end of the rowset. For example, calling | ||
| 350 | * <code>absolute(-1)</code> positions the cursor on the last row, | ||
| 351 | * <code>absolute(-2)</code> moves it on the next-to-last row, and so on. | ||
| 352 | * If the <code>CachedRowSetImpl</code> object <code>crs</code> has five rows, | ||
| 353 | * the following command moves the cursor to the fourth-to-last row, which | ||
| 354 | * in the case of a rowset with five rows, is also the second row, counting | ||
| 355 | * from the beginning. | ||
| 356 | * <PRE><code> | ||
| 357 | * | ||
| 358 | * crs.absolute(-4); | ||
| 359 | * | ||
| 360 | * </code> </PRE> | ||
| 361 | * | ||
| 362 | * If the number specified is larger than the number of rows, the cursor | ||
| 363 | * will move to the position after the last row. If the number specified | ||
| 364 | * would move the cursor one or more rows before the first row, the cursor | ||
| 365 | * moves to the position before the first row. | ||
| 366 | * <P> | ||
| 367 | * Note: Calling <code>absolute(1)</code> is the same as calling the | ||
| 368 | * method <code>first()</code>. Calling <code>absolute(-1)</code> is the | ||
| 369 | * same as calling <code>last()</code>. | ||
| 370 | * | ||
| 371 | * @param rows a positive number to indicate the row, starting row numbering from | ||
| 372 | * the first row, which is <code>1</code>; a negative number to indicate | ||
| 373 | * the row, starting row numbering from the last row, which is | ||
| 374 | * <code>-1</code>; it must not be <code>0</code> | ||
| 375 | * @return <code>true</code> if the cursor is on the rowset; <code>false</code> | ||
| 376 | * otherwise | ||
| 377 | * @throws SQLException if the given cursor position is <code>0</code> or the | ||
| 378 | * type of this rowset is <code>ResultSet.TYPE_FORWARD_ONLY</code> | ||
| 379 | */ | ||
| 380 | public boolean absolute(int rows) throws SQLException { | ||
| 381 | |||
| 382 | boolean retval; | ||
| 383 | boolean bool = false; | ||
| 384 | |||
| 385 | if(rows == 0 || getType() == ResultSet.TYPE_FORWARD_ONLY) { | ||
| 386 | throw new SQLException(resBundle.handleGetObject("filteredrowsetimpl.absolute").toString()); | ||
| 387 | } | ||
| 388 | |||
| 389 | if (rows > 0) { | ||
| 390 | bool = internalFirst(); | ||
| 391 | |||
| 392 | int i = 0; | ||
| 393 | while(i < (rows-1)) { | ||
| 394 | if( isAfterLast() ) { | ||
| 395 | return false; | ||
| 396 | } | ||
| 397 | bool = internalNext(); | ||
| 398 | i++; | ||
| 399 | } | ||
| 400 | retval = bool; | ||
| 401 | } else { | ||
| 402 | bool = internalLast(); | ||
| 403 | |||
| 404 | int j = rows; | ||
| 405 | while((j+1) < 0 ) { | ||
| 406 | if( isBeforeFirst() ) { | ||
| 407 | return false; | ||
| 408 | } | ||
| 409 | bool = internalPrevious(); | ||
| 410 | j++; | ||
| 411 | } | ||
| 412 | retval = bool; | ||
| 413 | } | ||
| 414 | notifyCursorMoved(); | ||
| 415 | return retval; | ||
| 416 | } | ||
| 417 | |||
| 418 | /** | ||
| 419 | * Moves the cursor for this <code>CachedRowSetImpl</code> object | ||
| 420 | * to the insert row. The current row in the rowset is remembered | ||
| 421 | * while the cursor is on the insert row. | ||
| 422 | * <P> | ||
| 423 | * The insert row is a special row associated with an updatable | ||
| 424 | * rowset. It is essentially a buffer where a new row may | ||
| 425 | * be constructed by calling the appropriate <code>updateXXX</code> | ||
| 426 | * methods to assign a value to each column in the row. A complete | ||
| 427 | * row must be constructed; that is, every column that is not nullable | ||
| 428 | * must be assigned a value. In order for the new row to become part | ||
| 429 | * of this rowset, the method <code>insertRow</code> must be called | ||
| 430 | * before the cursor is moved back to the rowset. | ||
| 431 | * <P> | ||
| 432 | * Only certain methods may be invoked while the cursor is on the insert | ||
| 433 | * row; many methods throw an exception if they are called while the | ||
| 434 | * cursor is there. In addition to the <code>updateXXX</code> | ||
| 435 | * and <code>insertRow</code> methods, only the <code>getXXX</code> methods | ||
| 436 | * may be called when the cursor is on the insert row. A <code>getXXX</code> | ||
| 437 | * method should be called on a column only after an <code>updateXXX</code> | ||
| 438 | * method has been called on that column; otherwise, the value returned is | ||
| 439 | * undetermined. | ||
| 440 | * | ||
| 441 | * @throws SQLException if this <code>CachedRowSetImpl</code> object is | ||
| 442 | * <code>ResultSet.CONCUR_READ_ONLY</code> | ||
| 443 | */ | ||
| 444 | public void moveToInsertRow() throws SQLException { | ||
| 445 | |||
| 446 | onInsertRow = true; | ||
| 447 | super.moveToInsertRow(); | ||
| 448 | } | ||
| 449 | |||
| 450 | /** | ||
| 451 | * This is explanation for the overriding of the updateXXX functions. | ||
| 452 | * These functions have been overriden to ensure that only correct | ||
| 453 | * values that pass the criteria for the filter are actaully inserted. | ||
| 454 | * The evaluation of whether a particular value passes the criteria | ||
| 455 | * of the filter is done using the evaluate function in the Predicate | ||
| 456 | * interface. | ||
| 457 | * | ||
| 458 | * The checking can will done in the evaluate function which is implemented | ||
| 459 | * in the class that implements the Predicate interface. So the checking | ||
| 460 | * can vary from one implementation to another. | ||
| 461 | * | ||
| 462 | * Some additional points here on the following: | ||
| 463 | * 1. updateBytes() - since the evaluate function takes Object as parameter | ||
| 464 | * a String is constructed from the byte array and would | ||
| 465 | * passed to the evaluate function. | ||
| 466 | * 2. updateXXXstream() - here it would suffice to pass the stream handle | ||
| 467 | * to the evaluate function and the implementation | ||
| 468 | * of the evaluate function can do the comparision | ||
| 469 | * based on the stream and also type of data. | ||
| 470 | */ | ||
| 471 | |||
| 472 | |||
| 473 | /** | ||
| 474 | * Sets the designated column in either the current row or the insert | ||
| 475 | * row of this <code>CachedRowSetImpl</code> object with the given | ||
| 476 | * <code>int</code> value. | ||
| 477 | * <P> | ||
| 478 | * This method updates a column value in the current row or the insert | ||
| 479 | * row of this rowset, but it does not update the database. | ||
| 480 | * If the cursor is on a row in the rowset, the | ||
| 481 | * method {@link #updateRow} must be called to update the database. | ||
| 482 | * If the cursor is on the insert row, the method {@link #insertRow} | ||
| 483 | * must be called, which will insert the new row into both this rowset | ||
| 484 | * and the database. Both of these methods must be called before the | ||
| 485 | * cursor moves to another row. | ||
| 486 | * | ||
| 487 | * @param columnIndex the first column is <code>1</code>, the second | ||
| 488 | * is <code>2</code>, and so on; must be <code>1</code> or larger | ||
| 489 | * and equal to or less than the number of columns in this rowset | ||
| 490 | * @param x the new column value | ||
| 491 | * @throws SQLException if (1) the given column index is out of bounds, | ||
| 492 | * (2) the cursor is not on one of this rowset's rows or its | ||
| 493 | * insert row, or (3) this rowset is | ||
| 494 | * <code>ResultSet.CONCUR_READ_ONLY</code> | ||
| 495 | */ | ||
| 496 | public void updateInt(int columnIndex , int x) throws SQLException { | ||
| 497 | |||
| 498 | boolean bool; | ||
| 499 | |||
| 500 | if(onInsertRow) { | ||
| 501 | if(p != null) { | ||
| 502 | bool = p.evaluate(Integer.valueOf(x),columnIndex); | ||
| 503 | |||
| 504 | if(!bool) { | ||
| 505 | throw new SQLException(resBundle.handleGetObject("filteredrowsetimpl.notallowed").toString()); | ||
| 506 | } | ||
| 507 | } | ||
| 508 | } | ||
| 509 | |||
| 510 | super.updateInt(columnIndex,x); | ||
| 511 | } | ||
| 512 | |||
| 513 | /** | ||
| 514 | * Sets the designated column in either the current row or the insert | ||
| 515 | * row of this <code>CachedRowSetImpl</code> object with the given | ||
| 516 | * <code>int</code> value. | ||
| 517 | * <P> | ||
| 518 | * This method updates a column value in the current row or the insert | ||
| 519 | * row of this rowset, but it does not update the database. | ||
| 520 | * If the cursor is on a row in the rowset, the | ||
| 521 | * method {@link #updateRow} must be called to update the database. | ||
| 522 | * If the cursor is on the insert row, the method {@link #insertRow} | ||
| 523 | * must be called, which will insert the new row into both this rowset | ||
| 524 | * and the database. Both of these methods must be called before the | ||
| 525 | * cursor moves to another row. | ||
| 526 | * | ||
| 527 | * @param columnName a <code>String</code> object that must match the | ||
| 528 | * SQL name of a column in this rowset, ignoring case | ||
| 529 | * @param x the new column value | ||
| 530 | * @throws SQLException if (1) the given column name does not match the | ||
| 531 | * name of a column in this rowset, (2) the cursor is not on | ||
| 532 | * one of this rowset's rows or its insert row, or (3) this | ||
| 533 | * rowset is <code>ResultSet.CONCUR_READ_ONLY</code> | ||
| 534 | */ | ||
| 535 | public void updateInt(String columnName , int x) throws SQLException { | ||
| 536 | |||
| 537 | this.updateInt(findColumn(columnName), x); | ||
| 538 | } | ||
| 539 | |||
| 540 | /** | ||
| 541 | * Sets the designated column in either the current row or the insert | ||
| 542 | * row of this <code>CachedRowSetImpl</code> object with the given | ||
| 543 | * <code>boolean</code> value. | ||
| 544 | * <P> | ||
| 545 | * This method updates a column value in the current row or the insert | ||
| 546 | * row of this rowset, but it does not update the database. | ||
| 547 | * If the cursor is on a row in the rowset, the | ||
| 548 | * method {@link #updateRow} must be called to update the database. | ||
| 549 | * If the cursor is on the insert row, the method {@link #insertRow} | ||
| 550 | * must be called, which will insert the new row into both this rowset | ||
| 551 | * and the database. Both of these methods must be called before the | ||
| 552 | * cursor moves to another row. | ||
| 553 | * | ||
| 554 | * @param columnIndex the first column is <code>1</code>, the second | ||
| 555 | * is <code>2</code>, and so on; must be <code>1</code> or larger | ||
| 556 | * and equal to or less than the number of columns in this rowset | ||
| 557 | * @param x the new column value | ||
| 558 | * @throws SQLException if (1) the given column index is out of bounds, | ||
| 559 | * (2) the cursor is not on one of this rowset's rows or its | ||
| 560 | * insert row, or (3) this rowset is | ||
| 561 | * <code>ResultSet.CONCUR_READ_ONLY</code> | ||
| 562 | */ | ||
| 563 | public void updateBoolean(int columnIndex, boolean x) throws SQLException { | ||
| 564 | |||
| 565 | boolean bool; | ||
| 566 | |||
| 567 | if(onInsertRow) { | ||
| 568 | if(p != null) { | ||
| 569 | bool = p.evaluate(Boolean.valueOf(x) , columnIndex); | ||
| 570 | |||
| 571 | if(!bool) { | ||
| 572 | throw new SQLException(resBundle.handleGetObject("filteredrowsetimpl.notallowed").toString()); | ||
| 573 | } | ||
| 574 | } | ||
| 575 | } | ||
| 576 | |||
| 577 | super.updateBoolean(columnIndex,x); | ||
| 578 | } | ||
| 579 | |||
| 580 | /** | ||
| 581 | * Sets the designated column in either the current row or the insert | ||
| 582 | * row of this <code>CachedRowSetImpl</code> object with the given | ||
| 583 | * <code>boolean</code> value. | ||
| 584 | * <P> | ||
| 585 | * This method updates a column value in the current row or the insert | ||
| 586 | * row of this rowset, but it does not update the database. | ||
| 587 | * If the cursor is on a row in the rowset, the | ||
| 588 | * method {@link #updateRow} must be called to update the database. | ||
| 589 | * If the cursor is on the insert row, the method {@link #insertRow} | ||
| 590 | * must be called, which will insert the new row into both this rowset | ||
| 591 | * and the database. Both of these methods must be called before the | ||
| 592 | * cursor moves to another row. | ||
| 593 | * | ||
| 594 | * @param columnName a <code>String</code> object that must match the | ||
| 595 | * SQL name of a column in this rowset, ignoring case | ||
| 596 | * @param x the new column value | ||
| 597 | * @throws SQLException if (1) the given column name does not match the | ||
| 598 | * name of a column in this rowset, (2) the cursor is not on | ||
| 599 | * one of this rowset's rows or its insert row, or (3) this | ||
| 600 | * rowset is <code>ResultSet.CONCUR_READ_ONLY</code> | ||
| 601 | */ | ||
| 602 | public void updateBoolean(String columnName , boolean x) throws SQLException { | ||
| 603 | |||
| 604 | this.updateBoolean(findColumn(columnName),x); | ||
| 605 | } | ||
| 606 | |||
| 607 | |||
| 608 | |||
| 609 | /** | ||
| 610 | * Sets the designated column in either the current row or the insert | ||
| 611 | * row of this <code>CachedRowSetImpl</code> object with the given | ||
| 612 | * <code>byte</code> value. | ||
| 613 | * <P> | ||
| 614 | * This method updates a column value in the current row or the insert | ||
| 615 | * row of this rowset, but it does not update the database. | ||
| 616 | * If the cursor is on a row in the rowset, the | ||
| 617 | * method {@link #updateRow} must be called to update the database. | ||
| 618 | * If the cursor is on the insert row, the method {@link #insertRow} | ||
| 619 | * must be called, which will insert the new row into both this rowset | ||
| 620 | * and the database. Both of these methods must be called before the | ||
| 621 | * cursor moves to another row. | ||
| 622 | * | ||
| 623 | * @param columnIndex the first column is <code>1</code>, the second | ||
| 624 | * is <code>2</code>, and so on; must be <code>1</code> or larger | ||
| 625 | * and equal to or less than the number of columns in this rowset | ||
| 626 | * @param x the new column value | ||
| 627 | * @throws SQLException if (1) the given column index is out of bounds, | ||
| 628 | * (2) the cursor is not on one of this rowset's rows or its | ||
| 629 | * insert row, or (3) this rowset is | ||
| 630 | * <code>ResultSet.CONCUR_READ_ONLY</code> | ||
| 631 | */ | ||
| 632 | public void updateByte(int columnIndex , byte x) throws SQLException { | ||
| 633 | boolean bool; | ||
| 634 | |||
| 635 | if(onInsertRow) { | ||
| 636 | if(p != null) { | ||
| 637 | bool = p.evaluate(Byte.valueOf(x),columnIndex); | ||
| 638 | |||
| 639 | if(!bool) { | ||
| 640 | throw new SQLException(resBundle.handleGetObject("filteredrowsetimpl.notallowed").toString()); | ||
| 641 | } | ||
| 642 | } | ||
| 643 | } | ||
| 644 | |||
| 645 | super.updateByte(columnIndex,x); | ||
| 646 | } | ||
| 647 | |||
| 648 | |||
| 649 | /** | ||
| 650 | * Sets the designated column in either the current row or the insert | ||
| 651 | * row of this <code>CachedRowSetImpl</code> object with the given | ||
| 652 | * <code>byte</code> value. | ||
| 653 | * <P> | ||
| 654 | * This method updates a column value in the current row or the insert | ||
| 655 | * row of this rowset, but it does not update the database. | ||
| 656 | * If the cursor is on a row in the rowset, the | ||
| 657 | * method {@link #updateRow} must be called to update the database. | ||
| 658 | * If the cursor is on the insert row, the method {@link #insertRow} | ||
| 659 | * must be called, which will insert the new row into both this rowset | ||
| 660 | * and the database. Both of these methods must be called before the | ||
| 661 | * cursor moves to another row. | ||
| 662 | * | ||
| 663 | * @param columnName a <code>String</code> object that must match the | ||
| 664 | * SQL name of a column in this rowset, ignoring case | ||
| 665 | * @param x the new column value | ||
| 666 | * @throws SQLException if (1) the given column name does not match the | ||
| 667 | * name of a column in this rowset, (2) the cursor is not on | ||
| 668 | * one of this rowset's rows or its insert row, or (3) this | ||
| 669 | * rowset is <code>ResultSet.CONCUR_READ_ONLY</code> | ||
| 670 | */ | ||
| 671 | public void updateByte(String columnName , byte x) throws SQLException { | ||
| 672 | |||
| 673 | this.updateByte(findColumn(columnName),x); | ||
| 674 | } | ||
| 675 | |||
| 676 | |||
| 677 | /** | ||
| 678 | * Sets the designated column in either the current row or the insert | ||
| 679 | * row of this <code>CachedRowSetImpl</code> object with the given | ||
| 680 | * <code>short</code> value. | ||
| 681 | * <P> | ||
| 682 | * This method updates a column value in the current row or the insert | ||
| 683 | * row of this rowset, but it does not update the database. | ||
| 684 | * If the cursor is on a row in the rowset, the | ||
| 685 | * method {@link #updateRow} must be called to update the database. | ||
| 686 | * If the cursor is on the insert row, the method {@link #insertRow} | ||
| 687 | * must be called, which will insert the new row into both this rowset | ||
| 688 | * and the database. Both of these methods must be called before the | ||
| 689 | * cursor moves to another row. | ||
| 690 | * | ||
| 691 | * @param columnIndex the first column is <code>1</code>, the second | ||
| 692 | * is <code>2</code>, and so on; must be <code>1</code> or larger | ||
| 693 | * and equal to or less than the number of columns in this rowset | ||
| 694 | * @param x the new column value | ||
| 695 | * @throws SQLException if (1) the given column index is out of bounds, | ||
| 696 | * (2) the cursor is not on one of this rowset's rows or its | ||
| 697 | * insert row, or (3) this rowset is | ||
| 698 | * <code>ResultSet.CONCUR_READ_ONLY</code> | ||
| 699 | */ | ||
| 700 | public void updateShort( int columnIndex , short x) throws SQLException { | ||
| 701 | |||
| 702 | boolean bool; | ||
| 703 | |||
| 704 | if(onInsertRow) { | ||
| 705 | if(p != null) { | ||
| 706 | bool = p.evaluate(Short.valueOf(x), columnIndex); | ||
| 707 | |||
| 708 | if(!bool) { | ||
| 709 | throw new SQLException(resBundle.handleGetObject("filteredrowsetimpl.notallowed").toString()); | ||
| 710 | } | ||
| 711 | } | ||
| 712 | } | ||
| 713 | |||
| 714 | super.updateShort(columnIndex,x); | ||
| 715 | } | ||
| 716 | |||
| 717 | /** | ||
| 718 | * Sets the designated column in either the current row or the insert | ||
| 719 | * row of this <code>CachedRowSetImpl</code> object with the given | ||
| 720 | * <code>short</code> value. | ||
| 721 | * <P> | ||
| 722 | * This method updates a column value in the current row or the insert | ||
| 723 | * row of this rowset, but it does not update the database. | ||
| 724 | * If the cursor is on a row in the rowset, the | ||
| 725 | * method {@link #updateRow} must be called to update the database. | ||
| 726 | * If the cursor is on the insert row, the method {@link #insertRow} | ||
| 727 | * must be called, which will insert the new row into both this rowset | ||
| 728 | * and the database. Both of these methods must be called before the | ||
| 729 | * cursor moves to another row. | ||
| 730 | * | ||
| 731 | * @param columnName a <code>String</code> object that must match the | ||
| 732 | * SQL name of a column in this rowset, ignoring case | ||
| 733 | * @param x the new column value | ||
| 734 | * @throws SQLException if (1) the given column name does not match the | ||
| 735 | * name of a column in this rowset, (2) the cursor is not on | ||
| 736 | * one of this rowset's rows or its insert row, or (3) this | ||
| 737 | * rowset is <code>ResultSet.CONCUR_READ_ONLY</code> | ||
| 738 | */ | ||
| 739 | public void updateShort( String columnName , short x) throws SQLException { | ||
| 740 | |||
| 741 | this.updateShort(findColumn(columnName),x); | ||
| 742 | } | ||
| 743 | |||
| 744 | |||
| 745 | /** | ||
| 746 | * Sets the designated column in either the current row or the insert | ||
| 747 | * row of this <code>CachedRowSetImpl</code> object with the given | ||
| 748 | * <code>long</code> value. | ||
| 749 | * <P> | ||
| 750 | * This method updates a column value in the current row or the insert | ||
| 751 | * row of this rowset, but it does not update the database. | ||
| 752 | * If the cursor is on a row in the rowset, the | ||
| 753 | * method {@link #updateRow} must be called to update the database. | ||
| 754 | * If the cursor is on the insert row, the method {@link #insertRow} | ||
| 755 | * must be called, which will insert the new row into both this rowset | ||
| 756 | * and the database. Both of these methods must be called before the | ||
| 757 | * cursor moves to another row. | ||
| 758 | * | ||
| 759 | * @param columnIndex the first column is <code>1</code>, the second | ||
| 760 | * is <code>2</code>, and so on; must be <code>1</code> or larger | ||
| 761 | * and equal to or less than the number of columns in this rowset | ||
| 762 | * @param x the new column value | ||
| 763 | * @throws SQLException if (1) the given column index is out of bounds, | ||
| 764 | * (2) the cursor is not on one of this rowset's rows or its | ||
| 765 | * insert row, or (3) this rowset is | ||
| 766 | * <code>ResultSet.CONCUR_READ_ONLY</code> | ||
| 767 | */ | ||
| 768 | public void updateLong(int columnIndex , long x) throws SQLException { | ||
| 769 | |||
| 770 | boolean bool; | ||
| 771 | |||
| 772 | if(onInsertRow) { | ||
| 773 | if(p != null) { | ||
| 774 | bool = p.evaluate(Long.valueOf(x), columnIndex); | ||
| 775 | |||
| 776 | if(!bool) { | ||
| 777 | throw new SQLException(resBundle.handleGetObject("filteredrowsetimpl.notallowed").toString()); | ||
| 778 | } | ||
| 779 | } | ||
| 780 | } | ||
| 781 | |||
| 782 | super.updateLong(columnIndex,x); | ||
| 783 | } | ||
| 784 | |||
| 785 | /** | ||
| 786 | * Sets the designated column in either the current row or the insert | ||
| 787 | * row of this <code>CachedRowSetImpl</code> object with the given | ||
| 788 | * <code>long</code> value. | ||
| 789 | * <P> | ||
| 790 | * This method updates a column value in the current row or the insert | ||
| 791 | * row of this rowset, but it does not update the database. | ||
| 792 | * If the cursor is on a row in the rowset, the | ||
| 793 | * method {@link #updateRow} must be called to update the database. | ||
| 794 | * If the cursor is on the insert row, the method {@link #insertRow} | ||
| 795 | * must be called, which will insert the new row into both this rowset | ||
| 796 | * and the database. Both of these methods must be called before the | ||
| 797 | * cursor moves to another row. | ||
| 798 | * | ||
| 799 | * @param columnName a <code>String</code> object that must match the | ||
| 800 | * SQL name of a column in this rowset, ignoring case | ||
| 801 | * @param x the new column value | ||
| 802 | * @throws SQLException if (1) the given column name does not match the | ||
| 803 | * name of a column in this rowset, (2) the cursor is not on | ||
| 804 | * one of this rowset's rows or its insert row, or (3) this | ||
| 805 | * rowset is <code>ResultSet.CONCUR_READ_ONLY</code> | ||
| 806 | */ | ||
| 807 | public void updateLong( String columnName , long x) throws SQLException { | ||
| 808 | |||
| 809 | this.updateLong(findColumn(columnName) , x); | ||
| 810 | } | ||
| 811 | |||
| 812 | /** | ||
| 813 | * Sets the designated column in either the current row or the insert | ||
| 814 | * row of this <code>CachedRowSetImpl</code> object with the given | ||
| 815 | * <code>float</code> value. | ||
| 816 | * <P> | ||
| 817 | * This method updates a column value in the current row or the insert | ||
| 818 | * row of this rowset, but it does not update the database. | ||
| 819 | * If the cursor is on a row in the rowset, the | ||
| 820 | * method {@link #updateRow} must be called to update the database. | ||
| 821 | * If the cursor is on the insert row, the method {@link #insertRow} | ||
| 822 | * must be called, which will insert the new row into both this rowset | ||
| 823 | * and the database. Both of these methods must be called before the | ||
| 824 | * cursor moves to another row. | ||
| 825 | * | ||
| 826 | * @param columnIndex the first column is <code>1</code>, the second | ||
| 827 | * is <code>2</code>, and so on; must be <code>1</code> or larger | ||
| 828 | * and equal to or less than the number of columns in this rowset | ||
| 829 | * @param x the new column value | ||
| 830 | * @throws SQLException if (1) the given column index is out of bounds, | ||
| 831 | * (2) the cursor is not on one of this rowset's rows or its | ||
| 832 | * insert row, or (3) this rowset is | ||
| 833 | * <code>ResultSet.CONCUR_READ_ONLY</code> | ||
| 834 | */ | ||
| 835 | public void updateFloat(int columnIndex , float x) throws SQLException { | ||
| 836 | |||
| 837 | boolean bool; | ||
| 838 | |||
| 839 | if(onInsertRow) { | ||
| 840 | if(p != null) { | ||
| 841 | bool = p.evaluate(new Float(x) , columnIndex); | ||
| 842 | |||
| 843 | if(!bool) { | ||
| 844 | throw new SQLException(resBundle.handleGetObject("filteredrowsetimpl.notallowed").toString()); | ||
| 845 | } | ||
| 846 | } | ||
| 847 | } | ||
| 848 | |||
| 849 | super.updateFloat(columnIndex,x); | ||
| 850 | } | ||
| 851 | |||
| 852 | /** | ||
| 853 | * Sets the designated column in either the current row or the insert | ||
| 854 | * row of this <code>CachedRowSetImpl</code> object with the given | ||
| 855 | * <code>float</code> value. | ||
| 856 | * <P> | ||
| 857 | * This method updates a column value in the current row or the insert | ||
| 858 | * row of this rowset, but it does not update the database. | ||
| 859 | * If the cursor is on a row in the rowset, the | ||
| 860 | * method {@link #updateRow} must be called to update the database. | ||
| 861 | * If the cursor is on the insert row, the method {@link #insertRow} | ||
| 862 | * must be called, which will insert the new row into both this rowset | ||
| 863 | * and the database. Both of these methods must be called before the | ||
| 864 | * cursor moves to another row. | ||
| 865 | * | ||
| 866 | * @param columnName a <code>String</code> object that must match the | ||
| 867 | * SQL name of a column in this rowset, ignoring case | ||
| 868 | * @param x the new column value | ||
| 869 | * @throws SQLException if (1) the given column name does not match the | ||
| 870 | * name of a column in this rowset, (2) the cursor is not on | ||
| 871 | * one of this rowset's rows or its insert row, or (3) this | ||
| 872 | * rowset is <code>ResultSet.CONCUR_READ_ONLY</code> | ||
| 873 | */ | ||
| 874 | public void updateFloat(String columnName , float x) throws SQLException { | ||
| 875 | |||
| 876 | this.updateFloat(findColumn(columnName),x); | ||
| 877 | } | ||
| 878 | |||
| 879 | /** | ||
| 880 | * Sets the designated column in either the current row or the insert | ||
| 881 | * row of this <code>CachedRowSetImpl</code> object with the given | ||
| 882 | * <code>double</code> value. | ||
| 883 | * | ||
| 884 | * This method updates a column value in either the current row or | ||
| 885 | * the insert row of this rowset, but it does not update the | ||
| 886 | * database. If the cursor is on a row in the rowset, the | ||
| 887 | * method {@link #updateRow} must be called to update the database. | ||
| 888 | * If the cursor is on the insert row, the method {@link #insertRow} | ||
| 889 | * must be called, which will insert the new row into both this rowset | ||
| 890 | * and the database. Both of these methods must be called before the | ||
| 891 | * cursor moves to another row. | ||
| 892 | * | ||
| 893 | * @param columnIndex the first column is <code>1</code>, the second | ||
| 894 | * is <code>2</code>, and so on; must be <code>1</code> or larger | ||
| 895 | * and equal to or less than the number of columns in this rowset | ||
| 896 | * @param x the new column value | ||
| 897 | * @throws SQLException if (1) the given column index is out of bounds, | ||
| 898 | * (2) the cursor is not on one of this rowset's rows or its | ||
| 899 | * insert row, or (3) this rowset is | ||
| 900 | * <code>ResultSet.CONCUR_READ_ONLY</code> | ||
| 901 | */ | ||
| 902 | public void updateDouble(int columnIndex , double x) throws SQLException { | ||
| 903 | |||
| 904 | boolean bool; | ||
| 905 | |||
| 906 | if(onInsertRow) { | ||
| 907 | if(p != null) { | ||
| 908 | bool = p.evaluate(new Double(x) , columnIndex); | ||
| 909 | |||
| 910 | if(!bool) { | ||
| 911 | throw new SQLException(resBundle.handleGetObject("filteredrowsetimpl.notallowed").toString()); | ||
| 912 | } | ||
| 913 | } | ||
| 914 | } | ||
| 915 | |||
| 916 | super.updateDouble(columnIndex,x); | ||
| 917 | } | ||
| 918 | |||
| 919 | /** | ||
| 920 | * Sets the designated column in either the current row or the insert | ||
| 921 | * row of this <code>CachedRowSetImpl</code> object with the given | ||
| 922 | * <code>double</code> value. | ||
| 923 | * | ||
| 924 | * This method updates a column value in either the current row or | ||
| 925 | * the insert row of this rowset, but it does not update the | ||
| 926 | * database. If the cursor is on a row in the rowset, the | ||
| 927 | * method {@link #updateRow} must be called to update the database. | ||
| 928 | * If the cursor is on the insert row, the method {@link #insertRow} | ||
| 929 | * must be called, which will insert the new row into both this rowset | ||
| 930 | * and the database. Both of these methods must be called before the | ||
| 931 | * cursor moves to another row. | ||
| 932 | * | ||
| 933 | * @param columnName a <code>String</code> object that must match the | ||
| 934 | * SQL name of a column in this rowset, ignoring case | ||
| 935 | * @param x the new column value | ||
| 936 | * @throws SQLException if (1) the given column name does not match the | ||
| 937 | * name of a column in this rowset, (2) the cursor is not on | ||
| 938 | * one of this rowset's rows or its insert row, or (3) this | ||
| 939 | * rowset is <code>ResultSet.CONCUR_READ_ONLY</code> | ||
| 940 | */ | ||
| 941 | public void updateDouble(String columnName , double x) throws SQLException { | ||
| 942 | |||
| 943 | this.updateDouble(findColumn(columnName),x); | ||
| 944 | } | ||
| 945 | |||
| 946 | /** | ||
| 947 | * Sets the designated column in either the current row or the insert | ||
| 948 | * row of this <code>CachedRowSetImpl</code> object with the given | ||
| 949 | * <code>java.math.BigDecimal</code> object. | ||
| 950 | * <P> | ||
| 951 | * This method updates a column value in the current row or the insert | ||
| 952 | * row of this rowset, but it does not update the database. | ||
| 953 | * If the cursor is on a row in the rowset, the | ||
| 954 | * method {@link #updateRow} must be called to update the database. | ||
| 955 | * If the cursor is on the insert row, the method {@link #insertRow} | ||
| 956 | * must be called, which will insert the new row into both this rowset | ||
| 957 | * and the database. Both of these methods must be called before the | ||
| 958 | * cursor moves to another row. | ||
| 959 | * | ||
| 960 | * @param columnIndex the first column is <code>1</code>, the second | ||
| 961 | * is <code>2</code>, and so on; must be <code>1</code> or larger | ||
| 962 | * and equal to or less than the number of columns in this rowset | ||
| 963 | * @param x the new column value | ||
| 964 | * @throws SQLException if (1) the given column index is out of bounds, | ||
| 965 | * (2) the cursor is not on one of this rowset's rows or its | ||
| 966 | * insert row, or (3) this rowset is | ||
| 967 | * <code>ResultSet.CONCUR_READ_ONLY</code> | ||
| 968 | */ | ||
| 969 | public void updateBigDecimal(int columnIndex , BigDecimal x) throws SQLException { | ||
| 970 | |||
| 971 | boolean bool; | ||
| 972 | |||
| 973 | if(onInsertRow) { | ||
| 974 | if(p != null) { | ||
| 975 | bool = p.evaluate(x,columnIndex); | ||
| 976 | |||
| 977 | if(!bool) { | ||
| 978 | throw new SQLException(resBundle.handleGetObject("filteredrowsetimpl.notallowed").toString()); | ||
| 979 | } | ||
| 980 | } | ||
| 981 | } | ||
| 982 | |||
| 983 | super.updateBigDecimal(columnIndex,x); | ||
| 984 | } | ||
| 985 | |||
| 986 | /** | ||
| 987 | * Sets the designated column in either the current row or the insert | ||
| 988 | * row of this <code>CachedRowSetImpl</code> object with the given | ||
| 989 | * <code>java.math.BigDecimal</code> object. | ||
| 990 | * <P> | ||
| 991 | * This method updates a column value in the current row or the insert | ||
| 992 | * row of this rowset, but it does not update the database. | ||
| 993 | * If the cursor is on a row in the rowset, the | ||
| 994 | * method {@link #updateRow} must be called to update the database. | ||
| 995 | * If the cursor is on the insert row, the method {@link #insertRow} | ||
| 996 | * must be called, which will insert the new row into both this rowset | ||
| 997 | * and the database. Both of these methods must be called before the | ||
| 998 | * cursor moves to another row. | ||
| 999 | * | ||
| 1000 | * @param columnName a <code>String</code> object that must match the | ||
| 1001 | * SQL name of a column in this rowset, ignoring case | ||
| 1002 | * @param x the new column value | ||
| 1003 | * @throws SQLException if (1) the given column name does not match the | ||
| 1004 | * name of a column in this rowset, (2) the cursor is not on | ||
| 1005 | * one of this rowset's rows or its insert row, or (3) this | ||
| 1006 | * rowset is <code>ResultSet.CONCUR_READ_ONLY</code> | ||
| 1007 | */ | ||
| 1008 | public void updateBigDecimal(String columnName , BigDecimal x) throws SQLException { | ||
| 1009 | |||
| 1010 | this.updateBigDecimal(findColumn(columnName),x); | ||
| 1011 | } | ||
| 1012 | |||
| 1013 | /** | ||
| 1014 | * Sets the designated column in either the current row or the insert | ||
| 1015 | * row of this <code>CachedRowSetImpl</code> object with the given | ||
| 1016 | * <code>String</code> object. | ||
| 1017 | * <P> | ||
| 1018 | * This method updates a column value in either the current row or | ||
| 1019 | * the insert row of this rowset, but it does not update the | ||
| 1020 | * database. If the cursor is on a row in the rowset, the | ||
| 1021 | * method {@link #updateRow} must be called to mark the row as updated. | ||
| 1022 | * If the cursor is on the insert row, the method {@link #insertRow} | ||
| 1023 | * must be called to insert the new row into this rowset and mark it | ||
| 1024 | * as inserted. Both of these methods must be called before the | ||
| 1025 | * cursor moves to another row. | ||
| 1026 | * <P> | ||
| 1027 | * The method <code>acceptChanges</code> must be called if the | ||
| 1028 | * updated values are to be written back to the underlying database. | ||
| 1029 | * | ||
| 1030 | * @param columnIndex the first column is <code>1</code>, the second | ||
| 1031 | * is <code>2</code>, and so on; must be <code>1</code> or larger | ||
| 1032 | * and equal to or less than the number of columns in this rowset | ||
| 1033 | * @param x the new column value | ||
| 1034 | * @throws SQLException if (1) the given column index is out of bounds, | ||
| 1035 | * (2) the cursor is not on one of this rowset's rows or its | ||
| 1036 | * insert row, or (3) this rowset is | ||
| 1037 | * <code>ResultSet.CONCUR_READ_ONLY</code> | ||
| 1038 | */ | ||
| 1039 | public void updateString(int columnIndex , String x) throws SQLException { | ||
| 1040 | |||
| 1041 | boolean bool; | ||
| 1042 | |||
| 1043 | if(onInsertRow) { | ||
| 1044 | if(p != null) { | ||
| 1045 | bool = p.evaluate(x,columnIndex); | ||
| 1046 | |||
| 1047 | if(!bool) { | ||
| 1048 | throw new SQLException(resBundle.handleGetObject("filteredrowsetimpl.notallowed").toString()); | ||
| 1049 | } | ||
| 1050 | } | ||
| 1051 | } | ||
| 1052 | |||
| 1053 | super.updateString(columnIndex,x); | ||
| 1054 | } | ||
| 1055 | |||
| 1056 | /** | ||
| 1057 | * Sets the designated column in either the current row or the insert | ||
| 1058 | * row of this <code>CachedRowSetImpl</code> object with the given | ||
| 1059 | * <code>String</code> object. | ||
| 1060 | * | ||
| 1061 | * This method updates a column value in either the current row or | ||
| 1062 | * the insert row of this rowset, but it does not update the | ||
| 1063 | * database. If the cursor is on a row in the rowset, the | ||
| 1064 | * method {@link #updateRow} must be called to update the database. | ||
| 1065 | * If the cursor is on the insert row, the method {@link #insertRow} | ||
| 1066 | * must be called, which will insert the new row into both this rowset | ||
| 1067 | * and the database. Both of these methods must be called before the | ||
| 1068 | * cursor moves to another row. | ||
| 1069 | * | ||
| 1070 | * @param columnName a <code>String</code> object that must match the | ||
| 1071 | * SQL name of a column in this rowset, ignoring case | ||
| 1072 | * @param x the new column value | ||
| 1073 | * @throws SQLException if (1) the given column name does not match the | ||
| 1074 | * name of a column in this rowset, (2) the cursor is not on | ||
| 1075 | * one of this rowset's rows or its insert row, or (3) this | ||
| 1076 | * rowset is <code>ResultSet.CONCUR_READ_ONLY</code> | ||
| 1077 | */ | ||
| 1078 | public void updateString(String columnName , String x) throws SQLException { | ||
| 1079 | |||
| 1080 | this.updateString(findColumn(columnName),x); | ||
| 1081 | } | ||
| 1082 | |||
| 1083 | /** | ||
| 1084 | * Sets the designated column in either the current row or the insert | ||
| 1085 | * row of this <code>CachedRowSetImpl</code> object with the given | ||
| 1086 | * <code>byte</code> array. | ||
| 1087 | * | ||
| 1088 | * This method updates a column value in either the current row or | ||
| 1089 | * the insert row of this rowset, but it does not update the | ||
| 1090 | * database. If the cursor is on a row in the rowset, the | ||
| 1091 | * method {@link #updateRow} must be called to update the database. | ||
| 1092 | * If the cursor is on the insert row, the method {@link #insertRow} | ||
| 1093 | * must be called, which will insert the new row into both this rowset | ||
| 1094 | * and the database. Both of these methods must be called before the | ||
| 1095 | * cursor moves to another row. | ||
| 1096 | * | ||
| 1097 | * @param columnIndex the first column is <code>1</code>, the second | ||
| 1098 | * is <code>2</code>, and so on; must be <code>1</code> or larger | ||
| 1099 | * and equal to or less than the number of columns in this rowset | ||
| 1100 | * @param x the new column value | ||
| 1101 | * @throws SQLException if (1) the given column index is out of bounds, | ||
| 1102 | * (2) the cursor is not on one of this rowset's rows or its | ||
| 1103 | * insert row, or (3) this rowset is | ||
| 1104 | * <code>ResultSet.CONCUR_READ_ONLY</code> | ||
| 1105 | */ | ||
| 1106 | public void updateBytes(int columnIndex , byte []x) throws SQLException { | ||
| 1107 | |||
| 1108 | boolean bool; | ||
| 1109 | String val = ""; | ||
| 1110 | |||
| 1111 | Byte [] obj_arr = new Byte[x.length]; | ||
| 1112 | |||
| 1113 | for(int i = 0; i < x.length; i++) { | ||
| 1114 | obj_arr[i] = Byte.valueOf(x[i]); | ||
| 1115 | val = val.concat(obj_arr[i].toString()); | ||
| 1116 | } | ||
| 1117 | |||
| 1118 | |||
| 1119 | if(onInsertRow) { | ||
| 1120 | if(p != null) { | ||
| 1121 | bool = p.evaluate(val,columnIndex); | ||
| 1122 | |||
| 1123 | if(!bool) { | ||
| 1124 | throw new SQLException(resBundle.handleGetObject("filteredrowsetimpl.notallowed").toString()); | ||
| 1125 | } | ||
| 1126 | } | ||
| 1127 | } | ||
| 1128 | |||
| 1129 | super.updateBytes(columnIndex,x); | ||
| 1130 | } | ||
| 1131 | |||
| 1132 | /** | ||
| 1133 | * Sets the designated column in either the current row or the insert | ||
| 1134 | * row of this <code>CachedRowSetImpl</code> object with the given | ||
| 1135 | * <code>byte</code> array. | ||
| 1136 | * | ||
| 1137 | * This method updates a column value in either the current row or | ||
| 1138 | * the insert row of this rowset, but it does not update the | ||
| 1139 | * database. If the cursor is on a row in the rowset, the | ||
| 1140 | * method {@link #updateRow} must be called to update the database. | ||
| 1141 | * If the cursor is on the insert row, the method {@link #insertRow} | ||
| 1142 | * must be called, which will insert the new row into both this rowset | ||
| 1143 | * and the database. Both of these methods must be called before the | ||
| 1144 | * cursor moves to another row. | ||
| 1145 | * | ||
| 1146 | * @param columnName a <code>String</code> object that must match the | ||
| 1147 | * SQL name of a column in this rowset, ignoring case | ||
| 1148 | * @param x the new column value | ||
| 1149 | * @throws SQLException if (1) the given column name does not match the | ||
| 1150 | * name of a column in this rowset, (2) the cursor is not on | ||
| 1151 | * one of this rowset's rows or its insert row, or (3) this | ||
| 1152 | * rowset is <code>ResultSet.CONCUR_READ_ONLY</code> | ||
| 1153 | */ | ||
| 1154 | public void updateBytes(String columnName , byte []x) throws SQLException { | ||
| 1155 | |||
| 1156 | this.updateBytes(findColumn(columnName),x); | ||
| 1157 | } | ||
| 1158 | |||
| 1159 | /** | ||
| 1160 | * Sets the designated column in either the current row or the insert | ||
| 1161 | * row of this <code>CachedRowSetImpl</code> object with the given | ||
| 1162 | * <code>Date</code> object. | ||
| 1163 | * | ||
| 1164 | * This method updates a column value in either the current row or | ||
| 1165 | * the insert row of this rowset, but it does not update the | ||
| 1166 | * database. If the cursor is on a row in the rowset, the | ||
| 1167 | * method {@link #updateRow} must be called to update the database. | ||
| 1168 | * If the cursor is on the insert row, the method {@link #insertRow} | ||
| 1169 | * must be called, which will insert the new row into both this rowset | ||
| 1170 | * and the database. Both of these methods must be called before the | ||
| 1171 | * cursor moves to another row. | ||
| 1172 | * | ||
| 1173 | * @param columnIndex the first column is <code>1</code>, the second | ||
| 1174 | * is <code>2</code>, and so on; must be <code>1</code> or larger | ||
| 1175 | * and equal to or less than the number of columns in this rowset | ||
| 1176 | * @param x the new column value | ||
| 1177 | * @throws SQLException if (1) the given column index is out of bounds, | ||
| 1178 | * (2) the cursor is not on one of this rowset's rows or its | ||
| 1179 | * insert row, (3) the type of the designated column is not | ||
| 1180 | * an SQL <code>DATE</code> or <code>TIMESTAMP</code>, or | ||
| 1181 | * (4) this rowset is <code>ResultSet.CONCUR_READ_ONLY</code> | ||
| 1182 | */ | ||
| 1183 | public void updateDate(int columnIndex , java.sql.Date x) throws SQLException { | ||
| 1184 | |||
| 1185 | boolean bool; | ||
| 1186 | |||
| 1187 | if(onInsertRow) { | ||
| 1188 | if(p != null) { | ||
| 1189 | bool = p.evaluate(x,columnIndex); | ||
| 1190 | |||
| 1191 | if(!bool) { | ||
| 1192 | throw new SQLException(resBundle.handleGetObject("filteredrowsetimpl.notallowed").toString()); | ||
| 1193 | } | ||
| 1194 | } | ||
| 1195 | } | ||
| 1196 | |||
| 1197 | super.updateDate(columnIndex,x); | ||
| 1198 | } | ||
| 1199 | |||
| 1200 | /** | ||
| 1201 | * Sets the designated column in either the current row or the insert | ||
| 1202 | * row of this <code>CachedRowSetImpl</code> object with the given | ||
| 1203 | * <code>Date</code> object. | ||
| 1204 | * | ||
| 1205 | * This method updates a column value in either the current row or | ||
| 1206 | * the insert row of this rowset, but it does not update the | ||
| 1207 | * database. If the cursor is on a row in the rowset, the | ||
| 1208 | * method {@link #updateRow} must be called to update the database. | ||
| 1209 | * If the cursor is on the insert row, the method {@link #insertRow} | ||
| 1210 | * must be called, which will insert the new row into both this rowset | ||
| 1211 | * and the database. Both of these methods must be called before the | ||
| 1212 | * cursor moves to another row. | ||
| 1213 | * | ||
| 1214 | * @param columnName a <code>String</code> object that must match the | ||
| 1215 | * SQL name of a column in this rowset, ignoring case | ||
| 1216 | * @param x the new column value | ||
| 1217 | * @throws SQLException if (1) the given column name does not match the | ||
| 1218 | * name of a column in this rowset, (2) the cursor is not on | ||
| 1219 | * one of this rowset's rows or its insert row, (3) the type | ||
| 1220 | * of the designated column is not an SQL <code>DATE</code> or | ||
| 1221 | * <code>TIMESTAMP</code>, or (4) this rowset is | ||
| 1222 | * <code>ResultSet.CONCUR_READ_ONLY</code> | ||
| 1223 | */ | ||
| 1224 | public void updateDate(String columnName , java.sql.Date x) throws SQLException { | ||
| 1225 | |||
| 1226 | this.updateDate(findColumn(columnName),x); | ||
| 1227 | } | ||
| 1228 | |||
| 1229 | /** | ||
| 1230 | * Sets the designated column in either the current row or the insert | ||
| 1231 | * row of this <code>CachedRowSetImpl</code> object with the given | ||
| 1232 | * <code>Time</code> object. | ||
| 1233 | * | ||
| 1234 | * This method updates a column value in either the current row or | ||
| 1235 | * the insert row of this rowset, but it does not update the | ||
| 1236 | * database. If the cursor is on a row in the rowset, the | ||
| 1237 | * method {@link #updateRow} must be called to update the database. | ||
| 1238 | * If the cursor is on the insert row, the method {@link #insertRow} | ||
| 1239 | * must be called, which will insert the new row into both this rowset | ||
| 1240 | * and the database. Both of these methods must be called before the | ||
| 1241 | * cursor moves to another row. | ||
| 1242 | * | ||
| 1243 | * @param columnIndex the first column is <code>1</code>, the second | ||
| 1244 | * is <code>2</code>, and so on; must be <code>1</code> or larger | ||
| 1245 | * and equal to or less than the number of columns in this rowset | ||
| 1246 | * @param x the new column value | ||
| 1247 | * @throws SQLException if (1) the given column index is out of bounds, | ||
| 1248 | * (2) the cursor is not on one of this rowset's rows or its | ||
| 1249 | * insert row, (3) the type of the designated column is not | ||
| 1250 | * an SQL <code>TIME</code> or <code>TIMESTAMP</code>, or | ||
| 1251 | * (4) this rowset is <code>ResultSet.CONCUR_READ_ONLY</code> | ||
| 1252 | */ | ||
| 1253 | public void updateTime(int columnIndex , Time x) throws SQLException { | ||
| 1254 | |||
| 1255 | boolean bool; | ||
| 1256 | |||
| 1257 | if(onInsertRow) { | ||
| 1258 | if(p != null) { | ||
| 1259 | bool = p.evaluate(x, columnIndex); | ||
| 1260 | |||
| 1261 | if(!bool) { | ||
| 1262 | throw new SQLException(resBundle.handleGetObject("filteredrowsetimpl.notallowed").toString()); | ||
| 1263 | } | ||
| 1264 | } | ||
| 1265 | } | ||
| 1266 | |||
| 1267 | super.updateTime(columnIndex,x); | ||
| 1268 | } | ||
| 1269 | |||
| 1270 | /** | ||
| 1271 | * Sets the designated column in either the current row or the insert | ||
| 1272 | * row of this <code>CachedRowSetImpl</code> object with the given | ||
| 1273 | * <code>Time</code> object. | ||
| 1274 | * | ||
| 1275 | * This method updates a column value in either the current row or | ||
| 1276 | * the insert row of this rowset, but it does not update the | ||
| 1277 | * database. If the cursor is on a row in the rowset, the | ||
| 1278 | * method {@link #updateRow} must be called to update the database. | ||
| 1279 | * If the cursor is on the insert row, the method {@link #insertRow} | ||
| 1280 | * must be called, which will insert the new row into both this rowset | ||
| 1281 | * and the database. Both of these methods must be called before the | ||
| 1282 | * cursor moves to another row. | ||
| 1283 | * | ||
| 1284 | * @param columnName a <code>String</code> object that must match the | ||
| 1285 | * SQL name of a column in this rowset, ignoring case | ||
| 1286 | * @param x the new column value | ||
| 1287 | * @throws SQLException if (1) the given column name does not match the | ||
| 1288 | * name of a column in this rowset, (2) the cursor is not on | ||
| 1289 | * one of this rowset's rows or its insert row, (3) the type | ||
| 1290 | * of the designated column is not an SQL <code>TIME</code> or | ||
| 1291 | * <code>TIMESTAMP</code>, or (4) this rowset is | ||
| 1292 | * <code>ResultSet.CONCUR_READ_ONLY</code> | ||
| 1293 | */ | ||
| 1294 | public void updateTime(String columnName , Time x) throws SQLException { | ||
| 1295 | |||
| 1296 | this.updateTime(findColumn(columnName),x); | ||
| 1297 | } | ||
| 1298 | |||
| 1299 | /** | ||
| 1300 | * Sets the designated column in either the current row or the insert | ||
| 1301 | * row of this <code>CachedRowSetImpl</code> object with the given | ||
| 1302 | * <code>Timestamp</code> object. | ||
| 1303 | * | ||
| 1304 | * This method updates a column value in either the current row or | ||
| 1305 | * the insert row of this rowset, but it does not update the | ||
| 1306 | * database. If the cursor is on a row in the rowset, the | ||
| 1307 | * method {@link #updateRow} must be called to update the database. | ||
| 1308 | * If the cursor is on the insert row, the method {@link #insertRow} | ||
| 1309 | * must be called, which will insert the new row into both this rowset | ||
| 1310 | * and the database. Both of these methods must be called before the | ||
| 1311 | * cursor moves to another row. | ||
| 1312 | * | ||
| 1313 | * @param columnIndex the first column is <code>1</code>, the second | ||
| 1314 | * is <code>2</code>, and so on; must be <code>1</code> or larger | ||
| 1315 | * and equal to or less than the number of columns in this rowset | ||
| 1316 | * @param x the new column value | ||
| 1317 | * @throws SQLException if (1) the given column index is out of bounds, | ||
| 1318 | * (2) the cursor is not on one of this rowset's rows or its | ||
| 1319 | * insert row, (3) the type of the designated column is not | ||
| 1320 | * an SQL <code>DATE</code>, <code>TIME</code>, or | ||
| 1321 | * <code>TIMESTAMP</code>, or (4) this rowset is | ||
| 1322 | * <code>ResultSet.CONCUR_READ_ONLY</code> | ||
| 1323 | */ | ||
| 1324 | public void updateTimestamp(int columnIndex , Timestamp x) throws SQLException { | ||
| 1325 | |||
| 1326 | boolean bool; | ||
| 1327 | |||
| 1328 | if(onInsertRow) { | ||
| 1329 | if(p != null) { | ||
| 1330 | bool = p.evaluate(x,columnIndex); | ||
| 1331 | |||
| 1332 | if(!bool) { | ||
| 1333 | throw new SQLException(resBundle.handleGetObject("filteredrowsetimpl.notallowed").toString()); | ||
| 1334 | } | ||
| 1335 | } | ||
| 1336 | } | ||
| 1337 | |||
| 1338 | super.updateTimestamp(columnIndex,x); | ||
| 1339 | } | ||
| 1340 | |||
| 1341 | /** | ||
| 1342 | * Sets the designated column in either the current row or the insert | ||
| 1343 | * row of this <code>CachedRowSetImpl</code> object with the given | ||
| 1344 | * <code>Timestamp</code> object. | ||
| 1345 | * | ||
| 1346 | * This method updates a column value in either the current row or | ||
| 1347 | * the insert row of this rowset, but it does not update the | ||
| 1348 | * database. If the cursor is on a row in the rowset, the | ||
| 1349 | * method {@link #updateRow} must be called to update the database. | ||
| 1350 | * If the cursor is on the insert row, the method {@link #insertRow} | ||
| 1351 | * must be called, which will insert the new row into both this rowset | ||
| 1352 | * and the database. Both of these methods must be called before the | ||
| 1353 | * cursor moves to another row. | ||
| 1354 | * | ||
| 1355 | * @param columnName a <code>String</code> object that must match the | ||
| 1356 | * SQL name of a column in this rowset, ignoring case | ||
| 1357 | * @param x the new column value | ||
| 1358 | * @throws SQLException if the given column index is out of bounds or | ||
| 1359 | * the cursor is not on one of this rowset's rows or its | ||
| 1360 | * insert row | ||
| 1361 | * @throws SQLException if (1) the given column name does not match the | ||
| 1362 | * name of a column in this rowset, (2) the cursor is not on | ||
| 1363 | * one of this rowset's rows or its insert row, (3) the type | ||
| 1364 | * of the designated column is not an SQL <code>DATE</code>, | ||
| 1365 | * <code>TIME</code>, or <code>TIMESTAMP</code>, or (4) this | ||
| 1366 | * rowset is <code>ResultSet.CONCUR_READ_ONLY</code> | ||
| 1367 | */ | ||
| 1368 | public void updateTimestamp(String columnName , Timestamp x) throws SQLException { | ||
| 1369 | |||
| 1370 | this.updateTimestamp(findColumn(columnName),x); | ||
| 1371 | } | ||
| 1372 | |||
| 1373 | /** | ||
| 1374 | * Sets the designated column in either the current row or the insert | ||
| 1375 | * row of this <code>CachedRowSetImpl</code> object with the given | ||
| 1376 | * ASCII stream value. | ||
| 1377 | * <P> | ||
| 1378 | * This method updates a column value in either the current row or | ||
| 1379 | * the insert row of this rowset, but it does not update the | ||
| 1380 | * database. If the cursor is on a row in the rowset, the | ||
| 1381 | * method {@link #updateRow} must be called to update the database. | ||
| 1382 | * If the cursor is on the insert row, the method {@link #insertRow} | ||
| 1383 | * must be called, which will insert the new row into both this rowset | ||
| 1384 | * and the database. Both of these methods must be called before the | ||
| 1385 | * cursor moves to another row. | ||
| 1386 | * | ||
| 1387 | * @param columnIndex the first column is <code>1</code>, the second | ||
| 1388 | * is <code>2</code>, and so on; must be <code>1</code> or larger | ||
| 1389 | * and equal to or less than the number of columns in this rowset | ||
| 1390 | * @param x the new column value | ||
| 1391 | * @param length the number of one-byte ASCII characters in the stream | ||
| 1392 | * @throws SQLException if this method is invoked | ||
| 1393 | */ | ||
| 1394 | public void updateAsciiStream(int columnIndex , java.io.InputStream x ,int length) throws SQLException { | ||
| 1395 | |||
| 1396 | boolean bool; | ||
| 1397 | |||
| 1398 | if(onInsertRow) { | ||
| 1399 | if(p != null) { | ||
| 1400 | bool = p.evaluate(x,columnIndex); | ||
| 1401 | |||
| 1402 | if(!bool) { | ||
| 1403 | throw new SQLException(resBundle.handleGetObject("filteredrowsetimpl.notallowed").toString()); | ||
| 1404 | } | ||
| 1405 | } | ||
| 1406 | } | ||
| 1407 | |||
| 1408 | super.updateAsciiStream(columnIndex,x,length); | ||
| 1409 | } | ||
| 1410 | |||
| 1411 | /** | ||
| 1412 | * Sets the designated column in either the current row or the insert | ||
| 1413 | * row of this <code>CachedRowSetImpl</code> object with the given | ||
| 1414 | * ASCII stream value. | ||
| 1415 | * <P> | ||
| 1416 | * This method updates a column value in either the current row or | ||
| 1417 | * the insert row of this rowset, but it does not update the | ||
| 1418 | * database. If the cursor is on a row in the rowset, the | ||
| 1419 | * method {@link #updateRow} must be called to update the database. | ||
| 1420 | * If the cursor is on the insert row, the method {@link #insertRow} | ||
| 1421 | * must be called, which will insert the new row into both this rowset | ||
| 1422 | * and the database. Both of these methods must be called before the | ||
| 1423 | * cursor moves to another row. | ||
| 1424 | * | ||
| 1425 | * @param columnName a <code>String</code> object that must match the | ||
| 1426 | * SQL name of a column in this rowset, ignoring case | ||
| 1427 | * @param x the new column value | ||
| 1428 | * @param length the number of one-byte ASCII characters in the stream | ||
| 1429 | */ | ||
| 1430 | public void updateAsciiStream(String columnName , java.io.InputStream x , int length) throws SQLException { | ||
| 1431 | |||
| 1432 | this.updateAsciiStream(findColumn(columnName),x,length); | ||
| 1433 | } | ||
| 1434 | |||
| 1435 | /** | ||
| 1436 | * Sets the designated column in either the current row or the insert | ||
| 1437 | * row of this <code>CachedRowSetImpl</code> object with the given | ||
| 1438 | * <code>java.io.Reader</code> object. | ||
| 1439 | * <P> | ||
| 1440 | * This method updates a column value in either the current row or | ||
| 1441 | * the insert row of this rowset, but it does not update the | ||
| 1442 | * database. If the cursor is on a row in the rowset, the | ||
| 1443 | * method {@link #updateRow} must be called to update the database. | ||
| 1444 | * If the cursor is on the insert row, the method {@link #insertRow} | ||
| 1445 | * must be called, which will insert the new row into both this rowset | ||
| 1446 | * and the database. Both of these methods must be called before the | ||
| 1447 | * cursor moves to another row. | ||
| 1448 | * | ||
| 1449 | * @param columnIndex the first column is <code>1</code>, the second | ||
| 1450 | * is <code>2</code>, and so on; must be <code>1</code> or larger | ||
| 1451 | * and equal to or less than the number of columns in this rowset | ||
| 1452 | * @param x the new column value; must be a <code>java.io.Reader</code> | ||
| 1453 | * containing <code>BINARY</code>, <code>VARBINARY</code>, | ||
| 1454 | * <code>LONGVARBINARY</code>, <code>CHAR</code>, <code>VARCHAR</code>, | ||
| 1455 | * or <code>LONGVARCHAR</code> data | ||
| 1456 | * @param length the length of the stream in characters | ||
| 1457 | * @throws SQLException if (1) the given column index is out of bounds, | ||
| 1458 | * (2) the cursor is not on one of this rowset's rows or its | ||
| 1459 | * insert row, (3) the data in the stream is not a binary or | ||
| 1460 | * character type, or (4) this rowset is | ||
| 1461 | * <code>ResultSet.CONCUR_READ_ONLY</code> | ||
| 1462 | */ | ||
| 1463 | public void updateCharacterStream(int columnIndex , java.io.Reader x , int length) throws SQLException { | ||
| 1464 | |||
| 1465 | boolean bool; | ||
| 1466 | |||
| 1467 | if(onInsertRow) { | ||
| 1468 | if(p != null) { | ||
| 1469 | bool = p.evaluate(x,columnIndex); | ||
| 1470 | |||
| 1471 | if(!bool) { | ||
| 1472 | throw new SQLException(resBundle.handleGetObject("filteredrowsetimpl.notallowed").toString()); | ||
| 1473 | } | ||
| 1474 | } | ||
| 1475 | } | ||
| 1476 | |||
| 1477 | super.updateCharacterStream(columnIndex,x,length); | ||
| 1478 | } | ||
| 1479 | |||
| 1480 | /** | ||
| 1481 | * Sets the designated column in either the current row or the insert | ||
| 1482 | * row of this <code>CachedRowSetImpl</code> object with the given | ||
| 1483 | * <code>java.io.Reader</code> object. | ||
| 1484 | * <P> | ||
| 1485 | * This method updates a column value in either the current row or | ||
| 1486 | * the insert row of this rowset, but it does not update the | ||
| 1487 | * database. If the cursor is on a row in the rowset, the | ||
| 1488 | * method {@link #updateRow} must be called to update the database. | ||
| 1489 | * If the cursor is on the insert row, the method {@link #insertRow} | ||
| 1490 | * must be called, which will insert the new row into both this rowset | ||
| 1491 | * and the database. Both of these methods must be called before the | ||
| 1492 | * cursor moves to another row. | ||
| 1493 | * | ||
| 1494 | * @param columnName a <code>String</code> object that must match the | ||
| 1495 | * SQL name of a column in this rowset, ignoring case | ||
| 1496 | * @param reader the new column value; must be a | ||
| 1497 | * <code>java.io.Reader</code> containing <code>BINARY</code>, | ||
| 1498 | * <code>VARBINARY</code>, <code>LONGVARBINARY</code>, <code>CHAR</code>, | ||
| 1499 | * <code>VARCHAR</code>, or <code>LONGVARCHAR</code> data | ||
| 1500 | * @param length the length of the stream in characters | ||
| 1501 | * @throws SQLException if (1) the given column name does not match the | ||
| 1502 | * name of a column in this rowset, (2) the cursor is not on | ||
| 1503 | * one of this rowset's rows or its insert row, (3) the data | ||
| 1504 | * in the stream is not a binary or character type, or (4) this | ||
| 1505 | * rowset is <code>ResultSet.CONCUR_READ_ONLY</code> | ||
| 1506 | */ | ||
| 1507 | public void updateCharacterStream(String columnName , java.io.Reader reader, int length) throws SQLException { | ||
| 1508 | this.updateCharacterStream(findColumn(columnName), reader, length); | ||
| 1509 | } | ||
| 1510 | |||
| 1511 | /** | ||
| 1512 | * Sets the designated column in either the current row or the insert | ||
| 1513 | * row of this <code>CachedRowSetImpl</code> object with the given | ||
| 1514 | * <code>java.io.InputStream</code> object. | ||
| 1515 | * <P> | ||
| 1516 | * This method updates a column value in either the current row or | ||
| 1517 | * the insert row of this rowset, but it does not update the | ||
| 1518 | * database. If the cursor is on a row in the rowset, the | ||
| 1519 | * method {@link #updateRow} must be called to update the database. | ||
| 1520 | * If the cursor is on the insert row, the method {@link #insertRow} | ||
| 1521 | * must be called, which will insert the new row into both this rowset | ||
| 1522 | * and the database. Both of these methods must be called before the | ||
| 1523 | * cursor moves to another row. | ||
| 1524 | * | ||
| 1525 | * @param columnIndex the first column is <code>1</code>, the second | ||
| 1526 | * is <code>2</code>, and so on; must be <code>1</code> or larger | ||
| 1527 | * and equal to or less than the number of columns in this rowset | ||
| 1528 | * @param x the new column value; must be a <code>java.io.InputStream</code> | ||
| 1529 | * containing <code>BINARY</code>, <code>VARBINARY</code>, or | ||
| 1530 | * <code>LONGVARBINARY</code> data | ||
| 1531 | * @param length the length of the stream in bytes | ||
| 1532 | * @throws SQLException if (1) the given column index is out of bounds, | ||
| 1533 | * (2) the cursor is not on one of this rowset's rows or its | ||
| 1534 | * insert row, (3) the data in the stream is not binary, or | ||
| 1535 | * (4) this rowset is <code>ResultSet.CONCUR_READ_ONLY</code> | ||
| 1536 | */ | ||
| 1537 | public void updateBinaryStream(int columnIndex , java.io.InputStream x , int length) throws SQLException { | ||
| 1538 | |||
| 1539 | boolean bool; | ||
| 1540 | |||
| 1541 | if(onInsertRow) { | ||
| 1542 | if(p != null) { | ||
| 1543 | bool = p.evaluate(x,columnIndex); | ||
| 1544 | |||
| 1545 | if(!bool) { | ||
| 1546 | throw new SQLException(resBundle.handleGetObject("filteredrowsetimpl.notallowed").toString()); | ||
| 1547 | } | ||
| 1548 | } | ||
| 1549 | } | ||
| 1550 | |||
| 1551 | super.updateBinaryStream(columnIndex,x,length); | ||
| 1552 | } | ||
| 1553 | |||
| 1554 | /** | ||
| 1555 | * Sets the designated column in either the current row or the insert | ||
| 1556 | * row of this <code>CachedRowSetImpl</code> object with the given | ||
| 1557 | * <code>java.io.InputStream</code> object. | ||
| 1558 | * <P> | ||
| 1559 | * This method updates a column value in either the current row or | ||
| 1560 | * the insert row of this rowset, but it does not update the | ||
| 1561 | * database. If the cursor is on a row in the rowset, the | ||
| 1562 | * method {@link #updateRow} must be called to update the database. | ||
| 1563 | * If the cursor is on the insert row, the method {@link #insertRow} | ||
| 1564 | * must be called, which will insert the new row into both this rowset | ||
| 1565 | * and the database. Both of these methods must be called before the | ||
| 1566 | * cursor moves to another row. | ||
| 1567 | * | ||
| 1568 | * @param columnName a <code>String</code> object that must match the | ||
| 1569 | * SQL name of a column in this rowset, ignoring case | ||
| 1570 | * @param x the new column value; must be a <code>java.io.InputStream</code> | ||
| 1571 | * containing <code>BINARY</code>, <code>VARBINARY</code>, or | ||
| 1572 | * <code>LONGVARBINARY</code> data | ||
| 1573 | * @param length the length of the stream in bytes | ||
| 1574 | * @throws SQLException if (1) the given column name does not match the | ||
| 1575 | * name of a column in this rowset, (2) the cursor is not on | ||
| 1576 | * one of this rowset's rows or its insert row, (3) the data | ||
| 1577 | * in the stream is not binary, or (4) this rowset is | ||
| 1578 | * <code>ResultSet.CONCUR_READ_ONLY</code> | ||
| 1579 | */ | ||
| 1580 | public void updateBinaryStream(String columnName , java.io.InputStream x, int length) throws SQLException { | ||
| 1581 | |||
| 1582 | this.updateBinaryStream(findColumn(columnName),x,length); | ||
| 1583 | } | ||
| 1584 | |||
| 1585 | /** | ||
| 1586 | * Sets the designated column in either the current row or the insert | ||
| 1587 | * row of this <code>CachedRowSetImpl</code> object with the given | ||
| 1588 | * <code>Object</code> value. | ||
| 1589 | * <P> | ||
| 1590 | * This method updates a column value in either the current row or | ||
| 1591 | * the insert row of this rowset, but it does not update the | ||
| 1592 | * database. If the cursor is on a row in the rowset, the | ||
| 1593 | * method {@link #updateRow} must be called to update the database. | ||
| 1594 | * If the cursor is on the insert row, the method {@link #insertRow} | ||
| 1595 | * must be called, which will insert the new row into both this rowset | ||
| 1596 | * and the database. Both of these methods must be called before the | ||
| 1597 | * cursor moves to another row. | ||
| 1598 | * | ||
| 1599 | * @param columnIndex the first column is <code>1</code>, the second | ||
| 1600 | * is <code>2</code>, and so on; must be <code>1</code> or larger | ||
| 1601 | * and equal to or less than the number of columns in this rowset | ||
| 1602 | * @param x the new column value | ||
| 1603 | * @throws SQLException if (1) the given column index is out of bounds, | ||
| 1604 | * (2) the cursor is not on one of this rowset's rows or its | ||
| 1605 | * insert row, or (3) this rowset is | ||
| 1606 | * <code>ResultSet.CONCUR_READ_ONLY</code> | ||
| 1607 | */ | ||
| 1608 | public void updateObject(int columnIndex , Object x) throws SQLException { | ||
| 1609 | |||
| 1610 | boolean bool; | ||
| 1611 | |||
| 1612 | if(onInsertRow) { | ||
| 1613 | if(p != null) { | ||
| 1614 | bool = p.evaluate(x,columnIndex); | ||
| 1615 | |||
| 1616 | if(!bool) { | ||
| 1617 | throw new SQLException(resBundle.handleGetObject("filteredrowsetimpl.notallowed").toString()); | ||
| 1618 | } | ||
| 1619 | } | ||
| 1620 | } | ||
| 1621 | |||
| 1622 | super.updateObject(columnIndex,x); | ||
| 1623 | } | ||
| 1624 | |||
| 1625 | /** | ||
| 1626 | * Sets the designated column in either the current row or the insert | ||
| 1627 | * row of this <code>CachedRowSetImpl</code> object with the given | ||
| 1628 | * <code>Object</code> value. | ||
| 1629 | * <P> | ||
| 1630 | * This method updates a column value in either the current row or | ||
| 1631 | * the insert row of this rowset, but it does not update the | ||
| 1632 | * database. If the cursor is on a row in the rowset, the | ||
| 1633 | * method {@link #updateRow} must be called to update the database. | ||
| 1634 | * If the cursor is on the insert row, the method {@link #insertRow} | ||
| 1635 | * must be called, which will insert the new row into both this rowset | ||
| 1636 | * and the database. Both of these methods must be called before the | ||
| 1637 | * cursor moves to another row. | ||
| 1638 | * | ||
| 1639 | * @param columnName a <code>String</code> object that must match the | ||
| 1640 | * SQL name of a column in this rowset, ignoring case | ||
| 1641 | * @param x the new column value | ||
| 1642 | * @throws SQLException if (1) the given column name does not match the | ||
| 1643 | * name of a column in this rowset, (2) the cursor is not on | ||
| 1644 | * one of this rowset's rows or its insert row, or (3) this | ||
| 1645 | * rowset is <code>ResultSet.CONCUR_READ_ONLY</code> | ||
| 1646 | */ | ||
| 1647 | public void updateObject(String columnName , Object x) throws SQLException { | ||
| 1648 | |||
| 1649 | this.updateObject(findColumn(columnName),x); | ||
| 1650 | } | ||
| 1651 | |||
| 1652 | /** | ||
| 1653 | * Sets the designated column in either the current row or the insert | ||
| 1654 | * row of this <code>CachedRowSetImpl</code> object with the given | ||
| 1655 | * <code>Object</code> value. The <code>scale</code> parameter indicates | ||
| 1656 | * the number of digits to the right of the decimal point and is ignored | ||
| 1657 | * if the new column value is not a type that will be mapped to an SQL | ||
| 1658 | * <code>DECIMAL</code> or <code>NUMERIC</code> value. | ||
| 1659 | * <P> | ||
| 1660 | * This method updates a column value in either the current row or | ||
| 1661 | * the insert row of this rowset, but it does not update the | ||
| 1662 | * database. If the cursor is on a row in the rowset, the | ||
| 1663 | * method {@link #updateRow} must be called to update the database. | ||
| 1664 | * If the cursor is on the insert row, the method {@link #insertRow} | ||
| 1665 | * must be called, which will insert the new row into both this rowset | ||
| 1666 | * and the database. Both of these methods must be called before the | ||
| 1667 | * cursor moves to another row. | ||
| 1668 | * | ||
| 1669 | * @param columnIndex the first column is <code>1</code>, the second | ||
| 1670 | * is <code>2</code>, and so on; must be <code>1</code> or larger | ||
| 1671 | * and equal to or less than the number of columns in this rowset | ||
| 1672 | * @param x the new column value | ||
| 1673 | * @param scale the number of digits to the right of the decimal point (for | ||
| 1674 | * <code>DECIMAL</code> and <code>NUMERIC</code> types only) | ||
| 1675 | * @throws SQLException if (1) the given column index is out of bounds, | ||
| 1676 | * (2) the cursor is not on one of this rowset's rows or its | ||
| 1677 | * insert row, or (3) this rowset is | ||
| 1678 | * <code>ResultSet.CONCUR_READ_ONLY</code> | ||
| 1679 | */ | ||
| 1680 | public void updateObject(int columnIndex , Object x , int scale) throws SQLException { | ||
| 1681 | |||
| 1682 | boolean bool; | ||
| 1683 | |||
| 1684 | if(onInsertRow) { | ||
| 1685 | if(p != null) { | ||
| 1686 | bool = p.evaluate(x,columnIndex); | ||
| 1687 | |||
| 1688 | if(!bool) { | ||
| 1689 | throw new SQLException(resBundle.handleGetObject("filteredrowsetimpl.notallowed").toString()); | ||
| 1690 | } | ||
| 1691 | } | ||
| 1692 | } | ||
| 1693 | |||
| 1694 | super.updateObject(columnIndex,x,scale); | ||
| 1695 | } | ||
| 1696 | |||
| 1697 | /** | ||
| 1698 | * Sets the designated column in either the current row or the insert | ||
| 1699 | * row of this <code>CachedRowSetImpl</code> object with the given | ||
| 1700 | * <code>Object</code> value. The <code>scale</code> parameter | ||
| 1701 | * indicates the number of digits to the right of the decimal point | ||
| 1702 | * and is ignored if the new column value is not a type that will be | ||
| 1703 | * mapped to an SQL <code>DECIMAL</code> or <code>NUMERIC</code> value. | ||
| 1704 | * <P> | ||
| 1705 | * This method updates a column value in either the current row or | ||
| 1706 | * the insert row of this rowset, but it does not update the | ||
| 1707 | * database. If the cursor is on a row in the rowset, the | ||
| 1708 | * method {@link #updateRow} must be called to update the database. | ||
| 1709 | * If the cursor is on the insert row, the method {@link #insertRow} | ||
| 1710 | * must be called, which will insert the new row into both this rowset | ||
| 1711 | * and the database. Both of these methods must be called before the | ||
| 1712 | * cursor moves to another row. | ||
| 1713 | * | ||
| 1714 | * @param columnName a <code>String</code> object that must match the | ||
| 1715 | * SQL name of a column in this rowset, ignoring case | ||
| 1716 | * @param x the new column value | ||
| 1717 | * @param scale the number of digits to the right of the decimal point (for | ||
| 1718 | * <code>DECIMAL</code> and <code>NUMERIC</code> types only) | ||
| 1719 | * @throws SQLException if (1) the given column name does not match the | ||
| 1720 | * name of a column in this rowset, (2) the cursor is not on | ||
| 1721 | * one of this rowset's rows or its insert row, or (3) this | ||
| 1722 | * rowset is <code>ResultSet.CONCUR_READ_ONLY</code> | ||
| 1723 | */ | ||
| 1724 | public void updateObject(String columnName , Object x, int scale) throws SQLException { | ||
| 1725 | |||
| 1726 | this.updateObject(findColumn(columnName),x,scale); | ||
| 1727 | } | ||
| 1728 | |||
| 1729 | /** | ||
| 1730 | * Inserts the contents of this <code>CachedRowSetImpl</code> object's insert | ||
| 1731 | * row into this rowset immediately following the current row. | ||
| 1732 | * If the current row is the | ||
| 1733 | * position after the last row or before the first row, the new row will | ||
| 1734 | * be inserted at the end of the rowset. This method also notifies | ||
| 1735 | * listeners registered with this rowset that the row has changed. | ||
| 1736 | * <P> | ||
| 1737 | * The cursor must be on the insert row when this method is called. | ||
| 1738 | * | ||
| 1739 | * @throws SQLException if (1) the cursor is not on the insert row, | ||
| 1740 | * (2) one or more of the non-nullable columns in the insert | ||
| 1741 | * row has not been given a value, or (3) this rowset is | ||
| 1742 | * <code>ResultSet.CONCUR_READ_ONLY</code> | ||
| 1743 | */ | ||
| 1744 | public void insertRow() throws SQLException { | ||
| 1745 | |||
| 1746 | onInsertRow = false; | ||
| 1747 | super.insertRow(); | ||
| 1748 | } | ||
| 1749 | |||
| 1750 | /** | ||
| 1751 | * This method re populates the resBundle | ||
| 1752 | * during the deserialization process | ||
| 1753 | * | ||
| 1754 | */ | ||
| 1755 | private void readObject(ObjectInputStream ois) throws IOException, ClassNotFoundException { | ||
| 1756 | // Default state initialization happens here | ||
| 1757 | ois.defaultReadObject(); | ||
| 1758 | // Initialization of transient Res Bundle happens here . | ||
| 1759 | try { | ||
| 1760 | resBundle = JdbcRowSetResourceBundle.getJdbcRowSetResourceBundle(); | ||
| 1761 | } catch(IOException ioe) { | ||
| 1762 | throw new RuntimeException(ioe); | ||
| 1763 | } | ||
| 1764 | |||
| 1765 | } | ||
| 1766 | |||
| 1767 | static final long serialVersionUID = 6178454588413509360L; | ||
| 1768 | } // end FilteredRowSetImpl class | ||