1
package org.postgresql.jdbc1;
3
import java.sql.SQLException;
4
import org.postgresql.core.QueryExecutor;
5
import org.postgresql.core.BaseStatement;
6
import org.postgresql.PGRefCursorResultSet;
8
/** A real result set based on a ref cursor.
10
* @author Nic Ferrier <nferrier@tapsellferrier.co.uk>
12
public class Jdbc1RefCursorResultSet extends Jdbc1ResultSet
13
implements PGRefCursorResultSet
16
// The name of the cursor being used.
17
String refCursorHandle;
19
// Indicates when the result set has activaly bound to the cursor.
20
boolean isInitialized = false;
23
Jdbc1RefCursorResultSet(BaseStatement statement, String refCursorName)
25
super(statement, null, null, null, -1, 0L);
26
this.refCursorHandle = refCursorName;
29
public String getRefCursor ()
31
return refCursorHandle;
34
public boolean next () throws SQLException
38
// Initialize this res set with the rows from the cursor.
39
String[] toExec = { "FETCH ALL IN \"" + refCursorHandle + "\";" };
40
QueryExecutor.execute(toExec, new String[0], this);