If it is possible to use SQLite in Sencha Touch 2 applications?

I would like to make a Sencha Touch 2 application, and I need to use client-side data storage. So, if there is a way to use SQLite Database or the same alternative? My application should work if the user does not have Internet access and the user can do CRUD on the data. When the device establishes an Internet connection, the application must synchronize the client database (SQLite) with the server database.

+4
source share
2 answers

There are two possibilities that I think.

The first works with WebSQL. This is similar to a SQL database. But it is deprecated in favor of indexedDb (which is currently not available for mobile browsers).

There is a plugin for WebSQL and Sencha Touch 2. https://github.com/grgur/Ext.data.proxy.WebSQL

The second feature ist works with LocalStorage. You can hide your data directly using the repository and localstorage proxy. But this is not a SQLite database, but I think you can use it for your problem.

Sencha Docs: http://docs.sencha.com/touch/2-1/#!/api/Ext.data.proxy.LocalStorage

+2
source

The latest version of Sencha Touch (2.1) has built-in Web SQL support through the Ext.data.proxy.Sql class.

This provides official Web SQL support. However, it has virtually no documentation and is rather painful to use. Good starting point here: http://druckit.wordpress.com/2012/11/16/using-the-sencha-touch-2-1-sql-proxy/

I myself used it for the project and found that it does not give errors when a problem occurs. As an example, I had a problem when I sealed a sort declaration (which seems to be required, but not documented as such), and it stopped working. There were no errors. After about 5 hours, I found out the problem and it started working again.

This is painful, but it will do the job for a complete database repository.

+1
source

All Articles