I am using this plugin in my ionic project. I am able to open the db. I can see the log:
DB opened: test.db
I created a brand new db using SQL Lite Manager (a firefox plugin) and a table called Products. I then copied the db over to my www folder of my xcode project. I noticed that the extension was called .sqlite, I renamed it to .db. Hopefully that did not create any issues.
Now whenever I try to query that table I get a "No Such Table" - Code 5. I am not sure what that means. The table exists. I tried lower case, upper case etc.., but nothing seems to work.
XCode log window shows me the below log entry, so I assume that its able to find the DB.
open full db path: /var/mobile/Containers/Data/Application/397075D2-943E-40DC-B076-5C0B5B7D1F42/Documents/test.db
Here is my code:
var db = $cordovaSQLite.openDB("test.db", 1);
var query = "SELECT * FROM 'main'.'Products'";
$cordovaSQLite.execute(db, query).then(function (res)
{ ... });
The second question is how do I check if I was able to open the db successfully from js?
Aucun commentaire:
Enregistrer un commentaire