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

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

Introduction

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

Prototype

public SerialArray(Array array) throws SerialException, SQLException 

Source Link

Document

Constructs a new SerialArray object from the given Array 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>java.sql.Array</code> values.
 *
 * 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.// w ww . java 2s. co m
 *
 * @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 a the new column <code>Array</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 updateArray(int columnIndex, Array a) throws SQLException {
    // sanity check.
    checkIndex(columnIndex);
    // make sure the cursor is on a valid row
    checkCursor();

    // SerialArray 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 SerialArray(a));
}