0

I'm currently trying to import ~300.000 lines saved in a file.sql.

After reading few forums, few posts stackoverflow, I found two main solutions :

What is the best solution, considering the performance aspect, the evolvment aspect (volumetry), the best practises on Android...? In the perfect case, can I have a example ?

I'm using ORMlite libray, and classic DatabaseHelper methods like : onCreate => to import my data onUpgrade => to do my migrations scripts (https://riggaroo.co.za/android-sqlite-database-use-onupgrade-correctly/)

Edit : The database is used for the operations of read-write, and is synchronized with a primary server, in order to obtain and send the changes (using Flatbuffer). The reason for which I need to import these data is because the synchronization dating of a timestamp 0 (all the lines contained in the base of data of the backend server) is too long at the level of the time.

Community
  • 1
  • 1
Boris S.
  • 1,068
  • 1
  • 8
  • 18

1 Answers1

1

What is the best solution, considering the performance aspect

Shipping a database in assets, and using SQLiteAssetHelper to install it as needed, should be much faster than anything involving executing database transactions.

volumetric evolution about data. the amount of my line (in file.sql), will grow.

Shipping a database in assets will be faster for deploying the app to a new user.

For existing users, neither of your approaches works, and you will need to craft your own code to blend:

  • Your new data that you want to ship with the app
  • The old data that you already shipped and have on the user's device
  • The data that is on the user's device that shipped with neither the original nor the updated app (e.g., data from a server, data entered by the user)
CommonsWare
  • 986,068
  • 189
  • 2,389
  • 2,491