Brewtarget / brewtarget

Main brewtarget source code repository.
GNU General Public License v3.0
310 stars 134 forks source link

Error recovery for string-in-boolean field in DB #767

Closed matty0ung closed 11 months ago

matty0ung commented 11 months ago

Fix src/database/ObjectStore.cpp so that it can recover from the case where it finds a "true" or "false" string in a table field where it was expecting a boolean (or actually a 0 or 1, since SQLite doesn't have native booleans).

I'm not sure how we end up with a string in a boolean field, but it can happen -- see https://github.com/Brewtarget/brewtarget/issues/766. Given that we can automatically recover (provided the string holds something sane), we should.

I've tested this locally by manually modifying my DB but, as ever, any corrections or comments are welcome!