我正在使用html5sql javascript库(html5sql.js)来加速使用Phonegap在Android上的多个HTML5数据库插入。 Android 2.X似乎非常快(1秒内1000行)但Android 3.X和4.X(几分钟内1000行)速度非常慢。有谁知道解决方案?
我的代码片段:
sqlStatements = 'INSERT INTO table ("id","data") VALUES("' + id + '", "' + data + '"); INSERT INTO ... ' // 1 thousand inserts
html5sql.openDatabase(
"dbase",
"dbase",
3*1024*1024);
html5sql.process(
//This is the text data from the SQL file you retrieved
sqlStatements,
function(){
// After all statements are processed this function will be called.
console.log("success ");
},
function(error){
// Handle any errors here
console.log("error " + error);
}
);
答案 0 :(得分:0)
尝试运行“PRAGMA synchronous = OFF; PRAGMA count_changes = OFF; PRAGMA journal_mode = MEMORY; PRAGMA temp_store = MEMORY;”在第一次sql查询之前