入门客AI创业平台(我带你入门,你带我飞行)
博文笔记

JS html5 操作SQLite

创建时间:2015-01-05 投稿人: 浏览次数:1530
//执行查询
	
	$("#btnSQL").tap(function(){
 	<span style="white-space:pre">	</span>var db = openDatabase("mydb", "1.0", "Test DB", 2 * 1024 * 1024); 
 		db.transaction(function (tx) {            
     		<span style="white-space:pre">	</span>tx.executeSql("CREATE TABLE IF NOT EXISTS testHtml (id unique, contentText)");
     		<span style="white-space:pre">	</span>tx.executeSql("INSERT INTO testHtml (contentText) VALUES ("insert data test1!")"); 
      		}); 
      	 <span style="white-space:pre">	</span>db.transaction(function(tx){           
     		tx.executeSql("SELECT * FROM testHtml",[],function(tx,result){
           <span style="white-space:pre">		</span>var len=result.rows.length;
          	<span style="white-space:pre">	</span>app.alert(len);
    		<span style="white-space:pre">	</span>var str=result.rows.item(0);
    		<span style="white-space:pre">	</span>app.alert(str.contentText);
        <span style="white-space:pre">	</span>},null);
     <span style="white-space:pre">		</span>}); 
	});

声明:该文观点仅代表作者本人,入门客AI创业平台信息发布平台仅提供信息存储空间服务,如有疑问请联系rumenke@qq.com。
  • 上一篇:没有了
  • 下一篇:没有了
未上传头像