View Full Version : save data in Iphone database

22 Sep 2010, 9:34 PM
Hi guys,

I'm just starting to use sencha touch to develop applications. Well, I have this form in which you can fill in certain fields and if I save it, I want it to be saved in a text file or any database and at the same time retrieve the data from it. I have read the api documentation and it seems there is no information about this. Is there a way to do this?

22 Sep 2010, 11:05 PM
Yes, but not directly. You need some layer in between (php, ruby, .net) that interacts with the DB.

You would use an Ajax request to send/receive data from the server.

22 Sep 2010, 11:14 PM
I mean the database file is inside the iphone itself. I'm planning to create a app in which the user can update informations and save it in that database when he is offline and sync the database to the server when he's online.

22 Sep 2010, 11:16 PM
Oh right, then yes. Look at the LocalStorageProxy.

23 Sep 2010, 5:15 AM
Is it possible that you can use database such as sqlite or any other database storage in sencha? I want to see the file so that I can validate the data saved in it.

23 Sep 2010, 6:24 AM
This is a good question. Where is the SQLite support? I realize that SQLite is not supported in every mobile browser, but the standard browser installed on iPhone and Android is mobile webkit with SQLite support. Even BlackBerry will have it available for 6+. There is a need for SQLite other than key value pairs with a more robust data storage option on a phone. Maybe Sencha has this on their road map? I would consider this a key feature for the 1.0 release as this will be a decision for those purchasing a license vs. using JQtouch and pure JavaScript as a alternative to reaching their goal.

lukeHeather, I wouldn't ever trust the client. There is no encryption that I know of available for client side SQLite storage. But that isn't much of a concern if we consider that the phone is locked, the mobile browser is in a sandbox and the data they type in is their's. Trust the user vs don't trust the user. If there is encryption a like to an example would be appreciated.

Can SQLite mobile store a BLOB(file)? If so a link to an example would be appreciated.

28 Sep 2010, 3:08 AM
From what I've learned from Sencha, there is no dirrect support to sqlite database.
You have to use a php script and then call it in ajax to use sqlite database in the mobile.

But from the need of lukeHeather123, it should just use a simple localstorage with synch.

28 Sep 2010, 11:49 PM
Thank you for your replies. I'll try all the suggestion posted and post back if something comes up.

29 Sep 2010, 3:23 AM
Take a look at the form demo by tomalex in the showcase section of the forum. It uses the browser database.