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
After one error through a callback or promise(), a compiled statement is parsed and compiled again on every run #2875
After a single error through a callback or promise(), a statement made with alasql.compile() is parsed and compiled again on every later run, for good.
alasql.fn.BOOM=x=>{if(x===99)thrownewError('boom');returnx;};alasql('CREATE TABLE z (a INT); INSERT INTO z VALUES (1)');varst=alasql.compile('SELECT BOOM(?) AS v FROM z');// 5000 runs of st([1]): 11 msawaitst.promise([99]).catch(()=>{});// 5000 runs of st([1]): 571 ms (4.20.0: 4 ms)
Since #2747 (in 4.21.0). runStatement (src/engine/core.js) counts a run up in statement.running and counts it down when the run finishes or calls back. When the statement throws synchronously and a callback was given, neither happens, so running stays above 0, and every later call is treated as overlapping and gets a fresh parse and compile. promise() always passes a callback, so one rejected promise is enough. The fix: catch the synchronous throw, call finish(), rethrow; and a test that rejects once and then checks that the next run reuses the compiled statement.
The same counter in the dexec statement cache (#2465) probably has the same problem; not checked.
Activity
Fix statement state release during sync execution errors to closes Al…