Solved

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

Posted on 2006-06-27
10
1,177 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 250 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 250 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
 
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
IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 
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

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
countX 22 70
Free Alternative to JIRA 4 58
Java Jpanels and Jframe 8 20
JList custom Cell Renderer refresh 15 43
For customizing the look of your lightweight component and making it look lucid like it was made of glass. Or: how to make your component more Apple-ish ;) This tip assumes your component to be of rectangular shape and completely opaque. (COD…
After being asked a question last year, I went into one of my moods where I did some research and code just for the fun and learning of it all.  Subsequently, from this journey, I put together this article on "Range Searching Using Visual Basic.NET …
Viewers learn about the “while” loop and how to utilize it correctly in Java. Additionally, viewers begin exploring how to include conditional statements within a while loop and avoid an endless loop. Define While Loop: Basic Example: Explanatio…
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.

746 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

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now