mirror of
https://github.com/postgres/postgres.git
synced 2025-07-18 17:42:25 +03:00
Fix for bug with the jdbc driver not properly working with binary cursors and
the V3 protocol. Modified Files: Tag: REL7_4_STABLE jdbc/org/postgresql/Driver.java.in jdbc/org/postgresql/core/BaseResultSet.java jdbc/org/postgresql/core/BaseStatement.java jdbc/org/postgresql/core/Field.java jdbc/org/postgresql/core/PGStream.java jdbc/org/postgresql/core/QueryExecutor.java jdbc/org/postgresql/jdbc1/AbstractJdbc1DatabaseMetaData.java jdbc/org/postgresql/jdbc1/AbstractJdbc1ResultSet.java jdbc/org/postgresql/jdbc1/AbstractJdbc1Statement.java jdbc/org/postgresql/jdbc1/Jdbc1CallableStatement.java jdbc/org/postgresql/jdbc1/Jdbc1PreparedStatement.java jdbc/org/postgresql/jdbc1/Jdbc1RefCursorResultSet.java jdbc/org/postgresql/jdbc1/Jdbc1ResultSet.java jdbc/org/postgresql/jdbc1/Jdbc1Statement.java jdbc/org/postgresql/jdbc2/AbstractJdbc2ResultSet.java jdbc/org/postgresql/jdbc2/Array.java jdbc/org/postgresql/jdbc2/Jdbc2CallableStatement.java jdbc/org/postgresql/jdbc2/Jdbc2PreparedStatement.java jdbc/org/postgresql/jdbc2/Jdbc2RefCursorResultSet.java jdbc/org/postgresql/jdbc2/Jdbc2ResultSet.java jdbc/org/postgresql/jdbc2/Jdbc2Statement.java jdbc/org/postgresql/jdbc3/AbstractJdbc3ResultSet.java jdbc/org/postgresql/jdbc3/Jdbc3CallableStatement.java jdbc/org/postgresql/jdbc3/Jdbc3PreparedStatement.java jdbc/org/postgresql/jdbc3/Jdbc3RefCursorResultSet.java jdbc/org/postgresql/jdbc3/Jdbc3ResultSet.java jdbc/org/postgresql/jdbc3/Jdbc3Statement.java jdbc/org/postgresql/test/jdbc2/Jdbc2TestSuite.java jdbc/org/postgresql/test/jdbc2/OID74Test.java Added Files: Tag: REL7_4_STABLE jdbc/org/postgresql/test/jdbc2/ServerCursorTest.java
This commit is contained in:
@ -6,7 +6,7 @@
|
|||||||
* Copyright (c) 2003, PostgreSQL Global Development Group
|
* Copyright (c) 2003, PostgreSQL Global Development Group
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* IDENTIFICATION
|
||||||
* $Header: /cvsroot/pgsql/src/interfaces/jdbc/org/postgresql/Attic/Driver.java.in,v 1.36.2.3 2004/03/04 03:25:10 jurka Exp $
|
* $Header: /cvsroot/pgsql/src/interfaces/jdbc/org/postgresql/Attic/Driver.java.in,v 1.36.2.4 2004/03/29 17:47:47 barry Exp $
|
||||||
*
|
*
|
||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
@ -494,6 +494,6 @@ public class Driver implements java.sql.Driver
|
|||||||
|
|
||||||
|
|
||||||
//The build number should be incremented for every new build
|
//The build number should be incremented for every new build
|
||||||
private static int m_buildNumber = 212;
|
private static int m_buildNumber = 213;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
* Copyright (c) 2003, PostgreSQL Global Development Group
|
* Copyright (c) 2003, PostgreSQL Global Development Group
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* IDENTIFICATION
|
||||||
* $Header: /cvsroot/pgsql/src/interfaces/jdbc/org/postgresql/core/Attic/BaseResultSet.java,v 1.2 2003/03/08 06:06:55 barry Exp $
|
* $Header: /cvsroot/pgsql/src/interfaces/jdbc/org/postgresql/core/Attic/BaseResultSet.java,v 1.2.4.1 2004/03/29 17:47:47 barry Exp $
|
||||||
*
|
*
|
||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
@ -44,7 +44,7 @@ public interface BaseResultSet
|
|||||||
public boolean next() throws SQLException;
|
public boolean next() throws SQLException;
|
||||||
public boolean reallyResultSet();
|
public boolean reallyResultSet();
|
||||||
public void reInit (Field[] fields, Vector tuples, String status,
|
public void reInit (Field[] fields, Vector tuples, String status,
|
||||||
int updateCount, long insertOID, boolean binaryCursor);
|
int updateCount, long insertOID);
|
||||||
public void setStatement(BaseStatement statement);
|
public void setStatement(BaseStatement statement);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
* Copyright (c) 2003, PostgreSQL Global Development Group
|
* Copyright (c) 2003, PostgreSQL Global Development Group
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* IDENTIFICATION
|
||||||
* $Header: /cvsroot/pgsql/src/interfaces/jdbc/org/postgresql/core/Attic/BaseStatement.java,v 1.6 2003/10/29 02:39:09 davec Exp $
|
* $Header: /cvsroot/pgsql/src/interfaces/jdbc/org/postgresql/core/Attic/BaseStatement.java,v 1.6.2.1 2004/03/29 17:47:47 barry Exp $
|
||||||
*
|
*
|
||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
@ -18,7 +18,7 @@ import java.util.Vector;
|
|||||||
|
|
||||||
public interface BaseStatement extends org.postgresql.PGStatement
|
public interface BaseStatement extends org.postgresql.PGStatement
|
||||||
{
|
{
|
||||||
public BaseResultSet createResultSet(Field[] fields, Vector tuples, String status, int updateCount, long insertOID, boolean binaryCursor) throws SQLException;
|
public BaseResultSet createResultSet(Field[] fields, Vector tuples, String status, int updateCount, long insertOID) throws SQLException;
|
||||||
public PGRefCursorResultSet createRefCursorResultSet(String cursorName) throws SQLException;
|
public PGRefCursorResultSet createRefCursorResultSet(String cursorName) throws SQLException;
|
||||||
|
|
||||||
public BaseConnection getPGConnection();
|
public BaseConnection getPGConnection();
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
* Copyright (c) 2003, PostgreSQL Global Development Group
|
* Copyright (c) 2003, PostgreSQL Global Development Group
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* IDENTIFICATION
|
||||||
* $Header: /cvsroot/pgsql/src/interfaces/jdbc/org/postgresql/core/Attic/Field.java,v 1.2 2003/05/29 03:21:32 barry Exp $
|
* $Header: /cvsroot/pgsql/src/interfaces/jdbc/org/postgresql/core/Attic/Field.java,v 1.2.4.1 2004/03/29 17:47:47 barry Exp $
|
||||||
*
|
*
|
||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
@ -19,10 +19,19 @@ import org.postgresql.core.BaseConnection;
|
|||||||
*/
|
*/
|
||||||
public class Field
|
public class Field
|
||||||
{
|
{
|
||||||
|
//Constants for the two V3 protocol data formats
|
||||||
|
public static final int TEXT_FORMAT = 0;
|
||||||
|
public static final int BINARY_FORMAT = 1;
|
||||||
|
|
||||||
private int length; // Internal Length of this field
|
private int length; // Internal Length of this field
|
||||||
private int oid; // OID of the type
|
private int oid; // OID of the type
|
||||||
private int mod; // type modifier of this field
|
private int mod; // type modifier of this field
|
||||||
private String name; // Name of this field
|
private String name; // Name of this field
|
||||||
|
private int format = TEXT_FORMAT; // In the V3 protocol each field has a format
|
||||||
|
// 0 = text, 1 = binary
|
||||||
|
// In the V2 protocol all fields in a
|
||||||
|
// binary cursor are binary and all
|
||||||
|
// others are text
|
||||||
|
|
||||||
private BaseConnection conn; // Connection Instantation
|
private BaseConnection conn; // Connection Instantation
|
||||||
|
|
||||||
@ -89,6 +98,22 @@ public class Field
|
|||||||
return length;
|
return length;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* @return the format of this Field's data (text=0, binary=1)
|
||||||
|
*/
|
||||||
|
public int getFormat()
|
||||||
|
{
|
||||||
|
return format;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* @param format the format of this Field's data (text=0, binary=1)
|
||||||
|
*/
|
||||||
|
public void setFormat(int format)
|
||||||
|
{
|
||||||
|
this.format = format;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* We also need to get the PG type name as returned by the back end.
|
* We also need to get the PG type name as returned by the back end.
|
||||||
*
|
*
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
* Copyright (c) 2003, PostgreSQL Global Development Group
|
* Copyright (c) 2003, PostgreSQL Global Development Group
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* IDENTIFICATION
|
||||||
* $Header: /cvsroot/pgsql/src/interfaces/jdbc/org/postgresql/core/Attic/PGStream.java,v 1.3 2003/09/08 17:30:22 barry Exp $
|
* $Header: /cvsroot/pgsql/src/interfaces/jdbc/org/postgresql/core/Attic/PGStream.java,v 1.3.2.1 2004/03/29 17:47:47 barry Exp $
|
||||||
*
|
*
|
||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
@ -288,12 +288,11 @@ public class PGStream
|
|||||||
* array of bytes
|
* array of bytes
|
||||||
*
|
*
|
||||||
* @param nf the number of fields expected
|
* @param nf the number of fields expected
|
||||||
* @param bin true if the tuple is a binary tuple
|
|
||||||
* @return null if the current response has no more tuples, otherwise
|
* @return null if the current response has no more tuples, otherwise
|
||||||
* an array of strings
|
* an array of strings
|
||||||
* @exception SQLException if a data I/O error occurs
|
* @exception SQLException if a data I/O error occurs
|
||||||
*/
|
*/
|
||||||
public byte[][] ReceiveTupleV3(int nf, boolean bin) throws SQLException
|
public byte[][] ReceiveTupleV3(int nf) throws SQLException
|
||||||
{
|
{
|
||||||
//TODO: use l_msgSize
|
//TODO: use l_msgSize
|
||||||
int l_msgSize = ReceiveIntegerR(4);
|
int l_msgSize = ReceiveIntegerR(4);
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
* Copyright (c) 2003, PostgreSQL Global Development Group
|
* Copyright (c) 2003, PostgreSQL Global Development Group
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* IDENTIFICATION
|
||||||
* $Header: /cvsroot/pgsql/src/interfaces/jdbc/org/postgresql/core/Attic/QueryExecutor.java,v 1.27.2.1 2004/02/03 05:43:22 jurka Exp $
|
* $Header: /cvsroot/pgsql/src/interfaces/jdbc/org/postgresql/core/Attic/QueryExecutor.java,v 1.27.2.2 2004/03/29 17:47:47 barry Exp $
|
||||||
*
|
*
|
||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
@ -82,7 +82,6 @@ public class QueryExecutor
|
|||||||
|
|
||||||
private Field[] fields = null;
|
private Field[] fields = null;
|
||||||
private Vector tuples = new Vector();
|
private Vector tuples = new Vector();
|
||||||
private boolean binaryCursor = false;
|
|
||||||
private String status = null;
|
private String status = null;
|
||||||
private int update_count = 1;
|
private int update_count = 1;
|
||||||
private long insert_oid = 0;
|
private long insert_oid = 0;
|
||||||
@ -135,14 +134,11 @@ public class QueryExecutor
|
|||||||
String param = pgStream.ReceiveString(connection.getEncoding());
|
String param = pgStream.ReceiveString(connection.getEncoding());
|
||||||
connection.addNotification(new org.postgresql.core.Notification(msg, pid));
|
connection.addNotification(new org.postgresql.core.Notification(msg, pid));
|
||||||
break;
|
break;
|
||||||
case 'B': // Binary Data Transfer
|
|
||||||
receiveTupleV3(true);
|
|
||||||
break;
|
|
||||||
case 'C': // Command Status
|
case 'C': // Command Status
|
||||||
receiveCommandStatusV3();
|
receiveCommandStatusV3();
|
||||||
break;
|
break;
|
||||||
case 'D': // Text Data Transfer
|
case 'D': // Data Transfer
|
||||||
receiveTupleV3(false);
|
receiveTupleV3();
|
||||||
break;
|
break;
|
||||||
case 'E': // Error Message
|
case 'E': // Error Message
|
||||||
|
|
||||||
@ -205,11 +201,11 @@ public class QueryExecutor
|
|||||||
//create a new one
|
//create a new one
|
||||||
if (rs != null)
|
if (rs != null)
|
||||||
{
|
{
|
||||||
rs.reInit(fields, tuples, status, update_count, insert_oid, binaryCursor);
|
rs.reInit(fields, tuples, status, update_count, insert_oid);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
rs = statement.createResultSet(fields, tuples, status, update_count, insert_oid, binaryCursor);
|
rs = statement.createResultSet(fields, tuples, status, update_count, insert_oid);
|
||||||
}
|
}
|
||||||
return rs;
|
return rs;
|
||||||
}
|
}
|
||||||
@ -295,11 +291,11 @@ public class QueryExecutor
|
|||||||
//create a new one
|
//create a new one
|
||||||
if (rs != null)
|
if (rs != null)
|
||||||
{
|
{
|
||||||
rs.reInit(fields, tuples, status, update_count, insert_oid, binaryCursor);
|
rs.reInit(fields, tuples, status, update_count, insert_oid);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
rs = statement.createResultSet(fields, tuples, status, update_count, insert_oid, binaryCursor);
|
rs = statement.createResultSet(fields, tuples, status, update_count, insert_oid);
|
||||||
}
|
}
|
||||||
return rs;
|
return rs;
|
||||||
}
|
}
|
||||||
@ -378,16 +374,12 @@ public class QueryExecutor
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* Receive a tuple from the backend.
|
* Receive a tuple from the backend.
|
||||||
*
|
|
||||||
* @param isBinary set if the tuple should be treated as binary data
|
|
||||||
*/
|
*/
|
||||||
private void receiveTupleV3(boolean isBinary) throws SQLException
|
private void receiveTupleV3() throws SQLException
|
||||||
{
|
{
|
||||||
if (fields == null)
|
if (fields == null)
|
||||||
throw new PSQLException("postgresql.con.tuple", PSQLState.CONNECTION_FAILURE);
|
throw new PSQLException("postgresql.con.tuple", PSQLState.CONNECTION_FAILURE);
|
||||||
Object tuple = pgStream.ReceiveTupleV3(fields.length, isBinary);
|
Object tuple = pgStream.ReceiveTupleV3(fields.length);
|
||||||
if (isBinary)
|
|
||||||
binaryCursor = true;
|
|
||||||
if (maxRows == 0 || tuples.size() < maxRows)
|
if (maxRows == 0 || tuples.size() < maxRows)
|
||||||
tuples.addElement(tuple);
|
tuples.addElement(tuple);
|
||||||
}
|
}
|
||||||
@ -402,8 +394,11 @@ public class QueryExecutor
|
|||||||
if (fields == null)
|
if (fields == null)
|
||||||
throw new PSQLException("postgresql.con.tuple", PSQLState.CONNECTION_FAILURE);
|
throw new PSQLException("postgresql.con.tuple", PSQLState.CONNECTION_FAILURE);
|
||||||
Object tuple = pgStream.ReceiveTupleV2(fields.length, isBinary);
|
Object tuple = pgStream.ReceiveTupleV2(fields.length, isBinary);
|
||||||
if (isBinary)
|
if (isBinary) {
|
||||||
binaryCursor = true;
|
for (int i = 0; i < fields.length; i++) {
|
||||||
|
fields[i].setFormat(Field.BINARY_FORMAT); //Set the field to binary format
|
||||||
|
}
|
||||||
|
}
|
||||||
if (maxRows == 0 || tuples.size() < maxRows)
|
if (maxRows == 0 || tuples.size() < maxRows)
|
||||||
tuples.addElement(tuple);
|
tuples.addElement(tuple);
|
||||||
}
|
}
|
||||||
@ -488,6 +483,7 @@ public class QueryExecutor
|
|||||||
int formatType = pgStream.ReceiveIntegerR(2);
|
int formatType = pgStream.ReceiveIntegerR(2);
|
||||||
//TODO: use the extra values coming back
|
//TODO: use the extra values coming back
|
||||||
fields[i] = new Field(connection, typeName, typeOid, typeLength, typeModifier);
|
fields[i] = new Field(connection, typeName, typeOid, typeLength, typeModifier);
|
||||||
|
fields[i].setFormat(formatType);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
|
@ -1926,7 +1926,7 @@ public abstract class AbstractJdbc1DatabaseMetaData
|
|||||||
}
|
}
|
||||||
rs.close();
|
rs.close();
|
||||||
|
|
||||||
return (ResultSet) ((BaseStatement)connection.createStatement()).createResultSet(f, v, "OK", 1, 0, false);
|
return (ResultSet) ((BaseStatement)connection.createStatement()).createResultSet(f, v, "OK", 1, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -2218,7 +2218,7 @@ public abstract class AbstractJdbc1DatabaseMetaData
|
|||||||
v.addElement(tuple);
|
v.addElement(tuple);
|
||||||
}
|
}
|
||||||
|
|
||||||
return (ResultSet) ((BaseStatement)connection.createStatement()).createResultSet(f, v, "OK", 1, 0, false);
|
return (ResultSet) ((BaseStatement)connection.createStatement()).createResultSet(f, v, "OK", 1, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -2392,7 +2392,7 @@ public abstract class AbstractJdbc1DatabaseMetaData
|
|||||||
}
|
}
|
||||||
rs.close();
|
rs.close();
|
||||||
|
|
||||||
return (ResultSet) ((BaseStatement)connection.createStatement()).createResultSet(f, v, "OK", 1, 0, false);
|
return (ResultSet) ((BaseStatement)connection.createStatement()).createResultSet(f, v, "OK", 1, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -2505,7 +2505,7 @@ public abstract class AbstractJdbc1DatabaseMetaData
|
|||||||
}
|
}
|
||||||
rs.close();
|
rs.close();
|
||||||
|
|
||||||
return (ResultSet) ((BaseStatement)connection.createStatement()).createResultSet(f, v, "OK", 1, 0, false);
|
return (ResultSet) ((BaseStatement)connection.createStatement()).createResultSet(f, v, "OK", 1, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -2607,7 +2607,7 @@ public abstract class AbstractJdbc1DatabaseMetaData
|
|||||||
}
|
}
|
||||||
rs.close();
|
rs.close();
|
||||||
|
|
||||||
return (ResultSet) ((BaseStatement)connection.createStatement()).createResultSet(f, v, "OK", 1, 0, false);
|
return (ResultSet) ((BaseStatement)connection.createStatement()).createResultSet(f, v, "OK", 1, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void sortStringArray(String s[]) {
|
private static void sortStringArray(String s[]) {
|
||||||
@ -2805,7 +2805,7 @@ public abstract class AbstractJdbc1DatabaseMetaData
|
|||||||
v.addElement(tuple);
|
v.addElement(tuple);
|
||||||
}
|
}
|
||||||
|
|
||||||
return (ResultSet) ((BaseStatement)connection.createStatement()).createResultSet(f, v, "OK", 1, 0, false);
|
return (ResultSet) ((BaseStatement)connection.createStatement()).createResultSet(f, v, "OK", 1, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -2875,7 +2875,7 @@ public abstract class AbstractJdbc1DatabaseMetaData
|
|||||||
/* Perhaps we should check that the given
|
/* Perhaps we should check that the given
|
||||||
* catalog.schema.table actually exists. -KJ
|
* catalog.schema.table actually exists. -KJ
|
||||||
*/
|
*/
|
||||||
return (ResultSet) ((BaseStatement)connection.createStatement()).createResultSet(f, v, "OK", 1, 0, false);
|
return (ResultSet) ((BaseStatement)connection.createStatement()).createResultSet(f, v, "OK", 1, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -3247,7 +3247,7 @@ public abstract class AbstractJdbc1DatabaseMetaData
|
|||||||
tuples.addElement(tuple);
|
tuples.addElement(tuple);
|
||||||
}
|
}
|
||||||
|
|
||||||
return (ResultSet) ((BaseStatement)connection.createStatement()).createResultSet(f, tuples, "OK", 1, 0, false);
|
return (ResultSet) ((BaseStatement)connection.createStatement()).createResultSet(f, tuples, "OK", 1, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -3532,7 +3532,7 @@ public abstract class AbstractJdbc1DatabaseMetaData
|
|||||||
}
|
}
|
||||||
rs.close();
|
rs.close();
|
||||||
|
|
||||||
return (ResultSet) ((BaseStatement)connection.createStatement()).createResultSet(f, v, "OK", 1, 0, false);
|
return (ResultSet) ((BaseStatement)connection.createStatement()).createResultSet(f, v, "OK", 1, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -9,7 +9,7 @@
|
|||||||
* Copyright (c) 2003, PostgreSQL Global Development Group
|
* Copyright (c) 2003, PostgreSQL Global Development Group
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* IDENTIFICATION
|
||||||
* $Header: /cvsroot/pgsql/src/interfaces/jdbc/org/postgresql/jdbc1/Attic/AbstractJdbc1ResultSet.java,v 1.22.2.2 2004/02/03 05:25:36 jurka Exp $
|
* $Header: /cvsroot/pgsql/src/interfaces/jdbc/org/postgresql/jdbc1/Attic/AbstractJdbc1ResultSet.java,v 1.22.2.3 2004/03/29 17:47:47 barry Exp $
|
||||||
*
|
*
|
||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
@ -41,7 +41,6 @@ public abstract class AbstractJdbc1ResultSet implements BaseResultSet
|
|||||||
protected BaseStatement statement;
|
protected BaseStatement statement;
|
||||||
protected Field fields[]; // The field descriptions
|
protected Field fields[]; // The field descriptions
|
||||||
protected String status; // Status of the result
|
protected String status; // Status of the result
|
||||||
protected boolean binaryCursor = false; // is the data binary or Strings
|
|
||||||
protected int updateCount; // How many rows did we get back?
|
protected int updateCount; // How many rows did we get back?
|
||||||
protected long insertOID; // The oid of an inserted row
|
protected long insertOID; // The oid of an inserted row
|
||||||
protected int current_row; // Our pointer to where we are at
|
protected int current_row; // Our pointer to where we are at
|
||||||
@ -71,8 +70,7 @@ public abstract class AbstractJdbc1ResultSet implements BaseResultSet
|
|||||||
Vector tuples,
|
Vector tuples,
|
||||||
String status,
|
String status,
|
||||||
int updateCount,
|
int updateCount,
|
||||||
long insertOID,
|
long insertOID)
|
||||||
boolean binaryCursor)
|
|
||||||
{
|
{
|
||||||
this.connection = statement.getPGConnection();
|
this.connection = statement.getPGConnection();
|
||||||
this.statement = statement;
|
this.statement = statement;
|
||||||
@ -84,7 +82,6 @@ public abstract class AbstractJdbc1ResultSet implements BaseResultSet
|
|||||||
this.insertOID = insertOID;
|
this.insertOID = insertOID;
|
||||||
this.this_row = null;
|
this.this_row = null;
|
||||||
this.current_row = -1;
|
this.current_row = -1;
|
||||||
this.binaryCursor = binaryCursor;
|
|
||||||
|
|
||||||
this.lastFetchSize = this.fetchSize = (statement == null ? 0 : statement.getFetchSize());
|
this.lastFetchSize = this.fetchSize = (statement == null ? 0 : statement.getFetchSize());
|
||||||
}
|
}
|
||||||
@ -103,7 +100,7 @@ public abstract class AbstractJdbc1ResultSet implements BaseResultSet
|
|||||||
|
|
||||||
//method to reinitialize a result set with more data
|
//method to reinitialize a result set with more data
|
||||||
public void reInit (Field[] fields, Vector tuples, String status,
|
public void reInit (Field[] fields, Vector tuples, String status,
|
||||||
int updateCount, long insertOID, boolean binaryCursor)
|
int updateCount, long insertOID)
|
||||||
{
|
{
|
||||||
this.fields = fields;
|
this.fields = fields;
|
||||||
// on a reinit the size of this indicates how many we pulled
|
// on a reinit the size of this indicates how many we pulled
|
||||||
@ -114,7 +111,6 @@ public abstract class AbstractJdbc1ResultSet implements BaseResultSet
|
|||||||
this.insertOID = insertOID;
|
this.insertOID = insertOID;
|
||||||
this.this_row = null;
|
this.this_row = null;
|
||||||
this.current_row = -1;
|
this.current_row = -1;
|
||||||
this.binaryCursor = binaryCursor;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
@ -327,7 +323,7 @@ public abstract class AbstractJdbc1ResultSet implements BaseResultSet
|
|||||||
wasNullFlag = (this_row[columnIndex - 1] == null);
|
wasNullFlag = (this_row[columnIndex - 1] == null);
|
||||||
if (!wasNullFlag)
|
if (!wasNullFlag)
|
||||||
{
|
{
|
||||||
if (binaryCursor)
|
if (fields[columnIndex -1].getFormat() == Field.BINARY_FORMAT)
|
||||||
{
|
{
|
||||||
//If the data is already binary then just return it
|
//If the data is already binary then just return it
|
||||||
return this_row[columnIndex - 1];
|
return this_row[columnIndex - 1];
|
||||||
|
@ -26,7 +26,7 @@ import java.sql.Timestamp;
|
|||||||
import java.sql.Types;
|
import java.sql.Types;
|
||||||
import java.util.Vector;
|
import java.util.Vector;
|
||||||
|
|
||||||
/* $Header: /cvsroot/pgsql/src/interfaces/jdbc/org/postgresql/jdbc1/Attic/AbstractJdbc1Statement.java,v 1.41.2.4 2004/02/24 13:11:44 jurka Exp $
|
/* $Header: /cvsroot/pgsql/src/interfaces/jdbc/org/postgresql/jdbc1/Attic/AbstractJdbc1Statement.java,v 1.41.2.5 2004/03/29 17:47:47 barry Exp $
|
||||||
* This class defines methods of the jdbc1 specification. This class is
|
* This class defines methods of the jdbc1 specification. This class is
|
||||||
* extended by org.postgresql.jdbc2.AbstractJdbc2Statement which adds the jdbc2
|
* extended by org.postgresql.jdbc2.AbstractJdbc2Statement which adds the jdbc2
|
||||||
* methods. The real Statement class (for jdbc1) is org.postgresql.jdbc1.Jdbc1Statement
|
* methods. The real Statement class (for jdbc1) is org.postgresql.jdbc1.Jdbc1Statement
|
||||||
@ -110,7 +110,7 @@ public abstract class AbstractJdbc1Statement implements BaseStatement
|
|||||||
protected Object callResult;
|
protected Object callResult;
|
||||||
protected int maxfieldSize = 0;
|
protected int maxfieldSize = 0;
|
||||||
|
|
||||||
public abstract BaseResultSet createResultSet(Field[] fields, Vector tuples, String status, int updateCount, long insertOID, boolean binaryCursor) throws SQLException;
|
public abstract BaseResultSet createResultSet(Field[] fields, Vector tuples, String status, int updateCount, long insertOID) throws SQLException;
|
||||||
|
|
||||||
public AbstractJdbc1Statement (BaseConnection connection)
|
public AbstractJdbc1Statement (BaseConnection connection)
|
||||||
{
|
{
|
||||||
|
@ -15,9 +15,9 @@ public class Jdbc1CallableStatement extends AbstractJdbc1Statement implements ja
|
|||||||
super(connection, sql);
|
super(connection, sql);
|
||||||
}
|
}
|
||||||
|
|
||||||
public BaseResultSet createResultSet (Field[] fields, java.util.Vector tuples, String status, int updateCount, long insertOID, boolean binaryCursor) throws SQLException
|
public BaseResultSet createResultSet (Field[] fields, java.util.Vector tuples, String status, int updateCount, long insertOID) throws SQLException
|
||||||
{
|
{
|
||||||
return new Jdbc1ResultSet(this, fields, tuples, status, updateCount, insertOID, binaryCursor);
|
return new Jdbc1ResultSet(this, fields, tuples, status, updateCount, insertOID);
|
||||||
}
|
}
|
||||||
|
|
||||||
public PGRefCursorResultSet createRefCursorResultSet (String cursorName) throws SQLException
|
public PGRefCursorResultSet createRefCursorResultSet (String cursorName) throws SQLException
|
||||||
|
@ -14,9 +14,9 @@ public class Jdbc1PreparedStatement extends AbstractJdbc1Statement implements Pr
|
|||||||
super(connection, sql);
|
super(connection, sql);
|
||||||
}
|
}
|
||||||
|
|
||||||
public BaseResultSet createResultSet (Field[] fields, java.util.Vector tuples, String status, int updateCount, long insertOID, boolean binaryCursor) throws SQLException
|
public BaseResultSet createResultSet (Field[] fields, java.util.Vector tuples, String status, int updateCount, long insertOID) throws SQLException
|
||||||
{
|
{
|
||||||
return new Jdbc1ResultSet(this, fields, tuples, status, updateCount, insertOID, binaryCursor);
|
return new Jdbc1ResultSet(this, fields, tuples, status, updateCount, insertOID);
|
||||||
}
|
}
|
||||||
|
|
||||||
public PGRefCursorResultSet createRefCursorResultSet (String cursorName) throws SQLException
|
public PGRefCursorResultSet createRefCursorResultSet (String cursorName) throws SQLException
|
||||||
|
@ -22,7 +22,7 @@ public class Jdbc1RefCursorResultSet extends Jdbc1ResultSet
|
|||||||
|
|
||||||
Jdbc1RefCursorResultSet(BaseStatement statement, String refCursorName)
|
Jdbc1RefCursorResultSet(BaseStatement statement, String refCursorName)
|
||||||
{
|
{
|
||||||
super(statement, null, null, null, -1, 0L, false);
|
super(statement, null, null, null, -1, 0L);
|
||||||
this.refCursorHandle = refCursorName;
|
this.refCursorHandle = refCursorName;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -6,7 +6,7 @@ import java.util.Vector;
|
|||||||
import org.postgresql.core.BaseStatement;
|
import org.postgresql.core.BaseStatement;
|
||||||
import org.postgresql.core.Field;
|
import org.postgresql.core.Field;
|
||||||
|
|
||||||
/* $Header: /cvsroot/pgsql/src/interfaces/jdbc/org/postgresql/jdbc1/Attic/Jdbc1ResultSet.java,v 1.6 2003/03/07 18:39:44 barry Exp $
|
/* $Header: /cvsroot/pgsql/src/interfaces/jdbc/org/postgresql/jdbc1/Attic/Jdbc1ResultSet.java,v 1.6.4.1 2004/03/29 17:47:47 barry Exp $
|
||||||
* This class implements the java.sql.ResultSet interface for JDBC1.
|
* This class implements the java.sql.ResultSet interface for JDBC1.
|
||||||
* However most of the implementation is really done in
|
* However most of the implementation is really done in
|
||||||
* org.postgresql.jdbc1.AbstractJdbc1ResultSet
|
* org.postgresql.jdbc1.AbstractJdbc1ResultSet
|
||||||
@ -14,9 +14,9 @@ import org.postgresql.core.Field;
|
|||||||
public class Jdbc1ResultSet extends org.postgresql.jdbc1.AbstractJdbc1ResultSet implements java.sql.ResultSet
|
public class Jdbc1ResultSet extends org.postgresql.jdbc1.AbstractJdbc1ResultSet implements java.sql.ResultSet
|
||||||
{
|
{
|
||||||
|
|
||||||
public Jdbc1ResultSet(BaseStatement statement, Field[] fields, Vector tuples, String status, int updateCount, long insertOID, boolean binaryCursor)
|
public Jdbc1ResultSet(BaseStatement statement, Field[] fields, Vector tuples, String status, int updateCount, long insertOID)
|
||||||
{
|
{
|
||||||
super(statement, fields, tuples, status, updateCount, insertOID, binaryCursor);
|
super(statement, fields, tuples, status, updateCount, insertOID);
|
||||||
}
|
}
|
||||||
|
|
||||||
public java.sql.ResultSetMetaData getMetaData() throws SQLException
|
public java.sql.ResultSetMetaData getMetaData() throws SQLException
|
||||||
|
@ -7,7 +7,7 @@ import org.postgresql.PGRefCursorResultSet;
|
|||||||
import org.postgresql.core.BaseResultSet;
|
import org.postgresql.core.BaseResultSet;
|
||||||
import org.postgresql.core.Field;
|
import org.postgresql.core.Field;
|
||||||
|
|
||||||
/* $Header: /cvsroot/pgsql/src/interfaces/jdbc/org/postgresql/jdbc1/Attic/Jdbc1Statement.java,v 1.6 2003/05/03 20:40:45 barry Exp $
|
/* $Header: /cvsroot/pgsql/src/interfaces/jdbc/org/postgresql/jdbc1/Attic/Jdbc1Statement.java,v 1.6.4.1 2004/03/29 17:47:47 barry Exp $
|
||||||
* This class implements the java.sql.Statement interface for JDBC1.
|
* This class implements the java.sql.Statement interface for JDBC1.
|
||||||
* However most of the implementation is really done in
|
* However most of the implementation is really done in
|
||||||
* org.postgresql.jdbc1.AbstractJdbc1Statement
|
* org.postgresql.jdbc1.AbstractJdbc1Statement
|
||||||
@ -20,9 +20,9 @@ public class Jdbc1Statement extends org.postgresql.jdbc1.AbstractJdbc1Statement
|
|||||||
super(c);
|
super(c);
|
||||||
}
|
}
|
||||||
|
|
||||||
public BaseResultSet createResultSet (Field[] fields, Vector tuples, String status, int updateCount, long insertOID, boolean binaryCursor) throws SQLException
|
public BaseResultSet createResultSet (Field[] fields, Vector tuples, String status, int updateCount, long insertOID) throws SQLException
|
||||||
{
|
{
|
||||||
return new Jdbc1ResultSet(this, fields, tuples, status, updateCount, insertOID, binaryCursor);
|
return new Jdbc1ResultSet(this, fields, tuples, status, updateCount, insertOID);
|
||||||
}
|
}
|
||||||
|
|
||||||
public PGRefCursorResultSet createRefCursorResultSet (String cursorName) throws SQLException
|
public PGRefCursorResultSet createRefCursorResultSet (String cursorName) throws SQLException
|
||||||
|
@ -9,7 +9,7 @@
|
|||||||
* Copyright (c) 2003, PostgreSQL Global Development Group
|
* Copyright (c) 2003, PostgreSQL Global Development Group
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* IDENTIFICATION
|
||||||
* $Header: /cvsroot/pgsql/src/interfaces/jdbc/org/postgresql/jdbc2/Attic/AbstractJdbc2ResultSet.java,v 1.25.2.3 2004/02/03 05:25:37 jurka Exp $
|
* $Header: /cvsroot/pgsql/src/interfaces/jdbc/org/postgresql/jdbc2/Attic/AbstractJdbc2ResultSet.java,v 1.25.2.4 2004/03/29 17:47:47 barry Exp $
|
||||||
*
|
*
|
||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
@ -52,9 +52,9 @@ public abstract class AbstractJdbc2ResultSet extends org.postgresql.jdbc1.Abstra
|
|||||||
private PreparedStatement selectStatement = null;
|
private PreparedStatement selectStatement = null;
|
||||||
|
|
||||||
|
|
||||||
public AbstractJdbc2ResultSet(BaseStatement statement, Field[] fields, Vector tuples, String status, int updateCount, long insertOID, boolean binaryCursor)
|
public AbstractJdbc2ResultSet(BaseStatement statement, Field[] fields, Vector tuples, String status, int updateCount, long insertOID)
|
||||||
{
|
{
|
||||||
super (statement, fields, tuples, status, updateCount, insertOID, binaryCursor);
|
super (statement, fields, tuples, status, updateCount, insertOID);
|
||||||
}
|
}
|
||||||
|
|
||||||
public java.net.URL getURL(int columnIndex) throws SQLException
|
public java.net.URL getURL(int columnIndex) throws SQLException
|
||||||
|
@ -353,7 +353,7 @@ public class Array implements java.sql.Array
|
|||||||
throw org.postgresql.Driver.notImplemented();
|
throw org.postgresql.Driver.notImplemented();
|
||||||
}
|
}
|
||||||
BaseStatement stat = (BaseStatement) conn.createStatement();
|
BaseStatement stat = (BaseStatement) conn.createStatement();
|
||||||
return (ResultSet) stat.createResultSet(fields, rows, "OK", 1, 0, false);
|
return (ResultSet) stat.createResultSet(fields, rows, "OK", 1, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
public String toString()
|
public String toString()
|
||||||
|
@ -15,9 +15,9 @@ public class Jdbc2CallableStatement extends org.postgresql.jdbc2.AbstractJdbc2St
|
|||||||
super(connection, sql);
|
super(connection, sql);
|
||||||
}
|
}
|
||||||
|
|
||||||
public BaseResultSet createResultSet (Field[] fields, Vector tuples, String status, int updateCount, long insertOID, boolean binaryCursor) throws SQLException
|
public BaseResultSet createResultSet (Field[] fields, Vector tuples, String status, int updateCount, long insertOID) throws SQLException
|
||||||
{
|
{
|
||||||
return new Jdbc2ResultSet(this, fields, tuples, status, updateCount, insertOID, binaryCursor);
|
return new Jdbc2ResultSet(this, fields, tuples, status, updateCount, insertOID);
|
||||||
}
|
}
|
||||||
|
|
||||||
public PGRefCursorResultSet createRefCursorResultSet (String cursorName) throws SQLException
|
public PGRefCursorResultSet createRefCursorResultSet (String cursorName) throws SQLException
|
||||||
|
@ -15,9 +15,9 @@ public class Jdbc2PreparedStatement extends org.postgresql.jdbc2.AbstractJdbc2St
|
|||||||
super(connection, sql);
|
super(connection, sql);
|
||||||
}
|
}
|
||||||
|
|
||||||
public BaseResultSet createResultSet (Field[] fields, Vector tuples, String status, int updateCount, long insertOID, boolean binaryCursor) throws SQLException
|
public BaseResultSet createResultSet (Field[] fields, Vector tuples, String status, int updateCount, long insertOID) throws SQLException
|
||||||
{
|
{
|
||||||
return new Jdbc2ResultSet(this, fields, tuples, status, updateCount, insertOID, binaryCursor);
|
return new Jdbc2ResultSet(this, fields, tuples, status, updateCount, insertOID);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -21,7 +21,7 @@ public class Jdbc2RefCursorResultSet extends Jdbc2ResultSet
|
|||||||
|
|
||||||
Jdbc2RefCursorResultSet(BaseStatement statement, String refCursorName) throws java.sql.SQLException
|
Jdbc2RefCursorResultSet(BaseStatement statement, String refCursorName) throws java.sql.SQLException
|
||||||
{
|
{
|
||||||
super(statement, null, null, null, -1, 0L, false);
|
super(statement, null, null, null, -1, 0L);
|
||||||
this.refCursorHandle = refCursorName;
|
this.refCursorHandle = refCursorName;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -6,7 +6,7 @@ import java.util.Vector;
|
|||||||
import org.postgresql.core.BaseStatement;
|
import org.postgresql.core.BaseStatement;
|
||||||
import org.postgresql.core.Field;
|
import org.postgresql.core.Field;
|
||||||
|
|
||||||
/* $Header: /cvsroot/pgsql/src/interfaces/jdbc/org/postgresql/jdbc2/Attic/Jdbc2ResultSet.java,v 1.8 2003/03/07 18:39:45 barry Exp $
|
/* $Header: /cvsroot/pgsql/src/interfaces/jdbc/org/postgresql/jdbc2/Attic/Jdbc2ResultSet.java,v 1.8.4.1 2004/03/29 17:47:47 barry Exp $
|
||||||
* This class implements the java.sql.ResultSet interface for JDBC2.
|
* This class implements the java.sql.ResultSet interface for JDBC2.
|
||||||
* However most of the implementation is really done in
|
* However most of the implementation is really done in
|
||||||
* org.postgresql.jdbc2.AbstractJdbc2ResultSet or one of it's parents
|
* org.postgresql.jdbc2.AbstractJdbc2ResultSet or one of it's parents
|
||||||
@ -14,9 +14,9 @@ import org.postgresql.core.Field;
|
|||||||
public class Jdbc2ResultSet extends org.postgresql.jdbc2.AbstractJdbc2ResultSet implements java.sql.ResultSet
|
public class Jdbc2ResultSet extends org.postgresql.jdbc2.AbstractJdbc2ResultSet implements java.sql.ResultSet
|
||||||
{
|
{
|
||||||
|
|
||||||
public Jdbc2ResultSet(BaseStatement statement, Field[] fields, Vector tuples, String status, int updateCount, long insertOID, boolean binaryCursor)
|
public Jdbc2ResultSet(BaseStatement statement, Field[] fields, Vector tuples, String status, int updateCount, long insertOID)
|
||||||
{
|
{
|
||||||
super(statement, fields, tuples, status, updateCount, insertOID, binaryCursor);
|
super(statement, fields, tuples, status, updateCount, insertOID);
|
||||||
}
|
}
|
||||||
|
|
||||||
public ResultSetMetaData getMetaData() throws SQLException
|
public ResultSetMetaData getMetaData() throws SQLException
|
||||||
|
@ -7,7 +7,7 @@ import org.postgresql.PGRefCursorResultSet;
|
|||||||
import org.postgresql.core.BaseResultSet;
|
import org.postgresql.core.BaseResultSet;
|
||||||
import org.postgresql.core.Field;
|
import org.postgresql.core.Field;
|
||||||
|
|
||||||
/* $Header: /cvsroot/pgsql/src/interfaces/jdbc/org/postgresql/jdbc2/Attic/Jdbc2Statement.java,v 1.6 2003/05/03 20:40:45 barry Exp $
|
/* $Header: /cvsroot/pgsql/src/interfaces/jdbc/org/postgresql/jdbc2/Attic/Jdbc2Statement.java,v 1.6.4.1 2004/03/29 17:47:47 barry Exp $
|
||||||
* This class implements the java.sql.Statement interface for JDBC2.
|
* This class implements the java.sql.Statement interface for JDBC2.
|
||||||
* However most of the implementation is really done in
|
* However most of the implementation is really done in
|
||||||
* org.postgresql.jdbc2.AbstractJdbc2Statement or one of it's parents
|
* org.postgresql.jdbc2.AbstractJdbc2Statement or one of it's parents
|
||||||
@ -20,9 +20,9 @@ public class Jdbc2Statement extends org.postgresql.jdbc2.AbstractJdbc2Statement
|
|||||||
super(c);
|
super(c);
|
||||||
}
|
}
|
||||||
|
|
||||||
public BaseResultSet createResultSet (Field[] fields, Vector tuples, String status, int updateCount, long insertOID, boolean binaryCursor) throws SQLException
|
public BaseResultSet createResultSet (Field[] fields, Vector tuples, String status, int updateCount, long insertOID) throws SQLException
|
||||||
{
|
{
|
||||||
return new Jdbc2ResultSet(this, fields, tuples, status, updateCount, insertOID, binaryCursor);
|
return new Jdbc2ResultSet(this, fields, tuples, status, updateCount, insertOID);
|
||||||
}
|
}
|
||||||
|
|
||||||
public PGRefCursorResultSet createRefCursorResultSet (String cursorName) throws SQLException
|
public PGRefCursorResultSet createRefCursorResultSet (String cursorName) throws SQLException
|
||||||
|
@ -7,7 +7,7 @@ import org.postgresql.core.BaseStatement;
|
|||||||
import org.postgresql.core.Field;
|
import org.postgresql.core.Field;
|
||||||
|
|
||||||
|
|
||||||
/* $Header: /cvsroot/pgsql/src/interfaces/jdbc/org/postgresql/jdbc3/Attic/AbstractJdbc3ResultSet.java,v 1.4 2003/03/07 18:39:45 barry Exp $
|
/* $Header: /cvsroot/pgsql/src/interfaces/jdbc/org/postgresql/jdbc3/Attic/AbstractJdbc3ResultSet.java,v 1.4.4.1 2004/03/29 17:47:47 barry Exp $
|
||||||
* This class defines methods of the jdbc3 specification. This class extends
|
* This class defines methods of the jdbc3 specification. This class extends
|
||||||
* org.postgresql.jdbc2.AbstractJdbc2ResultSet which provides the jdbc2
|
* org.postgresql.jdbc2.AbstractJdbc2ResultSet which provides the jdbc2
|
||||||
* methods. The real Statement class (for jdbc3) is org.postgresql.jdbc3.Jdbc3ResultSet
|
* methods. The real Statement class (for jdbc3) is org.postgresql.jdbc3.Jdbc3ResultSet
|
||||||
@ -15,9 +15,9 @@ import org.postgresql.core.Field;
|
|||||||
public abstract class AbstractJdbc3ResultSet extends org.postgresql.jdbc2.AbstractJdbc2ResultSet
|
public abstract class AbstractJdbc3ResultSet extends org.postgresql.jdbc2.AbstractJdbc2ResultSet
|
||||||
{
|
{
|
||||||
|
|
||||||
public AbstractJdbc3ResultSet(BaseStatement statement, Field[] fields, Vector tuples, String status, int updateCount, long insertOID, boolean binaryCursor)
|
public AbstractJdbc3ResultSet(BaseStatement statement, Field[] fields, Vector tuples, String status, int updateCount, long insertOID)
|
||||||
{
|
{
|
||||||
super (statement, fields, tuples, status, updateCount, insertOID, binaryCursor);
|
super (statement, fields, tuples, status, updateCount, insertOID);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -15,9 +15,9 @@ public class Jdbc3CallableStatement extends org.postgresql.jdbc3.AbstractJdbc3St
|
|||||||
super(connection, sql);
|
super(connection, sql);
|
||||||
}
|
}
|
||||||
|
|
||||||
public BaseResultSet createResultSet (Field[] fields, Vector tuples, String status, int updateCount, long insertOID, boolean binaryCursor) throws SQLException
|
public BaseResultSet createResultSet (Field[] fields, Vector tuples, String status, int updateCount, long insertOID) throws SQLException
|
||||||
{
|
{
|
||||||
return new Jdbc3ResultSet(this, fields, tuples, status, updateCount, insertOID, binaryCursor);
|
return new Jdbc3ResultSet(this, fields, tuples, status, updateCount, insertOID);
|
||||||
}
|
}
|
||||||
|
|
||||||
public PGRefCursorResultSet createRefCursorResultSet (String cursorName) throws SQLException
|
public PGRefCursorResultSet createRefCursorResultSet (String cursorName) throws SQLException
|
||||||
|
@ -15,9 +15,9 @@ public class Jdbc3PreparedStatement extends org.postgresql.jdbc3.AbstractJdbc3St
|
|||||||
super(connection, sql);
|
super(connection, sql);
|
||||||
}
|
}
|
||||||
|
|
||||||
public BaseResultSet createResultSet (Field[] fields, java.util.Vector tuples, String status, int updateCount, long insertOID, boolean binaryCursor) throws SQLException
|
public BaseResultSet createResultSet (Field[] fields, java.util.Vector tuples, String status, int updateCount, long insertOID) throws SQLException
|
||||||
{
|
{
|
||||||
return new Jdbc3ResultSet((BaseStatement)this, fields, tuples, status, updateCount, insertOID, binaryCursor);
|
return new Jdbc3ResultSet((BaseStatement)this, fields, tuples, status, updateCount, insertOID);
|
||||||
}
|
}
|
||||||
|
|
||||||
public PGRefCursorResultSet createRefCursorResultSet (String cursorName) throws SQLException
|
public PGRefCursorResultSet createRefCursorResultSet (String cursorName) throws SQLException
|
||||||
|
@ -24,7 +24,7 @@ public class Jdbc3RefCursorResultSet extends Jdbc3ResultSet implements PGRefCurs
|
|||||||
super((BaseStatement)statement,
|
super((BaseStatement)statement,
|
||||||
(Field[])null,
|
(Field[])null,
|
||||||
(Vector)null,
|
(Vector)null,
|
||||||
(String)null, -1, 0L, false);
|
(String)null, -1, 0L);
|
||||||
this.refCursorHandle = refCursorName;
|
this.refCursorHandle = refCursorName;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -6,7 +6,7 @@ import java.util.Vector;
|
|||||||
import org.postgresql.core.Field;
|
import org.postgresql.core.Field;
|
||||||
import org.postgresql.core.BaseStatement;
|
import org.postgresql.core.BaseStatement;
|
||||||
|
|
||||||
/* $Header: /cvsroot/pgsql/src/interfaces/jdbc/org/postgresql/jdbc3/Attic/Jdbc3ResultSet.java,v 1.5 2003/03/07 18:39:45 barry Exp $
|
/* $Header: /cvsroot/pgsql/src/interfaces/jdbc/org/postgresql/jdbc3/Attic/Jdbc3ResultSet.java,v 1.5.4.1 2004/03/29 17:47:47 barry Exp $
|
||||||
* This class implements the java.sql.ResultSet interface for JDBC3.
|
* This class implements the java.sql.ResultSet interface for JDBC3.
|
||||||
* However most of the implementation is really done in
|
* However most of the implementation is really done in
|
||||||
* org.postgresql.jdbc3.AbstractJdbc3ResultSet or one of it's parents
|
* org.postgresql.jdbc3.AbstractJdbc3ResultSet or one of it's parents
|
||||||
@ -14,9 +14,9 @@ import org.postgresql.core.BaseStatement;
|
|||||||
public class Jdbc3ResultSet extends org.postgresql.jdbc3.AbstractJdbc3ResultSet implements java.sql.ResultSet
|
public class Jdbc3ResultSet extends org.postgresql.jdbc3.AbstractJdbc3ResultSet implements java.sql.ResultSet
|
||||||
{
|
{
|
||||||
|
|
||||||
public Jdbc3ResultSet(BaseStatement statement, Field[] fields, Vector tuples, String status, int updateCount, long insertOID, boolean binaryCursor)
|
public Jdbc3ResultSet(BaseStatement statement, Field[] fields, Vector tuples, String status, int updateCount, long insertOID)
|
||||||
{
|
{
|
||||||
super(statement, fields, tuples, status, updateCount, insertOID, binaryCursor);
|
super(statement, fields, tuples, status, updateCount, insertOID);
|
||||||
}
|
}
|
||||||
|
|
||||||
public java.sql.ResultSetMetaData getMetaData() throws SQLException
|
public java.sql.ResultSetMetaData getMetaData() throws SQLException
|
||||||
|
@ -7,7 +7,7 @@ import org.postgresql.PGRefCursorResultSet;
|
|||||||
import org.postgresql.core.BaseResultSet;
|
import org.postgresql.core.BaseResultSet;
|
||||||
import org.postgresql.core.Field;
|
import org.postgresql.core.Field;
|
||||||
|
|
||||||
/* $Header: /cvsroot/pgsql/src/interfaces/jdbc/org/postgresql/jdbc3/Attic/Jdbc3Statement.java,v 1.5 2003/05/03 20:40:45 barry Exp $
|
/* $Header: /cvsroot/pgsql/src/interfaces/jdbc/org/postgresql/jdbc3/Attic/Jdbc3Statement.java,v 1.5.4.1 2004/03/29 17:47:47 barry Exp $
|
||||||
* This class implements the java.sql.Statement interface for JDBC3.
|
* This class implements the java.sql.Statement interface for JDBC3.
|
||||||
* However most of the implementation is really done in
|
* However most of the implementation is really done in
|
||||||
* org.postgresql.jdbc3.AbstractJdbc3Statement or one of it's parents
|
* org.postgresql.jdbc3.AbstractJdbc3Statement or one of it's parents
|
||||||
@ -20,9 +20,9 @@ public class Jdbc3Statement extends org.postgresql.jdbc3.AbstractJdbc3Statement
|
|||||||
super(c);
|
super(c);
|
||||||
}
|
}
|
||||||
|
|
||||||
public BaseResultSet createResultSet (Field[] fields, Vector tuples, String status, int updateCount, long insertOID, boolean binaryCursor) throws SQLException
|
public BaseResultSet createResultSet (Field[] fields, Vector tuples, String status, int updateCount, long insertOID) throws SQLException
|
||||||
{
|
{
|
||||||
return new Jdbc3ResultSet(this, fields, tuples, status, updateCount, insertOID, binaryCursor);
|
return new Jdbc3ResultSet(this, fields, tuples, status, updateCount, insertOID);
|
||||||
}
|
}
|
||||||
|
|
||||||
public PGRefCursorResultSet createRefCursorResultSet (String cursorName) throws SQLException
|
public PGRefCursorResultSet createRefCursorResultSet (String cursorName) throws SQLException
|
||||||
|
@ -65,6 +65,7 @@ public class Jdbc2TestSuite extends TestSuite
|
|||||||
|
|
||||||
suite.addTestSuite(CallableStmtTest.class );
|
suite.addTestSuite(CallableStmtTest.class );
|
||||||
suite.addTestSuite(CursorFetchTest.class);
|
suite.addTestSuite(CursorFetchTest.class);
|
||||||
|
suite.addTestSuite(ServerCursorTest.class);
|
||||||
|
|
||||||
// That's all folks
|
// That's all folks
|
||||||
return suite;
|
return suite;
|
||||||
|
@ -14,7 +14,7 @@ import java.sql.*;
|
|||||||
* User: alexei
|
* User: alexei
|
||||||
* Date: 17-Dec-2003
|
* Date: 17-Dec-2003
|
||||||
* Time: 11:01:44
|
* Time: 11:01:44
|
||||||
* @version $Id: OID74Test.java,v 1.2.2.2 2003/12/18 04:10:12 davec Exp $
|
* @version $Id: OID74Test.java,v 1.2.2.3 2004/03/29 17:47:47 barry Exp $
|
||||||
*/
|
*/
|
||||||
public class OID74Test extends TestCase
|
public class OID74Test extends TestCase
|
||||||
{
|
{
|
||||||
@ -75,6 +75,7 @@ public class OID74Test extends TestCase
|
|||||||
}
|
}
|
||||||
|
|
||||||
TestUtil.dropTable(c,"temp");
|
TestUtil.dropTable(c,"temp");
|
||||||
|
c.commit();
|
||||||
TestUtil.closeDB(c);
|
TestUtil.closeDB(c);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,91 @@
|
|||||||
|
package org.postgresql.test.jdbc2;
|
||||||
|
|
||||||
|
import java.sql.*;
|
||||||
|
|
||||||
|
import junit.framework.TestCase;
|
||||||
|
|
||||||
|
import org.postgresql.test.TestUtil;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Tests for using non-zero setFetchSize().
|
||||||
|
*/
|
||||||
|
public class ServerCursorTest extends TestCase
|
||||||
|
{
|
||||||
|
private Connection con;
|
||||||
|
|
||||||
|
public ServerCursorTest(String name)
|
||||||
|
{
|
||||||
|
super(name);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void setUp() throws Exception
|
||||||
|
{
|
||||||
|
con = TestUtil.openDB();
|
||||||
|
TestUtil.createTable(con, "test_fetch", "value integer,data bytea");
|
||||||
|
con.setAutoCommit(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void tearDown() throws Exception
|
||||||
|
{
|
||||||
|
con.rollback();
|
||||||
|
con.setAutoCommit(true);
|
||||||
|
TestUtil.dropTable(con, "test_fetch");
|
||||||
|
TestUtil.closeDB(con);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void createRows(int count) throws Exception
|
||||||
|
{
|
||||||
|
PreparedStatement stmt = con.prepareStatement("insert into test_fetch(value,data) values(?,?)");
|
||||||
|
for (int i = 0; i < count; ++i) {
|
||||||
|
stmt.setInt(1,i+1);
|
||||||
|
stmt.setBytes(2,DATA_STRING.getBytes("UTF8"));
|
||||||
|
stmt.executeUpdate();
|
||||||
|
}
|
||||||
|
con.commit();
|
||||||
|
}
|
||||||
|
|
||||||
|
//Test regular cursor fetching
|
||||||
|
public void testBasicFetch() throws Exception
|
||||||
|
{
|
||||||
|
createRows(1);
|
||||||
|
|
||||||
|
PreparedStatement stmt = con.prepareStatement("declare test_cursor cursor for select * from test_fetch");
|
||||||
|
stmt.execute();
|
||||||
|
|
||||||
|
stmt = con.prepareStatement("fetch forward from test_cursor");
|
||||||
|
ResultSet rs = stmt.executeQuery();
|
||||||
|
while (rs.next()) {
|
||||||
|
//there should only be one row returned
|
||||||
|
assertEquals("query value error", 1, rs.getInt(1));
|
||||||
|
byte[] dataBytes = rs.getBytes(2);
|
||||||
|
assertEquals("binary data got munged", DATA_STRING, new String(dataBytes,"UTF8"));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
//Test binary cursor fetching
|
||||||
|
public void testBinaryFetch() throws Exception
|
||||||
|
{
|
||||||
|
createRows(1);
|
||||||
|
|
||||||
|
PreparedStatement stmt = con.prepareStatement("declare test_cursor binary cursor for select * from test_fetch");
|
||||||
|
stmt.execute();
|
||||||
|
|
||||||
|
stmt = con.prepareStatement("fetch forward from test_cursor");
|
||||||
|
ResultSet rs = stmt.executeQuery();
|
||||||
|
while (rs.next()) {
|
||||||
|
//there should only be one row returned
|
||||||
|
byte[] dataBytes = rs.getBytes(2);
|
||||||
|
assertEquals("binary data got munged", DATA_STRING, new String(dataBytes,"UTF8"));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
//This string contains a variety different data:
|
||||||
|
// three japanese characters representing "japanese" in japanese
|
||||||
|
// the four characters "\000"
|
||||||
|
// a null character
|
||||||
|
// the seven ascii characters "english"
|
||||||
|
private static final String DATA_STRING = "\u65E5\u672C\u8A9E\\000\u0000english";
|
||||||
|
|
||||||
|
}
|
Reference in New Issue
Block a user