How to speed up the process when inserting 1000's of records into sqlite using HTML5

后端 未结 5 1957
[愿得一人]
[愿得一人] 2021-01-13 09:58

Iam new to developing HTML5 applications. In this I want to insert 1000\'s of records into sqlite database using HTML5. This process is very slow. How to use BEGIN/COMMIT be

5条回答
  •  攒了一身酷
    2021-01-13 10:20

    You already have the code to place your 1000 inserts inside a single transaction. For some reason it is commented out. Remove the comments and you are done!

    db.transaction(function(tx){tx.executeSql("BEGIN",[]);});
    for(var i=0;i<1000;i++)
    {
        txquer(i,"test");
    }
    db.transaction(function(tx){tx.executeSql("COMMIT",[]);});
    

提交回复
热议问题