Re: res.getInt() returns 0 for NULL? - Mailing list pgsql-jdbc

From Kris Jurka
Subject Re: res.getInt() returns 0 for NULL?
Date
Msg-id Pine.LNX.4.33.0211070134280.30478-100000@leary.csoft.net
Whole thread Raw
In response to res.getInt() returns 0 for NULL?  (Jean-Christian Imbeault <jc@mega-bucks.co.jp>)
List pgsql-jdbc
This is according to the JDBC spec.  Check the API docs for getInt()

On Thu, 7 Nov 2002, Jean-Christian Imbeault wrote:

> Just need a clarification. When using res.getInt() on a column with a
> null value I am getting back "0", should I not get some error thrown or
> some kind or error instead?
>
> The following code illustrates:
>
> int id = res.getInt("id");
> if (res.wasNull()) {
>    System.out.println("result was null");
> }
> System.out.println("id is " + id);
>
> Output:
>
> result was null
> id is 0
>
>
> Thanks,
>
> Jc
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 1: subscribe and unsubscribe commands go to majordomo@postgresql.org
>


pgsql-jdbc by date:

Previous
From: Jean-Christian Imbeault
Date:
Subject: res.getInt() returns 0 for NULL?
Next
From: Dave Cramer
Date:
Subject: Re: