mercredi 27 janvier 2016

Ionic PouchDb SQLte plugin issue

We are seriously exploring Ionic, PouchDb and CouchDb as a solution to one of our requirement where we need to build a mobile app which can provide offline sync functionality and also to be platform agnostic.

One of the other major requirement we have, that the data in offline mode would be persistence in nature and can grew more than 500 MB and since PouchDb is going to use IndexedDB / WebSQL adapters etc. to store data in offline mode, it has certain size limitation in mobile and web platform and also the data is not persistence in nature.

Then I came across this article in pouchdb site itself:

http://ift.tt/1HU7ur8

Where you can use SQLite plugin for Cordova and you can write something like:

To force the PouchDb to use SQLite plugin.

var db = new PouchDB('myDB', {adapter: 'websql'});

But when I test the code using following code to check whether WebSql adapter is using SQLite plugin or not, both in Android (chrome remote debugging) and web platform.

db.info().then(console.log.bind(console));

The sqlite_plugin is always returning false and also it is not creating any .db files. Though PouchDb and CouchDb sync is working fine.

Object {doc_count: 5, update_seq: 42, sqlite_plugin: false, websql_encoding: "UTF-8", db_name: "birthdays"…}
1.  adapter: "websql"
2.  auto_compaction: false
3.  db_name: "testDb"
4.  doc_count: 5
5.  sqlite_plugin: false
6.  update_seq: 42
7.  websql_encoding: "UTF-8"
8.  __proto__: Object
And also it mentioned

The SQLite Plugin does not currently pass the PouchDB test suite. It also tends to be slower than direct IndexedDB/WebSQL. We recommend avoiding the SQLite Plugin, unless you are hitting the 50MB storage limit in iOS or you require native or preloaded access to the database files.

I have used following command to install the SQLite plugin:

cordova plugin add http://ift.tt/1s13J1g

Here is Ionic version information: Click to see the Ionic version information currently using by me.

PouchDB version: 5.2.0

I would highly appreciate if someone can help me to solve this issue. Thanks in advance.

Aucun commentaire:

Enregistrer un commentaire