Details
-
Bug
-
Status: Closed
-
Minor
-
Resolution: Fixed
-
4.0, 4.1.M2
-
None
Description
I am trying to use SQLExec for batch inserts, reusing the basic query:
SQLExec inserter = SQLExec.query("insert into t1 (id) values (#bind($id))"); for(int i = 0; i < 2; i++) { inserter.paramsArray(i).execute(context); }
This works on the first loop iteration, but fails on the second with a duplicate PK error. Looks like the underlying "replacementQuery" is compiled only once during the first "execute()" call and is cached on subsequent calls even though the main query settings have changed.
I suspect this issue affects other subclasses of IndirectQuery as well... We need to clear their cached state if the settings affecting it change in the main query.