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

Comparing:
ibx/trunk/fbintf/IB.pas (file contents), Revision 310 by tony, Tue Jul 21 08:20:03 2020 UTC vs.
ibx/branches/udr/client/IB.pas (file contents), Revision 390 by tony, Sat Jan 22 16:15:12 2022 UTC

# Line 129 | Line 129 | uses
129    Classes,
130    {$IFDEF WINDOWS}Windows, {$ENDIF}
131    {$IFDEF FPC} Dynlibs, {$ENDIF}
132 <  SysUtils, DB, FBMessages, IBExternals;
132 >  SysUtils, DB, FBMessages, IBExternals, FmtBcd;
133  
134   const
135    {Interface version information}
136    FBIntf_Major = 1;
137 <  FBIntf_Minor = 1;
138 <  FBIntf_Release = 6;
139 <  FBIntf_Version = '1.1.6';
137 >  FBIntf_Minor = 4;
138 >  FBIntf_Release = 0;
139 >  FBIntf_Version = '1.4.0';
140 >
141 > const
142 >  {DPB, TPB and SPB Parameter Block Name Prefixes}
143 >  DPBPrefix = 'isc_dpb_';
144 >  TPBPrefix = 'isc_tpb_';
145 >
146 > const
147 >  {Time Zone ID constraint}
148 >  MaxOffsetTimeZoneID = 2879; {lower values represent a time zone offset between
149 >                               -23:59 and 23:59. Higher values are keys to the
150 >                               Time Zone database.}
151 >
152 >  TimeZoneID_GMT = 23*minsPerHour + 59;
153 >  decimillisecondsPerSecond = 10000;
154 >  TimeZoneDisplacementDelta = 60*23 + 59; {23:59 in minutes}
155  
156   {These include files are converted from the 'C' originals in the Firebird API
157   and define the various constants used by the API}
158  
159   {$I 'include/consts_pub.inc'}
160 + {$I 'include/dyn_consts.inc'}
161   {$I 'include/inf_pub.inc'}
162   {$I 'include/configkeys.inc'}
163 + {$I 'include/blr.inc'}
164  
165   {The following constants define the values return by calls to the GetSQLType
166   methods provided by several of the interfaces defined below.}
# Line 165 | Line 182 | const
182    SQL_TYPE_TIME                  =        560;
183    SQL_TYPE_DATE                  =        570;
184    SQL_INT64                      =        580;
185 +  SQL_TIMESTAMP_TZ_EX            =        32748;
186 +  SQL_TIME_TZ_EX                 =        32750;
187 +  SQL_INT128                     =        32752;
188    SQL_BOOLEAN                    =        32764;
189 +  SQL_TIMESTAMP_TZ               =        32754;
190 +  SQL_TIME_TZ                    =        32756;
191 +  SQL_DEC_FIXED                  =        32758;    {FB4 Beta 1 only}
192 +  SQL_DEC16                      =        32760;
193 +  SQL_DEC34                      =        32762;
194 +  SQL_NULL                       =        32766;
195    SQL_DATE                       =        SQL_TIMESTAMP;
196  
197   type
# Line 215 | Line 241 | type
241  
242    TFBStatusCode = cardinal;
243    TByteArray = array of byte;
244 +  TFBTimeZoneID = ISC_USHORT;
245  
246    IFirebirdAPI = interface;
247    IAttachment = interface;
248    ITransaction = interface;
249    IStatement = interface;
250  
251 +  {The IFBNumeric interface provides a managed type for Fixed Point integers
252 +   used to hold Firebird Numeric(m,n) types}
253 +
254 +  IFBNumeric = interface
255 +    ['{8bdccfe9-d552-446b-bd82-844ca264455d}']
256 +    function getRawValue: Int64;
257 +    function getScale: integer;
258 +    function AdjustScaleTo(aNewScale: integer): IFBNumeric;
259 +    function getAsString: AnsiString;
260 +    function getAsDouble: double;
261 +    function getAsBCD: TBCD;
262 +    function getAsInt64: Int64; {scaled}
263 +    function getAsInteger: integer; {scaled - may be truncated}
264 +    function getAsSmallInt: SmallInt; {scaled - may be truncated}
265 +    function getAsCurrency: Currency;
266 +  end;
267 +
268    {The IParameterBlock interface provides the template for all parameter
269     block interfaces}
270  
# Line 234 | Line 278 | type
278      property Items[index: integer]: _IItem read getItems; default;
279    end;
280  
281 +  IParameterBlockWithTypeNames<_IItem> = interface(IParameterBlock<_IItem>)
282 +    function AddByTypeName(ParamTypeName: AnsiString): _IItem;
283 +    function GetDPBParamTypeName(ParamType: byte): Ansistring; deprecated 'Use Get ParamTypeName';
284 +    function GetParamTypeName(ParamType: byte): Ansistring;
285 +  end;
286 +
287    {IParameterBlockItem is not used on its own but instead provides a base type for
288     different parameter block items }
289  
# Line 251 | Line 301 | type
301      property AsInteger: integer read getAsInteger write SetAsInteger;
302    end;
303  
304 +  IParameterBlockItemWithTypeName = interface(IParameterBlockItem)
305 +    function getParamTypeName: AnsiString;
306 +  end;
307  
308    {The IStatus interface provides access to error information, if any, returned
309     by the last API call. It can also be used to customise the error message
# Line 265 | Line 318 | type
318  
319     TIBDataBaseErrorMessages   = set of TIBDataBaseErrorMessage;
320  
321 +   TStatusCode = long;
322 +
323    IStatus = interface
324      ['{34167722-af38-4831-b08a-93162d58ede3}']
325 <    function GetIBErrorCode: Long;
326 <    function Getsqlcode: Long;
325 >    function InErrorState: boolean;
326 >    function GetIBErrorCode: TStatusCode;
327 >    function Getsqlcode: TStatusCode;
328      function GetMessage: AnsiString;
329      function CheckStatusVector(ErrorCodes: array of TFBStatusCode): Boolean;
330      function GetIBDataBaseErrorMessages: TIBDataBaseErrorMessages;
331 +    function Clone: IStatus;
332      procedure SetIBDataBaseErrorMessages(Value: TIBDataBaseErrorMessages);
333    end;
334  
# Line 330 | Line 387 | type
387      function GetAsBoolean(index: array of integer): boolean;
388      function GetAsCurrency(index: array of integer): Currency;
389      function GetAsInt64(index: array of integer): Int64;
390 <    function GetAsDateTime(index: array of integer): TDateTime;
390 >    function GetAsDateTime(index: array of integer): TDateTime; overload;
391 >    procedure GetAsDateTime(index: array of integer; var aDateTime: TDateTime; var dstOffset: smallint; var aTimezoneID: TFBTimeZoneID); overload;
392 >    procedure GetAsDateTime(index: array of integer; var aDateTime: TDateTime; var dstOffset: smallint; var aTimezone: AnsiString); overload;
393 >    procedure GetAsTime(index: array of integer; var aTime: TDateTime; var dstOffset: smallint; var aTimezoneID: TFBTimeZoneID; OnDate: TDateTime); overload;
394 >    procedure GetAsTime(index: array of integer; var aTime: TDateTime; var dstOffset: smallint; var aTimezone: AnsiString; OnDate: TDateTime); overload;
395 >    function GetAsUTCDateTime(index: array of integer): TDateTime;
396      function GetAsDouble(index: array of integer): Double;
397      function GetAsFloat(index: array of integer): Float;
398      function GetAsLong(index: array of integer): Long;
399      function GetAsShort(index: array of integer): Short;
400      function GetAsString(index: array of integer): AnsiString;
401      function GetAsVariant(index: array of integer): Variant;
402 +    function GetAsBCD(index: array of integer): tBCD;
403      procedure SetAsInteger(index: array of integer; AValue: integer);
404      procedure SetAsBoolean(index: array of integer; AValue: boolean);
405      procedure SetAsCurrency(index: array of integer; Value: Currency);
406      procedure SetAsInt64(index: array of integer; Value: Int64);
407      procedure SetAsDate(index: array of integer; Value: TDateTime);
408 +    procedure SetAsDateTime(index: array of integer; Value: TDateTime); overload;
409 +    procedure SetAsDateTime(index: array of integer; aValue: TDateTime; aTimeZoneID: TFBTimeZoneID); overload;
410 +    procedure SetAsDateTime(index: array of integer; aValue: TDateTime; aTimeZone: AnsiString); overload;
411 +    procedure SetAsTime(index: array of integer; Value: TDateTime); overload;
412 +    procedure SetAsTime(index: array of integer; aValue: TDateTime; OnDate: TDateTime; aTimeZoneID: TFBTimeZoneID); overload;
413 +    procedure SetAsTime(index: array of integer; aValue: TDateTime; OnDate: TDateTime; aTimeZone: AnsiString); overload;
414 +    procedure SetAsUTCDateTime(index: array of integer; aUTCTime: TDateTime);
415      procedure SetAsLong(index: array of integer; Value: Long);
346    procedure SetAsTime(index: array of integer; Value: TDateTime);
347    procedure SetAsDateTime(index: array of integer; Value: TDateTime);
416      procedure SetAsDouble(index: array of integer; Value: Double);
417      procedure SetAsFloat(index: array of integer; Value: Float);
418      procedure SetAsShort(index: array of integer; Value: Short);
419      procedure SetAsString(index: array of integer; Value: AnsiString);
420      procedure SetAsVariant(index: array of integer; Value: Variant);
421 +    procedure SetAsBcd(index: array of integer; aValue: tBCD);
422      procedure SetBounds(dim, UpperBound, LowerBound: integer);
423      function GetAttachment: IAttachment;
424      function GetTransaction: ITransaction;
# Line 422 | Line 491 | type
491  
492    TIBDateTimeFormats = (dfTimestamp, {SQL TIMESTAMP}
493                          dfDateTime,   {SQL DATETIME}
494 <                        dfTime);      {SQL TIME}
494 >                        dfTime,      {SQL TIME}
495 >                        dfTimestampTZ, {SQL_TIMESTAMP_TZ}
496 >                        dfTimeTZ);       {SQLTIME_TZ
497  
498    { IColumnMetaData }
499  
# Line 448 | Line 519 | type
519      function GetDateTimeStrLength(DateTimeFormat: TIBDateTimeFormats): integer;
520      function GetStatement: IStatement;
521      function GetTransaction: ITransaction;
522 +    function GetAttachment: IAttachment;
523      property Name: AnsiString read GetName;
524      property Size: cardinal read GetSize;
525      property SQLType: cardinal read GetSQLType;
# Line 493 | Line 565 | type
565      function GetAsBoolean: boolean;
566      function GetAsCurrency: Currency;
567      function GetAsInt64: Int64;
568 <    function GetAsDateTime: TDateTime;
568 >    function GetAsDateTime: TDateTime; overload;
569 >    procedure GetAsDateTime(var aDateTime: TDateTime; var dstOffset: smallint; var aTimezoneID: TFBTimeZoneID); overload;
570 >    procedure GetAsDateTime(var aDateTime: TDateTime; var dstOffset: smallint; var aTimezone: AnsiString); overload;
571 >    procedure GetAsTime(var aTime: TDateTime; var dstOffset: smallint; var aTimezoneID: TFBTimeZoneID; OnDate: TDateTime); overload;
572 >    procedure GetAsTime(var aTime: TDateTime; var dstOffset: smallint; var aTimezone: AnsiString; OnDate: TDateTime); overload;
573 >    procedure GetAsTime(var aTime: TDateTime; var dstOffset: smallint; var aTimezoneID: TFBTimeZoneID); overload;
574 >    procedure GetAsTime(var aTime: TDateTime; var dstOffset: smallint; var aTimezone: AnsiString); overload;
575 >    function GetAsUTCDateTime: TDateTime;
576      function GetAsDouble: Double;
577      function GetAsFloat: Float;
578      function GetAsLong: Long;
# Line 506 | Line 585 | type
585      function GetAsBlob: IBlob; overload;
586      function GetAsBlob(BPB: IBPB): IBlob; overload;
587      function GetAsArray: IArray;
588 +    function GetAsBCD: tBCD;
589 +    function GetAsNumeric: IFBNumeric;
590      property AsDate: TDateTime read GetAsDateTime;
591      property AsBoolean:boolean read GetAsBoolean;
592      property AsTime: TDateTime read GetAsDateTime;
# Line 523 | Line 604 | type
604      property AsVariant: Variant read GetAsVariant ;
605      property AsBlob: IBlob read GetAsBlob;
606      property AsArray: IArray read GetAsArray;
607 +    property AsBCD: tBCD read GetAsBCD;
608 +    property AsNumeric: IFBNumeric read GetAsNumeric;
609      property IsNull: Boolean read GetIsNull;
610      property Value: Variant read GetAsVariant;
611    end;
# Line 538 | Line 621 | type
621     function getCount: integer;
622     function GetStatement: IStatement;
623     function GetTransaction: ITransaction;
624 +   function GetAttachment: IAttachment;
625     function ByName(Idx: AnsiString): ISQLData;
626     function getSQLData(index: integer): ISQLData;
627     procedure GetData(index: integer; var IsNull:boolean; var len: short; var data: PByte);
# Line 553 | Line 637 | type
637    }
638    IResultSet = interface(IResults)
639      ['{0ae4979b-7857-4e8c-8918-ec6f155b51a0}']
640 <    function FetchNext: boolean;
640 >    function FetchNext: boolean; {fetch next record}
641 >    function FetchPrior: boolean; {fetch previous record}
642 >    function FetchFirst:boolean; {fetch first record}
643 >    function FetchLast: boolean; {fetch last record}
644 >    function FetchAbsolute(position: Integer): boolean; {fetch record by its absolute position in result set}
645 >    function FetchRelative(offset: Integer): boolean; {fetch record by position relative to current}
646      function GetCursorName: AnsiString;
647 +    function IsBof: boolean;
648      function IsEof: boolean;
649      procedure Close;
650    end;
651  
652    {The ISQLParam interface is used to provide access to each parameter in a
653 <   parametised SQL Statement. It subclasses IColumnMetaData and this part of
564 <   the interface may be used to access information on the expected SQL Type, etc.
565 <
566 <   It also subclasses ISQLData and this part of the interface may be used to access
567 <   current values for each parameter.
568 <
569 <   Otherwise, the interface comprises the Setter Methods and properties used to
653 >   parametised SQL Statement. The interface comprises the Setter Methods and properties used to
654     set the value of each parameter.
655  
656     Automatic conversion is provided to and from strings. That is GetAsString and
657     SetAsString are safe to use for sql types other than boolean - provided automatic
658     conversion is possible.
659 +
660 +   ISQLParam is subclassed from the IParamMetaData interface. This interface provides
661 +   access to the parameter metadata. This metadata is mutable and can change after
662 +   a parameter is set to a given value. This is acceptable as long as the parameter
663 +   metadata is type compatible with the underlying column metadata and hence the
664 +   parameter value can be converted by Firebird into a value acceptable by the
665 +   underlying column. The column metadata, which is unmutable, can be obtained
666 +   by the ISQLParam.getColMetadata interface. When a statement is prepared, the
667 +   parameter metadata is always initialised to the column metadata.
668    }
669  
670 <  ISQLParam = interface
671 <    ['{b22b4578-6d41-4807-a9a9-d2ec8d1d5a14}']
579 <    function GetIndex: integer;
670 >  IParamMetaData = interface
671 >  ['{4e148c4e-2d48-4991-a263-f66eca05c6aa}']
672      function GetSQLType: cardinal;
673      function GetSQLTypeName: AnsiString;
674      function getSubtype: integer;
583    function getName: AnsiString;
675      function getScale: integer;
676      function getCharSetID: cardinal;
677      function getCodePage: TSystemCodePage;
678      function getIsNullable: boolean;
679      function GetSize: cardinal;
680 +    property SQLType: cardinal read GetSQLType;
681 +  end;
682 +
683 +  ISQLParam = interface(IParamMetaData)
684 +    ['{b22b4578-6d41-4807-a9a9-d2ec8d1d5a14}']
685 +    function getColMetadata: IParamMetaData;
686 +    function GetStatement: IStatement;
687 +    function GetTransaction: ITransaction;
688 +    function GetAttachment: IAttachment;
689 +    function GetIndex: integer;
690 +    function getName: AnsiString;
691      function GetAsBoolean: boolean;
692      function GetAsCurrency: Currency;
693      function GetAsInt64: Int64;
694 <    function GetAsDateTime: TDateTime;
694 >    function GetAsDateTime: TDateTime; overload;
695 >    procedure GetAsDateTime(var aDateTime: TDateTime; var dstOffset: smallint; var aTimezoneID: TFBTimeZoneID); overload;
696 >    procedure GetAsDateTime(var aDateTime: TDateTime; var dstOffset: smallint; var aTimezone: AnsiString); overload;
697 >    procedure GetAsTime(var aTime: TDateTime; var dstOffset: smallint; var aTimezoneID: TFBTimeZoneID; OnDate: TDateTime); overload;
698 >    procedure GetAsTime(var aTime: TDateTime; var dstOffset: smallint; var aTimezone: AnsiString; OnDate: TDateTime); overload;
699 >    procedure GetAsTime(var aTime: TDateTime; var dstOffset: smallint; var aTimezoneID: TFBTimeZoneID); overload;
700 >    procedure GetAsTime(var aTime: TDateTime; var dstOffset: smallint; var aTimezone: AnsiString); overload;
701 >    function GetAsUTCDateTime: TDateTime;
702      function GetAsDouble: Double;
703      function GetAsFloat: Float;
704      function GetAsLong: Long;
# Line 601 | Line 710 | type
710      function GetAsVariant: Variant;
711      function GetAsBlob: IBlob;
712      function GetAsArray: IArray;
713 +    function GetAsBCD: tBCD;
714 +    function GetAsNumeric: IFBNumeric;
715      procedure Clear;
716      function GetModified: boolean;
717      procedure SetAsBoolean(AValue: boolean);
# Line 608 | Line 719 | type
719      procedure SetAsInt64(aValue: Int64);
720      procedure SetAsDate(aValue: TDateTime);
721      procedure SetAsLong(aValue: Long);
722 <    procedure SetAsTime(aValue: TDateTime);
723 <    procedure SetAsDateTime(aValue: TDateTime);
722 >    procedure SetAsTime(aValue: TDateTime); overload;
723 >    procedure SetAsTime(aValue: TDateTime; OnDate: TDateTime; aTimeZoneID: TFBTimeZoneID); overload;
724 >    procedure SetAsTime(aValue: TDateTime; OnDate: TDateTime; aTimeZone: AnsiString); overload;
725 >    procedure SetAsTime(aValue: TDateTime; aTimeZoneID: TFBTimeZoneID); overload;
726 >    procedure SetAsTime(aValue: TDateTime; aTimeZone: AnsiString); overload;
727 >    procedure SetAsDateTime(aValue: TDateTime); overload;
728 >    procedure SetAsDateTime(aValue: TDateTime; aTimeZoneID: TFBTimeZoneID); overload;
729 >    procedure SetAsDateTime(aValue: TDateTime; aTimeZone: AnsiString); overload;
730 >    procedure SetAsUTCDateTime(aUTCTime: TDateTime);
731      procedure SetAsDouble(aValue: Double);
732      procedure SetAsFloat(aValue: Float);
733      procedure SetAsPointer(aValue: Pointer);
# Line 621 | Line 739 | type
739      procedure SetAsArray(anArray: IArray);
740      procedure SetAsQuad(aValue: TISC_QUAD);
741      procedure SetCharSetID(aValue: cardinal);
742 +    procedure SetAsBcd(aValue: tBCD);
743 +    procedure SetAsNumeric(Value: IFBNumeric);
744      property AsDate: TDateTime read GetAsDateTime write SetAsDate;
745      property AsBoolean:boolean read GetAsBoolean write SetAsBoolean;
746      property AsTime: TDateTime read GetAsDateTime write SetAsTime;
# Line 637 | Line 757 | type
757      property AsVariant: Variant read GetAsVariant write SetAsVariant;
758      property AsBlob: IBlob read GetAsBlob write SetAsBlob;
759      property AsArray: IArray read GetAsArray write SetAsArray;
760 +    property AsBCD: tBCD read GetAsBCD write SetAsBCD;
761 +    property AsNumeric: IFBNumeric read GetAsNumeric write SetAsNumeric;
762      property AsQuad: TISC_QUAD read GetAsQuad write SetAsQuad;
763      property Value: Variant read GetAsVariant write SetAsVariant;
764      property IsNull: Boolean read GetIsNull write SetIsNull;
765      property IsNullable: Boolean read GetIsNullable;
766      property Modified: Boolean read getModified;
767      property Name: AnsiString read GetName;
646    property SQLType: cardinal read GetSQLType;
768    end;
769  
770     {
# Line 658 | Line 779 | type
779      function ByName(Idx: AnsiString): ISQLParam ;
780      function GetModified: Boolean;
781      function GetHasCaseSensitiveParams: Boolean;
782 +    function GetStatement: IStatement;
783 +    function GetTransaction: ITransaction;
784 +    function GetAttachment: IAttachment;
785 +    procedure Clear;
786      property Modified: Boolean read GetModified;
787      property Params[index: integer]: ISQLParam read getSQLParam; default;
788      property Count: integer read getCount;
# Line 670 | Line 795 | type
795  
796    TPerfCounters = array[TPerfStats] of Int64;
797  
798 +  {Batch Query Execution Support}
799 +
800 +  TBatchCompletionState = (bcExecuteFailed, bcSuccessNoInfo, bcNoMoreErrors);
801 +
802 +  IBatchCompletion = interface
803 +  ['{9bc3d49d-16d9-4606-94e5-ee987103ad92}']
804 +    function getTotalProcessed: cardinal;
805 +    function getState(updateNo: cardinal): TBatchCompletionState;
806 +    function getStatusMessage(updateNo: cardinal): AnsiString;
807 +    function getUpdated: integer;
808 +    function getErrorStatus(var RowNo: integer; var status: IStatus): boolean;
809 +    end;
810 +
811    {The IStatement interface provides access to an SQL Statement once it has been
812     initially prepared. The interface is returned from the IAttachment interface.
813     }
814  
815 +  TStatementFlag = (stHasCursor,stRepeatExecute,stScrollable);
816 +  TStatementFlags = set of TStatementFlag;
817 +
818    IStatement = interface
819      ['{a260576d-a07d-4a66-b02d-1b72543fd7cf}']
820      function GetMetaData: IMetaData;  {Output Metadata}
# Line 681 | Line 822 | type
822      function GetPlan: AnsiString;
823      function GetRowsAffected(var SelectCount, InsertCount, UpdateCount, DeleteCount: integer): boolean;
824      function GetSQLStatementType: TIBSQLStatementTypes;
825 +    function GetSQLStatementTypeName: AnsiString;
826      function GetSQLText: AnsiString;
827      function GetProcessedSQLText: AnsiString;
828      function GetSQLDialect: integer;
829 +    function GetFlags: TStatementFlags;
830      function IsPrepared: boolean;
831 <    procedure Prepare(aTransaction: ITransaction=nil);
831 >    function HasBatchMode: boolean;
832 >    function IsInBatchMode: boolean;
833 >    procedure Prepare(aTransaction: ITransaction=nil); overload;
834 >    procedure Prepare(CursorName: AnsiString; aTransaction: ITransaction=nil); overload;
835      function Execute(aTransaction: ITransaction=nil): IResults;
836 <    function OpenCursor(aTransaction: ITransaction=nil): IResultSet;
836 >    function OpenCursor(aTransaction: ITransaction=nil): IResultSet; overload;
837 >    function OpenCursor(Scrollable: boolean; aTransaction: ITransaction=nil): IResultSet; overload;
838      function GetAttachment: IAttachment;
839      function GetTransaction: ITransaction;
840      procedure SetRetainInterfaces(aValue: boolean);
841      procedure EnableStatistics(aValue: boolean);
842      function GetPerfStatistics(var stats: TPerfCounters): boolean;
843 +    {IBatch interface support}
844 +    procedure AddToBatch;
845 +    function ExecuteBatch(aTransaction: ITransaction=nil): IBatchCompletion;
846 +    procedure CancelBatch;
847 +    function GetBatchCompletion: IBatchCompletion;
848 +    function GetBatchRowLimit: integer;
849 +    procedure SetBatchRowLimit(aLimit: integer);
850 +    {Stale Reference Check}
851 +    procedure SetStaleReferenceChecks(Enable:boolean); {default true}
852 +    function GetStaleReferenceChecks: boolean;
853 +
854      property MetaData: IMetaData read GetMetaData;
855      property SQLParams: ISQLParams read GetSQLParams;
856      property SQLStatementType: TIBSQLStatementTypes read GetSQLStatementType;
857    end;
858  
859 +  ITrInfoItem = interface
860 +    ['{41455e1a-f84e-4e26-aff0-1a78e8b69cfe}']
861 +    function getItemType: byte;
862 +    function getSize: integer;
863 +    function getAsString: AnsiString;
864 +    function getAsInteger: int64;
865 +    procedure DecodeTraIsolation(var IsolationType, RecVersion: byte);
866 +  end;
867 +
868 +  { ITrInformation }
869 +
870 +  ITrInformation = interface
871 +    ['{e6ea4a52-c1a1-44ba-9609-c8bcc7cba7b2}']
872 +    function GetCount: integer;
873 +    function GetItem(index: integer): ITrInfoItem;
874 +    function Find(ItemType: byte): ITrInfoItem;
875 +    procedure PrintBuf; {can be used to print buffer in hex for debugging}
876 +    property Count: integer read GetCount;
877 +    property Items[index: integer]: ITrInfoItem read getItem; default;
878 +  end;
879 +
880    {Transaction Parameter Block: (TPB)
881  
882     The TPB provides the parameters used when starting a transaction. It is allocated
# Line 709 | Line 888 | type
888     found in the Interbase 6.0 API Guide.
889    }
890  
891 <  ITPBItem = interface(IParameterBlockItem)
891 >  ITPBItem = interface(IParameterBlockItemWithTypeName)
892      ['{544c1f2b-7c12-4a87-a4a5-face7ea72671}']
893    end;
894  
895 <  ITPB = interface(IParameterBlock<ITPBItem>)
895 >  ITPB = interface(IParameterBlockWithTypeNames<ITPBItem>)
896      ['{7369b0ff-defe-437b-81fe-19b211d42d25}']
897 +    function AsText: AnsiString;
898    end;
899  
900    {The ITransactionAction interface provides access to a Transaction once it
# Line 727 | Line 907 | type
907  
908    TTransactionAction  = (TARollback, TACommit, TACommitRetaining, TARollbackRetaining);
909    TTransactionCompletion = TARollback.. TACommit;
910 +  TTrCompletionState = (trCommitted, trRolledback, trCommitFailed, trRollbackFailed);
911 +
912  
913    ITransaction = interface
914      ['{30928d0e-a9d7-4c61-b7cf-14f4f38abe2a}']
915      function getTPB: ITPB;
916      procedure Start(DefaultCompletion: TTransactionCompletion=taCommit);
917      function GetInTransaction: boolean;
918 +    function GetIsReadOnly: boolean;
919 +    function GetTransactionID: integer;
920 +    function GetJournalingActive(attachment: IAttachment): boolean;
921 +    function GetDefaultCompletion: TTransactionCompletion;
922      procedure PrepareForCommit; {Two phase commit - stage 1}
923 <    procedure Commit(Force: boolean=false);
923 >    function Commit(Force: boolean=false): TTrCompletionState;
924      procedure CommitRetaining;
925      function HasActivity: boolean;
926 <    procedure Rollback(Force: boolean=false);
926 >    function Rollback(Force: boolean=false): TTrCompletionState;
927      procedure RollbackRetaining;
928      function GetAttachmentCount: integer;
929      function GetAttachment(index: integer): IAttachment;
930 +    function GetTrInformation(Requests: array of byte): ITrInformation; overload;
931 +    function GetTrInformation(Request: byte): ITrInformation; overload;
932 +    function GetTransactionName: AnsiString;
933 +    procedure SetTransactionName(aValue: AnsiString);
934      property InTransaction: boolean read GetInTransaction;
935 +    property TransactionName: AnsiString read GetTransactionName write SetTransactionName;
936    end;
937  
938    { The IEvents Interface is used to handle events from a single database. The
# Line 771 | Line 962 | type
962      ['{6a0be233-ed08-4524-889c-2e45d0c20e5f}']
963      procedure GetEvents(EventNames: TStrings);
964      procedure SetEvents(EventNames: TStrings); overload;
965 <    procedure SetEvents(EventName: AnsiString); overload;
965 >    procedure SetEvents(EventName: string); overload;
966      procedure Cancel;
967      function ExtractEventCounts: TEventCounts;
968      procedure WaitForEvent;
# Line 779 | Line 970 | type
970      function GetAttachment: IAttachment;
971    end;
972  
973 +  TTZTextOptions = (tzOffset,      {Time Zone Rendered as an offset to GMT}
974 +                    tzGMT,         {No Time Zone. Time part is always rendered in GMT}
975 +                    tzOriginalID); {Time Zone shown as originally entered}
976 +
977 +  {The ITimeZoneServices interface provides access to the time zone database
978 +   used for the attachment. It may be used in support of TIMESTAMP WITH TIME ZONE
979 +   and TIME WITH TIME ZONE data types.}
980 +
981 +  ITimeZoneServices = interface
982 +    ['{163821f5-ebef-42b9-ac60-8ac4b5c09954}']
983 +    {utility functions}
984 +    function TimeZoneID2TimeZoneName(aTimeZoneID: TFBTimeZoneID): AnsiString;
985 +    function TimeZoneName2TimeZoneID(aTimeZone: AnsiString): TFBTimeZoneID;
986 +    function LocalTimeToGMT(aLocalTime: TDateTime; aTimeZone: AnsiString): TDateTime; overload;
987 +    function LocalTimeToGMT(aLocalTime: TDateTime; aTimeZoneID: TFBTimeZoneID): TDateTime; overload;
988 +    function GMTToLocalTime(aGMTTime: TDateTime; aTimeZone: AnsiString): TDateTime; overload;
989 +    function GMTToLocalTime(aGMTTime: TDateTime; aTimeZoneID: TFBTimeZoneID): TDateTime; overload;
990 +    function GetEffectiveOffsetMins(aLocalTime: TDateTime; aTimeZone: AnsiString): integer; overload;
991 +    function GetEffectiveOffsetMins(aLocalTime: TDateTime; aTimeZoneID: TFBTimeZoneID): integer; overload;
992 +
993 +    {Time Zone DB Information}
994 +    function UsingRemoteTZDB: boolean;
995 +    procedure SetUseLocalTZDB(useLocalTZDB: boolean);
996 +    function GetLocalTimeZoneName: AnsiString;
997 +    function GetLocalTimeZoneID: TFBTimeZoneID;
998 +    procedure GetTimeZoneInfo(aTimeZone: AnsiString; OnDate: TDateTime;
999 +                           var ZoneOffset, DSTOffset, EffectiveOffset: integer);
1000 +    {Configurable Options}
1001 +    function GetTimeTZDate: TDateTime;
1002 +    procedure SetTimeTZDate(aDate: TDateTime);
1003 +    function GetTZTextOption: TTZTextOptions;
1004 +    procedure SetTZTextOption(aOptionValue: TTZTextOptions);
1005 +  end;
1006 +
1007    {The IDBInformation Interface.
1008  
1009     An IDBInformation interface is returned by the  IAttachment GetDBInformation
# Line 807 | Line 1032 | type
1032      function getSize: integer;
1033      procedure getRawBytes(var Buffer);
1034      function getAsString: AnsiString;
1035 <    function getAsInteger: integer;
1035 >    function getAsInteger: int64;
1036      procedure DecodeIDCluster(var ConnectionType: integer; var DBFileName, DBSiteName: AnsiString);
1037      function getAsBytes: TByteArray;
1038      function getAsDateTime: TDateTime;
# Line 819 | Line 1044 | type
1044      function GetCount: integer;
1045      function GetItem(index: integer): IDBInfoItem;
1046      function Find(ItemType: byte): IDBInfoItem;
1047 <    property AsInteger: integer read getAsInteger;
1047 >    property AsInteger: int64 read getAsInteger;
1048      property AsString: AnsiString read GetAsString;
1049      property Count: integer read GetCount;
1050      property Items[index: integer]: IDBInfoItem read getItem; default;
# Line 862 | Line 1087 | type
1087     found in the Interbase 6.0 API Guide.
1088     }
1089  
1090 <  IDPBItem = interface(IParameterBlockItem)
1090 >  IDPBItem = interface(IParameterBlockItemWithTypeName)
1091      ['{123d4ad0-087a-4cd1-a344-1b3d03b30673}']
1092    end;
1093  
1094 <  IDPB = interface(IParameterBlock<IDPBItem>)
1095 <    ['{e676067b-1cf4-4eba-9256-9724f57e0d16}']
1096 <  end;
1094 >   IDPB = interface(IParameterBlockWithTypeNames<IDPBItem>)
1095 >     ['{e676067b-1cf4-4eba-9256-9724f57e0d16}']
1096 >   end;
1097 >
1098 >   {Journaling options. Default is [joReadWriteTransactions,joModifyQueries] }
1099 >
1100 >   TJournalOption = (joReadOnlyTransactions, joReadWriteTransactions,
1101 >                     joModifyQueries, joReadOnlyQueries,joNoServerTable);
1102 >
1103 >   TJournalOptions = set of TJournalOption;
1104  
1105    {The IAttachment interface provides access to a Database Connection. It may be
1106     used to:
# Line 907 | Line 1139 | type
1139      procedure Disconnect(Force: boolean=false);
1140      function IsConnected: boolean;
1141      procedure DropDatabase;
1142 <    function StartTransaction(TPB: array of byte; DefaultCompletion: TTransactionCompletion=taCommit): ITransaction; overload;
1143 <    function StartTransaction(TPB: ITPB; DefaultCompletion: TTransactionCompletion=taCommit): ITransaction; overload;
1142 >    function StartTransaction(TPB: array of byte;
1143 >                              DefaultCompletion: TTransactionCompletion=taCommit;
1144 >                              aName: AnsiString=''): ITransaction; overload;
1145 >    function StartTransaction(TPB: ITPB;
1146 >                              DefaultCompletion: TTransactionCompletion=taCommit;
1147 >                              aName: AnsiString=''): ITransaction; overload;
1148      procedure ExecImmediate(transaction: ITransaction; sql: AnsiString; SQLDialect: integer); overload;
1149      procedure ExecImmediate(TPB: array of byte; sql: AnsiString; SQLDialect: integer); overload;
1150      procedure ExecImmediate(transaction: ITransaction; sql: AnsiString); overload;
# Line 917 | Line 1153 | type
1153      function ExecuteSQL(transaction: ITransaction; sql: AnsiString; SQLDialect: integer; params: array of const): IResults; overload;
1154      function ExecuteSQL(TPB: array of byte; sql: AnsiString; params: array of const): IResults; overload;
1155      function ExecuteSQL(transaction: ITransaction; sql: AnsiString; params: array of const): IResults; overload;
920    function OpenCursor(transaction: ITransaction; sql: AnsiString; aSQLDialect: integer): IResultSet; overload;
1156      function OpenCursor(transaction: ITransaction; sql: AnsiString; aSQLDialect: integer;
1157 +                             Scrollable: boolean=false): IResultSet; overload;
1158 +    function OpenCursor(transaction: ITransaction; sql: AnsiString; aSQLDialect: integer;
1159 +                             params: array of const): IResultSet; overload;
1160 +    function OpenCursor(transaction: ITransaction; sql: AnsiString; Scrollable: boolean=false): IResultSet; overload;
1161 +    function OpenCursor(transaction: ITransaction; sql: AnsiString; Scrollable: boolean;
1162                               params: array of const): IResultSet; overload;
923    function OpenCursor(transaction: ITransaction; sql: AnsiString): IResultSet; overload;
1163      function OpenCursor(transaction: ITransaction; sql: AnsiString;
1164                               params: array of const): IResultSet; overload;
1165 <    function OpenCursorAtStart(transaction: ITransaction; sql: AnsiString; aSQLDialect: integer): IResultSet; overload;
1165 >    function OpenCursor(transaction: ITransaction; sql: AnsiString; aSQLDialect: integer; Scrollable: boolean;
1166 >                             params: array of const): IResultSet; overload;
1167 >    function OpenCursorAtStart(transaction: ITransaction; sql: AnsiString; aSQLDialect: integer;
1168 >                             Scrollable: boolean=false): IResultSet; overload;
1169      function OpenCursorAtStart(transaction: ITransaction; sql: AnsiString; aSQLDialect: integer;
1170                               params: array of const): IResultSet; overload;
1171 <    function OpenCursorAtStart(transaction: ITransaction; sql: AnsiString): IResultSet; overload;
1171 >    function OpenCursorAtStart(transaction: ITransaction; sql: AnsiString; aSQLDialect: integer; Scrollable: boolean;
1172 >                             params: array of const): IResultSet; overload;
1173 >    function OpenCursorAtStart(transaction: ITransaction; sql: AnsiString; Scrollable: boolean=false): IResultSet; overload;
1174      function OpenCursorAtStart(transaction: ITransaction; sql: AnsiString;
1175                               params: array of const): IResultSet; overload;
1176 <    function OpenCursorAtStart(sql: AnsiString): IResultSet; overload;
1176 >    function OpenCursorAtStart(transaction: ITransaction; sql: AnsiString; Scrollable: boolean;
1177 >                             params: array of const): IResultSet; overload;
1178 >    function OpenCursorAtStart(sql: AnsiString; Scrollable: boolean=false): IResultSet; overload;
1179 >    function OpenCursorAtStart(sql: AnsiString; Scrollable: boolean;
1180 >                             params: array of const): IResultSet; overload;
1181      function OpenCursorAtStart(sql: AnsiString;
1182                               params: array of const): IResultSet; overload;
1183 <    function Prepare(transaction: ITransaction; sql: AnsiString; aSQLDialect: integer): IStatement; overload;
1184 <    function Prepare(transaction: ITransaction; sql: AnsiString): IStatement; overload;
1183 >    function Prepare(transaction: ITransaction; sql: AnsiString; aSQLDialect: integer; CursorName: AnsiString=''): IStatement; overload;
1184 >    function Prepare(transaction: ITransaction; sql: AnsiString; CursorName: AnsiString=''): IStatement; overload;
1185      function PrepareWithNamedParameters(transaction: ITransaction; sql: AnsiString;
1186                         aSQLDialect: integer; GenerateParamNames: boolean=false;
1187 <                       CaseSensitiveParams: boolean = false): IStatement; overload;
1187 >                       CaseSensitiveParams: boolean = false; CursorName: AnsiString=''): IStatement; overload;
1188      function PrepareWithNamedParameters(transaction: ITransaction; sql: AnsiString;
1189                         GenerateParamNames: boolean=false;
1190 <                       CaseSensitiveParams: boolean = false): IStatement; overload;
1190 >                       CaseSensitiveParams: boolean = false; CursorName: AnsiString=''): IStatement; overload;
1191  
1192      {Events}
1193      function GetEventHandler(Events: TStrings): IEvents; overload;
# Line 952 | Line 1200 | type
1200      function CreateBlob(transaction: ITransaction; SubType: integer; CharSetID: cardinal=0; BPB: IBPB=nil): IBlob; overload;
1201      function OpenBlob(transaction: ITransaction; RelationName, ColumnName: AnsiString; BlobID: TISC_QUAD; BPB: IBPB=nil): IBlob; overload;
1202      function OpenBlob(transaction: ITransaction; BlobMetaData: IBlobMetaData; BlobID: TISC_QUAD; BPB: IBPB=nil): IBlob;  overload;
1203 +    function GetInlineBlobLimit: integer;
1204 +    procedure SetInlineBlobLimit(limit: integer);
1205  
1206      {Array - may use to open existing arrays. However, ISQLData.AsArray is preferred}
1207  
# Line 965 | Line 1215 | type
1215  
1216      {Database Information}
1217      function GetSQLDialect: integer;
1218 +    function GetAttachmentID: integer;
1219      function GetBlobMetaData(Transaction: ITransaction; tableName, columnName: AnsiString): IBlobMetaData;
1220      function GetArrayMetaData(Transaction: ITransaction; tableName, columnName: AnsiString): IArrayMetaData;
1221      function GetDBInformation(Requests: array of byte): IDBInformation; overload;
# Line 978 | Line 1229 | type
1229      function GetODSMinorVersion: integer;
1230      procedure getFBVersion(version: TStrings);
1231      function HasActivity: boolean;
1232 +    function HasDecFloatSupport: boolean;
1233 +    function HasBatchMode: boolean;
1234 +    function HasScollableCursors: boolean;
1235 +    function HasTable(aTableName: AnsiString): boolean;  {case sensitive}
1236 +    function HasFunction(aFunctionName: AnsiString): boolean; {case sensitive}
1237 +    function HasProcedure(aProcName: AnsiString): boolean; {case sensitive}
1238  
1239      {Character Sets}
1240 +    function GetCharSetID: integer; {connection character set}
1241      function HasDefaultCharSet: boolean;
1242      function GetDefaultCharSetID: integer;
1243      function GetCharsetName(CharSetID: integer): AnsiString;
# Line 989 | Line 1247 | type
1247      function CharSetWidth(CharSetID: integer; var Width: integer): boolean;
1248      procedure RegisterCharSet(CharSetName: AnsiString; CodePage: TSystemCodePage;
1249        AllowReverseLookup:boolean; out CharSetID: integer);
1250 <  end;
1250 >
1251 >    {Time Zone Database}
1252 >    function GetTimeZoneServices: ITimeZoneServices;
1253 >    function HasTimeZoneSupport: boolean;
1254 >
1255 >    {Client side Journaling}
1256 >    function JournalingActive: boolean;
1257 >    function GetJournalOptions: TJournalOptions;
1258 >    function StartJournaling(aJournalLogFile: AnsiString): integer; overload;
1259 >    function StartJournaling(aJournalLogFile: AnsiString; Options: TJournalOptions): integer; overload;
1260 >    function StartJournaling(S: TStream; Options: TJournalOptions): integer; overload;
1261 >    procedure StopJournaling(RetainJournal: boolean);
1262 > end;
1263  
1264    TProtocolAll = (TCP, SPX, NamedPipe, Local, inet, inet4, inet6, wnet, xnet, unknownProtocol);
1265    TProtocol = TCP..xnet;
# Line 1006 | Line 1276 | type
1276  
1277    }
1278  
1279 <  ISPBItem = interface(IParameterBlockItem)
1279 >  ISPBItem = interface(IParameterBlockItemWithTypeName)
1280      ['{5d08ae2b-4519-41bd-8b40-97cd451c3f6a}']
1281    end;
1282  
1283 <  ISPB = interface(IParameterBlock<ISPBItem>)
1283 >  ISPB = interface(IParameterBlockWithTypeNames<ISPBItem>)
1284      ['{2c5836fd-41ed-4426-9b7d-5af580ec2659}']
1285    end;
1286  
# Line 1070 | Line 1340 | type
1340      function getSize: integer;
1341      procedure getRawBytes(var Buffer);
1342      function getAsString: AnsiString;
1343 <    function getAsInteger: integer;
1343 >    function getAsInteger: int64;
1344      function getAsByte: byte;
1345      function CopyTo(stream: TStream; count: integer): integer;
1346      property AsString: AnsiString read getAsString;
1347 <    property AsInteger: integer read getAsInteger;
1347 >    property AsInteger: int64 read getAsInteger;
1348      property AsByte: byte read getAsByte;
1349    end;
1350  
# Line 1144 | Line 1414 | type
1414     The interface is returned by the FirebirdAPI function.
1415    }
1416  
1417 +  { IFirebirdAPI }
1418 +
1419    IFirebirdAPI = interface
1420      ['{edeee691-c8d3-4dcf-a780-cd7e432821d5}']
1421      {Database connections}
# Line 1155 | Line 1427 | type
1427      {Start Transaction against multiple databases}
1428      function AllocateTPB: ITPB;
1429      function StartTransaction(Attachments: array of IAttachment;
1430 <             TPB: array of byte; DefaultCompletion: TTransactionCompletion=taCommit): ITransaction; overload;
1430 >             TPB: array of byte; DefaultCompletion: TTransactionCompletion=taCommit;
1431 >             aName: AnsiString=''): ITransaction; overload;
1432      function StartTransaction(Attachments: array of IAttachment;
1433 <             TPB: ITPB; DefaultCompletion: TTransactionCompletion=taCommit): ITransaction; overload;
1433 >             TPB: ITPB; DefaultCompletion: TTransactionCompletion=taCommit;
1434 >             aName: AnsiString=''): ITransaction; overload;
1435  
1436      {Service Manager}
1437      function HasServiceAPI: boolean;
# Line 1172 | Line 1446 | type
1446      function GetImplementationVersion: AnsiString;
1447      function GetClientMajor: integer;
1448      function GetClientMinor: integer;
1449 +    function HasDecFloatSupport: boolean;
1450 +    function HasLocalTZDB: boolean;
1451 +    function HasTimeZoneSupport: boolean;
1452 +    function HasExtendedTZSupport: boolean;
1453  
1454      {Firebird 3 API}
1455      function HasMasterIntf: boolean;
1456 <    function GetIMaster: TObject;
1456 >    function GetIMaster: TObject;  deprecated 'Use FirebirdAPI.QueryInterface and FBClientLib.pas IFBIMasterProvider instead';
1457      function GetFBLibrary: IFirebirdLibrary;
1458   end;
1459  
# Line 1202 | Line 1480 | type
1480     EIBInterBaseError = class(EIBError)
1481     private
1482       FIBErrorCode: Long;
1483 +     FStatus: IStatus;
1484     public
1485 <     constructor Create(Status: IStatus); overload;
1485 >     constructor Create(aStatus: IStatus); overload;
1486       constructor Create(ASQLCode: Long; AIBErrorCode: Long; Msg: AnsiString); overload;
1487       property IBErrorCode: Long read FIBErrorCode;
1488 +     property Status: IStatus read FStatus;
1489     end;
1490  
1491     {IB Client Exceptions}
1492     EIBClientError = class(EIBError);
1493  
1494 +   {Used to explicitly report a Batch Buffer overflow}
1495 +   EIBBatchBufferOverflow = class(EIBError);
1496 +
1497   {The Firebird API function is used to access the IFirebirdAPI interface.
1498  
1499   It will load the Firebird Client Library if this is not already loaded and
# Line 1220 | Line 1503 | type
1503   function FirebirdAPI: IFirebirdAPI;
1504  
1505   {IBX support functions. Probably best ignored i.e. always used the FirebirdAPI
1506 < functino to load the library and check if it's loaded.}
1506 > function to load the library and check if it's loaded.}
1507  
1508   function TryIBLoad: Boolean;
1509   procedure CheckIBLoaded;
# Line 1231 | Line 1514 | procedure CheckIBLoaded;
1514  
1515   function LoadFBLibrary(aLibPathName: string): IFirebirdLibrary;
1516  
1517 + {$if not declared(Null)} {Needed for Delphi}
1518 + function Null: Variant;       // Null standard constant
1519 + {$define NEEDNULLFUNCTION}
1520 + {$ifend}
1521 +
1522   implementation
1523  
1524 < uses FBClientAPI
1524 > uses FBClientAPI {$if not declared(NULL)}, Variants {$ifend}
1525    {$IFDEF USELEGACYFIREBIRDAPI}, FB25ClientAPI {$ENDIF}
1526    {$IFDEF USEFIREBIRD3API}, FB30ClientAPI {$ENDIF};
1527  
# Line 1325 | Line 1613 | end;
1613  
1614   { EIBInterBaseError }
1615  
1616 < constructor EIBInterBaseError.Create(Status: IStatus);
1616 > constructor EIBInterBaseError.Create(aStatus: IStatus);
1617   begin
1618 <  inherited Create(Status.Getsqlcode,Status.GetMessage);
1619 <  FIBErrorCode := Status.GetIBErrorCode;
1618 >  inherited Create(aStatus.Getsqlcode,aStatus.GetMessage);
1619 >  FIBErrorCode := aStatus.GetIBErrorCode;
1620 >  FStatus := aStatus.Clone;
1621   end;
1622  
1623   constructor EIBInterBaseError.Create(ASQLCode: Long; AIBErrorCode: Long;
# Line 1338 | Line 1627 | begin
1627    FIBErrorCode := AIBErrorCode;
1628   end;
1629  
1630 + {$ifdef NEEDNULLFUNCTION}
1631 + function Null: Variant;       // Null standard constant
1632 +   begin
1633 +     VarClearProc(TVarData(Result));
1634 +     TVarData(Result).VType := varnull;
1635 +   end;
1636 + {$endif}
1637  
1638   initialization
1639    FDefaultFBLibrary := nil;

Comparing:
ibx/trunk/fbintf/IB.pas (property svn:eol-style), Revision 310 by tony, Tue Jul 21 08:20:03 2020 UTC vs.
ibx/branches/udr/client/IB.pas (property svn:eol-style), Revision 390 by tony, Sat Jan 22 16:15:12 2022 UTC

# Line 0 | Line 1
1 + native

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines