Am trying to check in the select query if the provided data in the where cause exist then alert the data exist else alert data dose not exist but am not getting how to achieve that.
var db = openDatabase("demo", "1.0", "demo", 200000);
db.transaction(function(tx) {
tx.executeSql( "CREATE TABLE IF NOT EXISTS test (Slno INTEGER PRIMARY KEY AUTOINCREMENT, column1 TEXT UNIQUE, column2 TEXT UNIQUE, column3 TEXT UNIQUE, column4 TEXT UNIQUE, column5 TEXT UNIQUE)");
},errorHandler);
db.transaction(function(tx) {
tx.executeSql("INSERT INTO test (column1, column2 ,column3, column4,column5) VALUES ('insert1','insert2','insert3','insert4','insert5');");
},errorHandler);
Select Query
db.transaction(function(tx) {
tx.executeSql("SELECT * FROM test where column1='insert1'");
},errorHandler,successHandler);
function errorHandler(error) {
alert("Error : " + error.message);
}
function successHandler (transaction, resultSet) {
alert(resultSet.length);
}
Aucun commentaire:
Enregistrer un commentaire