Class Holdability

java.lang.Object
org.postgresql.pljava.example.annotation.Holdability
All Implemented Interfaces:
ResultSetHandle

@SQLAction(requires={"Holdability.stash","Holdability.unstash"}, install={"SELECT javatest.stashResultSet()","SELECT CASE WHEN 1000 < count(*) THEN javatest.logmessage(\'INFO\', \'Holdability OK\') ELSE javatest.logmessage(\'WARNING\', \'Holdability suspicious\') END FROM javatest.unstashResultSet()"}) public class Holdability extends Object implements ResultSetHandle
Demonstrate holdability of ResultSets (test for issue 168).

The stashResultSet method will execute a query and save its ResultSet (wrapped in a ResultSetHandle in a static for later retrieval. The unstashResultSet method, called later in the same transaction, retrieves and returns the result set. A call after the transaction has ended will fail.

The query selects all rows from pg_description, a table that should always exist, with more rows than the default connection fetchSize, to ensure the stashed ResultSet has work to do.