Subject | Re: Issue for process |
---|---|
Author | heroes3lover |
Post date | 2007-05-30T01:13:29Z |
calling code,
function ProcessDataThread( dataThread : TDataThread ):Boolean;
begin
Result := TRUE;
dataThread.Resume;
while not dataThread.Terminated do
begin
Application.ProcessMessages;
Sleep(5);
end;
end;
function OpenSQLCompleteDataSetPlus( SQLQuery :
TSQLCompleteDataSetPlus; IsSelect : Boolean ):Boolean;
var
SQLThread : TSQLCompleteDataSetPlusThread;
i : Integer;
begin
if( IsSelect )then
begin
SQLQuery.Close;
SQLThread := TSQLCompleteDataSetPlusThread.Create(SQLQuery);
SQLThread.isSelect := IsSelect;
Result := ProcessDataThread(SQLThread);
SQLQuery.FieldDefs.Assign(SQLThread.qryInThread.FieldDefs);
SQLQuery.CreateDataSet;
SQLQuery.LogChanges := False;
while not SQLThread.qryInThread.Eof do
begin
SQLQuery.Insert;
for i:= 0 to SQLThread.qryInThread.FieldDefs.Count-1 do
SQLQuery.Fields.Fields[i].Value :=
SQLThread.qryInThread.Fields.Fields[i].Value;
SQLQuery.Post;
SQLThread.qryInThread.Next;
end;
SQLQuery.LogChanges := True;
SQLQuery.First;
FreeAndNil(SQLThread);
end
else
begin
SQLQuery.Close;
SQLThread := TSQLCompleteDataSetPlusThread.Create(SQLQuery);
SQLThread.isSelect := IsSelect;
Result := ProcessDataThread(SQLThread);
FreeAndNil(SQLThread);
end;
end;
function ProcessDataThread( dataThread : TDataThread ):Boolean;
begin
Result := TRUE;
dataThread.Resume;
while not dataThread.Terminated do
begin
Application.ProcessMessages;
Sleep(5);
end;
end;
function OpenSQLCompleteDataSetPlus( SQLQuery :
TSQLCompleteDataSetPlus; IsSelect : Boolean ):Boolean;
var
SQLThread : TSQLCompleteDataSetPlusThread;
i : Integer;
begin
if( IsSelect )then
begin
SQLQuery.Close;
SQLThread := TSQLCompleteDataSetPlusThread.Create(SQLQuery);
SQLThread.isSelect := IsSelect;
Result := ProcessDataThread(SQLThread);
SQLQuery.FieldDefs.Assign(SQLThread.qryInThread.FieldDefs);
SQLQuery.CreateDataSet;
SQLQuery.LogChanges := False;
while not SQLThread.qryInThread.Eof do
begin
SQLQuery.Insert;
for i:= 0 to SQLThread.qryInThread.FieldDefs.Count-1 do
SQLQuery.Fields.Fields[i].Value :=
SQLThread.qryInThread.Fields.Fields[i].Value;
SQLQuery.Post;
SQLThread.qryInThread.Next;
end;
SQLQuery.LogChanges := True;
SQLQuery.First;
FreeAndNil(SQLThread);
end
else
begin
SQLQuery.Close;
SQLThread := TSQLCompleteDataSetPlusThread.Create(SQLQuery);
SQLThread.isSelect := IsSelect;
Result := ProcessDataThread(SQLThread);
FreeAndNil(SQLThread);
end;
end;