DigitalNam
asked on
Delphi XE10, MySQL Query
Hi all,
Can someone please help me to run this query in a thread that updates a progress bar on the mainform?
procedure TMainForm.OnComplete(ASend er: Tobject; Const ReaderSerNum: WideString; Const pSample: IDispatch);
var
recNo : Integer;
startTime64, endTime64, frequency64: Int64;
elapsedSeconds: single;
begin
QueryPerformanceFrequency( frequency6 4);
QueryPerformanceCounter(st artTime64) ;
VerifyProgress.Position := 0;
DM.mySQLQuery.DisableContr ols;
DM.mysqlQuery.SQL.Text := 'SELECT MemberFP FROM MemberTbl';
DM.mysqlQuery.Open;
DM.mysqlQuery.First;
VerifyProgress.Properties. Max := DM.mySQLQuery.RecordCount;
if DM.mysqlQuery.Eof then begin
lblStatus.Caption := 'No Fingerprint Found in the Database';
AdvSmoothButton7.Enabled := False;
exit;
end;
recno:=0;
while not DM.mysqlQuery.Eof do begin
inc(recno);
VerifyProgress.Position := recNo;
lblStatus.Caption := 'Scanning Fingerprint Record Number: ' + inttostr(recno);
lblStatus.Update;
vTemplate:= DM.mysqlQuery.FieldByName( 'MemberFP' ).AsVarian t;
dptemplate.DefaultInterfac e.Deserial ize(vTempl ate);
dpfeat.DefaultInterface.Cr eateFeatur eSet(pSamp le, DataPurposeVerification);
dpres := dpver.DefaultInterface.Ver ify(dpFeat .DefaultIn terface.Fe atureSet, dptemplate.DefaultInterfac e) as DPFPVerificationResult;
if dpRes.Verified then begin
//cxLabel4.Caption := DM.mysqlQuery.FieldByName( 'MemberNam e').AsStri ng;
AdvSmoothButton7.Enabled := True;
break;
end
else
lblStatus.Caption := 'Fingerprint NOT Identified';
lblStatus.Update;
DM.mysqlQuery.Next;
end;
DM.mysqlQuery.Close;
lblStatus.Caption := 'Waiting Fingerprint to be verified...';
lblStatus.Update;
DM.mySQLQuery.EnableContro ls;
QueryPerformanceCounter(en dTime64);
elapsedSeconds := (endTime64 - startTime64) / frequency64;
Label4.Caption := FloatToStr(ElapsedSeconds) ;
end;
Can someone please help me to run this query in a thread that updates a progress bar on the mainform?
procedure TMainForm.OnComplete(ASend
var
recNo : Integer;
startTime64, endTime64, frequency64: Int64;
elapsedSeconds: single;
begin
QueryPerformanceFrequency(
QueryPerformanceCounter(st
VerifyProgress.Position := 0;
DM.mySQLQuery.DisableContr
DM.mysqlQuery.SQL.Text := 'SELECT MemberFP FROM MemberTbl';
DM.mysqlQuery.Open;
DM.mysqlQuery.First;
VerifyProgress.Properties.
if DM.mysqlQuery.Eof then begin
lblStatus.Caption := 'No Fingerprint Found in the Database';
AdvSmoothButton7.Enabled := False;
exit;
end;
recno:=0;
while not DM.mysqlQuery.Eof do begin
inc(recno);
VerifyProgress.Position := recNo;
lblStatus.Caption := 'Scanning Fingerprint Record Number: ' + inttostr(recno);
lblStatus.Update;
vTemplate:= DM.mysqlQuery.FieldByName(
dptemplate.DefaultInterfac
dpfeat.DefaultInterface.Cr
dpres := dpver.DefaultInterface.Ver
if dpRes.Verified then begin
//cxLabel4.Caption := DM.mysqlQuery.FieldByName(
AdvSmoothButton7.Enabled := True;
break;
end
else
lblStatus.Caption := 'Fingerprint NOT Identified';
lblStatus.Update;
DM.mysqlQuery.Next;
end;
DM.mysqlQuery.Close;
lblStatus.Caption := 'Waiting Fingerprint to be verified...';
lblStatus.Update;
DM.mySQLQuery.EnableContro
QueryPerformanceCounter(en
elapsedSeconds := (endTime64 - startTime64) / frequency64;
Label4.Caption := FloatToStr(ElapsedSeconds)
end;
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thank you. Managed to shave off a few seconds on the query
ASKER
Thank you for the comment. I am using Unidac and to get the progress I can do but with my query on about 1000 records takes about 23 seconds. Can you perhaps help me to put my query in a thread that shows a progress on the threaded query then?