mirror of
https://github.com/postgres/postgres.git
synced 2025-07-02 09:02:37 +03:00
Patch from Nic Ferrier to add support for result sets being cursor based
so that rows can be fetched incrementally. This is enabled by using setFetchSize()
This commit is contained in:
@ -6,7 +6,7 @@ import java.net.ConnectException;
|
||||
import java.sql.*;
|
||||
import org.postgresql.util.PSQLException;
|
||||
|
||||
/* $Header: /cvsroot/pgsql/src/interfaces/jdbc/org/postgresql/jdbc2/Attic/AbstractJdbc2Connection.java,v 1.2 2002/09/06 21:23:06 momjian Exp $
|
||||
/* $Header: /cvsroot/pgsql/src/interfaces/jdbc/org/postgresql/jdbc2/Attic/AbstractJdbc2Connection.java,v 1.3 2003/02/04 09:20:10 barry Exp $
|
||||
* This class defines methods of the jdbc2 specification. This class extends
|
||||
* org.postgresql.jdbc1.AbstractJdbc1Connection which provides the jdbc1
|
||||
* methods. The real Connection class (for jdbc2) is org.postgresql.jdbc2.Jdbc2Connection
|
||||
@ -17,7 +17,7 @@ public abstract class AbstractJdbc2Connection extends org.postgresql.jdbc1.Abstr
|
||||
* The current type mappings
|
||||
*/
|
||||
protected java.util.Map typemap;
|
||||
|
||||
|
||||
public java.sql.Statement createStatement() throws SQLException
|
||||
{
|
||||
// The spec says default of TYPE_FORWARD_ONLY but everyone is used to
|
||||
|
@ -15,7 +15,7 @@ import org.postgresql.util.PGbytea;
|
||||
import org.postgresql.util.PSQLException;
|
||||
|
||||
|
||||
/* $Header: /cvsroot/pgsql/src/interfaces/jdbc/org/postgresql/jdbc2/Attic/AbstractJdbc2ResultSet.java,v 1.12 2003/01/23 18:49:22 davec Exp $
|
||||
/* $Header: /cvsroot/pgsql/src/interfaces/jdbc/org/postgresql/jdbc2/Attic/AbstractJdbc2ResultSet.java,v 1.13 2003/02/04 09:20:10 barry Exp $
|
||||
* This class defines methods of the jdbc2 specification. This class extends
|
||||
* org.postgresql.jdbc1.AbstractJdbc1ResultSet which provides the jdbc1
|
||||
* methods. The real Statement class (for jdbc2) is org.postgresql.jdbc2.Jdbc2ResultSet
|
||||
@ -38,11 +38,10 @@ public abstract class AbstractJdbc2ResultSet extends org.postgresql.jdbc1.Abstra
|
||||
protected PreparedStatement deleteStatement = null;
|
||||
private PreparedStatement selectStatement = null;
|
||||
|
||||
|
||||
|
||||
public AbstractJdbc2ResultSet(org.postgresql.PGConnection conn, Statement statement, Field[] fields, Vector tuples, String status, int updateCount, long insertOID, boolean binaryCursor)
|
||||
|
||||
public AbstractJdbc2ResultSet(Statement statement, Field[] fields, Vector tuples, String status, int updateCount, long insertOID, boolean binaryCursor)
|
||||
{
|
||||
super (conn, statement, fields, tuples, status, updateCount, insertOID, binaryCursor);
|
||||
super (statement, fields, tuples, status, updateCount, insertOID, binaryCursor);
|
||||
}
|
||||
|
||||
public java.net.URL getURL(int columnIndex) throws SQLException
|
||||
@ -366,9 +365,7 @@ public abstract class AbstractJdbc2ResultSet extends org.postgresql.jdbc1.Abstra
|
||||
|
||||
public int getFetchSize() throws SQLException
|
||||
{
|
||||
// In this implementation we return the entire result set, so
|
||||
// here return the number of rows we have. Sub-classes can return a proper
|
||||
// value
|
||||
// Returning the current batch size seems the right thing to do.
|
||||
return rows.size();
|
||||
}
|
||||
|
||||
@ -754,7 +751,6 @@ public abstract class AbstractJdbc2ResultSet extends org.postgresql.jdbc1.Abstra
|
||||
}
|
||||
|
||||
updateValue(columnIndex, theData);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -787,7 +783,6 @@ public abstract class AbstractJdbc2ResultSet extends org.postgresql.jdbc1.Abstra
|
||||
throw new PSQLException("postgresql.updateable.ioerror" + ie);
|
||||
}
|
||||
updateValue(columnIndex, theData);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
@ -8,7 +8,7 @@ import java.util.Vector;
|
||||
import org.postgresql.largeobject.*;
|
||||
import org.postgresql.util.PSQLException;
|
||||
|
||||
/* $Header: /cvsroot/pgsql/src/interfaces/jdbc/org/postgresql/jdbc2/Attic/AbstractJdbc2Statement.java,v 1.10 2002/11/20 20:37:53 barry Exp $
|
||||
/* $Header: /cvsroot/pgsql/src/interfaces/jdbc/org/postgresql/jdbc2/Attic/AbstractJdbc2Statement.java,v 1.11 2003/02/04 09:20:10 barry Exp $
|
||||
* This class defines methods of the jdbc2 specification. This class extends
|
||||
* org.postgresql.jdbc1.AbstractJdbc1Statement which provides the jdbc1
|
||||
* methods. The real Statement class (for jdbc2) is org.postgresql.jdbc2.Jdbc2Statement
|
||||
@ -133,7 +133,7 @@ public abstract class AbstractJdbc2Statement extends org.postgresql.jdbc1.Abstra
|
||||
|
||||
public int getFetchSize() throws SQLException
|
||||
{
|
||||
return 0;
|
||||
return super.fetchSize;
|
||||
}
|
||||
|
||||
public int getResultSetConcurrency() throws SQLException
|
||||
@ -148,12 +148,14 @@ public abstract class AbstractJdbc2Statement extends org.postgresql.jdbc1.Abstra
|
||||
|
||||
public void setFetchDirection(int direction) throws SQLException
|
||||
{
|
||||
throw org.postgresql.Driver.notImplemented();
|
||||
// I don't think this should happen, since it's a hint it should just
|
||||
// fail quietly.
|
||||
// throw org.postgresql.Driver.notImplemented();
|
||||
}
|
||||
|
||||
public void setFetchSize(int rows) throws SQLException
|
||||
{
|
||||
throw org.postgresql.Driver.notImplemented();
|
||||
super.fetchSize = rows;
|
||||
}
|
||||
|
||||
public void setResultSetConcurrency(int value) throws SQLException
|
||||
|
@ -343,7 +343,8 @@ public class Array implements java.sql.Array
|
||||
default:
|
||||
throw org.postgresql.Driver.notImplemented();
|
||||
}
|
||||
return ((AbstractJdbc2Connection)conn).getResultSet(null, fields, rows, "OK", 1 );
|
||||
java.sql.Statement stat = ((AbstractJdbc2Connection)conn).createStatement();
|
||||
return ((AbstractJdbc2Statement)stat).createResultSet(fields, rows, "OK", 1, 0, false);
|
||||
}
|
||||
|
||||
public String toString()
|
||||
|
@ -11,5 +11,9 @@ public class Jdbc2CallableStatement extends org.postgresql.jdbc2.AbstractJdbc2St
|
||||
super(connection, sql);
|
||||
}
|
||||
|
||||
public java.sql.ResultSet createResultSet (org.postgresql.Field[] fields, java.util.Vector tuples, String status, int updateCount, long insertOID, boolean binaryCursor) throws SQLException
|
||||
{
|
||||
return new Jdbc2ResultSet(this, fields, tuples, status, updateCount, insertOID, binaryCursor);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -6,7 +6,7 @@ import java.util.Vector;
|
||||
import java.util.Hashtable;
|
||||
import org.postgresql.Field;
|
||||
|
||||
/* $Header: /cvsroot/pgsql/src/interfaces/jdbc/org/postgresql/jdbc2/Attic/Jdbc2Connection.java,v 1.5 2002/09/06 21:23:06 momjian Exp $
|
||||
/* $Header: /cvsroot/pgsql/src/interfaces/jdbc/org/postgresql/jdbc2/Attic/Jdbc2Connection.java,v 1.6 2003/02/04 09:20:10 barry Exp $
|
||||
* This class implements the java.sql.Connection interface for JDBC2.
|
||||
* However most of the implementation is really done in
|
||||
* org.postgresql.jdbc2.AbstractJdbc2Connection or one of it's parents
|
||||
@ -46,17 +46,6 @@ public class Jdbc2Connection extends org.postgresql.jdbc2.AbstractJdbc2Connectio
|
||||
return metadata;
|
||||
}
|
||||
|
||||
public java.sql.ResultSet getResultSet(Statement statement, Field[] fields, Vector tuples, String status, int updateCount, long insertOID, boolean binaryCursor) throws SQLException
|
||||
{
|
||||
return new Jdbc2ResultSet(this, statement, fields, tuples, status, updateCount, insertOID, binaryCursor);
|
||||
}
|
||||
|
||||
public java.sql.ResultSet getResultSet(Statement statement, Field[] fields, Vector tuples, String status, int updateCount) throws SQLException
|
||||
{
|
||||
return new Jdbc2ResultSet(this, statement, fields, tuples, status, updateCount, 0, false);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
@ -11,5 +11,9 @@ public class Jdbc2PreparedStatement extends org.postgresql.jdbc2.AbstractJdbc2St
|
||||
super(connection, sql);
|
||||
}
|
||||
|
||||
public java.sql.ResultSet createResultSet (org.postgresql.Field[] fields, java.util.Vector tuples, String status, int updateCount, long insertOID, boolean binaryCursor) throws SQLException
|
||||
{
|
||||
return new Jdbc2ResultSet(this, fields, tuples, status, updateCount, insertOID, binaryCursor);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -5,7 +5,7 @@ import java.sql.*;
|
||||
import java.util.Vector;
|
||||
import org.postgresql.Field;
|
||||
|
||||
/* $Header: /cvsroot/pgsql/src/interfaces/jdbc/org/postgresql/jdbc2/Attic/Jdbc2ResultSet.java,v 1.6 2002/09/11 05:38:45 barry Exp $
|
||||
/* $Header: /cvsroot/pgsql/src/interfaces/jdbc/org/postgresql/jdbc2/Attic/Jdbc2ResultSet.java,v 1.7 2003/02/04 09:20:10 barry Exp $
|
||||
* This class implements the java.sql.ResultSet interface for JDBC2.
|
||||
* However most of the implementation is really done in
|
||||
* org.postgresql.jdbc2.AbstractJdbc2ResultSet or one of it's parents
|
||||
@ -13,9 +13,9 @@ import org.postgresql.Field;
|
||||
public class Jdbc2ResultSet extends org.postgresql.jdbc2.AbstractJdbc2ResultSet implements java.sql.ResultSet
|
||||
{
|
||||
|
||||
public Jdbc2ResultSet(Jdbc2Connection conn, Statement statement, Field[] fields, Vector tuples, String status, int updateCount, long insertOID, boolean binaryCursor)
|
||||
public Jdbc2ResultSet(Statement statement, Field[] fields, Vector tuples, String status, int updateCount, long insertOID, boolean binaryCursor)
|
||||
{
|
||||
super(conn, statement, fields, tuples, status, updateCount, insertOID, binaryCursor);
|
||||
super(statement, fields, tuples, status, updateCount, insertOID, binaryCursor);
|
||||
}
|
||||
|
||||
public java.sql.ResultSetMetaData getMetaData() throws SQLException
|
||||
|
@ -3,7 +3,7 @@ package org.postgresql.jdbc2;
|
||||
|
||||
import java.sql.*;
|
||||
|
||||
/* $Header: /cvsroot/pgsql/src/interfaces/jdbc/org/postgresql/jdbc2/Attic/Jdbc2Statement.java,v 1.3 2002/09/06 21:23:06 momjian Exp $
|
||||
/* $Header: /cvsroot/pgsql/src/interfaces/jdbc/org/postgresql/jdbc2/Attic/Jdbc2Statement.java,v 1.4 2003/02/04 09:20:10 barry Exp $
|
||||
* This class implements the java.sql.Statement interface for JDBC2.
|
||||
* However most of the implementation is really done in
|
||||
* org.postgresql.jdbc2.AbstractJdbc2Statement or one of it's parents
|
||||
@ -16,4 +16,8 @@ public class Jdbc2Statement extends org.postgresql.jdbc2.AbstractJdbc2Statement
|
||||
super(c);
|
||||
}
|
||||
|
||||
public java.sql.ResultSet createResultSet (org.postgresql.Field[] fields, java.util.Vector tuples, String status, int updateCount, long insertOID, boolean binaryCursor) throws SQLException
|
||||
{
|
||||
return new Jdbc2ResultSet(this, fields, tuples, status, updateCount, insertOID, binaryCursor);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user