Add new KiwiJdbc utilities to convert from an int (used as a boolean) to boolean #1046
Labels
new feature
A new feature such as a new class, method, package, group of classes, etc.
Milestone
Add two new static methods to
KiwiJdbc
:These methods are intended for use with database fields that are intended as
boolean
, for example if you are using MySql which usestinyint
to store "boolean" values as zero or one.If the database value is
NULL
, this method will returnfalse
(sinceResultSet#getLong
returns zero when the database value isNULL
).These methods should check that the
int
value is either zero or one first, and throw an exception (IllegalArgumentException
) if not. They should returntrue
for a value of one andfalse
for zero.Alternatively, these methods could consider zero as false, and anything non-zero as true. In this case, it would never throw an exception. Or, we could have methods that do one or the other, i.e. one "strict" method that only accepts zero or one, and another that accepts zero as false and any non-zero number as true.
The text was updated successfully, but these errors were encountered: