patch: ResultSetTest.java - Mailing list pgsql-jdbc

From kgeis@speakeasy.net
Subject patch: ResultSetTest.java
Date
Msg-id W277193702285981130228293@webmail4
Whole thread Raw
Responses Re: patch: ResultSetTest.java
Re: patch: ResultSetTest.java
List pgsql-jdbc
Here are a couple of problems I ran across in ResultSetTest.

The first section removes an assertion that is redundant and makes the (not necessarily true) assumption that the field
wasreturned by the database in text format.  From the Javadoc on java.sql.ResultSet.getBytes(): "The bytes represent
theraw values returned by the driver." 

The second section has an unnecessarily complex query that caused me problems because pg_database contains a column of
typeaclitem[] which does not support binary transfer from the database. 


Ken


===================================================================
RCS file: /usr/local/cvsroot/pgjdbc/pgjdbc/org/postgresql/test/jdbc2/ResultSetTest.java,v
retrieving revision 1.25
diff -u -r1.25 ResultSetTest.java
--- jdbc2/ResultSetTest.java    11 Jan 2005 08:25:48 -0000    1.25
+++ jdbc2/ResultSetTest.java    25 Oct 2005 08:09:13 -0000
@@ -170,14 +170,12 @@
         //it should apply only to binary and char/varchar columns
         rs.next();
         assertEquals("12345", rs.getString(1));
-        assertEquals("12345", new String(rs.getBytes(1)));

         //max should apply to the following since the column is
         //a varchar column
         rs = stmt.executeQuery("select * from teststring");
         rs.next();
         assertEquals("12", rs.getString(1));
-        assertEquals("12", new String(rs.getBytes(1)));
     }

     public void booleanTests(boolean useServerPrepare) throws SQLException
@@ -485,7 +483,7 @@
     {
         Statement stmt = con.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_UPDATABLE);
         // Create a one row result set.
-        ResultSet rs = stmt.executeQuery("SELECT * FROM pg_database WHERE datname='template1'");
+        ResultSet rs = stmt.executeQuery("SELECT 1");

         assertTrue(rs.isBeforeFirst());
         assertTrue(!rs.isAfterLast());




pgsql-jdbc by date:

Previous
From: Ken Geis
Date:
Subject: name "oid" is confusing
Next
From: Oliver Jowett
Date:
Subject: Re: name "oid" is confusing