解决方法@H_404_9@
var db = openDatabase('dbname','dbversion 1.0','description',64*1024);
db.transaction(function (query){
query.executesql('CREATE TABLE IF NOT EXISTS tablename (id unique,value)');
var rows = 10000,i;
for(i=0; i < rows; i++){
query.executesql('INSERT INTO tablename (id,value) VALUES ('+ i + ',"Stackoverflow")');
}
query.executesql('SELECT * FROM tablename',[],function (query,results) {
for (i = 0; i < 5; i++) {
alert(results.rows.item(i).text);
}
});
});
//Do magic with your webapp now
接受的查询是SQLite类型.查看official specification了解更多信息.
var db = openDatabase('dbname','dbversion 1.0','description',64*1024); db.transaction(function (query){ query.executesql('CREATE TABLE IF NOT EXISTS tablename (id unique,value)'); var rows = 10000,i; for(i=0; i < rows; i++){ query.executesql('INSERT INTO tablename (id,value) VALUES ('+ i + ',"Stackoverflow")'); } query.executesql('SELECT * FROM tablename',[],function (query,results) { for (i = 0; i < 5; i++) { alert(results.rows.item(i).text); } }); }); //Do magic with your webapp now
接受的查询是SQLite类型.查看official specification了解更多信息.