Sencha Touch 2 アプリケーションを作成したいのですが、クライアント側のデータ ストレージを使用する必要があります。それで、SQLite データベースまたは同じ代替手段を使用する方法がある場合は? ユーザーがインターネットにアクセスできず、ユーザーがデータに対して CRUD を実行できる場合、私のアプリケーションは機能する必要があります。デバイスがインターネット接続を確立すると、アプリケーションはクライアント側データベース (SQLite) をサーバー側 DB と同期する必要があります。
2 に答える
チャンスは2つあると思います。
1 つ目は、WebSQL の使用です。SQL データベースのようなものです。しかし、indexedDb (モバイル ブラウザーでは現在利用できません) を優先して廃止されました。
WebSQL と Sencha Touch 2 用のプラグインがあります。 https://github.com/grgur/Ext.data.proxy.WebSQL
2 つ目の機会は、LocalStorage を使用することです。ストアと「localstorage」プロキシを使用して、データを直接 CRUD できます。しかし、それは SQLite データベースではありませんが、問題に使用できると思います。
Sencha ドキュメント: http://docs.sencha.com/touch/2-1/#!/api/Ext.data.proxy.LocalStorage
The latest version of Sencha Touch (2.1) has built-in support for Web SQL via the Ext.data.proxy.Sql class.
This provides official support for Web SQL. However, it has virtually no documentation and is quite painful to use. A good starting point is here: http://druckit.wordpress.com/2012/11/16/using-the-sencha-touch-2-1-sql-proxy/
I have been using it myself for a project and have found that it doesn't provide errors when there is a problem. As an example, I had an issue where I misspelled a sort-by declaration (which are apparently required but not documented as such) and it stopped working. No errors were displayed. After about 5 hours, I figured out the issue and it started working again.
It is painful but it will get the job done for full DB local storage.