SQLServerDataTable table = new SQLServerDataTable();
table.addColumnMetadata("Wat", Types.BIT);
table.addRow(1);
This table will store a 0 into your database, because the 1 gets converted to "1" with toString, then parsed to false with Boolean.parseBoolean.
I personally disagree with SQLServerDataTable::addRow's general approach of "call toString on the argument then parse it in a lax manner". I think it would be better to:
- Handle known types specifically, e.g. if you attempt to set a BIT field with a
Byte, cast it to a Byte and handle the value
- Handle known values specifically, e.g. allow 0, 1, true, false to set a BIT field
- Reject unknown types and nonsense values with an exception
This table will store a 0 into your database, because the
1gets converted to"1"withtoString, then parsed tofalsewithBoolean.parseBoolean.I personally disagree with
SQLServerDataTable::addRow's general approach of "calltoStringon the argument then parse it in a lax manner". I think it would be better to:Byte, cast it to aByteand handle the value