Closed Sin- closed 7 years ago
maybe wrong adapter gets used? I thought you could check it with db.info();
Yes, can you provide more steps to reproduce? Also db.adapter
is another way to figure out which adapter you're using.
Actually, I followed this nice tutorial step by step and then replaced the original sqlite plugin with this one:
http://gonehybrid.com/how-to-use-pouchdb-sqlite-for-local-storage-in-your-ionic-app/
I specifically ask my db to use websql with:
_db = new PouchDB('birthdays', {adapter: 'websql'});
I have not yet tested the db.info(), I'll test it this evening.
Here is my return of db.info()
:
{ "do_count":" 2, "update_seq": 2, "websl_encoding": "UTF-8", "db_name": "contacts", "auto-compaction": false, "adapter": "websql" }
Shouldn't there be a sqlite_plugin
field?
I also used this to make sure sqlite is working, and it does nothing...
document.addEventListener('deviceready', function() { window.sqlitePlugin.echoTest(function() { console.log('ECHO test OK'); }); });
I think it evens crashes the app, so it seems the sqlite plugin is in fact not wroking...
Ok, I fixed the persistence issue I had a problem with my get function. But I'm still bothered by this missing sqlite_plugin field missing. It surely means I'm not using sqlite. Do you think I can rely solely on the persistence of PouchDB with websql or cordova sqlite is preferred? This is going to be an offline contacts manager and losing the data would be critical...
websql is persistent but there is a 5mb limit on ios. Yes, should be something with sqlite. try remove the plugin, remove the platform ios. add again platform ios and add again the plugin.
I tried removing the platform, reinstalling it, removing the plugin and the platform, reinstalling the platform and the plugin in every order imaginable. Still no sqlite_plugin field...
Then try to create the local db with the option {adapter: 'cordova-sqlite'}
Just tried it, nothing changes... I checked I included the pouchdb.cordova-sqlite.js file after pouchdb.js file in the index and everything seems good but I still don't have the sqlite_plugin field in the db.info(). It must be a SQLite problem, but I just can't see why it doesn't work...
@Sin- I just checked that tutorial; it is out of date and provides instructions for PouchDB 5. In PouchDB 6 you now have to use pouchdb-adapter-cordova-sqlite.
db.info()
will not tell you if you're using cordova-sqlite anymore, but db.adapter
will. Sorry for the confusion.
Please follow these directions: https://github.com/nolanlawson/pouchdb-adapter-cordova-sqlite
Indeed! I already followed these instructions, but never thought about printing the output of dB.adapter as I read everywhere it wouldn't work, but it does! It returns 'cordova-sqlite'. Thanks for the help now I can continue the development =)
Awesome. Thanks!
As the title suggests, I can't seem to make my data persistent on iOS with PouchDB. PouchDB with the websql adapter seems to work fine, I can create an item and get it back but if I quit the app, and launch it back, my data is gone. I was previously using cordova-plugin-sqlite before discovering this one. I thought this was my problem and replaced it with this one, but the problem is still here, do you have any idea? Thanks!