Open Bug 1570672 Opened 5 years ago Updated 2 years ago

executeAsync doesn't clear bound parameters after each insert

Categories

(Toolkit :: Storage, defect, P3)

defect

Tracking

()

People

(Reporter: neil, Unassigned)

Details

Consider the following code:

file = FileUtils.getFile("ProfD", ["asyncInsert.sqlite"]);
dbConn = Services.storage.openDatabase(file);
dbConn.executeSimpleSQL("CREATE TABLE async (left INTEGER, right INTEGER)");
asyncInsert = dbConn.createAsyncStatement("INSERT INTO async (left, right) VALUES (:left, :right)");
array = asyncInsert.newBindingParamsArray();
params1 = array.newBindingParams();
params1.bindByName("left", 1);
params1.bindByName("right", 2);
array.addParams(params1);
params2 = array.newBindingParams();
params2.bindByName("left", 3);
array.addParams(params2);
asyncInsert.bindParameters(array);
dbConn.executeAsync([stmt], 1);

Subsequent examination of the database will show that the both rows have a "right" value of 2, although it was only bound on the first set of parameters.

interesting, thank you for the test case.

Off-hand (didn't look very deeply though) we seem to be resetting after every execution
https://searchfox.org/mozilla-central/rev/0ffa9e372df56c95547fed9c3433ddec4fbf6f11/storage/mozStorageAsyncStatementExecution.cpp#154
it will require some debugging.

Priority: -- → P1
Priority: P1 → P3
Severity: normal → S3
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.