2

I am creating a question answer hybrid application and for that I am using webSQL I do not have a complete database for my app at the moment and it will never be complete. So I want to know if I could host a sqlite database file or a dump of that file on my google drive public folder and point the app to download the latest db file and wipe off the previous websql data. I do not know how to tell the websql that the server has latest version of db so download it.

What I have now in mind is to get the date modified of the file on server and if the date/time matches the date on which the websql was downloaded than do not do nothing as you have the latest version. Is there any other method of doing it?

And first of all how I go about doing this? I have a rough Idea Correct me where you think I am wrong

  • How to get the modified date of the file on my shared folder Google Drive Folder? (This step is SOLVED)
  • Inorder to get the sql file I use $http.get(locationof the file); //I use angular
  • How do I Insert data from a big file. If the file is big it may cause some performance issues. How do I Insert the File in parts?
Amron
  • 197
  • 1
  • 9

1 Answers1

0

Well, two hours have passed and no expert replied to your question, so I may as well have a go.

First, I'm not sure what you mean by saying that your database is not complete ("and will never be complete"). Do you mean database schema (tables structure etc.) or stored data? If that's the first, than Web SQL has nice versioning API - look at Web SQL specification and changeVersion method.

If you mean that you'll have more and more data, than standard approach is to apply changes incrementally rather than by re-downloading the whole database. You said the data file is big, do you really want to download it after every update? The advantage of your approach is that you don't need to bother with incremental upgrades files.

Rather than downloading some dump file and trying to somehow over-write existing database I'd store the data as a list of insert queries (or some csv format) on Google Drive. This way process of updating the data would be just to delete all tables content and execute latest version of the file. Binary dump of the database is probably smaller, but debugging any problems will be a nightmare.

If you want to version your data just create a table and store a single row describing latest revision or last modification date, as you said.

And finally about the insert performance - my guess is that actual bottleneck will be downloading the data, rather than inserting. If performance is crucial for your app consider incremental updates approach rather than re-downloading the database.

M Kowalski
  • 460
  • 4
  • 6
  • Google Drive has its Api To get Last Modified Date&&Time of a file so that is of good use to me right now. For Smaller Changes Incremental Updates will be best but for complete change in schema full database download will be best. So I will have to use both at appropriate situations. But how do I manage minor Incremental changes. Many people are committing to the database so keeping track of all the changes will be tedious. – Amron Apr 20 '15 at 14:08
  • If many people are committing to the database then you probably need some code pushing modified version of db (with peoples' changes) back to Google Drive, right? Instead of pushing whole database you could push only new data into a new 'incremental change' file created after every commit (or periodically). – M Kowalski Apr 20 '15 at 14:49
  • Here I have another problem if I do incremental updates my new app user will get only the updates and not the old data – Amron Apr 21 '15 at 04:21
  • What I have now decided is to not push small updates but push major updates once in a week/month and that update will carry a js file which will create the database from scratch. This will remove all the complex workarounds required to get things working and will make my workflow smooth. Though bandwidth will be a major concern as my database size increases beyond 100mb. But than I will split my app and database because my database is split-able and than the user can download the part of the app they want to use. If anyone has better and easy to follow idea please provide it here. – Amron Apr 21 '15 at 05:08