null: was is the default returned value?
null: was is the default returned value?
От:
Jean-Christian Imbeault <jc@mega-bucks.co.jp>
Дата:
What value does the jdbc driver return from the various getXXX()
functions when the DB return value is null?
I've been having some trouble using getObject() and getStr() on
ResultSets that contain null values for some fields.
If I do Object o = r.getObject("col") and the returned value is null I
get a nullPointeException. But for String s = r.getStr("col") I get a
value that prints out as "null" ... so if getStr() works I don't
understand why getObject() doesn't ...
Thanks,
Jc
Re: null: was is the default returned value?
От:
Toby <toby@paperjet.com>
Дата:
>What value does the jdbc driver return from the various getXXX()
functions when the DB return value is null
i think this is undefined. what you need to do is first call your getXXX()
call and then follow up with a wasNull() call.
>But for String s = r.getStr("col") I get a value that prints out as "null"
if you tried doing the following, i think you'd see the same thing happening
String s;
System.out.println("s=" + s);
the printing of null isn't to do with the database, its to do with the
default behaviour of the String class, even though you have a null instance.
t
Re: null: was is the default returned value?
От:
Jean-Christian Imbeault <jc@mega-bucks.co.jp>
Дата:
Toby wrote: > > i think this is undefined. what you need to do is first call your > getXXX() call and then follow up with a wasNull() call. You're right. Thanks for the explanation. I didn't know about wasNull(). That fixes everything! Jc
Re: null: was is the default returned value?
От:
Sean Liu <iqalab@yahoo.com>
Дата:
how to remove me from the mailing list? thanks, sean --- Jean-Christian Imbeault wrote: > Toby wrote: > > > > i think this is undefined. what you need to do is > first call your > > getXXX() call and then follow up with a wasNull() > call. > > You're right. Thanks for the explanation. I didn't > know about wasNull(). > That fixes everything! > > Jc > > > ---------------------------(end of > broadcast)--------------------------- > TIP 1: subscribe and unsubscribe commands go to majordomo@postgresql.org