2
votes

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?

1
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

1 Answers

0
votes

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.