RIOptimisticProvider implementation to
propagate changes back to the data source from which the rowset got its data.
A CachedRowSetWriter object, called a writer, has the public
method writeData for writing modified data to the underlying data source.
This method is invoked by the rowset internally and is never invoked directly by an application.
A writer also has public methods for setting and getting
the CachedRowSetReader object, called a reader, that is associated
with the writer. The remainder of the methods in this class are private and
are invoked internally, either directly or indirectly, by the method
writeData.
Typically the SyncFactory manages the RowSetReader and
the RowSetWriter implementations using SyncProvider objects.
Standard JDBC RowSet implementations provide an object instance of this
writer by invoking the SyncProvider.getRowSetWriter() method.
javax.sql.rowset.spi.SyncProvider , javax.sql.rowset.spi.SyncFactory , javax.sql.rowset.spi.SyncFactoryException
| Modifier and Type | Field and Description |
|---|---|
| private int | callerColumnCount
The number of columns in the |
| private ResultSetMetaData | callerMd
The |
| private transient Connection | con
The |
| private CachedRowSetImpl | crsResolve
This |
| private String | deleteCmd
The SQL |
| private String | deleteWhere
The SQL |
| private int | iChangedValsInDbAndCRS
This will check whether the same field value has changed both in database and CachedRowSet. |
| private int | iChangedValsinDbOnly
This will hold the number of cols for which the values have changed only in database. |
| private String | insertCmd
The SQL |
| private int[] | keyCols
An array containing the column numbers of the columns that are
needed to uniquely identify a row in the |
| private Object[] | params
An array of the parameters that should be used to set the parameter
placeholders in a |
| private CachedRowSetReader | reader
The |
| private JdbcRowSetResourceBundle | |
| private String | selectCmd
The SQL |
| pack-priv static final long | |
| private ArrayList | status
This |
| private String | updateCmd
The SQL |
| private String | updateWhere
The SQL |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| private void | buildKeyDesc(CachedRowSet
the crs)CachedRowSet object for which this
CachedRowSetWriter object is the writerAssigns to the given |
| private String | Returns: aString object with the fully qualified name of the
table from which this writer's rowset was deriveda dbmd, String DatabaseMetaData object that contains metadata
about this writer's CachedRowSet objecta catalog, String schema, String String object with the rowset's catalog
namea table)String object with the name of the table from
which this writer's rowset was derivedReturns a fully qualified table name built from the given catalog and table names. |
| private String | Returns: aWHERE clause of the form "WHERE
columnName = ? AND columnName = ? AND columnName = ? ..."a whereClause, ResultSet String object that is an empty
string ("")a rs)ResultSet object that can be used
to access the CachedRowSet object's dataConstructs an SQL |
| public void | commit()
Implements javax. Makes permanent all changes that have been performed by the
|
| public void | |
| private boolean | Returns: false if the deletion was successful, which means that
there was no conflict; true otherwiseDeletes the row in the underlying data source that corresponds to
a row that has been deleted in the given |
| public CachedRowSetReader | |
| private void | initSQLStatements(CachedRowSet
a caller)CachedRowSet object for which this
CachedRowSetWriter object is the writerComposes a |
| private boolean | Returns: false to indicate that the insertion was successful;
true otherwisethe crs, PreparedStatement CachedRowSet object that has had a row inserted
and to whose underlying data source the row will be insertedthe pstmt, CachedRowSetImpl crsRes)PreparedStatement object that will be used
to execute the insertionInserts a row that has been inserted into the given
|
| private boolean | Returns: true if found, false otherwise (auto generated key)- Primary Key to validate pk, ResultSetMetaData - ResultSetMetadata for the RowSet rsmd)Validate whether the Primary Key is known to the CachedRowSet. |
| private void | |
| public void | rollback()
Implements javax. Undoes all changes made in the current transaction. |
| public void | rollback(Savepoint s)
Implements javax. Undoes all changes made in the current transaction made prior to the given
|
| public void | |
| private boolean | Returns: false if the update to the underlying data source is
successful; true otherwiseUpdates the given |
| pack-priv void | |
| public boolean | Returns: true if changes to the rowset were successfully
written to the rowset's underlying data source;
false otherwiseImplements javax. Propagates changes in the given |
| callerColumnCount | back to summary |
|---|---|
| private int callerColumnCount The number of columns in the | |
| callerMd | back to summary |
|---|---|
| private ResultSetMetaData callerMd The
| |
| con | back to summary |
|---|---|
| private transient Connection con The | |
| crsResolve | back to summary |
|---|---|
| private CachedRowSetImpl crsResolve This | |
| deleteCmd | back to summary |
|---|---|
| private String deleteCmd The SQL | |
| deleteWhere | back to summary |
|---|---|
| private String deleteWhere The SQL | |
| iChangedValsInDbAndCRS | back to summary |
|---|---|
| private int iChangedValsInDbAndCRS This will check whether the same field value has changed both in database and CachedRowSet. | |
| iChangedValsinDbOnly | back to summary |
|---|---|
| private int iChangedValsinDbOnly This will hold the number of cols for which the values have changed only in database. | |
| insertCmd | back to summary |
|---|---|
| private String insertCmd The SQL | |
| keyCols | back to summary |
|---|---|
| private int[] keyCols An array containing the column numbers of the columns that are
needed to uniquely identify a row in the | |
| params | back to summary |
|---|---|
| private Object[] params An array of the parameters that should be used to set the parameter
placeholders in a
| |
| reader | back to summary |
|---|---|
| private CachedRowSetReader reader The | |
| resBundle | back to summary |
|---|---|
| private JdbcRowSetResourceBundle resBundle | |
| selectCmd | back to summary |
|---|---|
| private String selectCmd The SQL | |
| serialVersionUID | back to summary |
|---|---|
| pack-priv static final long serialVersionUID | |
| status | back to summary |
|---|---|
| private ArrayList<Integer> status This | |
| updateCmd | back to summary |
|---|---|
| private String updateCmd The SQL | |
| updateWhere | back to summary |
|---|---|
| private String updateWhere The SQL | |
| CachedRowSetWriter | back to summary |
|---|---|
| public CachedRowSetWriter() | |
| buildKeyDesc | back to summary |
|---|---|
| private void buildKeyDesc(CachedRowSet crs) throws SQLException Assigns to the given
If the
| |
| buildTableName | back to summary |
|---|---|
| private String buildTableName(DatabaseMetaData dbmd, String catalog, String schema, String table) throws SQLException Returns a fully qualified table name built from the given catalog and table names. The given metadata object is used to get the proper order and separator.
| |
| buildWhereClause | back to summary |
|---|---|
| private String buildWhereClause(String whereClause, ResultSet rs) throws SQLException Constructs an SQL
This method uses the given result set to access values in the
| |
| commit | back to summary |
|---|---|
| public void commit() throws SQLException Implements javax. Doc from javax. Makes permanent all changes that have been performed by the
| |
| commit | back to summary |
|---|---|
| public void commit(CachedRowSetImpl crs, boolean updateRowset) throws SQLException | |
| deleteOriginalRow | back to summary |
|---|---|
| private boolean deleteOriginalRow(CachedRowSet crs, CachedRowSetImpl crsRes) throws SQLException Deletes the row in the underlying data source that corresponds to
a row that has been deleted in the given
This method is called internally by this writer's
| |
| getReader | back to summary |
|---|---|
| public CachedRowSetReader getReader() throws SQLException Gets the reader for this writer.
| |
| initSQLStatements | back to summary |
|---|---|
| private void initSQLStatements(CachedRowSet caller) throws SQLException Composes a
| |
| insertNewRow | back to summary |
|---|---|
| private boolean insertNewRow(CachedRowSet crs, PreparedStatement pstmt, CachedRowSetImpl crsRes) throws SQLException Inserts a row that has been inserted into the given
| |
| isPKNameValid | back to summary |
|---|---|
| private boolean isPKNameValid(String pk, ResultSetMetaData rsmd) throws SQLException Validate whether the Primary Key is known to the CachedRowSet. If it is not, it is an auto-generated key
| |
| readObject | back to summary |
|---|---|
| private void readObject(ObjectInputStream ois) throws IOException, ClassNotFoundException | |
| rollback | back to summary |
|---|---|
| public void rollback() throws SQLException Implements javax. Doc from javax. Undoes all changes made in the current transaction. This method should be used only when auto-commit mode has been disabled.
| |
| rollback | back to summary |
|---|---|
| public void rollback(Savepoint s) throws SQLException Implements javax. Doc from javax. Undoes all changes made in the current transaction made prior to the given
| |
| setReader | back to summary |
|---|---|
| public void setReader(CachedRowSetReader reader) throws SQLException Sets the reader for this writer to the given reader.
| |
| updateOriginalRow | back to summary |
|---|---|
| private boolean updateOriginalRow(CachedRowSet crs) throws SQLException Updates the given
This method is called internally by the method
| |
| updateResolvedConflictToDB | back to summary |
|---|---|
| pack-priv void updateResolvedConflictToDB(CachedRowSet crs, Connection con) throws SQLException | |
| writeData | back to summary |
|---|---|
| public boolean writeData(RowSetInternal caller) throws SQLException Implements javax. Propagates changes in the given
This method is called by the rowset internally when
the application invokes the method
| |