Re: absolute positioning - Mailing list pgsql-jdbc

From Oliver Jowett
Subject Re: absolute positioning
Date
Msg-id 406151FE.8010106@opencloud.com
Whole thread Raw
In response to Re: absolute positioning  (Indra Heckenbach <indra@macnica.com>)
List pgsql-jdbc
Indra Heckenbach wrote:

> I went ahead and patched the JDBC jar from the CVS head on gborg.  This
> patch should enable scrollable cursor support, and provide absolute()
> w/o loading all results into the JDBC buffer.

Context diff ('cvs diff -c') output is preferred as it's a lot more
readable..

   Unfortunately, the patch
> involves changing some core aspects of the driver.  I have not reviewed
> the existing code thoroughly, so I could have introduced problems.  I
> have also not tested extensively.  However, the patch works for me, and
> I could use the patched driver with existing applications.  Is there a
> test suite for the driver?  At this point I hope to get some feedback.

There is indeed a test suite -- try 'ant test'. You'll need the JUnit
jar available in Ant's classpath or it fails silently (we should fix
that..). You also need a database called 'test' and a user called 'test'
on a server running on localhost (these are tweakable -- see build.xml
for details). The test cases are in org/postgresql/test.

With your patch I get a couple of failures from the test suite that I
don't get with CVS HEAD:

>     [junit] Testcase: testScrollableFetch(org.postgresql.test.jdbc2.CursorFetchTest):   FAILED
>     [junit] ran out of rows doing a reverse fetch on iteration 1/0 at position 49 with fetch size 1
>     [junit] junit.framework.AssertionFailedError: ran out of rows doing a reverse fetch on iteration 1/0 at position
49with fetch size 1 
>     [junit]     at org.postgresql.test.jdbc2.CursorFetchTest.testScrollableFetch(CursorFetchTest.java:100)
>     [junit]     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>     [junit]     at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>     [junit]     at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)

>     [junit] Testcase: testScrollableAbsoluteFetch(org.postgresql.test.jdbc2.CursorFetchTest):   Caused an ERROR
>     [junit] Result set not positioned properly, perhaps you need to call next().
>     [junit] org.postgresql.util.PSQLException: Result set not positioned properly, perhaps you need to call next().
>     [junit]     at org.postgresql.jdbc1.AbstractJdbc1ResultSet.checkResultSet(AbstractJdbc1ResultSet.java:859)
>     [junit]     at org.postgresql.jdbc1.AbstractJdbc1ResultSet.getString(AbstractJdbc1ResultSet.java:222)
>     [junit]     at org.postgresql.jdbc1.AbstractJdbc1ResultSet.getFixedString(AbstractJdbc1ResultSet.java:823)
>     [junit]     at org.postgresql.jdbc1.AbstractJdbc1ResultSet.getInt(AbstractJdbc1ResultSet.java:310)
>     [junit]     at org.postgresql.test.jdbc2.CursorFetchTest.testScrollableAbsoluteFetch(CursorFetchTest.java:127)
>     [junit]     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>     [junit]     at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>     [junit]     at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)

-O

pgsql-jdbc by date:

Previous
From: Indra Heckenbach
Date:
Subject: Re: absolute positioning
Next
From: Paul Thomas
Date:
Subject: Re: Postmaster not dropping connections on tomcat restart.