You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Review #2349 for code improvements: UPDATE, DELETE and INSERT on ? build a temporary table each run #2682
This is not a bug report. It is an invitation to look at #2349 again, because it makes UPDATE ?, DELETE FROM ? and INSERT INTO ? work by building a temporary table on every run. The goal is to understand the change and decide whether anything should be improved. The notes below come from a quick read of the diff and a few runs, not from a full analysis.
The concerns:
Each run compiles the statement again around a temporary table.yy.compileParamValue (src/28yy.js) adds a table __p<n>_<Date.now()> to the database, swaps it into the parsed statement (self[refProp]), compiles, runs, copies the rows back into the array and deletes the table. The parsed statement is shared by the statement cache, so it is changed while it is in use.
The table is deleted before an asynchronous run finishes. The finally runs as soon as the statement returns. await alasql.promise('INSERT INTO ? SELECT * FROM JSON("j.json")', [arr]) fails with Cannot read properties of undefined (reading 'data').
SELECT … FROM ? already reads an array as a source without a table. Letting UPDATE, DELETE and INSERT work on an array source in the same way would avoid the temporary table, the second compile and the copy back.
Activity