Skip site navigation (1) Skip section navigation (2)

patch: ResultSetTest.java

From: kgeis(at)speakeasy(dot)net
To: pgsql-jdbc(at)postgresql(dot)org
Subject: patch: ResultSetTest.java
Date: 2005-10-25 08:18:13
Message-ID: W277193702285981130228293@webmail4 (view raw or flat)
Thread:
Lists: 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 was returned by the database in text format.  From the Javadoc on java.sql.ResultSet.getBytes(): "The bytes represent the raw values returned by the driver."

The second section has an unnecessarily complex query that caused me problems because pg_database contains a column of type aclitem[] 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());




Responses

pgsql-jdbc by date

Next:From: Oliver JowettDate: 2005-10-25 08:43:45
Subject: Re: name "oid" is confusing
Previous:From: Ken GeisDate: 2005-10-25 08:08:00
Subject: name "oid" is confusing

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group