Reputation: 896
I've got a limited list of booleans, example:
{true, true, true, false, false, true}
This list is part of a Object (there might be up to 100 of these objects) like(example):
{INDEX, STRING, false, **{true, true, true, false, false, true}**, FUNC_A, FUNC_B, FUNC_C}
Due prevention of dataloss is highest priority, I save a copy of the Object in a SQLite3 Database. But I am a totally beginner in SQL.
My question is, how can I save the booleans with little calculating affort but best security? The program is running on a 200mhz MCU with only 16mb flash memory, thats why I want to minimize calculation affort, still security and size are more important.
My idea so far: Converting the booleans to a bitfield and just insert it.
Upvotes: 0
Views: 191
Reputation: 1269953
If you have a limited list of booleans, just store them in the native boolean type in your database or as tiny integers. Yes, these are 8-bits instead of 1-bit. For such a small list, the additional overhead should be negligible. Plus, you won't incur as much overhead in unpacking the bits when you want to use them.
I'm not sure what you mean by security, but databases offer lots of security options, particularly by restricting access to particular databases and tables. How the data is stored is generally not a security issue, except for obvious things like encrypting credit card numbers and social security numbers.
Upvotes: 1