PDA

View Full Version : How to store data into sqlite db from sencha touch java script and Html



bala7k
4 May 2011, 5:22 AM
:) Hi

I am new to sencha touch framework.

Can any one help me how to call local sqlite database and store data using Sencha touch java script.

please give me sample code.

Thanks
bala

ssk_hari
17 May 2011, 11:11 PM
Hi bala ... am also facing the same challenge ... Did you get any information on the same ? Could you please share it ...

Thanks,
Hari.

jmclem
18 May 2011, 11:12 PM
Hi,

AFAIK, sencha touch does not support sqlite storage.

However, PhoneGap does, refer to http://docs.phonegap.com/phonegap_storage_storage.md.html . You will though not be able to use the datamanagement of Sencha, as there is no proxy for this (again: AFAIK). This means too that you may miss some functionalities (example: configuring a list view with a data storage so that the list gets automatically filled with the DB data)

Writing a sencha touch proxy for phonegap sqlite may be a solution, maybe not quite easy.

If you're new to Sencha Touch, I would think twice about this...

Why do you want sqlite?

Jean-Marie.

ssk_hari
19 May 2011, 1:09 AM
We had used JSON data for a prototype. Now, we think of taking the prototype to next level on a bigger scale. So, just exploring if SQLite can be used a data repository since it is an embedded DB ...
As u said, will explore possibility of using PhoneGap instead sencha . Are you sure that whatever proxies that we use in Sencha won't work with PhoneGap ... Am concerned since I have used Proxy to read data from JSON's ....

kortovos
19 May 2011, 1:40 AM
Sqlite is superious to localstorage in every sense. Its potential size isn't limited to 5 mb, it supports asynchronous calls and it doesn't have the bugs that localstorage does (http://www.sencha.com/forum/showthread.php?132952-localstorage-doesn-t-save-all-data)

Try this tutorial
http://blog.maxaller.name/2010/03/html5-web-sql-database-intro-to-versioning-and-migrations/

You will need to program the link between the db and store yourself. I am currently working on a plugin of a store that uses web sql db's to save data, but can be used like a localstorage store (apart for the asynchronous calls)

jmclem
19 May 2011, 1:47 AM
Hi ssk_hari,

PhoneGap and Sencha do complementary things: PhoneGap interfaces to the device, and STouch helps you build your app on top of this.

The 'model' part theoretically belongs to the STouch part.

As for SQLite, this is slightly shifted: STouch does not provide it, but PhoneGap does. As a consequence, sqlite is not integrated in the STouch application framework.

I don't know of any bridge in this case, which would let STouch access the PhoneGap sqlite functionality through a proxy.

But maybe somebody already wrote one?

Jean-Marie.

tomalex0
11 Sep 2011, 11:54 PM
Just an update

Please have a look into http://www.sencha.com/forum/showthre...65-SqliteProxy (http://www.sencha.com/forum/showthread.php?146465-SqliteProxy)

I have started with sqliteproxy :)