• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1290
  • Last Modified:

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

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
InNoCenT_Ch1ld
Asked:
InNoCenT_Ch1ld
  • 4
  • 4
  • 2
2 Solutions
 
suprapto45Commented:
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
 
objectsCommented:
1. false, use wasNull() to check if null

2. i don't think so
0
 
suprapto45Commented:
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
Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
objectsCommented:
suck it and see :)
0
 
suprapto45Commented:
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
 
InNoCenT_Ch1ldAuthor Commented:
let me run some experiment for point#2 first...
0
 
InNoCenT_Ch1ldAuthor Commented:
here's my result:

field(varchar)           getBoolean()
----------------------------------------------
'FALSE'                    false
'TRUE'                     true
'FISH'
0
 
InNoCenT_Ch1ldAuthor Commented:
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
 
InNoCenT_Ch1ldAuthor Commented:
additional:

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

guess it only recognize 'TRUE' for ms sql server.. or maybe it depends on the jdbc...
0
 
suprapto45Commented:
>>"'TANK'                     false"
Ok, my theory is wrong :(.

Enjoy ;)
David
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: Python 3 Fundamentals

This course will teach participants about installing and configuring Python, syntax, importing, statements, types, strings, booleans, files, lists, tuples, comprehensions, functions, and classes.

  • 4
  • 4
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now