首页 > 数据库技术 > 详细

JS html5 操作SQLite

时间:2015-01-06 10:07:15      阅读:444      评论:0      收藏:0      [点我收藏+]
//执行查询
	
	$("#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>}); 
	});

JS html5 操作SQLite

原文:http://blog.csdn.net/whx405831799/article/details/42428511

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