cordova - Ionic PouchDb Sqlite plugin issue -
we exploring ionic, pouchdb , couchdb solution 1 of our requirement need build mobile app can provide offline sync functionality , platform agnostic.
one of other major requirement have, data in offline mode persistence in nature , can grew more 500 mb , since pouchdb going use indexeddb / websql adapters etc. store data in offline mode, has size limitation in mobile , web platform , data not persistence in nature.
then came across article in pouchdb site itself:
where can use sqlite plugin cordova , can write like:
to force pouchdb use sqlite plugin.
var db = new pouchdb('mydb', {adapter: 'websql'});
but when test code using following code check whether websql adapter using sqlite plugin or not, both in android (chrome remote debugging) , web platform.
db.info().then(console.log.bind(console));
the sqlite_plugin returning false , not creating .db files. though pouchdb , couchdb sync 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 , mentioned
the sqlite plugin not pass pouchdb test suite. tends slower direct indexeddb/websql. recommend avoiding sqlite plugin, unless hitting 50mb storage limit in ios or require native or preloaded access database files.
i have used following command install sqlite plugin:
cordova plugin add https://github.com/brodysoft/cordova-sqliteplugin.git
here ionic version information: click see ionic version information using me.
pouchdb version: 5.2.0
i highly appreciate if can me solve issue. in advance.
there demo of a cordova app using pouchdb , sqlite plugin. need make sure sqlite plugin <script>
loaded before pouchdb <script>
.
that said, if app data 500mb (half gb!), recommend against using pouchdb. if not using sync, pouchdb has overhead revision structure , run slowly.
you better off directly using sqlite plugin. hope helps!
Comments
Post a Comment