Closed dhruvsingh50 closed 4 years ago
I'm having exactly the same issue!
Hi @dhruvsingh50. Do you find any solution for this?
I hope this helps you. SQLite Plugin does not work on the browser. Until I tested it with my iOS device and made a few slight changes to my code it worked perfectly, but only on a real device. This is what I changed on my code:
PouchDB.plugin(SQLitePlugin);
this.db = new PouchDB(this.name, {
adapter: 'cordova-sqlite',
iosDatabaseLocation: 'Library',
androidDatabaseImplementation: 2
});
^ This is the right solution. SQLite plugin 2 runs in a WebView, not in a browser.
Hi, I have installed the /cordova-plugin-sqlite-2 but still getting this error.
PouchDB error: you must install a SQLite plugin in order for PouchDB to work on this platform. Options:
if (typeof cordova === 'undefined' || (typeof sqlitePlugin === 'undefined' && typeof openDatabase === 'undefined')) ---> this line is giving error
My code :
console output:
app-logs: LogStorage db: PouchDB adapter: "cordova-sqlite" auto_compaction: undefined name: "app-logs" prefix: "pouch" taskqueue: TaskQueue$1 {isReady: true, failed: false, queue: Array(0), db: PouchDB} type: ƒ () __opts: {adapter: "cordova-sqlite", name: "app-logs"} _adapter: "cordova-sqlite" _allDocs: ƒ (opts, callback) _bulkDocs: ƒ (req, reqOpts, callback) _cachedViews: {{"fields":{"pd_index":"asc","pd_type":"asc"}}_countundefined: t} _changes: ƒ (opts) _close: ƒ (callback) _destroy: ƒ (opts, callback) _doCompaction: ƒ (docId, revs, callback) _events: {destroyed: Array(1), closed: ƒ} _get: ƒ (id, opts, callback) _getAttachment: ƒ (docId, attachId, attachment, opts, callback) _getLocal: ƒ (id, callback) _getRevisionTree: ƒ (docId, callback) _id: ƒ () _info: ƒ (callback) _maxListeners: undefined _name: "app-logs" _putLocal: ƒ (doc, opts, callback) _remote: false _removeLocal: ƒ (doc, opts, callback) replicate: (...) proto: AbstractPouchDB