ViewVC Help
View File | Revision Log | Show Annotations | Download File | View Changeset | Root Listing
root/public/ibx/branches/journaling/fbintf/testsuite/testApp/TestApplication.pas
(Generate patch)

Comparing ibx/branches/journaling/fbintf/testsuite/testApp/TestApplication.pas (file contents):
Revision 362 by tony, Tue Dec 7 13:27:39 2021 UTC vs.
Revision 363 by tony, Tue Dec 7 13:30:05 2021 UTC

# Line 81 | Line 81 | type
81      FCursorSeq: integer;
82      function GetFirebirdAPI: IFirebirdAPI;
83      procedure SetOwner(AOwner: TTestApplication);
84 +    procedure HandleOnJnlEntry(JnlEntry: TJnlEntry);
85    protected
86      FHexStrings: boolean;
87      FShowBinaryBlob: boolean;
# Line 96 | Line 97 | type
97      procedure PrintSPB(SPB: ISPB);
98      procedure PrintMetaData(meta: IMetaData);
99      procedure ParamInfo(SQLParams: ISQLParams);
100 +    procedure PrintJournalFile(aFileName: AnsiString);
101 +    procedure PrintJournalTable(Attachment: IAttachment);
102      function ReportResults(Statement: IStatement; ShowCursorName: boolean=false): IResultSet;
103      procedure ReportResult(aValue: IResults);
104      function StringToHex(octetString: string; MaxLineLength: integer=0): string;
105 +    procedure WriteAttachmentInfo(Attachment: IAttachment);
106      procedure WriteArray(ar: IArray);
107      procedure WriteAffectedRows(Statement: IStatement);
108      procedure WriteDBInfo(DBInfo: IDBInformation);
109 +    procedure WriteTRInfo(TrInfo: ITrInformation);
110      procedure WriteBytes(Bytes: TByteArray);
111      procedure WriteOperationCounts(Category: AnsiString; ops: TDBOperationCounts);
112      procedure WritePerfStats(stats: TPerfCounters);
# Line 381 | Line 386 | begin
386    FOwner := AOwner;
387   end;
388  
389 + procedure TTestBase.HandleOnJnlEntry(JnlEntry: TJnlEntry);
390 + begin
391 + with JnlEntry do
392 + begin
393 +   {$IFNDEF FPC}
394 +   writeln(OutFile,'Journal Entry = ',ord(JnlEntryType),'(', TJournalProcessor.JnlEntryText(JnlEntryType),')');
395 +   {$ELSE}
396 +   writeln(OutFile,'Journal Entry = ',JnlEntryType,'(', TJournalProcessor.JnlEntryText(JnlEntryType),')');
397 +   {$ENDIF}
398 +   writeln(OutFIle,'Timestamp = ',FBFormatDateTime('yyyy/mm/dd hh:nn:ss.zzzz',Timestamp));
399 +   writeln(OutFile,'Session ID = ',SessionID);
400 +   writeln(OutFile,'Transaction ID = ',TransactionID);
401 +   case JnlEntry.JnlEntryType of
402 +   jeTransStart:
403 +     begin
404 +       writeln(OutFile,'Transaction Name = "',TransactionName,'"');
405 +       PrintTPB(TPB);
406 +       {$IFNDEF FPC}
407 +       writeln(OutFile,'Default Completion = ',ord(DefaultCompletion));
408 +       {$ELSE}
409 +       writeln(OutFile,'Default Completion = ',DefaultCompletion);
410 +       {$ENDIF}
411 +     end;
412 +
413 +   jeQuery:
414 +     begin
415 +       writeln(OutFile,'Query = ',QueryText);
416 +     end;
417 +
418 +   jeTransCommitRet,
419 +   jeTransRollbackRet:
420 +     writeln(Outfile,'Old TransactionID = ',OldTransactionID);
421 +   end;
422 + end;
423 + writeln(OutFile);
424 + end;
425 +
426   procedure TTestBase.DumpBCD(bcd: tBCD);
427   var i,l: integer;
428   begin
# Line 560 | Line 602 | begin
602    end;
603   end;
604  
605 + procedure TTestBase.PrintJournalFile(aFileName: AnsiString);
606 + begin
607 + writeln(OutFile,'Journal Entries');
608 + with TJournalProcessor.Create do
609 + try
610 +    Execute(aFileName,FirebirdAPI,HandleOnJnlEntry);
611 + finally
612 +   Free
613 + end;
614 + end;
615 +
616 + procedure TTestBase.PrintJournalTable(Attachment: IAttachment);
617 + var Results: IResultSet;
618 + begin
619 +  writeln(OutFile,'Journal Table');
620 +  Results := Attachment.OpenCursorAtStart('Select * From IBX$JOURNALS');
621 +  while not Results.IsEof do
622 +  begin
623 +    ReportResult(Results);
624 +    Results.Fetchnext;
625 +  end;
626 + end;
627 +
628   function TTestBase.ReportResults(Statement: IStatement; ShowCursorName: boolean): IResultSet;
629   begin
630    Result := Statement.OpenCursor;
# Line 617 | Line 682 | begin
682    end;
683   end;
684  
685 + procedure TTestBase.WriteAttachmentInfo(Attachment: IAttachment);
686 + begin
687 + writeln(outfile,'DB Connect String = ',Attachment.GetConnectString);
688 + writeln(outfile,'DB Charset ID = ',Attachment.GetDefaultCharSetID);
689 + writeln(outfile,'DB SQL Dialect = ',Attachment.GetSQLDialect);
690 + writeln(outfile,'DB Remote Protocol = ', Attachment.GetRemoteProtocol);
691 + writeln(outfile,'DB ODS Major Version = ',Attachment.GetODSMajorVersion);
692 + writeln(outfile,'DB ODS Minor Version = ',Attachment.GetODSMinorVersion);
693 + writeln(outfile,'User Authentication Method = ',Attachment.GetAuthenticationMethod);
694 + writeln(outfile,'Firebird Library Path = ',Attachment.getFirebirdAPI.GetFBLibrary.GetLibraryFilePath);
695 + writeln(outfile,'DB Client Implementation Version = ',Attachment.getFirebirdAPI.GetImplementationVersion);
696 + end;
697 +
698   procedure TTestBase.WriteArray(ar: IArray);
699   var Bounds: TArrayBounds;
700      i,j: integer;
# Line 770 | Line 848 | begin
848    end;
849   end;
850  
851 + procedure TTestBase.WriteTRInfo(TrInfo: ITrInformation);
852 + var IsolationType, RecVersion: byte;
853 +    i: integer;
854 +    access: integer;
855 + begin
856 + for i := 0 to TrInfo.GetCount - 1 do
857 + with TrInfo[i] do
858 + case getItemType of
859 +   isc_info_tra_id:
860 +     writeln(OutFile,'Transaction ID = ',getAsInteger);
861 +   isc_info_tra_oldest_interesting:
862 +     writeln(OutFile,'Oldest Interesting = ',getAsInteger);
863 +   isc_info_tra_oldest_active:
864 +     writeln(OutFile,'Oldest Action = ',getAsInteger);
865 +   isc_info_tra_oldest_snapshot:
866 +     writeln(OutFile,'Oldest Snapshot = ',getAsInteger);
867 +   fb_info_tra_snapshot_number:
868 +     writeln(OutFile,'Oldest Snapshot Number = ',getAsInteger);
869 +   isc_info_tra_lock_timeout:
870 +     writeln(OutFile,'Lock Timeout = ',getAsInteger);
871 +   isc_info_tra_isolation:
872 +     begin
873 +       DecodeTraIsolation(IsolationType, RecVersion);
874 +       write(OutFile,'Isolation Type = ');
875 +       case IsolationType of
876 +       isc_info_tra_consistency:
877 +         write(OutFile,'isc_info_tra_consistency');
878 +       isc_info_tra_concurrency:
879 +         write(OutFile,'isc_info_tra_concurrency');
880 +       isc_info_tra_read_committed:
881 +         begin
882 +          write(OutFile,'isc_info_tra_read_committed, Options =');
883 +          case RecVersion of
884 +          isc_info_tra_no_rec_version:
885 +            write(OutFile,'isc_info_tra_no_rec_version');
886 +          isc_info_tra_rec_version:
887 +            write(OutFile,'isc_info_tra_rec_version');
888 +          isc_info_tra_read_consistency:
889 +            write(OutFile,'isc_info_tra_read_consistency');
890 +          end;
891 +         end;
892 +       end;
893 +       writeln(OutFile);
894 +     end;
895 +   isc_info_tra_access:
896 +     begin
897 +       write(OutFile,'Transaction Access = ');
898 +       access :=  getAsInteger;
899 +       case access of
900 +       isc_info_tra_readonly:
901 +         writeln(OutFile,'isc_info_tra_readonly');
902 +       isc_info_tra_readwrite:
903 +         writeln(OutFile,'isc_info_tra_readwrite');
904 +       end;
905 +     end;
906 +   fb_info_tra_dbpath:
907 +     writeln(OutFile,'Transaction Database Path = ',getAsString);
908 + end;
909 +
910 + end;
911 +
912   procedure TTestBase.WriteBytes(Bytes: TByteArray);
913   var i: integer;
914   begin

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines