mardi 3 février 2015

How to get table names in sqllite database

I am using cordova + angular js for developing the mobile app. For creating this POC I am using this SQL tutorial. Now I want to fetch tables name from sqllite db. for this I write below code.



vm.tableName = function(){
var query = "SELECT * FROM sqlite_master WHERE type=?";
$cordovaSQLite.execute(db, query, ['table']).then(function(res) {
alert("res "+JSON.stringify(res));
}, function (err) {
alert("err "+JSON.stringify(err));
});
}


I can successfully read and write data in db, but I can't fetch the table names. I think, I miss something, but I get related answer but it not work for me link. And I don't understand how to attach db. I get some response from db when I run the above code.


enter image description here


Aucun commentaire:

Enregistrer un commentaire