]> git.ipfire.org Git - thirdparty/postgresql.git/commitdiff
Fix for bug with the jdbc driver not properly working with binary cursors and
authorBarry Lind <barry@xythos.com>
Mon, 29 Mar 2004 17:47:47 +0000 (17:47 +0000)
committerBarry Lind <barry@xythos.com>
Mon, 29 Mar 2004 17:47:47 +0000 (17:47 +0000)
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

30 files changed:
src/interfaces/jdbc/org/postgresql/Driver.java.in
src/interfaces/jdbc/org/postgresql/core/BaseResultSet.java
src/interfaces/jdbc/org/postgresql/core/BaseStatement.java
src/interfaces/jdbc/org/postgresql/core/Field.java
src/interfaces/jdbc/org/postgresql/core/PGStream.java
src/interfaces/jdbc/org/postgresql/core/QueryExecutor.java
src/interfaces/jdbc/org/postgresql/jdbc1/AbstractJdbc1DatabaseMetaData.java
src/interfaces/jdbc/org/postgresql/jdbc1/AbstractJdbc1ResultSet.java
src/interfaces/jdbc/org/postgresql/jdbc1/AbstractJdbc1Statement.java
src/interfaces/jdbc/org/postgresql/jdbc1/Jdbc1CallableStatement.java
src/interfaces/jdbc/org/postgresql/jdbc1/Jdbc1PreparedStatement.java
src/interfaces/jdbc/org/postgresql/jdbc1/Jdbc1RefCursorResultSet.java
src/interfaces/jdbc/org/postgresql/jdbc1/Jdbc1ResultSet.java
src/interfaces/jdbc/org/postgresql/jdbc1/Jdbc1Statement.java
src/interfaces/jdbc/org/postgresql/jdbc2/AbstractJdbc2ResultSet.java
src/interfaces/jdbc/org/postgresql/jdbc2/Array.java
src/interfaces/jdbc/org/postgresql/jdbc2/Jdbc2CallableStatement.java
src/interfaces/jdbc/org/postgresql/jdbc2/Jdbc2PreparedStatement.java
src/interfaces/jdbc/org/postgresql/jdbc2/Jdbc2RefCursorResultSet.java
src/interfaces/jdbc/org/postgresql/jdbc2/Jdbc2ResultSet.java
src/interfaces/jdbc/org/postgresql/jdbc2/Jdbc2Statement.java
src/interfaces/jdbc/org/postgresql/jdbc3/AbstractJdbc3ResultSet.java
src/interfaces/jdbc/org/postgresql/jdbc3/Jdbc3CallableStatement.java
src/interfaces/jdbc/org/postgresql/jdbc3/Jdbc3PreparedStatement.java
src/interfaces/jdbc/org/postgresql/jdbc3/Jdbc3RefCursorResultSet.java
src/interfaces/jdbc/org/postgresql/jdbc3/Jdbc3ResultSet.java
src/interfaces/jdbc/org/postgresql/jdbc3/Jdbc3Statement.java
src/interfaces/jdbc/org/postgresql/test/jdbc2/Jdbc2TestSuite.java
src/interfaces/jdbc/org/postgresql/test/jdbc2/OID74Test.java
src/interfaces/jdbc/org/postgresql/test/jdbc2/ServerCursorTest.java [new file with mode: 0644]

index bb4effd22c204bd2ba76b0b2ed9b22df496101d9..057fc6e83a94b4538dafb18157a2034deb8ca332 100644 (file)
@@ -6,7 +6,7 @@
  * Copyright (c) 2003, PostgreSQL Global Development Group
  *
  * 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
-       private static int m_buildNumber = 212;
+       private static int m_buildNumber = 213;
 
 }
index c89ad29ec8b89b9c84c1d0367c4ee54529c09804..dab56ad7b7a5a37759d8a1460ef428b34b977a98 100644 (file)
@@ -6,7 +6,7 @@
  * Copyright (c) 2003, PostgreSQL Global Development Group
  *
  * 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 reallyResultSet();
        public void reInit (Field[] fields, Vector tuples, String status,
-                                               int updateCount, long insertOID, boolean binaryCursor);
+                                               int updateCount, long insertOID);
        public void setStatement(BaseStatement statement);
 
 }
index 71fc85ff9ed74ce9e3237e3e12b0bd60fe6651ad..9a4ec55f2ad1ba7f49c1145044465d8621ed8577 100644 (file)
@@ -6,7 +6,7 @@
  * Copyright (c) 2003, PostgreSQL Global Development Group
  *
  * 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 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 BaseConnection getPGConnection();
index debb4b14857bc96514a593c150312021ac745ce7..1b2368792e8c9774842fef33efd781744f143269 100644 (file)
@@ -6,7 +6,7 @@
  * Copyright (c) 2003, PostgreSQL Global Development Group
  *
  * 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
 {
+    //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 oid;                // OID of the type
        private int mod;                // type modifier 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
 
@@ -89,6 +98,22 @@ public class Field
                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.
         *
index fe710e9efbfc6b5dff88c9431b52ea64065258fa..e9e0eed6063401ad6631193fa337ea4816748793 100644 (file)
@@ -7,7 +7,7 @@
  * Copyright (c) 2003, PostgreSQL Global Development Group
  *
  * 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
         *
         * @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
         *      an array of strings
         * @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
                int l_msgSize = ReceiveIntegerR(4);
index 624a9fc1d6200ed4361f2d69020960721a9486e6..00f0211a7414530120bd922f28d889ccdeda592e 100644 (file)
@@ -6,7 +6,7 @@
  * Copyright (c) 2003, PostgreSQL Global Development Group
  *
  * 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 Vector tuples = new Vector();
-       private boolean binaryCursor = false;
        private String status = null;
        private int update_count = 1;
        private long insert_oid = 0;
@@ -135,14 +134,11 @@ public class QueryExecutor
                                                String param = pgStream.ReceiveString(connection.getEncoding());
                                                connection.addNotification(new org.postgresql.core.Notification(msg, pid));
                                                break;
-                                       case 'B':       // Binary Data Transfer
-                                               receiveTupleV3(true);
-                                               break;
                                        case 'C':       // Command Status
                                                receiveCommandStatusV3();
                                                break;
-                                       case 'D':       // Text Data Transfer
-                                               receiveTupleV3(false);
+                                       case 'D':       // Data Transfer
+                                               receiveTupleV3();
                                                break;
                                        case 'E':       // Error Message
 
@@ -205,11 +201,11 @@ public class QueryExecutor
                        //create a new one
                        if (rs != null) 
                        {
-                               rs.reInit(fields, tuples, status, update_count, insert_oid, binaryCursor);
+                               rs.reInit(fields, tuples, status, update_count, insert_oid);
                        }
                        else 
                        {
-                               rs = statement.createResultSet(fields, tuples, status, update_count, insert_oid, binaryCursor);
+                               rs = statement.createResultSet(fields, tuples, status, update_count, insert_oid);
                        }
                        return rs;
                }
@@ -295,11 +291,11 @@ public class QueryExecutor
                        //create a new one
                        if (rs != null) 
                        {
-                               rs.reInit(fields, tuples, status, update_count, insert_oid, binaryCursor);
+                               rs.reInit(fields, tuples, status, update_count, insert_oid);
                        }
                        else 
                        {
-                               rs = statement.createResultSet(fields, tuples, status, update_count, insert_oid, binaryCursor);
+                               rs = statement.createResultSet(fields, tuples, status, update_count, insert_oid);
                        }
                        return rs;
                }
@@ -378,16 +374,12 @@ public class QueryExecutor
 
        /*
         * 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)
                        throw new PSQLException("postgresql.con.tuple", PSQLState.CONNECTION_FAILURE);
-               Object tuple = pgStream.ReceiveTupleV3(fields.length, isBinary);
-               if (isBinary)
-                       binaryCursor = true;
+               Object tuple = pgStream.ReceiveTupleV3(fields.length);
                if (maxRows == 0 || tuples.size() < maxRows)
                        tuples.addElement(tuple);
        }
@@ -402,8 +394,11 @@ public class QueryExecutor
                if (fields == null)
                        throw new PSQLException("postgresql.con.tuple", PSQLState.CONNECTION_FAILURE);
                Object tuple = pgStream.ReceiveTupleV2(fields.length, isBinary);
-               if (isBinary)
-                       binaryCursor = true;
+               if (isBinary) {
+                   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)
                        tuples.addElement(tuple);
        }
@@ -488,6 +483,7 @@ public class QueryExecutor
                        int formatType = pgStream.ReceiveIntegerR(2);
                        //TODO: use the extra values coming back
                        fields[i] = new Field(connection, typeName, typeOid, typeLength, typeModifier);
+                        fields[i].setFormat(formatType);
                }
        }
        /*
index 1a0d978212d2574dfc05e34f0e87d027a4cf04b0..ec73b2865515cf0b0d94bbdceef6d29a50d7dcb2 100644 (file)
@@ -1926,7 +1926,7 @@ public abstract class AbstractJdbc1DatabaseMetaData
                }
                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);
                }
 
-               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();
 
-               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();
 
-               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();
 
-               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[]) {
@@ -2805,7 +2805,7 @@ public abstract class AbstractJdbc1DatabaseMetaData
                        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
                 * 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);
                }
 
-               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();
 
-               return (ResultSet) ((BaseStatement)connection.createStatement()).createResultSet(f, v, "OK", 1, 0, false);
+               return (ResultSet) ((BaseStatement)connection.createStatement()).createResultSet(f, v, "OK", 1, 0);
        }
 
        /*
index 5dbb80a6921f5eee196f0567a292c03e566e400a..5216ff6df3384e1244ce08a8a4fd6ddf3853ba15 100644 (file)
@@ -9,7 +9,7 @@
  * Copyright (c) 2003, PostgreSQL Global Development Group
  *
  * 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 Field fields[];               // The field descriptions
        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 long insertOID;               // The oid of an inserted row
        protected int current_row;              // Our pointer to where we are at
@@ -71,8 +70,7 @@ public abstract class AbstractJdbc1ResultSet implements BaseResultSet
                                      Vector tuples,
                                      String status,
                                      int updateCount,
-                                     long insertOID, 
-                                         boolean binaryCursor)
+                                     long insertOID)
        {
                this.connection = statement.getPGConnection();
                this.statement = statement;
@@ -84,7 +82,6 @@ public abstract class AbstractJdbc1ResultSet implements BaseResultSet
                this.insertOID = insertOID;
                this.this_row = null;
                this.current_row = -1;
-               this.binaryCursor = binaryCursor;
 
                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
        public void reInit (Field[] fields, Vector tuples, String status,
-                         int updateCount, long insertOID, boolean binaryCursor)
+                         int updateCount, long insertOID)
        {
                this.fields = fields;
                // 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.this_row = null;
                this.current_row = -1;
-               this.binaryCursor = binaryCursor;
        }
 
        //
@@ -327,7 +323,7 @@ public abstract class AbstractJdbc1ResultSet implements BaseResultSet
                wasNullFlag = (this_row[columnIndex - 1] == null);
                if (!wasNullFlag)
                {
-                       if (binaryCursor)
+                       if (fields[columnIndex -1].getFormat() == Field.BINARY_FORMAT)
                        {
                                //If the data is already binary then just return it
                                return this_row[columnIndex - 1];
index 0addc9e47f9bf05a85eabe284ff317d53be1e0b3..9ee0047c58733dd1de66a59065c4b184f0630a4f 100644 (file)
@@ -26,7 +26,7 @@ import java.sql.Timestamp;
 import java.sql.Types;
 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
  * extended by org.postgresql.jdbc2.AbstractJdbc2Statement which adds the jdbc2
  * 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 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)
        {
index 697a1869ab7cff252a8f338e504d326983531346..4d4b89f4c1a1c305535eac5673117f3f7375afdc 100644 (file)
@@ -15,9 +15,9 @@ public class Jdbc1CallableStatement extends AbstractJdbc1Statement implements ja
                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
index a80928ebddfe8010066bdf7d2d6bb0604f3f2432..e40201836151ffa790e9e6066c045a4cac0029fa 100644 (file)
@@ -14,9 +14,9 @@ public class Jdbc1PreparedStatement extends AbstractJdbc1Statement implements Pr
                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
index 7b83bf674279d0b6aaee2168f704c6fb205ee420..8ab6c14a2d642050dbfb41f946e37d676e31fc2d 100644 (file)
@@ -22,7 +22,7 @@ public class Jdbc1RefCursorResultSet extends Jdbc1ResultSet
         
         Jdbc1RefCursorResultSet(BaseStatement statement, String refCursorName)
         {
-                super(statement, null, null, null, -1, 0L, false);
+                super(statement, null, null, null, -1, 0L);
                 this.refCursorHandle = refCursorName;
         }
 
index 80395f83ca2fecfbd7697924505923c99894aa5d..2a0d84444899aded018bd77a6e4e5e66b8e316e6 100644 (file)
@@ -6,7 +6,7 @@ import java.util.Vector;
 import org.postgresql.core.BaseStatement;
 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.
  * However most of the implementation is really done in
  * 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 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
index 38edfd87e0d96d18c88582aa20dd05e6af91011d..c296de65cc7cf36420addba6ae3a25d47e670651 100644 (file)
@@ -7,7 +7,7 @@ import org.postgresql.PGRefCursorResultSet;
 import org.postgresql.core.BaseResultSet;
 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.
  * However most of the implementation is really done in
  * org.postgresql.jdbc1.AbstractJdbc1Statement
@@ -20,9 +20,9 @@ public class Jdbc1Statement extends org.postgresql.jdbc1.AbstractJdbc1Statement
                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
index a10578cfe92f7384d5a8adbb07b166ede9657c53..0ac5a3916a17f6af5194f6c9d6af94076f86f827 100644 (file)
@@ -9,7 +9,7 @@
  * Copyright (c) 2003, PostgreSQL Global Development Group
  *
  * 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;
 
   
-       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
index e38b0c92edc99a9afc499f5bbfdfb61ee046c8d9..d3317b680c29999179af8ee87719449525bf761f 100644 (file)
@@ -353,7 +353,7 @@ public class Array implements java.sql.Array
                                throw org.postgresql.Driver.notImplemented();
                }
                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()
index e10223e975ca245822299adb9277d485a5e2f242..59c8d90984a09e6bdd5a6441e8cd62e86ecf3d5e 100644 (file)
@@ -15,9 +15,9 @@ public class Jdbc2CallableStatement extends org.postgresql.jdbc2.AbstractJdbc2St
                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
index 83023f05f44535c77a5b569831e179f6ea323eea..515c527297e6fe850c2b9b5a0c9f4a51250d707b 100644 (file)
@@ -15,9 +15,9 @@ public class Jdbc2PreparedStatement extends org.postgresql.jdbc2.AbstractJdbc2St
                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);
        }
 
  
index 08ec33d752f6c4de4f69e30cc9267e77a83f08f8..6e8f17696ff085c0daf53069bc84b659ad3c566a 100644 (file)
@@ -21,7 +21,7 @@ public class Jdbc2RefCursorResultSet extends Jdbc2ResultSet
 
         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;
         }
 
index 494d1f3b201cb712556ff949d088b17d9058f5c4..19d48050a64896709319d0bcc0927619c50feb34 100644 (file)
@@ -6,7 +6,7 @@ import java.util.Vector;
 import org.postgresql.core.BaseStatement;
 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.
  * However most of the implementation is really done in
  * 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 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
index eb78a889b3697d9de8f5d424e014d729b2040b57..9363c24843c6b43fe028e3201378f5bfa8b92531 100644 (file)
@@ -7,7 +7,7 @@ import org.postgresql.PGRefCursorResultSet;
 import org.postgresql.core.BaseResultSet;
 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.
  * However most of the implementation is really done in
  * org.postgresql.jdbc2.AbstractJdbc2Statement or one of it's parents
@@ -20,9 +20,9 @@ public class Jdbc2Statement extends org.postgresql.jdbc2.AbstractJdbc2Statement
                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
index 399da9391b85db3cb12f8d96cf8cabee71b9d98a..de4ca2d68cd5c6104a156f29b4feb7fbcac6d40d 100644 (file)
@@ -7,7 +7,7 @@ import org.postgresql.core.BaseStatement;
 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
  * org.postgresql.jdbc2.AbstractJdbc2ResultSet which provides the jdbc2
  * 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 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);
        }
 
        /**
index 0008f0e98ca0f490c46cf138143149941856acd1..17eb965d320e6f061af33794de582cbb04b3cae7 100644 (file)
@@ -15,9 +15,9 @@ public class Jdbc3CallableStatement extends org.postgresql.jdbc3.AbstractJdbc3St
                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
index e9e25f76b02ce25a388be9ee43bd3102c99c7256..e2882a0ed37ce17f2420f2a1328b4e73a0775fbe 100644 (file)
@@ -15,9 +15,9 @@ public class Jdbc3PreparedStatement extends org.postgresql.jdbc3.AbstractJdbc3St
                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
index f6c0451b4b79a7716e956105010ae469ae4becd7..7625682bb66ae394f5071ea0dcb2b7db26aaaed1 100644 (file)
@@ -24,7 +24,7 @@ public class Jdbc3RefCursorResultSet extends Jdbc3ResultSet implements PGRefCurs
                 super((BaseStatement)statement,
                       (Field[])null,
                       (Vector)null,
-                      (String)null, -1, 0L, false);
+                      (String)null, -1, 0L);
                 this.refCursorHandle = refCursorName;
        }
 
index f9b6f3de781e297f1d079efe4abf1cbf8f45fb6b..7f085f1f32429f9b0d015829af33a881179aaa7b 100644 (file)
@@ -6,7 +6,7 @@ import java.util.Vector;
 import org.postgresql.core.Field;
 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.
  * However most of the implementation is really done in
  * 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 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
index eedea2f5f05ec51d476d754be3ebba2da49c487f..862bf81c661add110b6275e593e4caf24391ebbb 100644 (file)
@@ -7,7 +7,7 @@ import org.postgresql.PGRefCursorResultSet;
 import org.postgresql.core.BaseResultSet;
 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.
  * However most of the implementation is really done in
  * org.postgresql.jdbc3.AbstractJdbc3Statement or one of it's parents
@@ -20,9 +20,9 @@ public class Jdbc3Statement extends org.postgresql.jdbc3.AbstractJdbc3Statement
                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
index 3eab8e6633812eedb46c0a0b11629a4e41bf2b5e..3d6ebf699684a53a7f280aa2be827bd811f5829b 100644 (file)
@@ -65,6 +65,7 @@ public class Jdbc2TestSuite extends TestSuite
 
                suite.addTestSuite(CallableStmtTest.class );
                suite.addTestSuite(CursorFetchTest.class);
+               suite.addTestSuite(ServerCursorTest.class);
 
                // That's all folks
                return suite;
index 2e22092ebeb1f301e895014a024f2eaa89f6862b..ba98e3558d7f074f226033ff4bfd0223b9c4f50a 100644 (file)
@@ -14,7 +14,7 @@ import java.sql.*;
  * User: alexei
  * Date: 17-Dec-2003
  * 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
 {
@@ -75,6 +75,7 @@ public class OID74Test  extends TestCase
                }
 
                TestUtil.dropTable(c,"temp");
+                c.commit();
                TestUtil.closeDB(c);
        }       
 }
diff --git a/src/interfaces/jdbc/org/postgresql/test/jdbc2/ServerCursorTest.java b/src/interfaces/jdbc/org/postgresql/test/jdbc2/ServerCursorTest.java
new file mode 100644 (file)
index 0000000..27a2f67
--- /dev/null
@@ -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";
+
+}