var
cDeb, cOpen, cFin : cardinal;
Transaction: TUIBTransaction;
DataBase : TUIBDataBase;
Query: TUIBQuery;
iRec : Integer;
begin
cDeb := GetTickCount;
try
try
DataBase := TUIBDatabase.Create(nil);
DataBase.DatabaseName := extractfilepath(application.ExeName)+'uib_manager.fb';
DataBase.LibraryName := extractfilepath(application.ExeName)+'fb64.dll';; // fbembed.dll 64bits renommé
Transaction := TUIBTransaction.Create(nil);
Transaction.DataBase := DataBase;
Query := TUIBQuery.Create(nil);
Query.Transaction := Transaction;
Query.FetchBlobs := false;
Query.SQL.Text := ' execute block returns ( '+
' NOM varchar(100) '+
',CLIENTHOST varchar(255) '+
',USERNAME varchar(255) '+
',LOGTIME TIMESTAMP '+
',PROCESSINGTIME int '+
',BYTESRECVD int '+
',BYTESSENT int '+
',SERVICESTATUS int '+
',WIN32STATUS int '+
',OPERATION varchar(255) '+
',TARGET varchar(255) '+
',PARAMETERS varchar(255) '+
',SERVICE varchar(50) '+
',ID int '+
') '+
' as '+
' begin '+
'for execute statement ''select * from site_inetlog_externe_now '' '+
'on external ''11.5.0.6:e:\fbdatas\inetlog.fb '' '+
'as USER ''SYSDBA'' PASSWORD ''masterkey'' '+
'WITH COMMON TRANSACTION '+
'into '+
' :NOM, '+
' :CLIENTHOST, '+
' :USERNAME, '+
' :LOGTIME, '+
' :PROCESSINGTIME, '+
' :BYTESRECVD, '+
' :BYTESSENT, '+
' :SERVICESTATUS, '+
' :WIN32STATUS, '+
' :OPERATION, '+
' :TARGET, '+
' :PARAMETERS, '+
' :SERVICE, '+
' :ID '+
'do suspend; '+
'end; ';
Query.Open;
cOpen := GetTickCount;
iRec := 0;
while not Query.EOF do
begin
inc(iRec);
Query.Next;
end;
except
on e:exception do begin
showmessage(e.Message);
end;
end;
finally // faute à Faust :-)
Query.Close(etmStayIn);
Query.Destroy;
Transaction.Destroy;
database.Connected := false;
database.CleanupInstance;
database.free;
end;
cFin := GetTickCount;
Showmessage(format('Exécution : '+#13#10+ 'select : %.3d millisecondes '+#13#10+'lecture : %.3d millisecondes pour %d enregistrements',[cOpen-cDeb,cFin-cOpen,iRec]));