procedure TView.btnStartClick(Sender: TObject);
begin
UniDataSource1.DataSet.DisableControls;
UniDataSource1.DataSet.Close;
DBGrid1.DataSource :=
Nil;
UniDataSource1.DataSet :=
Nil;
// I know this will leak at the moment!
FSQLThrd := TSqlQueryThrd.Create(self.Handle, edtConStr.Text, edtSqlTxt.Text, VirtualTable1);
try
FSQLThrd.FreeOnTerminate := false;
FSQLThrd.Start;
except
on E:
Exception do
MSGLog.Lines.Text := E.
Message;
end;
end;
procedure TView.OnThreadQueryDone(
const ThreadQueryDoneMsgPtr: PThreadQueryDoneMsg);
begin
case ThreadQueryDoneMsgPtr^.Done
of
true:
begin
QrPB.State := pbsPaused;
try
UniDataSource1.DataSet.DisableControls;
UniDataSource1.DataSet := VirtualTable1;
DBGrid1.DataSource := UniDataSource1;
UniDataSource1.DataSet.Open;
finally
// Das würd' ich nur machen, wenn's vorher keine Exception gab.
UniDataSource1.DataSet.EnableControls;
end;
end;
false: QrPB.State := pbsNormal;
end;
Dispose(ThreadQueryDoneMsgPtr);
end;