Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Get started with cordova-spatialite-storage #16

Open
Alma9170 opened this issue May 15, 2020 · 2 comments
Open

Get started with cordova-spatialite-storage #16

Alma9170 opened this issue May 15, 2020 · 2 comments

Comments

@Alma9170
Copy link

Alma9170 commented May 15, 2020

Hi,
I am developing a cordova app for android working with spatial data. For processing spatial data I am trying to use cordova-spatialite-storage plugin. Following plugin's
documentation, first of all, I added plugin to my project, then placed my Db.sqlite in my device (file:///storage/emulated/0/Download/DB.sqlite). at last, I executed a simple query as follows:
query = 'SELECT Geometry FROM myTable LIMIT ?';
var args = [20];
var querySuccess = function(results) { } var queryError = function(error) {
alert(error)
}
var spatialiteURI = "file:///storage/emulated/0/Download/DB.sqlite";
var db = window.sqlitePlugin.openDatabase({name: spatialiteURI}); db.transaction(function(tx) { tx.executeSql(query, args, querySuccess, queryError); })

But the only thing I've got is alert(error) in queryError function (please see attached picture).
It's worth mentioning, I am using Framework7 as javascript framwork in my project.

Can you please help me what's wrong with my code?Thank you for any help you can offer.

20200516_001714

@KimberleeDArmstrong
Copy link

I was having the same problem. This version fixed it for me. Good Luck!

cordova plugin add https://github.com/DisyInformationssysteme/Cordova-spatialite-storage#06762c59b5bb6d8ee402dea64c942a4d84623cb9

@Alma9170
Copy link
Author

Alma9170 commented Jun 16, 2020

I was having the same problem. This version fixed it for me. Good Luck!

cordova plugin add https://github.com/DisyInformationssysteme/Cordova-spatialite-storage#06762c59b5bb6d8ee402dea64c942a4d84623cb9

thanks!
I am using cordova-spatialite-storage version 2.0.0 (the latest version) but the plugin can't find my database file.
I think there is something wrong with database name I am using in my code as follows:
var spatialiteURI = "file:///storage/emulated/0/Documents/DB.sqlite";
var db = window.sqlitePlugin.openDatabase({ name: spatialiteURI });

In addition, In case I use a name like "DB.sqlite" the plugin will create a new database.
Is my way of defining database name option wrong ?Or is there another way to do this?
It is so critical for me to process spatial data in my app. So any help make this plugin work is so appreciated.
Thanks in advance.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants