Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: robust castToBoolean for setObject in PreparedStatement #714

merged 1 commit into from Dec 14, 2016


Copy link

@jorsol jorsol commented Dec 14, 2016

Based on the docs of PostgreSQL, valid literals are defined for Boolean Type.

This add the valid literals for all TRUE and FALSE values, now it don't fall back to false if the value is not correct.

Note: This only works for setObject with targetSqlType.

closes #701

Copy link

@codecov-io codecov-io commented Dec 14, 2016

Current coverage is 64.25% (diff: 78.57%)

Merging #714 into master will increase coverage by 0.16%

@@             master       #714   diff @@
  Files           164        164          
  Lines         15124      15145    +21   
  Methods           0          0          
  Messages          0          0          
  Branches       2979       2987     +8   
+ Hits           9693       9731    +38   
+ Misses         4195       4182    -13   
+ Partials       1236       1232     -4   

Powered by Codecov. Last update 436365b...a980ccc

if (in instanceof Clob) {
Boolean value = null;
final String strval = asString((Clob) in).trim();
if ("1".equals(strval) || "true".equalsIgnoreCase(strval)
Copy link

@davecramer davecramer Dec 14, 2016

seems to me this is duplicate of the code above. I would think it should be possible to only write this once ?

Copy link
Member Author

@jorsol jorsol Dec 14, 2016

Yes, done.

@jorsol jorsol force-pushed the robust-boolean-pstmt branch from ff1d5b5 to 3ca74e1 Dec 14, 2016
@jorsol jorsol force-pushed the robust-boolean-pstmt branch from 3ca74e1 to a980ccc Dec 14, 2016
@davecramer davecramer merged commit edc2a14 into pgjdbc:master Dec 14, 2016
2 checks passed
@vlsi vlsi added this to the 42.0.0 milestone Dec 30, 2016
@jorsol jorsol deleted the robust-boolean-pstmt branch Jan 4, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
None yet
Linked issues

Successfully merging this pull request may close these issues.

4 participants