Icon View Incident Report

Serious Serious
Reported By: Andrew Grilk
Reported On: 3/15/2004
For: Version 4.04 Build 1
# 1617 Executing an SQL SELECT Query That Modifies the Index Position Can Cause a Hanging Read Lock

My app is freezing on it's first update sql statement. Totally hangs the application. Selects work fine...and so do inserts. Its the same code I was running before just with v3.27 that now doesn't work with v4.04 so I'm at a bit of a loss there. Please see the code below. If you comment out the prepare statement it will run fine. If you run with the prepare statement it will lock at the execsql statement.

procedure TForm1.Button1Click(Sender: TObject);
begin
  with dbisamquery1 do
  begin
    sql.text := 'update test set id = 1';
    ExecSQL;
  end;
end;

procedure TForm1.FormCreate(Sender: TObject);
begin
  DBISAMDatabase1.Directory := ExtractFilePath(ParamStr(0));
  DBISAMDatabase1.Connected := True;
  ItemLookupQuery.Prepare;
end;



Comments Comments
The SELECT query was causing the active index to be changed during the execution of the query, and this was the root cause since it was leaving around a read lock and not clearing it on the source table in the query.


Resolution Resolution
Fixed Problem on 3/17/2004 in version 4.05 build 1
Image