Ramesh
Ramesh

Reputation: 13266

Is there a benefit storing protobuf in sqlite?

In my mobile app (hybrid), I want to allow the user to take his data to another device. There will be no server side components from my end. The data user would carry would contain images, audio, video along with text and timestamps etc. My design evolved as below

1. Store each entry in a JSON file with image, audio and video as Data URI and export this file to cloud sync platforms. The problem with this approach is that, even though JSON is better than XML, there could be better options. See below

2. Store each entry in a BSON file with image, audio and video as Data URI and export this file to cloud sync platforms. The problem with this approach is that as mentioned in its site still the field names will be repeated and protobuf could be a better fit.

3. Store each entry in a protocol buffer file with image, audio and video as Data URI and export this file to cloud sync platforms.

Then when I stumbled across greenDAO they were mentioning

greenDAO lets you persist protocol buffer (protobuf) objects directly into the database.

What is the benefit I will be getting by storing the protobuf object in sqlite DB? Will be able to export sqlite file instead of file containing object in protobuf format?

Upvotes: 3

Views: 5413

Answers (1)

nneonneo
nneonneo

Reputation: 179552

Well, the data still has to be serialized somehow into the database. greenDAO just hides the serialization from you. Since you have specific needs, you are probably best building your own solution, better tailored for your needs.

If you don't anticipate the field names changing, why not just store the entries as database rows? This has a number of nice advantages, including the ability to have sortable and searchable entries.

Upvotes: 6

Related Questions