凤凰台上凤凰游,凤去台空江自流。吴宫花草埋幽径,晋代衣冠成古丘。三山半落青天外,二水中分白鹭洲。总为浮云能蔽日,长安不见使人愁。

html5 webDatabase 存储中sql语句执行可嵌套使用

html5 webDatabase 存储中sql语句执行可嵌套使用,代码如下:

var data = window.openDatabase("stu","1.0","stu database",1024*10);
data.transaction(function(tx){
    tx.executeSql("create table if not exists news (id, title)");
    tx.executeSql("select * from news where id = '1'",[],function(tx,result){
        console.log("成功"+result.rows.length);
        if(result.rows.length == 0){
            tx.executeSql("select * from news where id = '123456'",[],function(tx,result){
                console.log("成功2"+result.rows.length);
            })
        }
    })
})

 

posted @ 2014-03-12 11:19  天兵Q  阅读(794)  评论(0编辑  收藏  举报