zoukankan      html  css  js  c++  java
  • html5_websql

    var db = openDatabase('mydb', '1.0', 'Test DB', 2 * 1024 * 1024);
     var msg;
     db.transaction(function (tx) {
        tx.executeSql('CREATE TABLE IF NOT EXISTS LOGS (id unique, log)');
        tx.executeSql('INSERT INTO LOGS (id, log) VALUES (1, "foobar")');
        tx.executeSql('INSERT INTO LOGS (id, log) VALUES (2, "logmsg")');
        msg = '<p>Log message created and row inserted.</p>';
      console.log(msg);
     });
     db.transaction(function (tx) {
        tx.executeSql('SELECT * FROM LOGS', [], function (tx, results) {
        var len = results.rows.length, i;
         msg = "<p>Found rows: " + len + "</p>";
         console.log(msg);
        for (i = 0; i < len; i++){
           msg = "<p><b>" + results.rows.item(i).log + "</b></p>";
           console.log(msg);
         }
     }, null);});
  • 相关阅读:
    多线程编程核心技术(五)死锁
    SELinux详细配置
    Linux实现RAID
    iSCSi的基本配置
    文本超出省略号之前后省略号实现
    对象冻结
    条件判断的优美写法
    使用VConsole
    重绘和重排(回流)
    移动端rem布局
  • 原文地址:https://www.cnblogs.com/shidengyun/p/5497823.html
Copyright © 2011-2022 走看看