jquery - SQLIte insertion looping trough text -
hi trying import pieces of long text sqlite table have following problem.
i use bellow code in order read long text stored in test db.
var mycollectoridlength = 0, mybill, line = 0; notesdb.transaction(function(t) { t.executesql('select * billtest;', [], function(t, bulkdata){ mybill = bulkdata.rows.item(0);
and loop through long text , try insert pieces of db.
for (i = 1; <= ((mybill.testtext.length)/126); += 1) { alert(line) // alerts 1, 126, 252 ... t.executesql('insert or ignore buildings (buildingcode, buildingaddress, buildingcollect, buildingpay) values (?,?,?,?);', [mybill.testtext.substr((line+0), 5).trim(), mybill.testtext.substr((line+44), 40).trim(), 0, 0], function(){ alert(line) // alerts 10962 (87 * 126) }); line = * 126; }
but line inside executesql not sync loop. sqlite insertion executed after loop. how can solve it???
Comments
Post a Comment