Interface SyncResolver
- All Superinterfaces:
AutoCloseable, ResultSet, RowSet, Wrapper
Note that a conflict is a situation where the RowSet object's original
values for a row do not match the values in the data source, which indicates that
the data source row has been modified since the last synchronization. Note also that
a RowSet object's original values are the values it had just prior to the
the last synchronization, which are not necessarily its initial values.
Description of a SyncResolver Object
A SyncResolver object is a specialized RowSet object
that implements the SyncResolver interface.
It may operate as either a connected RowSet object (an
implementation of the JdbcRowSet interface) or a connected
RowSet object (an implementation of the
CachedRowSet interface or one of its subinterfaces). For information
on the subinterfaces, see the
javax.sql.rowset package
description. The reference implementation for SyncResolver implements
the CachedRowSet interface, but other implementations
may choose to implement the JdbcRowSet interface to satisfy
particular needs.
After an application has attempted to synchronize a RowSet object with
the data source (by calling the CachedRowSet
method acceptChanges), and one or more conflicts have been found,
a rowset's SyncProvider object creates an instance of
SyncResolver. This new SyncResolver object has
the same number of rows and columns as the
RowSet object that was attempting the synchronization. The
SyncResolver object contains the values from the data source that caused
the conflict(s) and null for all other values.
In addition, it contains information about each conflict.
Getting and Using a SyncResolver Object
When the method acceptChanges encounters conflicts, the
SyncProvider object creates a SyncProviderException
object and sets it with the new SyncResolver object. The method
acceptChanges will throw this exception, which
the application can then catch and use to retrieve the
SyncResolver object it contains. The following code snippet uses the
SyncProviderException method getSyncResolver to get
the SyncResolver object resolver.
catch (SyncProviderException spe) {
SyncResolver resolver = spe.getSyncResolver();
...
}
}
With resolver in hand, an application can use it to get the information
it contains about the conflict or conflicts. A SyncResolver object
such as resolver keeps
track of the conflicts for each row in which there is a conflict. It also places a
lock on the table or tables affected by the rowset's command so that no more
conflicts can occur while the current conflicts are being resolved.
The following kinds of information can be obtained from a SyncResolver
object:
What operation was being attempted when a conflict occurred
TheSyncProvider interface defines four constants
describing states that may occur. Three
constants describe the type of operation (update, delete, or insert) that a
RowSet object was attempting to perform when a conflict was discovered,
and the fourth indicates that there is no conflict.
These constants are the possible return values when a SyncResolver object
calls the method getStatus.
int operation = resolver.getStatus();
The value in the data source that caused a conflict
A conflict exists when a value that aRowSet object has changed
and is attempting to write to the data source
has also been changed in the data source since the last synchronization. An
application can call the SyncResolver method
getConflictValue to retrieve the
value in the data source that is the cause of the conflict because the values in a
SyncResolver object are the conflict values from the data source.
java.lang.Object conflictValue = resolver.getConflictValue(2);
Note that the column in resolver can be designated by the column number,
as is done in the preceding line of code, or by the column name.
With the information retrieved from the methods getStatus and
getConflictValue, the application may make a determination as to
which value should be persisted in the data source. The application then calls the
SyncResolver method setResolvedValue, which sets the value
to be persisted in the RowSet object and also in the data source.
resolver.setResolvedValue("DEPT", 8390426);
In the preceding line of code,
the column name designates the column in the RowSet object
that is to be set with the given value. The column number can also be used to
designate the column.
An application calls the method setResolvedValue after it has
resolved all of the conflicts in the current conflict row and repeats this process
for each conflict row in the SyncResolver object.
Navigating a SyncResolver Object
Because a SyncResolver object is a RowSet object, an
application can use all of the RowSet methods for moving the cursor
to navigate a SyncResolver object. For example, an application can
use the RowSet method next to get to each row and then
call the SyncResolver method getStatus to see if the row
contains a conflict. In a row with one or more conflicts, the application can
iterate through the columns to find any non-null values, which will be the values
from the data source that are in conflict.
To make it easier to navigate a SyncResolver object, especially when
there are large numbers of rows with no conflicts, the SyncResolver
interface defines the methods nextConflict and
previousConflict, which move only to rows
that contain at least one conflict value. Then an application can call the
SyncResolver method getConflictValue, supplying it
with the column number, to get the conflict value itself. The code fragment in the
next section gives an example.
Code Example
The following code fragment demonstrates how a disconnectedRowSet
object crs might attempt to synchronize itself with the
underlying data source and then resolve the conflicts. In the try
block, crs calls the method acceptChanges, passing it the
Connection object con. If there are no conflicts, the
changes in crs are simply written to the data source. However, if there
is a conflict, the method acceptChanges throws a
SyncProviderException object, and the
catch block takes effect. In this example, which
illustrates one of the many ways a SyncResolver object can be used,
the SyncResolver method nextConflict is used in a
while loop. The loop will end when nextConflict returns
false, which will occur when there are no more conflict rows in the
SyncResolver object resolver. In This particular code fragment,
resolver looks for rows that have update conflicts (rows with the status
SyncResolver.UPDATE_ROW_CONFLICT), and the rest of this code fragment
executes only for rows where conflicts occurred because crs was attempting an
update.
After the cursor for resolver has moved to the next conflict row that
has an update conflict, the method getRow indicates the number of the
current row, and
the cursor for the CachedRowSet object crs is moved to
the comparable row in crs. By iterating
through the columns of that row in both resolver and crs, the conflicting
values can be retrieved and compared to decide which one should be persisted. In this
code fragment, the value in crs is the one set as the resolved value, which means
that it will be used to overwrite the conflict value in the data source.
try {
crs.acceptChanges(con);
} catch (SyncProviderException spe) {
SyncResolver resolver = spe.getSyncResolver();
Object crsValue; // value in the RowSet object
Object resolverValue: // value in the SyncResolver object
Object resolvedValue: // value to be persisted
while(resolver.nextConflict()) {
if(resolver.getStatus() == SyncResolver.UPDATE_ROW_CONFLICT) {
int row = resolver.getRow();
crs.absolute(row);
int colCount = crs.getMetaData().getColumnCount();
for(int j = 1; j <= colCount; j++) {
if (resolver.getConflictValue(j) != null) {
crsValue = crs.getObject(j);
resolverValue = resolver.getConflictValue(j);
. . .
// compare crsValue and resolverValue to determine
// which should be the resolved value (the value to persist)
resolvedValue = crsValue;
resolver.setResolvedValue(j, resolvedValue);
}
}
}
}
}
- Since:
- 1.5
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intIndicates that a conflict occurred while theRowSetobject was attempting to delete a row in the data source.static final intIndicates that a conflict occurred while theRowSetobject was attempting to insert a row into the data source.static final intIndicates that no conflict occurred while theRowSetobject was attempting to update, delete or insert a row in the data source.static final intIndicates that a conflict occurred while theRowSetobject was attempting to update a row in the data source.Fields declared in interface ResultSet
CLOSE_CURSORS_AT_COMMIT, CONCUR_READ_ONLY, CONCUR_UPDATABLE, FETCH_FORWARD, FETCH_REVERSE, FETCH_UNKNOWN, HOLD_CURSORS_OVER_COMMIT, TYPE_FORWARD_ONLY, TYPE_SCROLL_INSENSITIVE, TYPE_SCROLL_SENSITIVEModifier and TypeFieldDescriptionstatic final intThe constant indicating that openResultSetobjects with this holdability will be closed when the current transaction is committed.static final intThe constant indicating the concurrency mode for aResultSetobject that may NOT be updated.static final intThe constant indicating the concurrency mode for aResultSetobject that may be updated.static final intThe constant indicating that the rows in a result set will be processed in a forward direction; first-to-last.static final intThe constant indicating that the rows in a result set will be processed in a reverse direction; last-to-first.static final intThe constant indicating that the order in which rows in a result set will be processed is unknown.static final intThe constant indicating that openResultSetobjects with this holdability will remain open when the current transaction is committed.static final intThe constant indicating the type for aResultSetobject whose cursor may move only forward.static final intThe constant indicating the type for aResultSetobject that is scrollable but generally not sensitive to changes to the data that underlies theResultSet.static final intThe constant indicating the type for aResultSetobject that is scrollable and generally sensitive to changes to the data that underlies theResultSet. -
Method Summary
Modifier and TypeMethodDescriptiongetConflictValue(int index) Retrieves the value in the designated column in the current row of thisSyncResolverobject, which is the value in the data source that caused a conflict.getConflictValue(String columnName) Retrieves the value in the designated column in the current row of thisSyncResolverobject, which is the value in the data source that caused a conflict.intRetrieves the conflict status of the current row of thisSyncResolver, which indicates the operation theRowSetobject was attempting when the conflict occurred.booleanMoves the cursor down from its current position to the next row that contains a conflict value.booleanMoves the cursor up from its current position to the previous conflict row in thisSyncResolverobject.voidsetResolvedValue(int index, Object obj) Sets obj as the value in column index in the current row of theRowSetobject that is being synchronized.voidsetResolvedValue(String columnName, Object obj) Sets obj as the value in column columnName in the current row of theRowSetobject that is being synchronized.Methods declared in interface ResultSet
absolute, afterLast, beforeFirst, cancelRowUpdates, clearWarnings, close, deleteRow, findColumn, first, getArray, getArray, getAsciiStream, getAsciiStream, getBigDecimal, getBigDecimal, getBigDecimal, getBigDecimal, getBinaryStream, getBinaryStream, getBlob, getBlob, getBoolean, getBoolean, getByte, getByte, getBytes, getBytes, getCharacterStream, getCharacterStream, getClob, getClob, getConcurrency, getCursorName, getDate, getDate, getDate, getDate, getDouble, getDouble, getFetchDirection, getFetchSize, getFloat, getFloat, getHoldability, getInt, getInt, getLong, getLong, getMetaData, getNCharacterStream, getNCharacterStream, getNClob, getNClob, getNString, getNString, getObject, getObject, getObject, getObject, getObject, getObject, getRef, getRef, getRow, getRowId, getRowId, getShort, getShort, getSQLXML, getSQLXML, getStatement, getString, getString, getTime, getTime, getTime, getTime, getTimestamp, getTimestamp, getTimestamp, getTimestamp, getType, getUnicodeStream, getUnicodeStream, getURL, getURL, getWarnings, insertRow, isAfterLast, isBeforeFirst, isClosed, isFirst, isLast, last, moveToCurrentRow, moveToInsertRow, next, previous, refreshRow, relative, rowDeleted, rowInserted, rowUpdated, setFetchDirection, setFetchSize, updateArray, updateArray, updateAsciiStream, updateAsciiStream, updateAsciiStream, updateAsciiStream, updateAsciiStream, updateAsciiStream, updateBigDecimal, updateBigDecimal, updateBinaryStream, updateBinaryStream, updateBinaryStream, updateBinaryStream, updateBinaryStream, updateBinaryStream, updateBlob, updateBlob, updateBlob, updateBlob, updateBlob, updateBlob, updateBoolean, updateBoolean, updateByte, updateByte, updateBytes, updateBytes, updateCharacterStream, updateCharacterStream, updateCharacterStream, updateCharacterStream, updateCharacterStream, updateCharacterStream, updateClob, updateClob, updateClob, updateClob, updateClob, updateClob, updateDate, updateDate, updateDouble, updateDouble, updateFloat, updateFloat, updateInt, updateInt, updateLong, updateLong, updateNCharacterStream, updateNCharacterStream, updateNCharacterStream, updateNCharacterStream, updateNClob, updateNClob, updateNClob, updateNClob, updateNClob, updateNClob, updateNString, updateNString, updateNull, updateNull, updateObject, updateObject, updateObject, updateObject, updateObject, updateObject, updateObject, updateObject, updateRef, updateRef, updateRow, updateRowId, updateRowId, updateShort, updateShort, updateSQLXML, updateSQLXML, updateString, updateString, updateTime, updateTime, updateTimestamp, updateTimestamp, wasNullModifier and TypeMethodDescriptionbooleanabsolute(int row) Moves the cursor to the given row number in thisResultSetobject.voidMoves the cursor to the end of thisResultSetobject, just after the last row.voidMoves the cursor to the front of thisResultSetobject, just before the first row.voidCancels the updates made to the current row in thisResultSetobject.voidClears all warnings reported on thisResultSetobject.voidclose()Releases thisResultSetobject's database and JDBC resources immediately instead of waiting for this to happen when it is automatically closed.voidDeletes the current row from thisResultSetobject and from the underlying database.intfindColumn(String columnLabel) Maps the givenResultSetcolumn label to itsResultSetcolumn index.booleanfirst()Moves the cursor to the first row in thisResultSetobject.getArray(int columnIndex) Retrieves the value of the designated column in the current row of thisResultSetobject as anArrayobject in the Java programming language.Retrieves the value of the designated column in the current row of thisResultSetobject as anArrayobject in the Java programming language.getAsciiStream(int columnIndex) Retrieves the value of the designated column in the current row of thisResultSetobject as a stream of ASCII characters.getAsciiStream(String columnLabel) Retrieves the value of the designated column in the current row of thisResultSetobject as a stream of ASCII characters.getBigDecimal(int columnIndex) Retrieves the value of the designated column in the current row of thisResultSetobject as ajava.math.BigDecimalwith full precision.getBigDecimal(int columnIndex, int scale) Deprecated.getBigDecimal(String columnLabel) Retrieves the value of the designated column in the current row of thisResultSetobject as ajava.math.BigDecimalwith full precision.getBigDecimal(String columnLabel, int scale) Deprecated.UsegetBigDecimal(int columnIndex)orgetBigDecimal(String columnLabel)getBinaryStream(int columnIndex) Retrieves the value of the designated column in the current row of thisResultSetobject as a stream of uninterpreted bytes.getBinaryStream(String columnLabel) Retrieves the value of the designated column in the current row of thisResultSetobject as a stream of uninterpretedbytes.getBlob(int columnIndex) Retrieves the value of the designated column in the current row of thisResultSetobject as aBlobobject in the Java programming language.Retrieves the value of the designated column in the current row of thisResultSetobject as aBlobobject in the Java programming language.booleangetBoolean(int columnIndex) Retrieves the value of the designated column in the current row of thisResultSetobject as abooleanin the Java programming language.booleangetBoolean(String columnLabel) Retrieves the value of the designated column in the current row of thisResultSetobject as abooleanin the Java programming language.bytegetByte(int columnIndex) Retrieves the value of the designated column in the current row of thisResultSetobject as abytein the Java programming language.byteRetrieves the value of the designated column in the current row of thisResultSetobject as abytein the Java programming language.byte[]getBytes(int columnIndex) Retrieves the value of the designated column in the current row of thisResultSetobject as abytearray in the Java programming language.byte[]Retrieves the value of the designated column in the current row of thisResultSetobject as abytearray in the Java programming language.getCharacterStream(int columnIndex) Retrieves the value of the designated column in the current row of thisResultSetobject as ajava.io.Readerobject.getCharacterStream(String columnLabel) Retrieves the value of the designated column in the current row of thisResultSetobject as ajava.io.Readerobject.getClob(int columnIndex) Retrieves the value of the designated column in the current row of thisResultSetobject as aClobobject in the Java programming language.Retrieves the value of the designated column in the current row of thisResultSetobject as aClobobject in the Java programming language.intRetrieves the concurrency mode of thisResultSetobject.Retrieves the name of the SQL cursor used by thisResultSetobject.getDate(int columnIndex) Retrieves the value of the designated column in the current row of thisResultSetobject as ajava.sql.Dateobject in the Java programming language.Retrieves the value of the designated column in the current row of thisResultSetobject as ajava.sql.Dateobject in the Java programming language.Retrieves the value of the designated column in the current row of thisResultSetobject as ajava.sql.Dateobject in the Java programming language.Retrieves the value of the designated column in the current row of thisResultSetobject as ajava.sql.Dateobject in the Java programming language.doublegetDouble(int columnIndex) Retrieves the value of the designated column in the current row of thisResultSetobject as adoublein the Java programming language.doubleRetrieves the value of the designated column in the current row of thisResultSetobject as adoublein the Java programming language.intRetrieves the fetch direction for thisResultSetobject.intRetrieves the fetch size for thisResultSetobject.floatgetFloat(int columnIndex) Retrieves the value of the designated column in the current row of thisResultSetobject as afloatin the Java programming language.floatRetrieves the value of the designated column in the current row of thisResultSetobject as afloatin the Java programming language.intRetrieves the holdability of thisResultSetobjectintgetInt(int columnIndex) Retrieves the value of the designated column in the current row of thisResultSetobject as anintin the Java programming language.intRetrieves the value of the designated column in the current row of thisResultSetobject as anintin the Java programming language.longgetLong(int columnIndex) Retrieves the value of the designated column in the current row of thisResultSetobject as alongin the Java programming language.longRetrieves the value of the designated column in the current row of thisResultSetobject as alongin the Java programming language.Retrieves the number, types and properties of thisResultSetobject's columns.getNCharacterStream(int columnIndex) Retrieves the value of the designated column in the current row of thisResultSetobject as ajava.io.Readerobject.getNCharacterStream(String columnLabel) Retrieves the value of the designated column in the current row of thisResultSetobject as ajava.io.Readerobject.getNClob(int columnIndex) Retrieves the value of the designated column in the current row of thisResultSetobject as aNClobobject in the Java programming language.Retrieves the value of the designated column in the current row of thisResultSetobject as aNClobobject in the Java programming language.getNString(int columnIndex) Retrieves the value of the designated column in the current row of thisResultSetobject as aStringin the Java programming language.getNString(String columnLabel) Retrieves the value of the designated column in the current row of thisResultSetobject as aStringin the Java programming language.getObject(int columnIndex) Gets the value of the designated column in the current row of thisResultSetobject as anObjectin the Java programming language.<T> TRetrieves the value of the designated column in the current row of thisResultSetobject and will convert from the SQL type of the column to the requested Java data type, if the conversion is supported.Retrieves the value of the designated column in the current row of thisResultSetobject as anObjectin the Java programming language.Gets the value of the designated column in the current row of thisResultSetobject as anObjectin the Java programming language.<T> TRetrieves the value of the designated column in the current row of thisResultSetobject and will convert from the SQL type of the column to the requested Java data type, if the conversion is supported.Retrieves the value of the designated column in the current row of thisResultSetobject as anObjectin the Java programming language.getRef(int columnIndex) Retrieves the value of the designated column in the current row of thisResultSetobject as aRefobject in the Java programming language.Retrieves the value of the designated column in the current row of thisResultSetobject as aRefobject in the Java programming language.intgetRow()Retrieves the current row number.getRowId(int columnIndex) Retrieves the value of the designated column in the current row of thisResultSetobject as ajava.sql.RowIdobject in the Java programming language.Retrieves the value of the designated column in the current row of thisResultSetobject as ajava.sql.RowIdobject in the Java programming language.shortgetShort(int columnIndex) Retrieves the value of the designated column in the current row of thisResultSetobject as ashortin the Java programming language.shortRetrieves the value of the designated column in the current row of thisResultSetobject as ashortin the Java programming language.getSQLXML(int columnIndex) Retrieves the value of the designated column in the current row of thisResultSetas ajava.sql.SQLXMLobject in the Java programming language.Retrieves the value of the designated column in the current row of thisResultSetas ajava.sql.SQLXMLobject in the Java programming language.Retrieves theStatementobject that produced thisResultSetobject.getString(int columnIndex) Retrieves the value of the designated column in the current row of thisResultSetobject as aStringin the Java programming language.Retrieves the value of the designated column in the current row of thisResultSetobject as aStringin the Java programming language.getTime(int columnIndex) Retrieves the value of the designated column in the current row of thisResultSetobject as ajava.sql.Timeobject in the Java programming language.Retrieves the value of the designated column in the current row of thisResultSetobject as ajava.sql.Timeobject in the Java programming language.Retrieves the value of the designated column in the current row of thisResultSetobject as ajava.sql.Timeobject in the Java programming language.Retrieves the value of the designated column in the current row of thisResultSetobject as ajava.sql.Timeobject in the Java programming language.getTimestamp(int columnIndex) Retrieves the value of the designated column in the current row of thisResultSetobject as ajava.sql.Timestampobject in the Java programming language.getTimestamp(int columnIndex, Calendar cal) Retrieves the value of the designated column in the current row of thisResultSetobject as ajava.sql.Timestampobject in the Java programming language.getTimestamp(String columnLabel) Retrieves the value of the designated column in the current row of thisResultSetobject as ajava.sql.Timestampobject in the Java programming language.getTimestamp(String columnLabel, Calendar cal) Retrieves the value of the designated column in the current row of thisResultSetobject as ajava.sql.Timestampobject in the Java programming language.intgetType()Retrieves the type of thisResultSetobject.getUnicodeStream(int columnIndex) Deprecated.usegetCharacterStreamin place ofgetUnicodeStreamgetUnicodeStream(String columnLabel) Deprecated.usegetCharacterStreaminsteadgetURL(int columnIndex) Retrieves the value of the designated column in the current row of thisResultSetobject as ajava.net.URLobject in the Java programming language.Retrieves the value of the designated column in the current row of thisResultSetobject as ajava.net.URLobject in the Java programming language.Retrieves the first warning reported by calls on thisResultSetobject.voidInserts the contents of the insert row into thisResultSetobject and into the database.booleanRetrieves whether the cursor is after the last row in thisResultSetobject.booleanRetrieves whether the cursor is before the first row in thisResultSetobject.booleanisClosed()Retrieves whether thisResultSetobject has been closed.booleanisFirst()Retrieves whether the cursor is on the first row of thisResultSetobject.booleanisLast()Retrieves whether the cursor is on the last row of thisResultSetobject.booleanlast()Moves the cursor to the last row in thisResultSetobject.voidMoves the cursor to the remembered cursor position, usually the current row.voidMoves the cursor to the insert row.booleannext()Moves the cursor forward one row from its current position.booleanprevious()Moves the cursor to the previous row in thisResultSetobject.voidRefreshes the current row with its most recent value in the database.booleanrelative(int rows) Moves the cursor a relative number of rows, either positive or negative.booleanRetrieves whether a row has been deleted.booleanRetrieves whether the current row has had an insertion.booleanRetrieves whether the current row has been updated.voidsetFetchDirection(int direction) Gives a hint as to the direction in which the rows in thisResultSetobject will be processed.voidsetFetchSize(int rows) Gives the JDBC driver a hint as to the number of rows that should be fetched from the database when more rows are needed for thisResultSetobject.voidupdateArray(int columnIndex, Array x) Updates the designated column with ajava.sql.Arrayvalue.voidupdateArray(String columnLabel, Array x) Updates the designated column with ajava.sql.Arrayvalue.voidupdateAsciiStream(int columnIndex, InputStream x) Updates the designated column with an ascii stream value.voidupdateAsciiStream(int columnIndex, InputStream x, int length) Updates the designated column with an ascii stream value, which will have the specified number of bytes.voidupdateAsciiStream(int columnIndex, InputStream x, long length) Updates the designated column with an ascii stream value, which will have the specified number of bytes.voidupdateAsciiStream(String columnLabel, InputStream x) Updates the designated column with an ascii stream value.voidupdateAsciiStream(String columnLabel, InputStream x, int length) Updates the designated column with an ascii stream value, which will have the specified number of bytes.voidupdateAsciiStream(String columnLabel, InputStream x, long length) Updates the designated column with an ascii stream value, which will have the specified number of bytes.voidupdateBigDecimal(int columnIndex, BigDecimal x) Updates the designated column with ajava.math.BigDecimalvalue.voidupdateBigDecimal(String columnLabel, BigDecimal x) Updates the designated column with ajava.sql.BigDecimalvalue.voidupdateBinaryStream(int columnIndex, InputStream x) Updates the designated column with a binary stream value.voidupdateBinaryStream(int columnIndex, InputStream x, int length) Updates the designated column with a binary stream value, which will have the specified number of bytes.voidupdateBinaryStream(int columnIndex, InputStream x, long length) Updates the designated column with a binary stream value, which will have the specified number of bytes.voidupdateBinaryStream(String columnLabel, InputStream x) Updates the designated column with a binary stream value.voidupdateBinaryStream(String columnLabel, InputStream x, int length) Updates the designated column with a binary stream value, which will have the specified number of bytes.voidupdateBinaryStream(String columnLabel, InputStream x, long length) Updates the designated column with a binary stream value, which will have the specified number of bytes.voidupdateBlob(int columnIndex, InputStream inputStream) Updates the designated column using the given input stream.voidupdateBlob(int columnIndex, InputStream inputStream, long length) Updates the designated column using the given input stream, which will have the specified number of bytes.voidupdateBlob(int columnIndex, Blob x) Updates the designated column with ajava.sql.Blobvalue.voidupdateBlob(String columnLabel, InputStream inputStream) Updates the designated column using the given input stream.voidupdateBlob(String columnLabel, InputStream inputStream, long length) Updates the designated column using the given input stream, which will have the specified number of bytes.voidupdateBlob(String columnLabel, Blob x) Updates the designated column with ajava.sql.Blobvalue.voidupdateBoolean(int columnIndex, boolean x) Updates the designated column with abooleanvalue.voidupdateBoolean(String columnLabel, boolean x) Updates the designated column with abooleanvalue.voidupdateByte(int columnIndex, byte x) Updates the designated column with abytevalue.voidupdateByte(String columnLabel, byte x) Updates the designated column with abytevalue.voidupdateBytes(int columnIndex, byte[] x) Updates the designated column with abytearray value.voidupdateBytes(String columnLabel, byte[] x) Updates the designated column with a byte array value.voidupdateCharacterStream(int columnIndex, Reader x) Updates the designated column with a character stream value.voidupdateCharacterStream(int columnIndex, Reader x, int length) Updates the designated column with a character stream value, which will have the specified number of bytes.voidupdateCharacterStream(int columnIndex, Reader x, long length) Updates the designated column with a character stream value, which will have the specified number of bytes.voidupdateCharacterStream(String columnLabel, Reader reader) Updates the designated column with a character stream value.voidupdateCharacterStream(String columnLabel, Reader reader, int length) Updates the designated column with a character stream value, which will have the specified number of bytes.voidupdateCharacterStream(String columnLabel, Reader reader, long length) Updates the designated column with a character stream value, which will have the specified number of bytes.voidupdateClob(int columnIndex, Reader reader) Updates the designated column using the givenReaderobject.voidupdateClob(int columnIndex, Reader reader, long length) Updates the designated column using the givenReaderobject, which is the given number of characters long.voidupdateClob(int columnIndex, Clob x) Updates the designated column with ajava.sql.Clobvalue.voidupdateClob(String columnLabel, Reader reader) Updates the designated column using the givenReaderobject.voidupdateClob(String columnLabel, Reader reader, long length) Updates the designated column using the givenReaderobject, which is the given number of characters long.voidupdateClob(String columnLabel, Clob x) Updates the designated column with ajava.sql.Clobvalue.voidupdateDate(int columnIndex, Date x) Updates the designated column with ajava.sql.Datevalue.voidupdateDate(String columnLabel, Date x) Updates the designated column with ajava.sql.Datevalue.voidupdateDouble(int columnIndex, double x) Updates the designated column with adoublevalue.voidupdateDouble(String columnLabel, double x) Updates the designated column with adoublevalue.voidupdateFloat(int columnIndex, float x) Updates the designated column with afloatvalue.voidupdateFloat(String columnLabel, float x) Updates the designated column with afloatvalue.voidupdateInt(int columnIndex, int x) Updates the designated column with anintvalue.voidUpdates the designated column with anintvalue.voidupdateLong(int columnIndex, long x) Updates the designated column with alongvalue.voidupdateLong(String columnLabel, long x) Updates the designated column with alongvalue.voidupdateNCharacterStream(int columnIndex, Reader x) Updates the designated column with a character stream value.voidupdateNCharacterStream(int columnIndex, Reader x, long length) Updates the designated column with a character stream value, which will have the specified number of bytes.voidupdateNCharacterStream(String columnLabel, Reader reader) Updates the designated column with a character stream value.voidupdateNCharacterStream(String columnLabel, Reader reader, long length) Updates the designated column with a character stream value, which will have the specified number of bytes.voidupdateNClob(int columnIndex, Reader reader) Updates the designated column using the givenReaderThe data will be read from the stream as needed until end-of-stream is reached.voidupdateNClob(int columnIndex, Reader reader, long length) Updates the designated column using the givenReaderobject, which is the given number of characters long.voidupdateNClob(int columnIndex, NClob nClob) Updates the designated column with ajava.sql.NClobvalue.voidupdateNClob(String columnLabel, Reader reader) Updates the designated column using the givenReaderobject.voidupdateNClob(String columnLabel, Reader reader, long length) Updates the designated column using the givenReaderobject, which is the given number of characters long.voidupdateNClob(String columnLabel, NClob nClob) Updates the designated column with ajava.sql.NClobvalue.voidupdateNString(int columnIndex, String nString) Updates the designated column with aStringvalue.voidupdateNString(String columnLabel, String nString) Updates the designated column with aStringvalue.voidupdateNull(int columnIndex) Updates the designated column with anullvalue.voidupdateNull(String columnLabel) Updates the designated column with anullvalue.voidupdateObject(int columnIndex, Object x) Updates the designated column with anObjectvalue.voidupdateObject(int columnIndex, Object x, int scaleOrLength) Updates the designated column with anObjectvalue.default voidupdateObject(int columnIndex, Object x, SQLType targetSqlType) Updates the designated column with anObjectvalue.default voidupdateObject(int columnIndex, Object x, SQLType targetSqlType, int scaleOrLength) Updates the designated column with anObjectvalue.voidupdateObject(String columnLabel, Object x) Updates the designated column with anObjectvalue.voidupdateObject(String columnLabel, Object x, int scaleOrLength) Updates the designated column with anObjectvalue.default voidupdateObject(String columnLabel, Object x, SQLType targetSqlType) Updates the designated column with anObjectvalue.default voidupdateObject(String columnLabel, Object x, SQLType targetSqlType, int scaleOrLength) Updates the designated column with anObjectvalue.voidUpdates the designated column with ajava.sql.Refvalue.voidUpdates the designated column with ajava.sql.Refvalue.voidUpdates the underlying database with the new contents of the current row of thisResultSetobject.voidupdateRowId(int columnIndex, RowId x) Updates the designated column with aRowIdvalue.voidupdateRowId(String columnLabel, RowId x) Updates the designated column with aRowIdvalue.voidupdateShort(int columnIndex, short x) Updates the designated column with ashortvalue.voidupdateShort(String columnLabel, short x) Updates the designated column with ashortvalue.voidupdateSQLXML(int columnIndex, SQLXML xmlObject) Updates the designated column with ajava.sql.SQLXMLvalue.voidupdateSQLXML(String columnLabel, SQLXML xmlObject) Updates the designated column with ajava.sql.SQLXMLvalue.voidupdateString(int columnIndex, String x) Updates the designated column with aStringvalue.voidupdateString(String columnLabel, String x) Updates the designated column with aStringvalue.voidupdateTime(int columnIndex, Time x) Updates the designated column with ajava.sql.Timevalue.voidupdateTime(String columnLabel, Time x) Updates the designated column with ajava.sql.Timevalue.voidupdateTimestamp(int columnIndex, Timestamp x) Updates the designated column with ajava.sql.Timestampvalue.voidupdateTimestamp(String columnLabel, Timestamp x) Updates the designated column with ajava.sql.Timestampvalue.booleanwasNull()Reports whether the last column read had a value of SQLNULL.Methods declared in interface RowSet
addRowSetListener, clearParameters, execute, getCommand, getDataSourceName, getEscapeProcessing, getMaxFieldSize, getMaxRows, getPassword, getQueryTimeout, getTransactionIsolation, getTypeMap, getUrl, getUsername, isReadOnly, removeRowSetListener, setArray, setAsciiStream, setAsciiStream, setAsciiStream, setAsciiStream, setBigDecimal, setBigDecimal, setBinaryStream, setBinaryStream, setBinaryStream, setBinaryStream, setBlob, setBlob, setBlob, setBlob, setBlob, setBlob, setBoolean, setBoolean, setByte, setByte, setBytes, setBytes, setCharacterStream, setCharacterStream, setCharacterStream, setCharacterStream, setClob, setClob, setClob, setClob, setClob, setClob, setCommand, setConcurrency, setDataSourceName, setDate, setDate, setDate, setDate, setDouble, setDouble, setEscapeProcessing, setFloat, setFloat, setInt, setInt, setLong, setLong, setMaxFieldSize, setMaxRows, setNCharacterStream, setNCharacterStream, setNCharacterStream, setNCharacterStream, setNClob, setNClob, setNClob, setNClob, setNClob, setNClob, setNString, setNString, setNull, setNull, setNull, setNull, setObject, setObject, setObject, setObject, setObject, setObject, setPassword, setQueryTimeout, setReadOnly, setRef, setRowId, setRowId, setShort, setShort, setSQLXML, setSQLXML, setString, setString, setTime, setTime, setTime, setTime, setTimestamp, setTimestamp, setTimestamp, setTimestamp, setTransactionIsolation, setType, setTypeMap, setUrl, setURL, setUsernameModifier and TypeMethodDescriptionvoidaddRowSetListener(RowSetListener listener) Registers the given listener so that it will be notified of events that occur on thisRowSetobject.voidClears the parameters set for thisRowSetobject's command.voidexecute()Fills thisRowSetobject with data.Retrieves thisRowSetobject's command property.Retrieves the logical name that identifies the data source for thisRowSetobject.booleanRetrieves whether escape processing is enabled for thisRowSetobject.intRetrieves the maximum number of bytes that may be returned for certain column values.intRetrieves the maximum number of rows that thisRowSetobject can contain.Retrieves the password used to create a database connection.intRetrieves the maximum number of seconds the driver will wait for a statement to execute.intRetrieves the transaction isolation level set for thisRowSetobject.Retrieves theMapobject associated with thisRowSetobject, which specifies the custom mapping of SQL user-defined types, if any.getUrl()Retrieves the url property thisRowSetobject will use to create a connection if it uses theDriverManagerinstead of aDataSourceobject to establish the connection.Retrieves the username used to create a database connection for thisRowSetobject.booleanRetrieves whether thisRowSetobject is read-only.voidremoveRowSetListener(RowSetListener listener) Removes the specified listener from the list of components that will be notified when an event occurs on thisRowSetobject.voidSets the designated parameter in thisRowSetobject's command with the givenArrayvalue.voidsetAsciiStream(int parameterIndex, InputStream x) Sets the designated parameter in thisRowSetobject's command to the given input stream.voidsetAsciiStream(int parameterIndex, InputStream x, int length) Sets the designated parameter in thisRowSetobject's command to the givenjava.io.InputStreamvalue.voidsetAsciiStream(String parameterName, InputStream x) Sets the designated parameter to the given input stream.voidsetAsciiStream(String parameterName, InputStream x, int length) Sets the designated parameter to the given input stream, which will have the specified number of bytes.voidsetBigDecimal(int parameterIndex, BigDecimal x) Sets the designated parameter in thisRowSetobject's command to the givenjava.math.BigDecimalvalue.voidsetBigDecimal(String parameterName, BigDecimal x) Sets the designated parameter to the givenjava.math.BigDecimalvalue.voidsetBinaryStream(int parameterIndex, InputStream x) Sets the designated parameter in thisRowSetobject's command to the given input stream.voidsetBinaryStream(int parameterIndex, InputStream x, int length) Sets the designated parameter in thisRowSetobject's command to the givenjava.io.InputStreamvalue.voidsetBinaryStream(String parameterName, InputStream x) Sets the designated parameter to the given input stream.voidsetBinaryStream(String parameterName, InputStream x, int length) Sets the designated parameter to the given input stream, which will have the specified number of bytes.voidsetBlob(int parameterIndex, InputStream inputStream) Sets the designated parameter to aInputStreamobject.voidsetBlob(int parameterIndex, InputStream inputStream, long length) Sets the designated parameter to aInputStreamobject.voidSets the designated parameter in thisRowSetobject's command with the givenBlobvalue.voidsetBlob(String parameterName, InputStream inputStream) Sets the designated parameter to aInputStreamobject.voidsetBlob(String parameterName, InputStream inputStream, long length) Sets the designated parameter to aInputStreamobject.voidSets the designated parameter to the givenjava.sql.Blobobject.voidsetBoolean(int parameterIndex, boolean x) Sets the designated parameter in thisRowSetobject's command to the given Javabooleanvalue.voidsetBoolean(String parameterName, boolean x) Sets the designated parameter to the given Javabooleanvalue.voidsetByte(int parameterIndex, byte x) Sets the designated parameter in thisRowSetobject's command to the given Javabytevalue.voidSets the designated parameter to the given Javabytevalue.voidsetBytes(int parameterIndex, byte[] x) Sets the designated parameter in thisRowSetobject's command to the given Java array ofbytevalues.voidSets the designated parameter to the given Java array of bytes.voidsetCharacterStream(int parameterIndex, Reader reader) Sets the designated parameter in thisRowSetobject's command to the givenReaderobject.voidsetCharacterStream(int parameterIndex, Reader reader, int length) Sets the designated parameter in thisRowSetobject's command to the givenjava.io.Readervalue.voidsetCharacterStream(String parameterName, Reader reader) Sets the designated parameter to the givenReaderobject.voidsetCharacterStream(String parameterName, Reader reader, int length) Sets the designated parameter to the givenReaderobject, which is the given number of characters long.voidSets the designated parameter to aReaderobject.voidSets the designated parameter to aReaderobject.voidSets the designated parameter in thisRowSetobject's command with the givenClobvalue.voidSets the designated parameter to aReaderobject.voidSets the designated parameter to aReaderobject.voidSets the designated parameter to the givenjava.sql.Clobobject.voidsetCommand(String cmd) Sets thisRowSetobject's command property to the given SQL query.voidsetConcurrency(int concurrency) Sets the concurrency of thisRowSetobject to the given concurrency level.voidsetDataSourceName(String name) Sets the data source name property for thisRowSetobject to the givenString.voidSets the designated parameter in thisRowSetobject's command to the givenjava.sql.Datevalue.voidSets the designated parameter in thisRowSetobject's command with the givenjava.sql.Datevalue.voidSets the designated parameter to the givenjava.sql.Datevalue using the default time zone of the virtual machine that is running the application.voidSets the designated parameter to the givenjava.sql.Datevalue, using the givenCalendarobject.voidsetDouble(int parameterIndex, double x) Sets the designated parameter in thisRowSetobject's command to the given Javadoublevalue.voidSets the designated parameter to the given Javadoublevalue.voidsetEscapeProcessing(boolean enable) Sets escape processing for thisRowSetobject on or off.voidsetFloat(int parameterIndex, float x) Sets the designated parameter in thisRowSetobject's command to the given Javafloatvalue.voidSets the designated parameter to the given Javafloatvalue.voidsetInt(int parameterIndex, int x) Sets the designated parameter in thisRowSetobject's command to the given Javaintvalue.voidSets the designated parameter to the given Javaintvalue.voidsetLong(int parameterIndex, long x) Sets the designated parameter in thisRowSetobject's command to the given Javalongvalue.voidSets the designated parameter to the given Javalongvalue.voidsetMaxFieldSize(int max) Sets the maximum number of bytes that can be returned for a column value to the given number of bytes.voidsetMaxRows(int max) Sets the maximum number of rows that thisRowSetobject can contain to the specified number.voidsetNCharacterStream(int parameterIndex, Reader value) Sets the designated parameter in thisRowSetobject's command to aReaderobject.voidsetNCharacterStream(int parameterIndex, Reader value, long length) Sets the designated parameter to aReaderobject.voidsetNCharacterStream(String parameterName, Reader value) Sets the designated parameter to aReaderobject.voidsetNCharacterStream(String parameterName, Reader value, long length) Sets the designated parameter to aReaderobject.voidSets the designated parameter to aReaderobject.voidSets the designated parameter to aReaderobject.voidSets the designated parameter to ajava.sql.NClobobject.voidSets the designated parameter to aReaderobject.voidSets the designated parameter to aReaderobject.voidSets the designated parameter to ajava.sql.NClobobject.voidsetNString(int parameterIndex, String value) Sets the designated parameter to the givenStringobject.voidsetNString(String parameterName, String value) Sets the designated parameter to the givenStringobject.voidsetNull(int parameterIndex, int sqlType) Sets the designated parameter in thisRowSetobject's SQL command to SQLNULL.voidSets the designated parameter in thisRowSetobject's SQL command to SQLNULL.voidSets the designated parameter to SQLNULL.voidSets the designated parameter to SQLNULL.voidSets the designated parameter in thisRowSetobject's command with a JavaObject.voidSets the designated parameter in thisRowSetobject's command with a JavaObject.voidSets the designated parameter in thisRowSetobject's command with the given JavaObject.voidSets the value of the designated parameter with the given object.voidSets the value of the designated parameter with the given object.voidSets the value of the designated parameter with the given object.voidsetPassword(String password) Sets the database password for thisRowSetobject to the givenString.voidsetQueryTimeout(int seconds) Sets the maximum time the driver will wait for a statement to execute to the given number of seconds.voidsetReadOnly(boolean value) Sets whether thisRowSetobject is read-only to the givenboolean.voidSets the designated parameter in thisRowSetobject's command with the givenRefvalue.voidSets the designated parameter to the givenjava.sql.RowIdobject.voidSets the designated parameter to the givenjava.sql.RowIdobject.voidsetShort(int parameterIndex, short x) Sets the designated parameter in thisRowSetobject's command to the given Javashortvalue.voidSets the designated parameter to the given Javashortvalue.voidSets the designated parameter to the givenjava.sql.SQLXMLobject.voidSets the designated parameter to the givenjava.sql.SQLXMLobject.voidSets the designated parameter in thisRowSetobject's command to the given JavaStringvalue.voidSets the designated parameter to the given JavaStringvalue.voidSets the designated parameter in thisRowSetobject's command to the givenjava.sql.Timevalue.voidSets the designated parameter in thisRowSetobject's command with the givenjava.sql.Timevalue.voidSets the designated parameter to the givenjava.sql.Timevalue.voidSets the designated parameter to the givenjava.sql.Timevalue, using the givenCalendarobject.voidsetTimestamp(int parameterIndex, Timestamp x) Sets the designated parameter in thisRowSetobject's command to the givenjava.sql.Timestampvalue.voidsetTimestamp(int parameterIndex, Timestamp x, Calendar cal) Sets the designated parameter in thisRowSetobject's command with the givenjava.sql.Timestampvalue.voidsetTimestamp(String parameterName, Timestamp x) Sets the designated parameter to the givenjava.sql.Timestampvalue.voidsetTimestamp(String parameterName, Timestamp x, Calendar cal) Sets the designated parameter to the givenjava.sql.Timestampvalue, using the givenCalendarobject.voidsetTransactionIsolation(int level) Sets the transaction isolation level for thisRowSetobject.voidsetType(int type) Sets the type of thisRowSetobject to the given type.voidsetTypeMap(Map<String, Class<?>> map) Installs the givenjava.util.Mapobject as the default type map for thisRowSetobject.voidSets the URL thisRowSetobject will use when it uses theDriverManagerto create a connection.voidSets the designated parameter to the givenjava.net.URLvalue.voidsetUsername(String name) Sets the username property for thisRowSetobject to the givenString.Methods declared in interface Wrapper
isWrapperFor, unwrapModifier and TypeMethodDescriptionbooleanisWrapperFor(Class<?> iface) Returns true if this either implements the interface argument or is directly or indirectly a wrapper for an object that does.<T> TReturns an object that implements the given interface to allow access to non-standard methods, or standard methods not exposed by the proxy.
-
Field Details
-
UPDATE_ROW_CONFLICT
static final int UPDATE_ROW_CONFLICTIndicates that a conflict occurred while theRowSetobject was attempting to update a row in the data source. The values in the data source row to be updated differ from theRowSetobject's original values for that row, which means that the row in the data source has been updated or deleted since the last synchronization.- See Also:
-
DELETE_ROW_CONFLICT
static final int DELETE_ROW_CONFLICTIndicates that a conflict occurred while theRowSetobject was attempting to delete a row in the data source. The values in the data source row to be updated differ from theRowSetobject's original values for that row, which means that the row in the data source has been updated or deleted since the last synchronization.- See Also:
-
INSERT_ROW_CONFLICT
static final int INSERT_ROW_CONFLICTIndicates that a conflict occurred while theRowSetobject was attempting to insert a row into the data source. This means that a row with the same primary key as the row to be inserted has been inserted into the data source since the last synchronization.- See Also:
-
NO_ROW_CONFLICT
static final int NO_ROW_CONFLICTIndicates that no conflict occurred while theRowSetobject was attempting to update, delete or insert a row in the data source. The values in theSyncResolverwill containnullvalues only as an indication that no information in pertinent to the conflict resolution in this row.- See Also:
-
-
Method Details
-
getStatus
int getStatus()Retrieves the conflict status of the current row of thisSyncResolver, which indicates the operation theRowSetobject was attempting when the conflict occurred.- Returns:
- one of the following constants:
SyncResolver.UPDATE_ROW_CONFLICT,SyncResolver.DELETE_ROW_CONFLICT,SyncResolver.INSERT_ROW_CONFLICT, orSyncResolver.NO_ROW_CONFLICT
-
getConflictValue
Retrieves the value in the designated column in the current row of thisSyncResolverobject, which is the value in the data source that caused a conflict.- Parameters:
index- anintdesignating the column in this row of thisSyncResolverobject from which to retrieve the value causing a conflict- Returns:
- the value of the designated column in the current row of this
SyncResolverobject - Throws:
SQLException- if a database access error occurs
-
getConflictValue
Retrieves the value in the designated column in the current row of thisSyncResolverobject, which is the value in the data source that caused a conflict.- Parameters:
columnName- aStringobject designating the column in this row of thisSyncResolverobject from which to retrieve the value causing a conflict- Returns:
- the value of the designated column in the current row of this
SyncResolverobject - Throws:
SQLException- if a database access error occurs
-
setResolvedValue
Sets obj as the value in column index in the current row of theRowSetobject that is being synchronized. obj is set as the value in the data source internally.- Parameters:
index- anintgiving the number of the column into which to set the value to be persistedobj- anObjectthat is the value to be set in theRowSetobject and persisted in the data source- Throws:
SQLException- if a database access error occurs
-
setResolvedValue
Sets obj as the value in column columnName in the current row of theRowSetobject that is being synchronized. obj is set as the value in the data source internally.- Parameters:
columnName- aStringobject giving the name of the column into which to set the value to be persistedobj- anObjectthat is the value to be set in theRowSetobject and persisted in the data source- Throws:
SQLException- if a database access error occurs
-
nextConflict
Moves the cursor down from its current position to the next row that contains a conflict value. ASyncResolverobject's cursor is initially positioned before the first conflict row; the first call to the methodnextConflictmakes the first conflict row the current row; the second call makes the second conflict row the current row, and so on.A call to the method
nextConflictwill implicitly close an input stream if one is open and will clear theSyncResolverobject's warning chain.- Returns:
trueif the new current row is valid;falseif there are no more rows- Throws:
SQLException- if a database access error occurs or the result set type isTYPE_FORWARD_ONLY
-
previousConflict
Moves the cursor up from its current position to the previous conflict row in thisSyncResolverobject.A call to the method
previousConflictwill implicitly close an input stream if one is open and will clear theSyncResolverobject's warning chain.- Returns:
trueif the cursor is on a valid row;falseif it is off the result set- Throws:
SQLException- if a database access error occurs or the result set type isTYPE_FORWARD_ONLY
-
getBigDecimal(int columnIndex)orgetBigDecimal(String columnLabel)