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

Comparing:
ibx/trunk/fbintf/IB.pas (file contents), Revision 345 by tony, Mon Aug 23 14:22:29 2021 UTC vs.
ibx/branches/journaling/fbintf/IB.pas (file contents), Revision 363 by tony, Tue Dec 7 13:30:05 2021 UTC

# Line 135 | Line 135 | const
135    {Interface version information}
136    FBIntf_Major = 1;
137    FBIntf_Minor = 3;
138 <  FBIntf_Release = 1;
139 <  FBIntf_Version = '1.3.1';
138 >  FBIntf_Release = 2;
139 >  FBIntf_Version = '1.3.2';
140  
141   const
142    {DPB, TPB and SPB Parameter Block Name Prefixes}
# Line 614 | Line 614 | type
614    }
615    IResultSet = interface(IResults)
616      ['{0ae4979b-7857-4e8c-8918-ec6f155b51a0}']
617 <    function FetchNext: boolean;
617 >    function FetchNext: boolean; {fetch next record}
618 >    function FetchPrior: boolean; {fetch previous record}
619 >    function FetchFirst:boolean; {fetch first record}
620 >    function FetchLast: boolean; {fetch last record}
621 >    function FetchAbsolute(position: Integer): boolean; {fetch record by its absolute position in result set}
622 >    function FetchRelative(offset: Integer): boolean; {fetch record by position relative to current}
623      function GetCursorName: AnsiString;
624 +    function IsBof: boolean;
625      function IsEof: boolean;
626      procedure Close;
627    end;
628  
629    {The ISQLParam interface is used to provide access to each parameter in a
630 <   parametised SQL Statement. It subclasses IColumnMetaData and this part of
625 <   the interface may be used to access information on the expected SQL Type, etc.
626 <
627 <   It also subclasses ISQLData and this part of the interface may be used to access
628 <   current values for each parameter.
629 <
630 <   Otherwise, the interface comprises the Setter Methods and properties used to
630 >   parametised SQL Statement. The interface comprises the Setter Methods and properties used to
631     set the value of each parameter.
632  
633     Automatic conversion is provided to and from strings. That is GetAsString and
634     SetAsString are safe to use for sql types other than boolean - provided automatic
635     conversion is possible.
636 +
637 +   ISQLParam is subclassed from the IParamMetaData interface. This interface provides
638 +   access to the parameter metadata. This metadata is mutable and can change after
639 +   a parameter is set to a given value. This is acceptable as long as the parameter
640 +   metadata is type compatible with the underlying column metadata and hence the
641 +   parameter value can be converted by Firebird into a value acceptable by the
642 +   underlying column. The column metadata, which is unmutable, can be obtained
643 +   by the ISQLParam.getColMetadata interface. When a statement is prepared, the
644 +   parameter metadata is always initialised to the column metadata.
645    }
646  
647 <  ISQLParam = interface
648 <    ['{b22b4578-6d41-4807-a9a9-d2ec8d1d5a14}']
640 <    function GetIndex: integer;
647 >  IParamMetaData = interface
648 >  ['{4e148c4e-2d48-4991-a263-f66eca05c6aa}']
649      function GetSQLType: cardinal;
650      function GetSQLTypeName: AnsiString;
651      function getSubtype: integer;
644    function getName: AnsiString;
652      function getScale: integer;
653      function getCharSetID: cardinal;
654      function getCodePage: TSystemCodePage;
655      function getIsNullable: boolean;
656      function GetSize: cardinal;
657 +    property SQLType: cardinal read GetSQLType;
658 +  end;
659 +
660 +  ISQLParam = interface(IParamMetaData)
661 +    ['{b22b4578-6d41-4807-a9a9-d2ec8d1d5a14}']
662 +    function getColMetadata: IParamMetaData;
663 +    function GetIndex: integer;
664 +    function getName: AnsiString;
665      function GetAsBoolean: boolean;
666      function GetAsCurrency: Currency;
667      function GetAsInt64: Int64;
# Line 723 | Line 738 | type
738      property IsNullable: Boolean read GetIsNullable;
739      property Modified: Boolean read getModified;
740      property Name: AnsiString read GetName;
726    property SQLType: cardinal read GetSQLType;
741    end;
742  
743     {
# Line 767 | Line 781 | type
781     initially prepared. The interface is returned from the IAttachment interface.
782     }
783  
784 +  TStatementFlag = (stHasCursor,stRepeatExecute,stScrollable);
785 +  TStatementFlags = set of TStatementFlag;
786 +
787    IStatement = interface
788      ['{a260576d-a07d-4a66-b02d-1b72543fd7cf}']
789      function GetMetaData: IMetaData;  {Output Metadata}
# Line 778 | Line 795 | type
795      function GetSQLText: AnsiString;
796      function GetProcessedSQLText: AnsiString;
797      function GetSQLDialect: integer;
798 +    function GetFlags: TStatementFlags;
799      function IsPrepared: boolean;
800      function HasBatchMode: boolean;
801      function IsInBatchMode: boolean;
802 <    procedure Prepare(aTransaction: ITransaction=nil);
802 >    procedure Prepare(aTransaction: ITransaction=nil); overload;
803 >    procedure Prepare(CursorName: AnsiString; aTransaction: ITransaction=nil); overload;
804      function Execute(aTransaction: ITransaction=nil): IResults;
805 <    function OpenCursor(aTransaction: ITransaction=nil): IResultSet;
805 >    function OpenCursor(aTransaction: ITransaction=nil): IResultSet; overload;
806 >    function OpenCursor(Scrollable: boolean; aTransaction: ITransaction=nil): IResultSet; overload;
807      function GetAttachment: IAttachment;
808      function GetTransaction: ITransaction;
809      procedure SetRetainInterfaces(aValue: boolean);
# Line 796 | Line 816 | type
816      function GetBatchCompletion: IBatchCompletion;
817      function GetBatchRowLimit: integer;
818      procedure SetBatchRowLimit(aLimit: integer);
819 +    {Stale Reference Check}
820 +    procedure SetStaleReferenceChecks(Enable:boolean); {default true}
821 +    function GetStaleReferenceChecks: boolean;
822  
823      property MetaData: IMetaData read GetMetaData;
824      property SQLParams: ISQLParams read GetSQLParams;
825      property SQLStatementType: TIBSQLStatementTypes read GetSQLStatementType;
826    end;
827  
828 +  ITrInfoItem = interface
829 +    ['{41455e1a-f84e-4e26-aff0-1a78e8b69cfe}']
830 +    function getItemType: byte;
831 +    function getSize: integer;
832 +    function getAsString: AnsiString;
833 +    function getAsInteger: int64;
834 +    procedure DecodeTraIsolation(var IsolationType, RecVersion: byte);
835 +  end;
836 +
837 +  { ITrInformation }
838 +
839 +  ITrInformation = interface
840 +    ['{e6ea4a52-c1a1-44ba-9609-c8bcc7cba7b2}']
841 +    function GetCount: integer;
842 +    function GetItem(index: integer): ITrInfoItem;
843 +    function Find(ItemType: byte): ITrInfoItem;
844 +    procedure PrintBuf; {can be used to print buffer in hex for debugging}
845 +    property Count: integer read GetCount;
846 +    property Items[index: integer]: ITrInfoItem read getItem; default;
847 +  end;
848 +
849    {Transaction Parameter Block: (TPB)
850  
851     The TPB provides the parameters used when starting a transaction. It is allocated
# Line 815 | Line 859 | type
859  
860    ITPBItem = interface(IParameterBlockItemWithTypeName)
861      ['{544c1f2b-7c12-4a87-a4a5-face7ea72671}']
818    function getParamTypeName: AnsiString;
862    end;
863  
864    ITPB = interface(IParameterBlockWithTypeNames<ITPBItem>)
865      ['{7369b0ff-defe-437b-81fe-19b211d42d25}']
866 +    function AsText: AnsiString;
867    end;
868  
869    {The ITransactionAction interface provides access to a Transaction once it
# Line 838 | Line 882 | type
882      function getTPB: ITPB;
883      procedure Start(DefaultCompletion: TTransactionCompletion=taCommit);
884      function GetInTransaction: boolean;
885 +    function GetIsReadOnly: boolean;
886 +    function GetTransactionID: integer;
887 +    function GetJournalingActive(attachment: IAttachment): boolean;
888 +    function GetDefaultCompletion: TTransactionCompletion;
889      procedure PrepareForCommit; {Two phase commit - stage 1}
890      procedure Commit(Force: boolean=false);
891      procedure CommitRetaining;
# Line 846 | Line 894 | type
894      procedure RollbackRetaining;
895      function GetAttachmentCount: integer;
896      function GetAttachment(index: integer): IAttachment;
897 +    function GetTrInformation(Requests: array of byte): ITrInformation; overload;
898 +    function GetTrInformation(Request: byte): ITrInformation; overload;
899 +    function GetTransactionName: AnsiString;
900 +    procedure SetTransactionName(aValue: AnsiString);
901      property InTransaction: boolean read GetInTransaction;
902 +    property TransactionName: AnsiString read GetTransactionName write SetTransactionName;
903    end;
904  
905    { The IEvents Interface is used to handle events from a single database. The
# Line 1009 | Line 1062 | type
1062       ['{e676067b-1cf4-4eba-9256-9724f57e0d16}']
1063     end;
1064  
1065 +   {Journaling options. Default is [joReadWriteTransactions,joModifyQueries] }
1066 +
1067 +   TJournalOption = (joReadOnlyTransactions, joReadWriteTransactions,
1068 +                     joModifyQueries, joReadOnlyQueries);
1069 +
1070 +   TJournalOptions = set of TJournalOption;
1071 +
1072    {The IAttachment interface provides access to a Database Connection. It may be
1073     used to:
1074  
# Line 1046 | Line 1106 | type
1106      procedure Disconnect(Force: boolean=false);
1107      function IsConnected: boolean;
1108      procedure DropDatabase;
1109 <    function StartTransaction(TPB: array of byte; DefaultCompletion: TTransactionCompletion=taCommit): ITransaction; overload;
1110 <    function StartTransaction(TPB: ITPB; DefaultCompletion: TTransactionCompletion=taCommit): ITransaction; overload;
1109 >    function StartTransaction(TPB: array of byte;
1110 >                              DefaultCompletion: TTransactionCompletion=taCommit;
1111 >                              aName: AnsiString=''): ITransaction; overload;
1112 >    function StartTransaction(TPB: ITPB;
1113 >                              DefaultCompletion: TTransactionCompletion=taCommit;
1114 >                              aName: AnsiString=''): ITransaction; overload;
1115      procedure ExecImmediate(transaction: ITransaction; sql: AnsiString; SQLDialect: integer); overload;
1116      procedure ExecImmediate(TPB: array of byte; sql: AnsiString; SQLDialect: integer); overload;
1117      procedure ExecImmediate(transaction: ITransaction; sql: AnsiString); overload;
# Line 1056 | Line 1120 | type
1120      function ExecuteSQL(transaction: ITransaction; sql: AnsiString; SQLDialect: integer; params: array of const): IResults; overload;
1121      function ExecuteSQL(TPB: array of byte; sql: AnsiString; params: array of const): IResults; overload;
1122      function ExecuteSQL(transaction: ITransaction; sql: AnsiString; params: array of const): IResults; overload;
1059    function OpenCursor(transaction: ITransaction; sql: AnsiString; aSQLDialect: integer): IResultSet; overload;
1123      function OpenCursor(transaction: ITransaction; sql: AnsiString; aSQLDialect: integer;
1124 +                             Scrollable: boolean=false): IResultSet; overload;
1125 +    function OpenCursor(transaction: ITransaction; sql: AnsiString; aSQLDialect: integer;
1126 +                             params: array of const): IResultSet; overload;
1127 +    function OpenCursor(transaction: ITransaction; sql: AnsiString; Scrollable: boolean=false): IResultSet; overload;
1128 +    function OpenCursor(transaction: ITransaction; sql: AnsiString; Scrollable: boolean;
1129                               params: array of const): IResultSet; overload;
1062    function OpenCursor(transaction: ITransaction; sql: AnsiString): IResultSet; overload;
1130      function OpenCursor(transaction: ITransaction; sql: AnsiString;
1131                               params: array of const): IResultSet; overload;
1132 <    function OpenCursorAtStart(transaction: ITransaction; sql: AnsiString; aSQLDialect: integer): IResultSet; overload;
1132 >    function OpenCursor(transaction: ITransaction; sql: AnsiString; aSQLDialect: integer; Scrollable: boolean;
1133 >                             params: array of const): IResultSet; overload;
1134      function OpenCursorAtStart(transaction: ITransaction; sql: AnsiString; aSQLDialect: integer;
1135 +                             Scrollable: boolean=false): IResultSet; overload;
1136 +    function OpenCursorAtStart(transaction: ITransaction; sql: AnsiString; aSQLDialect: integer;
1137 +                             params: array of const): IResultSet; overload;
1138 +    function OpenCursorAtStart(transaction: ITransaction; sql: AnsiString; aSQLDialect: integer; Scrollable: boolean;
1139                               params: array of const): IResultSet; overload;
1140 <    function OpenCursorAtStart(transaction: ITransaction; sql: AnsiString): IResultSet; overload;
1140 >    function OpenCursorAtStart(transaction: ITransaction; sql: AnsiString; Scrollable: boolean=false): IResultSet; overload;
1141      function OpenCursorAtStart(transaction: ITransaction; sql: AnsiString;
1142                               params: array of const): IResultSet; overload;
1143 <    function OpenCursorAtStart(sql: AnsiString): IResultSet; overload;
1143 >    function OpenCursorAtStart(transaction: ITransaction; sql: AnsiString; Scrollable: boolean;
1144 >                             params: array of const): IResultSet; overload;
1145 >    function OpenCursorAtStart(sql: AnsiString; Scrollable: boolean=false): IResultSet; overload;
1146 >    function OpenCursorAtStart(sql: AnsiString; Scrollable: boolean;
1147 >                             params: array of const): IResultSet; overload;
1148      function OpenCursorAtStart(sql: AnsiString;
1149                               params: array of const): IResultSet; overload;
1150 <    function Prepare(transaction: ITransaction; sql: AnsiString; aSQLDialect: integer): IStatement; overload;
1151 <    function Prepare(transaction: ITransaction; sql: AnsiString): IStatement; overload;
1150 >    function Prepare(transaction: ITransaction; sql: AnsiString; aSQLDialect: integer; CursorName: AnsiString=''): IStatement; overload;
1151 >    function Prepare(transaction: ITransaction; sql: AnsiString; CursorName: AnsiString=''): IStatement; overload;
1152      function PrepareWithNamedParameters(transaction: ITransaction; sql: AnsiString;
1153                         aSQLDialect: integer; GenerateParamNames: boolean=false;
1154 <                       CaseSensitiveParams: boolean = false): IStatement; overload;
1154 >                       CaseSensitiveParams: boolean = false; CursorName: AnsiString=''): IStatement; overload;
1155      function PrepareWithNamedParameters(transaction: ITransaction; sql: AnsiString;
1156                         GenerateParamNames: boolean=false;
1157 <                       CaseSensitiveParams: boolean = false): IStatement; overload;
1157 >                       CaseSensitiveParams: boolean = false; CursorName: AnsiString=''): IStatement; overload;
1158  
1159      {Events}
1160      function GetEventHandler(Events: TStrings): IEvents; overload;
# Line 1106 | Line 1182 | type
1182  
1183      {Database Information}
1184      function GetSQLDialect: integer;
1185 +    function GetAttachmentID: integer;
1186      function GetBlobMetaData(Transaction: ITransaction; tableName, columnName: AnsiString): IBlobMetaData;
1187      function GetArrayMetaData(Transaction: ITransaction; tableName, columnName: AnsiString): IArrayMetaData;
1188      function GetDBInformation(Requests: array of byte): IDBInformation; overload;
# Line 1121 | Line 1198 | type
1198      function HasActivity: boolean;
1199      function HasDecFloatSupport: boolean;
1200      function HasBatchMode: boolean;
1201 +    function HasScollableCursors: boolean;
1202 +    function HasTable(aTableName: AnsiString): boolean;
1203  
1204      {Character Sets}
1205      function HasDefaultCharSet: boolean;
# Line 1136 | Line 1215 | type
1215      {Time Zone Database}
1216      function GetTimeZoneServices: ITimeZoneServices;
1217      function HasTimeZoneSupport: boolean;
1218 +
1219 +    {Client side Journaling}
1220 +    function JournalingActive: boolean;
1221 +    function GetJournalOptions: TJournalOptions;
1222 +    function StartJournaling(aJournalLogFile: AnsiString): integer; overload;
1223 +    function StartJournaling(aJournalLogFile: AnsiString; Options: TJournalOptions): integer; overload;
1224 +    procedure StopJournaling(RetainJournal: boolean);
1225   end;
1226  
1227    TProtocolAll = (TCP, SPX, NamedPipe, Local, inet, inet4, inet6, wnet, xnet, unknownProtocol);
# Line 1304 | Line 1390 | type
1390      {Start Transaction against multiple databases}
1391      function AllocateTPB: ITPB;
1392      function StartTransaction(Attachments: array of IAttachment;
1393 <             TPB: array of byte; DefaultCompletion: TTransactionCompletion=taCommit): ITransaction; overload;
1393 >             TPB: array of byte; DefaultCompletion: TTransactionCompletion=taCommit;
1394 >             aName: AnsiString=''): ITransaction; overload;
1395      function StartTransaction(Attachments: array of IAttachment;
1396 <             TPB: ITPB; DefaultCompletion: TTransactionCompletion=taCommit): ITransaction; overload;
1396 >             TPB: ITPB; DefaultCompletion: TTransactionCompletion=taCommit;
1397 >             aName: AnsiString=''): ITransaction; overload;
1398  
1399      {Service Manager}
1400      function HasServiceAPI: boolean;
# Line 1387 | Line 1475 | procedure CheckIBLoaded;
1475  
1476   function LoadFBLibrary(aLibPathName: string): IFirebirdLibrary;
1477  
1478 + {$if not declared(NULL)} {Needed for Delphi}
1479 + function Null: Variant;       // Null standard constant
1480 + {$define NEEDNULLFUNCTION}
1481 + {$ifend}
1482  
1483   implementation
1484  
1485 < uses FBClientAPI
1485 > uses FBClientAPI {$if not declared(NULL)}, Variants {$ifend}
1486    {$IFDEF USELEGACYFIREBIRDAPI}, FB25ClientAPI {$ENDIF}
1487    {$IFDEF USEFIREBIRD3API}, FB30ClientAPI {$ENDIF};
1488  
# Line 1495 | Line 1587 | begin
1587    FIBErrorCode := AIBErrorCode;
1588   end;
1589  
1590 + {$ifdef NEEDNULLFUNCTION}
1591 + function Null: Variant;       // Null standard constant
1592 +   begin
1593 +     VarClearProc(TVarData(Result));
1594 +     TVarData(Result).VType := varnull;
1595 +   end;
1596 + {$endif}
1597  
1598   initialization
1599    FDefaultFBLibrary := nil;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines