vendredi 4 décembre 2015

Get number of columns or check if column exists in a table without using Pragma

I need to find whether a column in a table exists in WebSQL DB of a Cordova Project. Tried something like this to check if a column exists by getting number of columns:

 db.transaction(function(tx) {
                                        var selectStatement = "pragma table_info(Policy)";
                                        tx.executeSql(selectStatement,[],function(tx, result) {
                                                      dataset = result.rows;
                                                      var length = dataset.length;
                                                      console.log("TEST ------>>>"+length);

                                                      });
                                        });

The above query is not returning any result. Is there any other way to achieve the same.?

Aucun commentaire:

Enregistrer un commentaire