?
Solved

what will rs.getBoolean() return if the field is null OR varchar 'FALSE'?

Posted on 2006-06-27
10
Medium Priority
?
1,255 Views
Last Modified: 2008-02-26
hi, as per title.
1. what will rs.getBoolean() return if the field is null?

2. if the field is varchar, and the value is 'FALSE' (for every row), if i read the value using rs.getBoolean, will i get the boolean value of 'false'?

tks
0
Comment
Question by:InNoCenT_Ch1ld
  • 4
  • 4
  • 2
10 Comments
 
LVL 16

Accepted Solution

by:
suprapto45 earned 1000 total points
ID: 16997797
1. It should be false.
2. If it is 'FALSE' it will return false, but if it is 'TRUE', it will return true.

David
0
 
LVL 92

Assisted Solution

by:objects
objects earned 1000 total points
ID: 16997802
1. false, use wasNull() to check if null

2. i don't think so
0
 
LVL 16

Expert Comment

by:suprapto45
ID: 16997805
I think for the second point, there is a rule where we can determine whether it is true or false. Let me check for a sec

David
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 92

Expert Comment

by:objects
ID: 16997809
suck it and see :)
0
 
LVL 16

Expert Comment

by:suprapto45
ID: 16997816
Sorry for the spam.

This is just based on my experiences and may not be right.

If your VARCHAR column is started with 'T' or even a single 'T', it should return true

but if it is started with other characters than 'T', it should return false.

Just my experiences ;)

David
0
 
LVL 3

Author Comment

by:InNoCenT_Ch1ld
ID: 16997920
let me run some experiment for point#2 first...
0
 
LVL 3

Author Comment

by:InNoCenT_Ch1ld
ID: 16998049
here's my result:

field(varchar)           getBoolean()
----------------------------------------------
'FALSE'                    false
'TRUE'                     true
'FISH'
0
 
LVL 3

Author Comment

by:InNoCenT_Ch1ld
ID: 16998061
ignore my previous comment ;-)

test:
-MS SQL SERVER 2000


here's my result:

field(varchar)           getBoolean()
----------------------------------------------
'FALSE'                    false
'TRUE'                     true
'FISH'                      false
'TANK'                     false
0
 
LVL 3

Author Comment

by:InNoCenT_Ch1ld
ID: 16998070
additional:

'T'       --> false
'F'       --> false

guess it only recognize 'TRUE' for ms sql server.. or maybe it depends on the jdbc...
0
 
LVL 16

Expert Comment

by:suprapto45
ID: 16998076
>>"'TANK'                     false"
Ok, my theory is wrong :(.

Enjoy ;)
David
0

Featured Post

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

An old method to applying the Singleton pattern in your Java code is to check if a static instance, defined in the same class that needs to be instantiated once and only once, is null and then create a new instance; otherwise, the pre-existing insta…
Java Flight Recorder and Java Mission Control together create a complete tool chain to continuously collect low level and detailed runtime information enabling after-the-fact incident analysis. Java Flight Recorder is a profiling and event collectio…
Video by: Michael
Viewers learn about how to reduce the potential repetitiveness of coding in main by developing methods to perform specific tasks for their program. Additionally, objects are introduced for the purpose of learning how to call methods in Java. Define …
This video teaches viewers about errors in exception handling.
Suggested Courses
Course of the Month17 days, 10 hours left to enroll

830 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question