mirror of
https://github.com/postgres/postgres.git
synced 2025-07-28 23:42:10 +03:00
This patch fixes a bug introduced in the jdbc bytea support patch.
That patch broke the ability to read data from binary cursors. --Barry Lind Modified Files: pgsql/src/interfaces/jdbc/org/postgresql/Connection.java pgsql/src/interfaces/jdbc/org/postgresql/ResultSet.java pgsql/src/interfaces/jdbc/org/postgresql/core/QueryExecutor.java pgsql/src/interfaces/jdbc/org/postgresql/jdbc1/Connection.java pgsql/src/interfaces/jdbc/org/postgresql/jdbc1/ResultSet.java pgsql/src/interfaces/jdbc/org/postgresql/jdbc2/Connection.java pgsql/src/interfaces/jdbc/org/postgresql/jdbc2/ResultSet.java pgsql/src/interfaces/jdbc/org/postgresql/jdbc2/UpdateableResultSet.java
This commit is contained in:
@ -17,7 +17,7 @@ import org.postgresql.largeobject.*;
|
||||
import org.postgresql.util.*;
|
||||
|
||||
/**
|
||||
* $Id: Connection.java,v 1.10 2001/09/10 15:07:05 momjian Exp $
|
||||
* $Id: Connection.java,v 1.11 2001/10/09 20:47:35 barry Exp $
|
||||
*
|
||||
* A Connection represents a session with a specific database. Within the
|
||||
* context of a Connection, SQL statements are executed and results are
|
||||
@ -131,10 +131,10 @@ public class Connection extends org.postgresql.Connection implements java.sql.Co
|
||||
* This overides the method in org.postgresql.Connection and returns a
|
||||
* ResultSet.
|
||||
*/
|
||||
public java.sql.ResultSet getResultSet(org.postgresql.Connection conn,java.sql.Statement stat, Field[] fields, Vector tuples, String status, int updateCount,int insertOID) throws SQLException
|
||||
public java.sql.ResultSet getResultSet(org.postgresql.Connection conn,java.sql.Statement stat, Field[] fields, Vector tuples, String status, int updateCount,int insertOID, boolean binaryCursor) throws SQLException
|
||||
{
|
||||
// in jdbc1 stat is ignored.
|
||||
return new org.postgresql.jdbc1.ResultSet((org.postgresql.jdbc1.Connection)conn,fields,tuples,status,updateCount,insertOID);
|
||||
return new org.postgresql.jdbc1.ResultSet((org.postgresql.jdbc1.Connection)conn,fields,tuples,status,updateCount,insertOID,binaryCursor);
|
||||
}
|
||||
|
||||
|
||||
|
@ -70,9 +70,9 @@ public class ResultSet extends org.postgresql.ResultSet implements java.sql.Resu
|
||||
* @param updateCount the number of rows affected by the operation
|
||||
* @param cursor the positioned update/delete cursor name
|
||||
*/
|
||||
public ResultSet(Connection conn, Field[] fields, Vector tuples, String status, int updateCount,int insertOID)
|
||||
public ResultSet(Connection conn, Field[] fields, Vector tuples, String status, int updateCount, int insertOID, boolean binaryCursor)
|
||||
{
|
||||
super(conn,fields,tuples,status,updateCount,insertOID);
|
||||
super(conn,fields,tuples,status,updateCount,insertOID,binaryCursor);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -86,10 +86,10 @@ public class ResultSet extends org.postgresql.ResultSet implements java.sql.Resu
|
||||
* @param updateCount the number of rows affected by the operation
|
||||
* @param cursor the positioned update/delete cursor name
|
||||
*/
|
||||
public ResultSet(Connection conn, Field[] fields, Vector tuples, String status, int updateCount)
|
||||
{
|
||||
super(conn,fields,tuples,status,updateCount,0);
|
||||
}
|
||||
public ResultSet(Connection conn, Field[] fields, Vector tuples, String status, int updateCount)
|
||||
{
|
||||
super(conn,fields,tuples,status,updateCount,0,false);
|
||||
}
|
||||
|
||||
/**
|
||||
* A ResultSet is initially positioned before its first row,
|
||||
@ -375,6 +375,9 @@ public class ResultSet extends org.postgresql.ResultSet implements java.sql.Resu
|
||||
if (columnIndex < 1 || columnIndex > fields.length)
|
||||
throw new PSQLException("postgresql.res.colrange");
|
||||
|
||||
//If the data is already binary then just return it
|
||||
if (binaryCursor) return this_row[columnIndex - 1];
|
||||
|
||||
if (connection.haveMinimumCompatibleVersion("7.2")) {
|
||||
//Version 7.2 supports the bytea datatype for byte arrays
|
||||
return PGbytea.toBytes(getString(columnIndex));
|
||||
|
Reference in New Issue
Block a user