Hi, I have a problem to pre-populate a database with cordova-sqlite-ext, the database is imported well, but when I make a query with db.executeSql the app stops.
I have:
cli packages:
@ionic/cli-utils : 1.6.0
ionic (Ionic CLI) : 3.6.0
System:
Android SDK Tools : 25.2.5
Node : v6.9.5
OS : Windows 10
npm : 4.6.1
What I do is create a project from scratch with the utter versions of ionic and the plugins I use, what I did was:
-
ionic start test
-
ionic cordova platform add android
-
cordova plugin add cordova-sqlite-ext --save
-
npm install --save @ionic-native/sqlite
-
In app.module.ts
- import { SQLite } from ‘@ionic-native/sqlite’; …
-
ionic generate provider database
- This is the code I have inside the povider
- This is the code I have inside the povider
-
ionic cordova run android -l -c
There are two problems:
1- My provider is never executed
Solution: I import it inside the app.component.ts
2- When the app opens, stop after reading my provider, I try without the query executeSql and it works without launching error, when I just put the executeSql stops the app, although I reopened it.
Verify that the database was imported correctly, since I did this:
- adb shell
- run-as io.ionic.starter
- cd databases
- sqlite3 database.db
- select nombre from fuerzas;
I had data in that table.
What I need is a fast pre-populated database.
If someone can help me I would appreciate it very much, thanks.