|
Deepa Remesh made changes - 08/Jul/05 11:56 AM
Rather than this code
String bigDecimalString = getString(); if(bigDecimalString == null) return false; to see if the value is NULL, you should use the isNull() method. e.g. if (isNull()) return false; otherwise it looks good. Can you re-submit a patch?
Hi Dan,
Thanks for pointing this out. I was using a round-about way to check if the value is null. Please look at the re-submitted patch. Deepa
Deepa Remesh made changes - 09/Jul/05 12:41 AM
Daniel John Debrunner made changes - 09/Jul/05 02:20 AM
Committed revision 209845.
Daniel John Debrunner made changes - 09/Jul/05 02:29 AM
Deepa Remesh made changes - 12/Jul/05 07:52 AM
Deepa Remesh made changes - 12/Jul/05 07:52 AM
Committed revision 219260 on 10.1 branch (merge of 209845)
svn merge -r 209844:209845 https://svn.apache.org/repos/asf/incubator/derby/code/trunk/
Daniel John Debrunner made changes - 21/Jul/05 04:29 PM
Also marked fixed in 10.1 branch
Daniel John Debrunner made changes - 21/Jul/05 04:30 PM
Daniel John Debrunner made changes - 21/Jul/05 04:30 PM
Kathey Marsden made changes - 16/Sep/05 01:55 AM
Kathey Marsden made changes - 16/Sep/05 01:55 AM
Kathey Marsden made changes - 16/Sep/05 01:55 AM
reopening to fix fix version
Deepa Remesh made changes - 30/Sep/05 02:15 AM
Deepa Remesh made changes - 30/Sep/05 02:15 AM
Deepa Remesh made changes - 30/Sep/05 02:18 AM
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Here is the method implementation:
// 0 or null is false, all else is true
public boolean getBoolean()
{
String bigDecimalString = getString();
if(bigDecimalString == null)
return false;
BigInteger bi = new BigInteger(data2c);
return bi.compareTo(java.math.BigInteger.ZERO) != 0;
}
I ran the test jdbcapi/resultset.java using IBM WCTME5.7 Foundation profile. Before the change the output file resultset.out had the following output for calls to getBoolean() for DECIMAL values:
getBoolean(10) got exception
Data Conversion SQLException
getBoolean(dc) got exception
Data Conversion SQLException
After the change, getBoolean() for DECIMAL value does not throw data conversion exception. The output file now has:
getBoolean(10): true
getBoolean(dc): true
To verify that the getBoolean() method returns the right value, I also tested using the following DECIMAL values (-10.1, 0, -0, 0.00, -0.00, null).
Note: The test jdbcapi/resultset.java is currently excluded for J2ME/Foundation. The following line "runwithfoundation=false" in resultset_app.properties has to be commented to be able to run the test. Also, the test will not be successful because of other BigDecimal methods. So the specific lines in output has to be checked in resultset.out. I am working on a test wrapper to make the test work in J2ME/Foundation and will submit this in a separate task.
Please review this patch and commit it.
Thanks,
Deepa