Example usage for javax.sql.rowset.serial SerialRef SerialRef

List of usage examples for javax.sql.rowset.serial SerialRef SerialRef

Introduction

In this page you can find the example usage for javax.sql.rowset.serial SerialRef SerialRef.

Prototype

public SerialRef(Ref ref) throws SerialException, SQLException 

Source Link

Document

Constructs a SerialRef object from the given Ref object.

Usage

From source file:lasige.steeldb.jdbc.BFTRowSet.java

/**
 * Sets the designated column in either the current row or the insert
 * row of this <code>CachedRowSetImpl</code> object with the given
 * <code>Ref</code> value./*from  ww  w  . ja v a  2  s.c  o  m*/
 *
 * This method updates a column value in either the current row or
 * the insert row of this rowset, but it does not update the
 * database.  If the cursor is on a row in the rowset, the
 * method {@link #updateRow} must be called to update the database.
 * If the cursor is on the insert row, the method {@link #insertRow}
 * must be called, which will insert the new row into both this rowset
 * and the database. Both of these methods must be called before the
 * cursor moves to another row.
 *
 * @param columnIndex the first column is <code>1</code>, the second
 *        is <code>2</code>, and so on; must be <code>1</code> or larger
 *        and equal to or less than the number of columns in this rowset
 * @param ref the new column <code>java.sql.Ref</code> value
 * @throws SQLException if (1) the given column index is out of bounds,
 *        (2) the cursor is not on one of this rowset's rows or its
 *        insert row, or (3) this rowset is
 *        <code>ResultSet.CONCUR_READ_ONLY</code>
 */
public void updateRef(int columnIndex, java.sql.Ref ref) throws SQLException {
    // sanity check.
    checkIndex(columnIndex);
    // make sure the cursor is on a valid row
    checkCursor();

    // SerialClob will help in getting the byte array and storing it.
    // We need to be checking DatabaseMetaData.locatorsUpdatorCopy()
    // or through RowSetMetaData.locatorsUpdatorCopy()
    getCurrentRow().setColumnObject(columnIndex, new SerialRef(ref));
}