2

I would like to create a simple application accessing a database.

Does PhoneGap has this feature in its framework?

Which database technology does it use? MySQL? Any database?

What are the requirements for developing a PhoneGap database application for IPhone?

Junior Mayhé
  • 16,144
  • 26
  • 115
  • 161

2 Answers2

2

Database (the Sqlite database) is baked right into Webkit (and Safari), though you do get some added functionality from Phonegap (the ability to pre-populate a Database). But you can just develop in HTML5 and Javascript to start. Apple provides a reference for Client Side storage. If you are looking for some sample code to play with, here is a little testbed I came up with to play with HTML5 databases. Note: when I say HTML5 databases, I mean Webkit as Mozilla is skeptical about adding an SQL database to HTML5 at all.

Kris Erickson
  • 33,454
  • 26
  • 120
  • 175
1

Though PhoneGap recommends using the websql as a means of data storage, it should be mentioned (but its not) that the responses from queries are not instantaneously returned. This is just simply a limitation of using Phonegap. Here is a function I've used to tie a websql database query with a particular action.

http://snipplr.com/view/50724/query-local-database-with-targeted-callback-and-custom-arguements/

For smaller chunks of data that you want to store on the device you can use LocalStorage. I've found it reasonable to use JSON.stringify to convert a simple object into a string to be stored in LocalStorage. And upon retrieval JSON.parse it. Here is another snippet to assist in using this method.

http://snipplr.com/view/54570/local-storage-html5-wrapper/

user774904
  • 31
  • 1