com.sun.rowset.internal
Class InsertRow

java.lang.Object
  extended bycom.sun.rowset.internal.BaseRow
      extended bycom.sun.rowset.internal.InsertRow
All Implemented Interfaces:
java.lang.Cloneable, java.io.Serializable

public class InsertRow
extends BaseRow
implements java.io.Serializable, java.lang.Cloneable

A class used internally to manage a CachedRowSet object's insert row. This class keeps track of the number of columns in the insert row and which columns have had a value inserted. It provides methods for retrieving a column value, setting a column value, and finding out whether the insert row is complete.

See Also:
Serialized Form

Field Summary
 
Fields inherited from class com.sun.rowset.internal.BaseRow
origVals
 
Constructor Summary
InsertRow(int numCols)
          Creates an InsertRow object initialized with the given number of columns, an array for keeping track of the original values in this insert row, and a BitSet object with the same number of bits as there are columns.
 
Method Summary
 java.lang.Object getColumnObject(int idx)
          Retrieves the value of the designated column in this InsertRow object.
 void initInsertRow()
          Clears all the bits in the internal BitSet object maintained by this InsertRow object.
 boolean isCompleteRow(javax.sql.RowSetMetaData RowSetMD)
          Indicates whether this InsertRow object has a value for every column that cannot be null.
protected  void markColInserted(int col)
          Sets the bit in this InsertRow object's internal BitSet object that corresponds to the specified column in this InsertRow object.
 void setColumnObject(int idx, java.lang.Object val)
          Sets the element in this InsertRow object's internal array of original values that corresponds to the designated column with the given value.
 
Methods inherited from class com.sun.rowset.internal.BaseRow
getOrigRow
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

InsertRow

public InsertRow(int numCols)
Creates an InsertRow object initialized with the given number of columns, an array for keeping track of the original values in this insert row, and a BitSet object with the same number of bits as there are columns.

Parameters:
numCols - an int indicating the number of columns in this InsertRow object
Method Detail

markColInserted

protected void markColInserted(int col)
Sets the bit in this InsertRow object's internal BitSet object that corresponds to the specified column in this InsertRow object. Setting a bit indicates that a value has been set.

Parameters:
col - the number of the column to be marked as inserted; the first column is 1

isCompleteRow

public boolean isCompleteRow(javax.sql.RowSetMetaData RowSetMD)
                      throws java.sql.SQLException
Indicates whether this InsertRow object has a value for every column that cannot be null.

Parameters:
RowSetMD - the RowSetMetaData object for the CachedRowSet object that maintains this InsertRow object
Returns:
true if this InsertRow object is complete; false otherwise
Throws:
java.sql.SQLException - if there is an error accessing data

initInsertRow

public void initInsertRow()
Clears all the bits in the internal BitSet object maintained by this InsertRow object. Clearing all the bits indicates that none of the columns have had a value inserted.


getColumnObject

public java.lang.Object getColumnObject(int idx)
                                 throws java.sql.SQLException
Retrieves the value of the designated column in this InsertRow object. If no value has been inserted into the designated column, this method throws an SQLException.

Specified by:
getColumnObject in class BaseRow
Parameters:
idx - the column number of the value to be retrieved; the first column is 1
Returns:
the Object value at the given index into this row's array of original values
Throws:
java.sql.SQLException - if no value has been inserted into the designated column

setColumnObject

public void setColumnObject(int idx,
                            java.lang.Object val)
Sets the element in this InsertRow object's internal array of original values that corresponds to the designated column with the given value. If the third argument is true, which means that the cursor is on the insert row, this InsertRow object's internal BitSet object is set so that the bit corresponding to the column being set is turned on.

Specified by:
setColumnObject in class BaseRow
Parameters:
val - the value to be set
idx - the index of the element to be set