首页 > 数据库技术 > 详细

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

时间:2014-03-12 15:57:05      阅读:559      评论:0      收藏:0      [点我收藏+]

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

bubuko.com,布布扣
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);
            })
        }
    })
})
bubuko.com,布布扣

html5 webDatabase 存储中sql语句执行可嵌套使用,布布扣,bubuko.com

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

原文:http://www.cnblogs.com/wshiqtb/p/3595920.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!