Quantcast
Channel: Delphi Forum - Delphi Programming Kings of Code - Delphi Programming
Viewing all articles
Browse latest Browse all 173

Unidac Query and MySQL

$
0
0
Hi,

I was wondering if there is someone that would be able to assist me. I need to run a query in a thread and supply feedback to my GUI. I am using MySQL and Unidac. I am searching for a fingerprint in the database and for 1000 records my search takes up to 14 seconds. Is there anyway to speed up the search? The fingerprint is stored as a BLOB type.

This is what I have so far. Any suggestions would be appreciated.

function VerifyMember(MemberType : String) : Boolean;
Var
  RecNo : Integer;
  qry : TUniQuery;
  startTime64, endTime64, frequency64: Int64;
  elapsedSeconds: single;

begin
  QueryPerformanceFrequency(frequency64);
  QueryPerformanceCounter(startTime64);
  VerifyForm.VerifyIndicator.Active := True;
  VerifyForm.VerifyStatusLbl.Caption := 'Busy verifying fingerprint. Please be patient.';
  Qry := TUniQuery.Create(nil);

  qry.Connection := DM.DBConnection;
  qry.Close;
  qry.SQL.Clear;
  qry.SQL.Text := 'SELECT FPrint, ID from Fingerprint';

  Qry.Open;
  Qry.First;
  if qry.Eof then
  begin
    Result := False;
  end;

  RecNo := 0;
  while not qry.Eof do
  begin
    Inc(recno);
    vTemplate := qry.FieldByName('FPrint').AsVariant;
    dptemplate.DefaultInterface.Deserialize(vTemplate);
    dpfeat.DefaultInterface.CreateFeatureSet(pSample2, DataPurposeVerification);
    dpres := dpver.DefaultInterface.Verify(dpFeat.DefaultInterface.FeatureSet, dptemplate.DefaultInterface) as DPFPVerificationResult;

  if dpRes.Verified then begin
    VerifiedID := qry.FieldByName('ID').Value;
    Verified := True;
    Result := True;
    break;
  end;
    qry.Next;
  end;

  if Verified = True then
  begin
    //Member Found get all info
    With DM.MemberInfoQry do
    begin
      Close;
      SQL.Clear;
      SQL.Text := 'Select * from Member WHERE ID = :MemberID';
      Params.ParamByName('MemberID').AsInteger := VerifiedID;
      Open;
      iMemberID := FieldByName('ID').AsInteger;
      iMemberCell := FieldByName('Cellnumber').AsString;
      iMemberName := FieldByName('FullName').AsString;
      iMemberCountry := FieldByName('Country').AsString;
      iMemberSex := FieldByName('Gender').AsString;
      iMemberEmail := FieldByName('Email').AsString;
      iMemberType := FieldByName('RegisterType').AsString;
      iMemberStatus := FieldByName('Status').AsString;
    end;
  end;
  queryPerformanceCounter(endTime64);
  VerifyForm.VerifyIndicator.Active := False;
  elapsedSeconds := (endTime64 - startTime64) / frequency64;
  VerifyForm.Label1.Caption := FloatToStrF(elapsedSeconds, ffGeneral, 4, 2);
  VerifyForm.Close;
end;
 

Viewing all articles
Browse latest Browse all 173

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>