A Cordova/PhoneGap plugin to open and use sqlite databases on Android/iOS/Windows Universal(8.1)/WP(7/8) with HTML5/Web SQL API
Hello, I am a newbie who is trying to upgrade an old Cordova IOS app. I need a suggestion on whether Cordova-sqlite-storage plugin is the fix for my issue. Issue: I do need to access the database which is already existing. The old code consists of a function which tries to get the database and it looks like :
NSArray *libraryPaths = NSSearchPathForDirectoriesInDomains
(NSLibraryDirectory, NSUserDomainMask, YES);
NSString *libraryDir = [libraryPaths objectAtIndex:0];
masterPath = [libraryDir stringByAppendingPathComponent:@"Caches/"];
databasePath = [libraryDirstringByAppendingPathComponent:@"Caches/file__0/"]; masterFile = [masterPath stringByAppendingPathComponent:masterName];
databaseFile = [databasePath
stringByAppendingPathComponent:databaseName];
// Execute the "checkAndCreateDatabase" function
[self checkAndCreateDatabase];
NSUserDefaults* appPreferences = [NSUserDefaults standardUserDefaults];
NSBundle* mainBundle = [NSBundle mainBundle];
...........
.........
I am facing the an error: sqlite prepare statement error - no such table
when I run the app. Should I use the Cordova-sqlite-storage plugin instead of using this code. Please correct me if I am missing anything.
Documents
if it does not already exist there. This is very similar to how the pre-populated database functionality works.
Hi again! I have now made some more testing, and I got ”PRAGMA AUTO_VACUUM = 1;” to work by executing ”VACUUM;” directly after the auto_vacuum statement is executed. This is (?) a bug and I will file an issue on it.
I using an iOS 8.4 simulator. The open parameters are "window.sqlitePlugin.openDatabase({name: db_name, location: 2, createFromLocation: 1});”.
I downloaded the zip file from that site (the link is at the top right), then extracted the two files in the folder (src/android/libs) and placed them in the project's libs directory. Then, I refreshed the project.
As the error kept going, he told me to "Make sure you removed sqlite-native-driver.jar". I deleted that file from the libs directory, refreshed the project, and The following error.