Note that there are some explanatory texts on larger screens.

plurals
  1. POSave big array into Sqlite database with javascript
    primarykey
    data
    text
    <p>I scrap data on the web with a Google Chrome extension. I store them in an multidimensional array. I want to save all theses data in a Sqlite database. </p> <p>I read this page <a href="https://stackoverflow.com/questions/3930741/how-to-speed-up-the-process-when-inserting-1000s-of-records-into-sqlite-using-h/3956658#3956658">How to speed up the process when inserting 1000&#39;s of records into sqlite using HTML5</a> but the answer given does not seem to work.</p> <p>When I open a transaction for each <strong>INSERT</strong> it works</p> <pre><code>i=0; while(i&lt;n){ (function(aa){ db.transaction(function (tx) { tx.executeSql("INSERT INTO Links2 (c1, c2, c3, c4, c5, c6) VALUES ('"+aa[0]+"', "+parseInt(aa[1])+", '"+parseInt(aa[2])+"', '"+aa[3]+"', '"+aa[4]+"', '"+aa[5]+"')"); }); })(myDataArray[i]); i++; } </code></pre> <p>The problem is when I try to opening the transaction before the <strong>While</strong></p> <pre><code>db.transaction(function (tx) { i=0; while(i&lt;n){ aa = myDataArray[i]; txquer(tx, i, aa[0], parseInt(aa[1]), parseInt(aa[2]), aa[3], aa[4], aa[5]); i++; } }); function txquer(tx,i,a,b,c,d,e,f){ console.log("INSERT INTO Links2 (c1, c2, c3, c4, c5, c6) VALUES ('"+a+"', "+b+", '"+c+"', '"+d+"', '"+e+"', '"+f+"')"); tx.executeSql("INSERT INTO Links2 (c1, c2, c3, c4, c5, c6) VALUES ('"+a+"', "+b+", '"+c+"', '"+d+"', '"+e+"', '"+f+"')"); } </code></pre> <p>When I test individually every console.log output I works. But the script does not save the data in the database.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload