Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SQLite or Serialization

Tags:

android

I'm writing an application which needs to store data. A single pack of data is about 4 classes with many dependencies between them. For example, class A has a list of objects B and B has a list of objects C and few more dependencies...

And I wonder what would be better. Keep them in SQLite db or serialize each pack separately and store them in serialized files?

like image 922
Michal W Avatar asked Oct 14 '12 09:10

Michal W


People also ask

When should you not use SQLite?

SQLite will normally work fine as the database backend to a website. But if the website is write-intensive or is so busy that it requires multiple servers, then consider using an enterprise-class client/server database engine instead of SQLite.

Why is SQLite not good for production?

The biggest problem with using SQLite in production is disaster recovery. If your server dies, so does your data. That's… not good. Other database servers have replication so they can stream database changes to another server in case one goes down.

What is SQLite serialize?

The sqlite3 module provides you with two methods for controlling the execution flow of statements. The serialize() method allows you to execute statements in serialized mode, while the parallelize() method executes the statements in parallel.

Is SQLite good enough for production?

Instead of using the client-server database management system model, SQLite is self-contained in a single file. It is library, database, and data, all in one package. For certain applications, SQLite is a solid choice for a production database. It's lightweight, ultra-portable, and has no external dependencies.


1 Answers

For me the only right solution would be to save the data inside a database especially if there are any dependencies. For beginners it might be hard at the beginning to get into database creation. but after you have created a database in the right form you just have to insert the data and you won't have any problems in the future if you want to change something or expand your app. With simple serialisation the logic has to be solved inside the app and might cause more problems especially if you have any dependencies.

If you need a good tutorial for saving data you should look at this tutorial http://thenewboston.org/watch.php?cat=6&number=111

For other different solutions for saving data there are also some tutorials on the website, Nr. 108 - 110 of Android programming

like image 72
Alex Cio Avatar answered Sep 21 '22 17:09

Alex Cio