Icon View Incident Report

Serious Serious
Reported By: Helmut Woss
Reported On: 11/22/2000
For: Version 2.04 Build 1
# 663 SQL INSERT, UPDATE, or DELETE Statements Could Cause Lock Timeout Error

i have a table with an unique index on a field and have a lot of inserts to do where it is possible that i should insert a new record which has the same value in the indexed field like an existing one. In this case i capture the error in "OnPostError", start a query to delete the old record from the table and leave the OnPostError with Action := daRetry. But now nothings happens and after a lot of time i get the Error 10249 (general lock).

procedure TForm1.FormCreate(Sender: TObject);
begin
   q1.Close;
   q1.Prepare;
end;

procedure TForm1.bstartClick(Sender: TObject);
var
   x: integer;
begin
   for x := 1 to 2 do begin
      label1.Caption := 'start insert, x = ' + IntToStr(x);
      label1.update;
      tbl1.Insert;
      tbl1.FieldByName('wert').AsInteger := 1;
      tbl1.Post;
      label1.Caption := 'post okay, x = ' + IntToStr(x);
      label1.update;
   end;
end;

procedure TForm1.tbl1PostError(DataSet: TDataSet; E: EDatabaseError;
   var Action: TDataAction);
begin
   if Pos('9729',E.message) = 0 then Exit;
   q1.ParamByName('wert').AsInteger := 1;
   q1.ExecSql;
   Action := daRetry;
   label1.Caption := 'retry post ...';
   label1.update;
end;

end.



Resolution Resolution
Fixed Problem on 11/22/2000 in version 2.05 build 1
Image