sporadic lost inserts using batchupdates
Posted: Thu 29 Jul 2021 10:13
using c+ builder 10.3.2, unidac 8.3.2, vcl win 32, oracle 12.2
I have a TUniSQL holding
I don't know how many values I will have so I set at each batch
adding a row:
And at the end:
It works 99.99% of the time, but sometimes I have sporadic inserts that were not inserted.
Monitor shows duration n/a, status pending for the insert, so the insert was asked but is pending then commit is done and insert is NOT committed.
I have to tell the same routine is called several time, could it be due to the fact that I usually update less than 20 rows and never get to execute the full 1000 rows?
I have a TUniSQL holding
Code: Select all
INSERT into XMLMESSDET(ID, PARENTID, TagName, TagValue, TREETop) VALUES (:1,:2,:3,:4,:5)
Code: Select all
q->Params->ValueCount=1000;
iArr1=0;
Code: Select all
q->Params->Items[0]->Values[iArr1]->AsLargeInt=...
q->Params->Items[1]->Values[iArr1]->AsLargeInt=...
q->Params->Items[2]->Values[iArr1]->AsIUnteger=...
if (s>"")
q->Params->Items[3]->Values[iArr1]->AsString=s2;
else
q->Params->Items[3]->Values[iArr1]->Clear();
q->Params->Items[4]->Values[iArr1]->AsLargeInt=...
iArr1++;
if (iArr1==1000) {
q->Execute(); // write 1000 first rows
q->Params->ValueCount=1000;
iArr1=0;
}
Code: Select all
if (iArr1>0) {
try {
q->Execute(iArr1); // write unwritten rows and return.
}
catch(...) {
iRv=-1;
q=NULL;
}
}
Monitor shows duration n/a, status pending for the insert, so the insert was asked but is pending then commit is done and insert is NOT committed.
I have to tell the same routine is called several time, could it be due to the fact that I usually update less than 20 rows and never get to execute the full 1000 rows?