mardi 11 février 2020

What is the best way to read/write objects in a file with the following conditions

I am willing to store objects in a database. The purpose is to be able to read / write these objects with the program to use them. The requirements are the following:

  • Objects can be complexe using Qt classes such as QList, Qstring ... or even can contain other objects that use QObjects
  • The database should not be readable or modified by human (no text, and if I use sqlite database, it has to be encrypted in a way)
  • I should be able to remove, add, count the number of objects in the database, without loading everything in the memory

I asked a question here, to do this with a QDataStream with an example. But it seems it is not the best way to proceed. Would you have some suggestions regarding the solutions that exist for this?

I have tried the following but it does not fulfill the requirements:

  • Storing text in sqlite with qtsql: the data is accessible by using sqlitemanager for example, can be remove by humans. Moreover, I have no idea regarding the way to store QList for example or other objects that contain 2 qlist
  • Storing binary data using QDataStream: in this case, I cannot count the number of objects in my file, neither read or remove a specific object without loading the entire file in memory.

I would be grateful if you could give me some suggestions or provide example, even if the example is simple.

Aucun commentaire:

Enregistrer un commentaire