From: kgeis@speakeasy.net
To: pgsql-jdbc@postgresql.org
Subject: patch: ResultSetTest.java
Date: Tue, 25 Oct 2005 08:18:13 +0000
Message-ID: <W277193702285981130228293@webmail4> (raw)
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
inline patch 1: jdbc2/ResultSetTest.java (+1/-3 lines) download inline-1.patchdiff -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());
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-jdbc@postgresql.org
Cc: kgeis@speakeasy.net
Subject: Re: patch: ResultSetTest.java
In-Reply-To: <W277193702285981130228293@webmail4>
References: <W277193702285981130228293@webmail4>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox