RawrUniversal / xerial

Automatically exported from code.google.com/p/xerial
0 stars 1 forks source link

JDBC: PrepairedStatment setObject with Boolean #13

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
setObject doesn't handle booleans.

Fix of this issue: PrepStmt.java:261
--snip--
else if (value instanceof Boolean)
            batch(pos, new Integer((Boolean) value ? 1 : 0));
--snap--

Original issue reported on code.google.com by pascal.b...@gmail.com on 21 Jun 2009 at 3:19

GoogleCodeExporter commented 8 years ago
SQLite does not accept boolean types as described here:
http://www.sqlite.org/datatype3.html

That means we have to translate boolean values, true or false, to something 
else.

Which is the right way to translate? 
boolean -> "true" or "false" (String)
boolean -> 1 (true) or 0 (false) (integer)

Original comment by taroleo on 21 Jun 2009 at 11:03

GoogleCodeExporter commented 8 years ago
yes, this is correct, there are no booleans.
but the translation is already defined in the setBoolean, so I took this 
definition.
It would be even better style if the already defined setter would be used in
setObject (which is currently not the case)

--snip--
else if (value instanceof Boolean)
            setBoolean((Boolean) value);
--snap--

Original comment by pascal.b...@gmail.com on 23 Jun 2009 at 12:26

GoogleCodeExporter commented 8 years ago
fixed this problem in sqlite-jdbc-3.6.16

Original comment by taroleo on 2 Jul 2009 at 1:29