< prev index next >

src/java.sql.rowset/share/classes/com/sun/rowset/CachedRowSetImpl.java

Print this page




1042         }
1043 
1044         Row currentRow = (Row)getCurrentRow();
1045         if (currentRow.getInserted() == true) {
1046             rvh.remove(cursorPos-1);
1047             --numRows;
1048             notifyRowChanged();
1049         } else {
1050             throw new SQLException(resBundle.handleGetObject("cachedrowsetimpl.illegalop").toString());
1051         }
1052     }
1053 
1054     /**
1055      * Immediately reverses the last update operation if the
1056      * row has been modified. This method can be
1057      * called to reverse updates on a all columns until all updates in a row have
1058      * been rolled back to their originating state since the last synchronization
1059      * (<code>acceptChanges</code>) or population. This method may also be called
1060      * while performing updates to the insert row.
1061      * <P>
1062      * <code>undoUpdate</code may be called at any time during the life-time of a
1063      * rowset, however after a synchronization has occurs this method has no
1064      * affect until further modification to the RowSet data occurs.
1065      *
1066      * @throws SQLException if cursor is before the first row, after the last
1067      *     row in rowset.
1068      * @see #undoDelete
1069      * @see #undoInsert
1070      * @see java.sql.ResultSet#cancelRowUpdates
1071      */
1072     public void undoUpdate() throws SQLException {
1073         // if on insert row, cancel the insert row
1074         // make the insert row flag,
1075         // cursorPos back to the current row
1076         moveToCurrentRow();
1077 
1078         // else if not on insert row
1079         // call undoUpdate or undoInsert
1080         undoDelete();
1081 
1082         undoInsert();


2450         binaryStream = new ByteArrayInputStream((byte[])value);
2451 
2452         return binaryStream;
2453 
2454     }
2455 
2456 
2457     // Methods for accessing results by column name
2458 
2459     /**
2460      * Retrieves the value stored in the designated column
2461      * of the current row as a <code>String</code> object.
2462      *
2463      * @param columnName a <code>String</code> object giving the SQL name of
2464      *        a column in this <code>CachedRowSetImpl</code> object
2465      * @return the column value; if the value is SQL <code>NULL</code>,
2466      *         the result is <code>null</code>
2467      * @throws SQLException if (1) the given column name is not the name of
2468      * a column in this rowset, (2) the cursor is not on one of
2469      * this rowset's rows or its insert row, or (3) the designated
2470      * column does not store an SQL <code>TINYINT, SMALLINT, INTEGER
2471      * BIGINT, REAL, FLOAT, DOUBLE, DECIMAL, NUMERIC, BIT, <b>CHAR</b>,
2472      * <b>VARCHAR</b></code> or <code>LONGVARCHAR<</code> value. The bold SQL type
2473      * designates the recommended return type.

2474      */
2475     public String getString(String columnName) throws SQLException {
2476         return getString(getColIdxByName(columnName));
2477     }
2478 
2479     /**
2480      * Retrieves the value stored in the designated column
2481      * of the current row as a <code>boolean</code> value.
2482      *
2483      * @param columnName a <code>String</code> object giving the SQL name of
2484      *        a column in this <code>CachedRowSetImpl</code> object
2485      * @return the column value as a <code>boolean</code> in the Java programming
2486      *        language; if the value is SQL <code>NULL</code>,
2487      *        the result is <code>false</code>
2488      * @throws SQLException if (1) the given column name is not the name of
2489      *            a column in this rowset, (2) the cursor is not on one of
2490      *            this rowset's rows or its insert row, or (3) the designated
2491      *            column does not store an SQL <code>BOOLEAN</code> value
2492      * @see #getBoolean(int)
2493      */


7731 
7732     /**
7733      * Retrieves the value of the designated column in the current row of this
7734      * <code>ResultSet</code> object as a java.sql.RowId object in the Java
7735      * programming language.
7736      *
7737      * @param columnName the name of the column
7738      * @return the column value if the value is a SQL <code>NULL</code> the
7739      *     value returned is <code>null</code>
7740      * @throws SQLException if a database access error occurs
7741      * @since 1.6
7742      */
7743     public RowId getRowId(String columnName) throws SQLException {
7744         throw new SQLFeatureNotSupportedException(resBundle.handleGetObject("cachedrowsetimpl.opnotysupp").toString());
7745     }
7746 
7747     /**
7748      * Updates the designated column with a <code>RowId</code> value. The updater
7749      * methods are used to update column values in the current row or the insert
7750      * row. The updater methods do not update the underlying database; instead
7751      * the <code>updateRow<code> or <code>insertRow</code> methods are called
7752      * to update the database.
7753      *
7754      * @param columnIndex the first column is 1, the second 2, ...
7755      * @param x the column value
7756      * @throws SQLException if a database access occurs
7757      * @since 1.6
7758      */
7759     public void updateRowId(int columnIndex, RowId x) throws SQLException {
7760         throw new SQLFeatureNotSupportedException(resBundle.handleGetObject("cachedrowsetimpl.opnotysupp").toString());
7761     }
7762 
7763     /**
7764      * Updates the designated column with a <code>RowId</code> value. The updater
7765      * methods are used to update column values in the current row or the insert
7766      * row. The updater methods do not update the underlying database; instead
7767      * the <code>updateRow<code> or <code>insertRow</code> methods are called
7768      * to update the database.
7769      *
7770      * @param columnName the name of the column
7771      * @param x the column value
7772      * @throws SQLException if a database access occurs
7773      * @since 1.6
7774      */
7775     public void updateRowId(String columnName, RowId x) throws SQLException {
7776         throw new SQLFeatureNotSupportedException(resBundle.handleGetObject("cachedrowsetimpl.opnotysupp").toString());
7777     }
7778 
7779     /**
7780      * Retrieves the holdability of this ResultSet object
7781      * @return  either ResultSet.HOLD_CURSORS_OVER_COMMIT or ResultSet.CLOSE_CURSORS_AT_COMMIT
7782      * @throws SQLException if a database error occurs
7783      * @since 1.6
7784      */
7785     public int getHoldability() throws SQLException {
7786         throw new SQLFeatureNotSupportedException(resBundle.handleGetObject("cachedrowsetimpl.opnotysupp").toString());
7787     }




1042         }
1043 
1044         Row currentRow = (Row)getCurrentRow();
1045         if (currentRow.getInserted() == true) {
1046             rvh.remove(cursorPos-1);
1047             --numRows;
1048             notifyRowChanged();
1049         } else {
1050             throw new SQLException(resBundle.handleGetObject("cachedrowsetimpl.illegalop").toString());
1051         }
1052     }
1053 
1054     /**
1055      * Immediately reverses the last update operation if the
1056      * row has been modified. This method can be
1057      * called to reverse updates on a all columns until all updates in a row have
1058      * been rolled back to their originating state since the last synchronization
1059      * (<code>acceptChanges</code>) or population. This method may also be called
1060      * while performing updates to the insert row.
1061      * <P>
1062      * {@code undoUpdate} may be called at any time during the life-time of a
1063      * rowset, however after a synchronization has occurs this method has no
1064      * affect until further modification to the RowSet data occurs.
1065      *
1066      * @throws SQLException if cursor is before the first row, after the last
1067      *     row in rowset.
1068      * @see #undoDelete
1069      * @see #undoInsert
1070      * @see java.sql.ResultSet#cancelRowUpdates
1071      */
1072     public void undoUpdate() throws SQLException {
1073         // if on insert row, cancel the insert row
1074         // make the insert row flag,
1075         // cursorPos back to the current row
1076         moveToCurrentRow();
1077 
1078         // else if not on insert row
1079         // call undoUpdate or undoInsert
1080         undoDelete();
1081 
1082         undoInsert();


2450         binaryStream = new ByteArrayInputStream((byte[])value);
2451 
2452         return binaryStream;
2453 
2454     }
2455 
2456 
2457     // Methods for accessing results by column name
2458 
2459     /**
2460      * Retrieves the value stored in the designated column
2461      * of the current row as a <code>String</code> object.
2462      *
2463      * @param columnName a <code>String</code> object giving the SQL name of
2464      *        a column in this <code>CachedRowSetImpl</code> object
2465      * @return the column value; if the value is SQL <code>NULL</code>,
2466      *         the result is <code>null</code>
2467      * @throws SQLException if (1) the given column name is not the name of
2468      * a column in this rowset, (2) the cursor is not on one of
2469      * this rowset's rows or its insert row, or (3) the designated
2470      * column does not store an SQL {@code TINYINT, SMALLINT, INTEGER
2471      * BIGINT, REAL, FLOAT, DOUBLE, DECIMAL, NUMERIC, BIT, }
2472      * <b>{@code CHAR, VARCHAR}</b> or
2473      * <b>{@code LONGVARCHAR}</b> value.
2474      * The bold SQL type designates the recommended return type.
2475      */
2476     public String getString(String columnName) throws SQLException {
2477         return getString(getColIdxByName(columnName));
2478     }
2479 
2480     /**
2481      * Retrieves the value stored in the designated column
2482      * of the current row as a <code>boolean</code> value.
2483      *
2484      * @param columnName a <code>String</code> object giving the SQL name of
2485      *        a column in this <code>CachedRowSetImpl</code> object
2486      * @return the column value as a <code>boolean</code> in the Java programming
2487      *        language; if the value is SQL <code>NULL</code>,
2488      *        the result is <code>false</code>
2489      * @throws SQLException if (1) the given column name is not the name of
2490      *            a column in this rowset, (2) the cursor is not on one of
2491      *            this rowset's rows or its insert row, or (3) the designated
2492      *            column does not store an SQL <code>BOOLEAN</code> value
2493      * @see #getBoolean(int)
2494      */


7732 
7733     /**
7734      * Retrieves the value of the designated column in the current row of this
7735      * <code>ResultSet</code> object as a java.sql.RowId object in the Java
7736      * programming language.
7737      *
7738      * @param columnName the name of the column
7739      * @return the column value if the value is a SQL <code>NULL</code> the
7740      *     value returned is <code>null</code>
7741      * @throws SQLException if a database access error occurs
7742      * @since 1.6
7743      */
7744     public RowId getRowId(String columnName) throws SQLException {
7745         throw new SQLFeatureNotSupportedException(resBundle.handleGetObject("cachedrowsetimpl.opnotysupp").toString());
7746     }
7747 
7748     /**
7749      * Updates the designated column with a <code>RowId</code> value. The updater
7750      * methods are used to update column values in the current row or the insert
7751      * row. The updater methods do not update the underlying database; instead
7752      * the {@code updateRow} or {@code insertRow} methods are called
7753      * to update the database.
7754      *
7755      * @param columnIndex the first column is 1, the second 2, ...
7756      * @param x the column value
7757      * @throws SQLException if a database access occurs
7758      * @since 1.6
7759      */
7760     public void updateRowId(int columnIndex, RowId x) throws SQLException {
7761         throw new SQLFeatureNotSupportedException(resBundle.handleGetObject("cachedrowsetimpl.opnotysupp").toString());
7762     }
7763 
7764     /**
7765      * Updates the designated column with a <code>RowId</code> value. The updater
7766      * methods are used to update column values in the current row or the insert
7767      * row. The updater methods do not update the underlying database; instead
7768      * the {@code updateRow} or {@code insertRow} methods are called
7769      * to update the database.
7770      *
7771      * @param columnName the name of the column
7772      * @param x the column value
7773      * @throws SQLException if a database access occurs
7774      * @since 1.6
7775      */
7776     public void updateRowId(String columnName, RowId x) throws SQLException {
7777         throw new SQLFeatureNotSupportedException(resBundle.handleGetObject("cachedrowsetimpl.opnotysupp").toString());
7778     }
7779 
7780     /**
7781      * Retrieves the holdability of this ResultSet object
7782      * @return  either ResultSet.HOLD_CURSORS_OVER_COMMIT or ResultSet.CLOSE_CURSORS_AT_COMMIT
7783      * @throws SQLException if a database error occurs
7784      * @since 1.6
7785      */
7786     public int getHoldability() throws SQLException {
7787         throw new SQLFeatureNotSupportedException(resBundle.handleGetObject("cachedrowsetimpl.opnotysupp").toString());
7788     }


< prev index next >