2

So PhoneGap's storage API supports webSQL which was deprecated in 2010. It's also totally broken in Chrome dev tools to test with. There is a native SQLite plugin that someone made

https://github.com/brodysoft/Cordova-SQLitePlugin

Which seems like a good idea to get the speed you need. But I'm having a huge problem testing our app before it's built for PhoneGap. We have a 10MB database and we can't import and manipulate it with webSQL. (Because webSQL crashes and just doesn't ever finish an import)

So my questions are:

1) Can you create a SQLite db file and have a PhoneGap app use that. And if so, how would you develop with that in the browser prior to building in PhoneGap? (so you can test)

2) Is there a more correct way to handle databases for a PhoneGap app?

nbanic
  • 1,270
  • 1
  • 8
  • 11
Sean Clark
  • 1,436
  • 1
  • 17
  • 31
  • We're exploring the idea of a .json database. Reading and writing a 10MB .json file seems instantaneous so far. The 'query language' would be javascript, and it's heavily cross platform.'=' – Sean Clark May 10 '14 at 09:27

1 Answers1

0

I'm just starting with it too, but looks like phonegap 3.1 natively supports the web sql storage, refer to this link for usage:

http://docs.phonegap.com/en/3.1.0/cordova_storage_storage.md.html#Storage

I tried to perform the window.openDatabse from remote console using weinre on a test app, and successfully created the database I assigned. I'll update this when I can confirm all of the functions work properly, but I'd say that's a good hint to begin with.

  • 1
    Don't use this at all. It's too slow. Build your database in JSON files with HTML5 File System and read them into memory for your apps use. It's lightning fast. – Sean Clark Aug 09 '14 at 02:28
  • thanks for the suggestion! I'm just getting started with storage in phonegap, so I thought first on trying their own solution. In the past I used localStorage but that's so limited for what I need to achieve in the current project, can you provide me some actual link with the supported methods? All I find is documents telling me the API is deprecated – Juan Carlos Alpizar Chinchilla Aug 09 '14 at 14:56