Insert multiple times gets optimized away.
Posted: 01.04.2011, 09:56
I've a TZQuery with the an insert into statement.
I run this 5 times with the same parameters in a for loop, which should result in 5 rows with different autonumbered ids.
However only one or two rows are inserted (and only those commands are visible in sql monitor).
The for loop is a bit braindead
for i:=0 to number-1 do
begin
qry.execsql;
qry.active:=true;
end;
Even if I add some parameter that forces the tuples to be different (I put the loopcounter in some memo) this still happen.
What is the proper way of doing this?
I run this 5 times with the same parameters in a for loop, which should result in 5 rows with different autonumbered ids.
However only one or two rows are inserted (and only those commands are visible in sql monitor).
The for loop is a bit braindead
for i:=0 to number-1 do
begin
qry.execsql;
qry.active:=true;
end;
Even if I add some parameter that forces the tuples to be different (I put the loopcounter in some memo) this still happen.
What is the proper way of doing this?