Best way to store changeable data. Which one?
I am choosing solution for my application which require me to store some portion of information on disk. Which way is better in Qt:
- similar to conf-files like text (key-value pairs)
- CSV and model definition
- Private instance of SQLITE DB
Real world case looks like: you have few users and you need to store theirs private data and settings for the Application UI for example. All of ways above is the solution, but which is better. Need argumented point of view.
what would "theirs private data" be ?
like documents and images etc or ?
@mrjj Mostly settings, but binary data or files might be too.
@bogong how private is private ? most of what you posted is human readable text format !?
If it can be readable I would say QSettings - with ini-format - it has the most robust and easy to use API.
@J.Hilk There are two types of information might be:
- public, mostly application settings related to user
- private like private/encrypted that is personal user data
*** For the second point after experiments I would use encrypted SQLite. But I am not sure about it right now.
@J.Hilk BTW - is there option to encrypt *.ini settings file by in-box solution from Qt?
but it's not build into QSettings, you would have to apply that yourself in-between.
Store them in a reliable database.
I do mostly JSON based config files these days. Before that I often used XML, but it's usually too heavy-weight for my needs. If you are partitioning your system correctly (with discrete user logins) then each user's data can easily be isolated anyways.
Here is a simple en/decryption class based in Qt: https://wiki.qt.io/Simple_encryption_with_SimpleCrypt
If QSetting is not applicable I'd use YAML: https://github.com/jbeder/yaml-cpp
I've made my decision. SUPER-MEGA-HUGE (SMH) thanks to all of you. I decided to use SQLite encrypted DB and specially adjusted class for it.