Help with Sqlite Plugin and Persistance


#1

Hi, i’m trying to use sqlite Plugin for my app (currently only on iOS). i’ve built a custom scanner using https://github.com/litehelpers/Cordova-SQLitePlugin.git#51e27dbef64f617fe5dddacc79ed44e3a88b93b9

sqlite plugin seems working, i create tables and insert rows, but if i close and reopen the simulator the sqlite db gets deleted and the plugin opens a new empty db. has anyone experienced something similar?
i open the db with
db = window.sqlitePlugin.openDatabase({name: dbName, iosDatabaseLocation: ‘default’}

am i doing something wrong?
thanks!


#2

Can you try this on a device, and not the simulator ?

Otherwise, you may want to ask on the plugin github, as it may be a plugin specific thing.


#3

At the moment i can’t test it on a device :frowning:
i’m asking here because the linked git commit url is an old commit and is the only one that i found that works inside the cloud builder of appgyver:

using cordova-sqlite-storage the build fails with:

Adding plugin from: https://github.com/litehelpers/Cordova-sqlite-storage.git
Uh oh!
cannot find “/Users/administrator/app-builder/STAGING/client/cordova/plugins/cordova-sqlite-storage/node_modules/cordova-sqlite-storage-dependencies/sqlite3.c” ios

using cordova-sqlite-legacy-build-support the build fails with:

User defaults from command line:
IDEDerivedDataPathOverride = /Users/administrator/app-builder/STAGING/client/build/Debug-iphoneos

Build settings from command line:
CODE_SIGN_IDENTITY = iPhone Developer: [omitted]
OTHER_CODE_SIGN_FLAGS = --keychain /Users/administrator/Library/Keychains/AppGyver-Testing
PROVISIONING_PROFILE = [omitted]
SDKROOT = iphonesimulator8.1

2016-11-28 14:15:03.245 xcodebuild[12817:52892] CFPropertyListCreateFromXMLData(): Old-style plist parser: missing semicolon in dictionary on line 1888. Parsing will be abandoned. Break on _CFPropertyListMissingSemicolon to debug.
2016-11-28 14:15:03.260 xcodebuild[12817:52892] CFPropertyListCreateFromXMLData(): Old-style plist parser: missing semicolon in dictionary on line 1888. Parsing will be abandoned. Break on _CFPropertyListMissingSemicolon to debug.
2016-11-28 14:15:03.263 xcodebuild[12817:52892] The data couldn’t be read because it isn’t in the correct format.
— xcodebuild: WARNING: Unable to open project file ‘/Users/administrator/app-builder/STAGING/client/AppGyver.xcodeproj’ in workspace ‘AppGyver.xcworkspace’.
xcodebuild: error: The workspace ‘AppGyver’ does not contain a scheme named ‘Scanner Simulator’.

using cordova-sqlite-evplus-legacy-free the build is completed but trying it i have troubles in using it (like failing silently instead of returning values, i can’t make console.log of results neither errors, but the db seems open…)

is anyone using the sqlite plugin in appgyver? what version are you using of the plugin?


#4

I can’t help you with this because I never used the plugin.

I don’t think that anyone will help with this, the community (and the appgyver team) don’t browse this forum to help anymore.

You could try to search directly the forum, and ask directly on the similar threads for help (that would send notifications to the followers)

The simpler thing to do is to do a sample app that you could try on a physical device (even if it’s an Android device) so you could debug and see what will happen on a device.

Concerning the build logs, you may want to contact appgyver team via email, they may help you (faster) like this.


#5

Thank You Amine!

I resolved opening the db in this (old) way:

db = window.sqlitePlugin.openDatabase({name: dbName, location: 1}

now the database seems persistent, anyway i’m using an old version of the plugin and this isn’t very good…

i wrote to Harry via e-mail about the build logs, but he can’t help me (at least until i use the free plan…)

maybe i’ll check for updates in the future