- java.lang.Object
-
- org.postgresql.pljava.jdbc.AbstractResultSet
-
- org.postgresql.pljava.jdbc.ObjectResultSet
-
- org.postgresql.pljava.jdbc.SingleRowResultSet
-
- org.postgresql.pljava.jdbc.SingleRowWriter
-
- All Implemented Interfaces:
AutoCloseable
,ResultSet
,Wrapper
public class SingleRowWriter extends SingleRowResultSet
A single row, updateable ResultSet, specially made for functions and procedures that returns complex types or sets.A
TupleDesc
must be passed to the constructor. After values have been written, the native pointer to a formedTuple
can be retrieved usinggetTupleAndClear()
.- 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 SingleRowWriter(TupleDesc tupleDesc)
Construct aSingleRowWriter
given a descriptor of the tuple structure it should produce.
-
Method Summary
Modifier and Type Method Description void
cancelRowUpdates()
void
close()
Cancels all changes but doesn't really close the set.void
copyRowFrom(ResultSet rs)
protected Object
getObjectValue(int columnIndex, Class<?> type)
Returns the value most recently written in the current tuple at the specified index, ornull
if none has been written.long
getTupleAndClear()
Creates a tuple from the current row values and then cancel all row updates to prepare for a new row.protected TupleDesc
getTupleDesc()
boolean
isClosed()
boolean
rowUpdated()
Returnstrue
if the row contains any nonnull
values since all values of the row arenull
initially.void
updateObject(int columnIndex, Object x)
-
Methods inherited from class org.postgresql.pljava.jdbc.SingleRowResultSet
absolute, afterLast, beforeFirst, deleteRow, findColumn, first, getConcurrency, 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
-
SingleRowWriter
public SingleRowWriter(TupleDesc tupleDesc) throws SQLException
Construct aSingleRowWriter
given a descriptor of the tuple structure it should produce.- Throws:
SQLException
-
-
Method Detail
-
getObjectValue
protected Object getObjectValue(int columnIndex, Class<?> type) throws SQLException
Returns the value most recently written in the current tuple at the specified index, ornull
if none has been written.- Specified by:
getObjectValue
in classObjectResultSet
- Throws:
SQLException
-
rowUpdated
public boolean rowUpdated() throws SQLException
Returnstrue
if the row contains any nonnull
values since all values of the row arenull
initially.- Throws:
SQLException
-
updateObject
public void updateObject(int columnIndex, Object x) throws SQLException
- Throws:
SQLException
-
cancelRowUpdates
public void cancelRowUpdates() throws SQLException
- Throws:
SQLException
-
close
public void close() throws SQLException
Cancels all changes but doesn't really close the set.- Throws:
SQLException
-
copyRowFrom
public void copyRowFrom(ResultSet rs) throws SQLException
- Throws:
SQLException
-
getTupleAndClear
public long getTupleAndClear() throws SQLException
Creates a tuple from the current row values and then cancel all row updates to prepare for a new row. This method is called automatically by the trigger handler and should not be called in any other way.- Returns:
- The native pointer of the Tuple reflecting the current row values.
- Throws:
SQLException
-
getTupleDesc
protected final TupleDesc getTupleDesc()
- Specified by:
getTupleDesc
in classSingleRowResultSet
-
isClosed
public boolean isClosed() throws SQLException
- Throws:
SQLException
-
-