From: | Dave Cramer <Dave(at)micro-automation(dot)net> |
---|---|
To: | nickf(at)ontko(dot)com |
Cc: | AgentM <agentm(at)cmu(dot)edu>, "pgsql-jdbc(at)postgresql(dot)org" <pgsql-jdbc(at)postgresql(dot)org> |
Subject: | Re: throw SQLException on no rs.next()? |
Date: | 2002-04-23 12:40:39 |
Message-ID: | 1019565640.4158.60.camel@inspiron.cramers |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-jdbc |
Nick,
I think it should throw a SQLException, since that is what most ppl are
catching, I don't really think any driver should ever NPE as a result of
misuse.
Dave
On Tue, 2002-04-23 at 08:29, Nick Fankhauser wrote:
> Dave-
>
> My response was based on my experience when I started (about a year ago) so
> this may be changed.
>
> However, at the time it looked to me like it *should* throw an NPE in this
> situation, so I'm suprised that it would be a candidate for change.
>
> -Nick
>
> > -----Original Message-----
> > From: Dave Cramer [mailto:Dave(at)micro-automation(dot)net]
> > Sent: Tuesday, April 23, 2002 7:23 AM
> > To: nickf(at)ontko(dot)com
> > Cc: AgentM; pgsql-jdbc(at)postgresql(dot)org
> > Subject: Re: [JDBC] throw SQLException on no rs.next()?
> >
> >
> > I thought I fixed it so that it doesn't throw an NPE, but I could be
> > mistaken?
> >
> > Dave
> > On Tue, 2002-04-23 at 08:09, Nick Fankhauser wrote:
> > > Yes, it sure does. The way I usually handle stepping through a
> > ResultSet is
> > > with a structure like this:
> > >
> > > /* create REsultSet results */
> > > while (results.next())
> > > {
> > > /*do something with results*/
> > > }
> > >
> > > You're right about this being a common newbie gotcha. I'll add it to the
> > > newbie FAQ.
> > >
> > > -NF
> > >
> > >
> > > > -----Original Message-----
> > > > From: pgsql-jdbc-owner(at)postgresql(dot)org
> > > > [mailto:pgsql-jdbc-owner(at)postgresql(dot)org]On Behalf Of AgentM
> > > > Sent: Tuesday, April 23, 2002 12:36 AM
> > > > To: pgsql-jdbc(at)postgresql(dot)org
> > > > Subject: [JDBC] throw SQLException on no rs.next()?
> > > >
> > > >
> > > > Hi- it's me the JDBC newbie again and I have a simple request. Could
> > > > a call to resultset.getX() throw some exception if rs.next() has not
> > > > yet been called? I just got horribly burned by missing this simple
> > > > thing and I think it may be helpful to other newbies to have this
> > > > extra bit of information. Thanks.
> > > > --
> > > > ><><><><><><><><><><><><
> > > > AgentM
> > > > agentm(at)cmu(dot)edu
> > > >
> > > > ---------------------------(end of
> > broadcast)---------------------------
> > > > TIP 6: Have you searched our list archives?
> > > >
> > > > http://archives.postgresql.org
> > > >
> > >
> > >
> > > ---------------------------(end of broadcast)---------------------------
> > > TIP 1: subscribe and unsubscribe commands go to majordomo(at)postgresql(dot)org
> > >
> > >
> >
> >
> >
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 5: Have you checked our extensive FAQ?
>
> http://www.postgresql.org/users-lounge/docs/faq.html
>
>
From | Date | Subject | |
---|---|---|---|
Next Message | Nick Fankhauser | 2002-04-23 12:53:56 | Re: throw SQLException on no rs.next()? |
Previous Message | Marin Dimitrov | 2002-04-23 12:29:48 | Re: throw SQLException on no rs.next()? |