pg.ddx.io  pgsql-jdbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Jan de Visser <jdevisser@digitalfairway.com>
To: pgsql-jdbc@postgresql.org
Subject: Re: unusual ResultSet.next() behaviour
Date: Wed, 27 Jul 2005 10:46:06 -0400
Message-ID: <200507271046.06174.jdevisser@digitalfairway.com> (raw)
In-Reply-To: <1122440425.20140@workhorse.newkinetics.com>
References: <1122440425.20140@workhorse.newkinetics.com>

First off, you need a different e-mail client. The one you're using makes a 
royal mess of MIME messages. Please stop using it (at least don't use it to 
send to this list :)


On Wednesday 27 July 2005 01:00, Les Carter wrote:
> Consider the following code snippet where rs is a ResultSet object obtained
> from a previous query:
>
>     for(int count=0; count!=someValue; count++)
>     {
>         if(!rs.next()) throw SomeException();
>     }
>     rs.next();
>
> Pretty simple, just cycle through someValue number of records and then get
> the next record after that.  For some reason, say if the query has 20 rows
> that will be returned, and I set someValue to be 5 for arguments sake, it
> will go through the for loop with no problems, but when it comes out of the
> for loop and tries to the next rs.next() operation it always returns
> false.  I can increase someValue to 10 and it will still loop without a
> problem, but it will always return false for that rs.next() operation
> following the for loop.
>
> I can't see any rational reason for this.  I'm using PostgreSQL 8.0 and the
> JDBC 3 drivers on Win XP with JDK 1.42_06.  The ResultS! et is a proxy
> object gained from a JBoss4.0 supplied connection pool.
>
> Can anyone offer any explanation, or repeat the simple steps to confirm I'm
> not loosing my sanity?

Works for me. I don't see what you're experiencing; my next() after the loop 
returns true.

>
> Cheers,
>
> L

JdV!!

-- 
--------------------------------------------------------------
Jan de Visser                     jdevisser@digitalfairway.com

                Baruk Khazad! Khazad ai-menu!
--------------------------------------------------------------



view thread (4+ messages)  latest in thread

Message-ID: <200507271046.06174.jdevisser@digitalfairway.com>
Permalink:  ../200507271046.06174.jdevisser@digitalfairway.com/
Also on:    postgresql.org/message-id/200507271046.06174.jdevisser@digitalfairway.com

 · 

reply

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: jdevisser@digitalfairway.com
  Subject: Re: unusual ResultSet.next() behaviour
  In-Reply-To: <200507271046.06174.jdevisser@digitalfairway.com>
  References: <1122440425.20140@workhorse.newkinetics.com> <200507271046.06174.jdevisser@digitalfairway.com>

* 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