In a SQLite Data Base, I have to add the contents of 5 CheckBox.
I had a strange (crazy ?) idea: What if I set a 5 digits Binary string (0 = True, 1 = False; 00000 = All True) ?
Of course, the traditional “One Field for each CheckBox” is good to me too.
The “binary” idea is funny, but may lead to trouble(s) and even with comments may be hard to follow in 6 months from now (or 6 years !) while the traditional seems traditional, but “Rock Solid” and easy to understand !
[quote=394380:@Jean-Yves Pochez]you will have difficulties to search for one or 2 checkboxes later if you choose the binary
better use 5 bools fields.[/quote]
SQLite has bitwise operators, like “&” and “|”, so searching for bit values is possible. Don’t know how much performance impact this may have, especially on large datasets.
Anytime an “operator” or “function” is used in the WHERE statement in an SQL query there will be a performance impact, and since SQLite doesn’t really have a “boolean” datatype, I would suspect that impact might be on the more noticeable side if you have a large amount of data.