- java.lang.Object
-
- org.postgresql.pljava.jdbc.AbstractResultSet
-
- org.postgresql.pljava.jdbc.ObjectResultSet
-
- org.postgresql.pljava.jdbc.SingleRowResultSet
-
- org.postgresql.pljava.jdbc.TriggerResultSet
-
- All Implemented Interfaces:
AutoCloseable
,ResultSet
,Wrapper
public class TriggerResultSet extends SingleRowResultSet
A single row, updateable ResultSet specially made for triggers. The changes made to this ResultSet are remembered and converted to a SPI_modify_tuple call prior to function return.- Author:
- Thomas Hallgren
-
-
Field Summary
-
Fields inherited from interface java.sql.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_SENSITIVE
-
-
Constructor Summary
Constructors Constructor Description TriggerResultSet(TupleDesc tupleDesc, Tuple tuple, boolean readOnly)
-
Method Summary
Modifier and Type Method Description void
cancelRowUpdates()
Cancel all changes made to the Tuple.void
close()
Cancels all changes but doesn't really close the set.Object[]
getChangeIndexesAndValues()
Return a 3 element array describing the changes that have been made to the contained Tuple.int
getConcurrency()
Returns the concurrency for this ResultSet.protected Object
getObjectValue(int columnIndex, Class<?> type)
If the value has not been changed, forwards toTuple.getObject
, with the usual behavior for type coercion; if it has been changed, returns the exact object that was supplied with the change.protected TupleDesc
getTupleDesc()
boolean
isClosed()
boolean
rowUpdated()
Returnstrue
if this row has been updated.void
updateObject(int columnIndex, Object x)
Store this change for later use-
Methods inherited from class org.postgresql.pljava.jdbc.SingleRowResultSet
absolute, afterLast, beforeFirst, deleteRow, findColumn, first, getFetchDirection, getFetchSize, getHoldability, getMetaData, getRow, getType, insertRow, isAfterLast, isBeforeFirst, isFirst, isLast, last, moveToCurrentRow, moveToInsertRow, next, previous, relative, rowDeleted, rowInserted, setFetchDirection, setFetchSize, updateObject, updateRow
-
Methods inherited from class org.postgresql.pljava.jdbc.ObjectResultSet
clearWarnings, getArray, getAsciiStream, getBigDecimal, getBigDecimal, getBinaryStream, getBlob, getBoolean, getByte, getBytes, getCharacterStream, getClob, getDate, getDate, getDouble, getFloat, getInt, getLong, getNumber, getObject, getObject, getObject, getObjectValue, getObjectValue, getRef, getShort, getString, getTime, getTime, getTimestamp, getTimestamp, getUnicodeStream, getURL, getValue, getValue, getWarnings, refreshRow, updateArray, updateAsciiStream, updateBigDecimal, updateBinaryStream, updateBlob, updateBoolean, updateByte, updateBytes, updateCharacterStream, updateClob, updateDate, updateDouble, updateFloat, updateInt, updateLong, updateNull, updateRef, updateShort, updateString, updateTime, updateTimestamp, wasNull
-
Methods inherited from class org.postgresql.pljava.jdbc.AbstractResultSet
getArray, getAsciiStream, getBigDecimal, getBigDecimal, getBinaryStream, getBlob, getBoolean, getByte, getBytes, getCharacterStream, getClob, getCursorName, getDate, getDate, getDouble, getFloat, getInt, getLong, getNCharacterStream, getNCharacterStream, getNClob, getNClob, getNString, getNString, getObject, getObject, getObject, getRef, getRowId, getRowId, getShort, getSQLXML, getSQLXML, getStatement, getString, getTime, getTime, getTimestamp, getTimestamp, getUnicodeStream, getURL, isWrapperFor, unwrap, updateArray, updateAsciiStream, updateAsciiStream, updateAsciiStream, updateAsciiStream, updateAsciiStream, updateBigDecimal, updateBinaryStream, updateBinaryStream, updateBinaryStream, updateBinaryStream, updateBinaryStream, updateBlob, updateBlob, updateBlob, updateBlob, updateBlob, updateBoolean, updateByte, updateBytes, updateCharacterStream, updateCharacterStream, updateCharacterStream, updateCharacterStream, updateCharacterStream, updateClob, updateClob, updateClob, updateClob, updateClob, updateDate, updateDouble, updateFloat, updateInt, updateLong, updateNCharacterStream, updateNCharacterStream, updateNCharacterStream, updateNCharacterStream, updateNClob, updateNClob, updateNClob, updateNClob, updateNClob, updateNClob, updateNString, updateNString, updateNull, updateObject, updateObject, updateRef, updateRowId, updateRowId, updateShort, updateSQLXML, updateSQLXML, updateString, updateTime, updateTimestamp
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface java.sql.ResultSet
updateObject, updateObject, updateObject, updateObject
-
-
-
-
Constructor Detail
-
TriggerResultSet
public TriggerResultSet(TupleDesc tupleDesc, Tuple tuple, boolean readOnly) throws SQLException
- Throws:
SQLException
-
-
Method Detail
-
cancelRowUpdates
public void cancelRowUpdates() throws SQLException
Cancel all changes made to the Tuple.- Throws:
SQLException
-
close
public void close() throws SQLException
Cancels all changes but doesn't really close the set.- Throws:
SQLException
-
getConcurrency
public int getConcurrency() throws SQLException
Returns the concurrency for this ResultSet.- Specified by:
getConcurrency
in interfaceResultSet
- Overrides:
getConcurrency
in classSingleRowResultSet
- Throws:
SQLException
- See Also:
ResultSet.getConcurrency()
-
rowUpdated
public boolean rowUpdated() throws SQLException
Returnstrue
if this row has been updated.- Throws:
SQLException
-
updateObject
public void updateObject(int columnIndex, Object x) throws SQLException
Store this change for later use- Throws:
SQLException
-
getChangeIndexesAndValues
public Object[] getChangeIndexesAndValues()
Return a 3 element array describing the changes that have been made to the contained Tuple. The first element the original Tuple, the second anint[]
containing the index of each changed value, and the third anObject[]
containing the corresponding values.- Returns:
- The 3 element array or
null
if no change has been made.
-
getObjectValue
protected Object getObjectValue(int columnIndex, Class<?> type) throws SQLException
If the value has not been changed, forwards toTuple.getObject
, with the usual behavior for type coercion; if it has been changed, returns the exact object that was supplied with the change.When the caller is the JDBC 4.1
ObjectResultSet.getObject(int,Class)
, the caller will check and complain if the returned object is not of the right class.- Specified by:
getObjectValue
in classObjectResultSet
- Throws:
SQLException
-
getTupleDesc
protected final TupleDesc getTupleDesc()
- Specified by:
getTupleDesc
in classSingleRowResultSet
-
isClosed
public boolean isClosed() throws SQLException
- Throws:
SQLException
-
-