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 241 by tony, Thu Oct 25 13:57:12 2018 UTC vs.
ibx/branches/udr/client/IB.pas (file contents), Revision 386 by tony, Tue Jan 18 12:05:35 2022 UTC

# Line 73 | Line 73 | unit IB;
73   {$IFEND}
74   {$ENDIF}
75  
76 + {$IFNDEF LEGACYFIREBIRDAPIONLY}
77   {$DEFINE USEFIREBIRD3API}
78 + {$ENDIF}
79 + {$IFNDEF FIREBIRD3APIONLY}
80   {$DEFINE USELEGACYFIREBIRDAPI}
81 + {$ENDIF}
82  
83   {
84    This unit defines the interfaces used to provide the Pascal Language
# Line 122 | Line 126 | unit IB;
126   interface
127  
128   uses
129 <  Classes, SysUtils, DB, FBMessages, IBExternals;
129 >  Classes,
130 >  {$IFDEF WINDOWS}Windows, {$ENDIF}
131 >  {$IFDEF FPC} Dynlibs, {$ENDIF}
132 >  SysUtils, DB, FBMessages, IBExternals, FmtBcd;
133  
134   const
135    {Interface version information}
136    FBIntf_Major = 1;
137 <  FBIntf_Minor = 1;
138 <  FBIntf_Release = 3;
139 <  FBIntf_Version = '1.1.3';
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 158 | 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 173 | Line 206 | type
206     PISC_QUAD            = ^TISC_QUAD;
207  
208   {$IFNDEF FPC}
209 + {Delphi missing definitions}
210 + type
211 +  TLibHandle = THandle;
212 +
213 + const
214 +  NilHandle = 0;
215 +  DirectorySeparator = '\';
216 +
217   {Delphi only seems to define CP_UTF8 and CP_UTF16}
218   const
219    CP_ACP     = 0;     // default to ANSI code page
# Line 195 | Line 236 | type
236                    SQLGetSegment, SQLPutSegment,
237                    SQLExecProcedure, SQLStartTransaction,
238                    SQLCommit, SQLRollback,
239 <                  SQLSelectForUpdate, SQLSetGenerator);
239 >                  SQLSelectForUpdate, SQLSetGenerator,
240 >                  SQLSavePoint);
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}
# Line 216 | 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 233 | 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 241 | Line 312 | type
312     This interface can be accessed from IFirebirdAPI.
313     }
314  
315 +   TIBDataBaseErrorMessage    = (ShowSQLCode,
316 +                                   ShowIBMessage,
317 +                                   ShowSQLMessage);
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 GetIBErrorCode: TStatusCode;
326 >    function Getsqlcode: TStatusCode;
327      function GetMessage: AnsiString;
328      function CheckStatusVector(ErrorCodes: array of TFBStatusCode): Boolean;
329      function GetIBDataBaseErrorMessages: TIBDataBaseErrorMessages;
330 +    function Clone: IStatus;
331      procedure SetIBDataBaseErrorMessages(Value: TIBDataBaseErrorMessages);
332    end;
333  
# Line 267 | Line 347 | type
347      function GetSQLTypeName: AnsiString;
348      function GetScale: integer;
349      function GetSize: cardinal;
350 +    function GetCharSetWidth: integer;
351      function GetCharSetID: cardinal;
352      function GetTableName: AnsiString;
353      function GetColumnName: AnsiString;
# Line 305 | Line 386 | type
386      function GetAsBoolean(index: array of integer): boolean;
387      function GetAsCurrency(index: array of integer): Currency;
388      function GetAsInt64(index: array of integer): Int64;
389 <    function GetAsDateTime(index: array of integer): TDateTime;
389 >    function GetAsDateTime(index: array of integer): TDateTime; overload;
390 >    procedure GetAsDateTime(index: array of integer; var aDateTime: TDateTime; var dstOffset: smallint; var aTimezoneID: TFBTimeZoneID); overload;
391 >    procedure GetAsDateTime(index: array of integer; var aDateTime: TDateTime; var dstOffset: smallint; var aTimezone: AnsiString); overload;
392 >    procedure GetAsTime(index: array of integer; var aTime: TDateTime; var dstOffset: smallint; var aTimezoneID: TFBTimeZoneID; OnDate: TDateTime); overload;
393 >    procedure GetAsTime(index: array of integer; var aTime: TDateTime; var dstOffset: smallint; var aTimezone: AnsiString; OnDate: TDateTime); overload;
394 >    function GetAsUTCDateTime(index: array of integer): TDateTime;
395      function GetAsDouble(index: array of integer): Double;
396      function GetAsFloat(index: array of integer): Float;
397      function GetAsLong(index: array of integer): Long;
398      function GetAsShort(index: array of integer): Short;
399      function GetAsString(index: array of integer): AnsiString;
400      function GetAsVariant(index: array of integer): Variant;
401 +    function GetAsBCD(index: array of integer): tBCD;
402      procedure SetAsInteger(index: array of integer; AValue: integer);
403      procedure SetAsBoolean(index: array of integer; AValue: boolean);
404      procedure SetAsCurrency(index: array of integer; Value: Currency);
405      procedure SetAsInt64(index: array of integer; Value: Int64);
406      procedure SetAsDate(index: array of integer; Value: TDateTime);
407 +    procedure SetAsDateTime(index: array of integer; Value: TDateTime); overload;
408 +    procedure SetAsDateTime(index: array of integer; aValue: TDateTime; aTimeZoneID: TFBTimeZoneID); overload;
409 +    procedure SetAsDateTime(index: array of integer; aValue: TDateTime; aTimeZone: AnsiString); overload;
410 +    procedure SetAsTime(index: array of integer; Value: TDateTime); overload;
411 +    procedure SetAsTime(index: array of integer; aValue: TDateTime; OnDate: TDateTime; aTimeZoneID: TFBTimeZoneID); overload;
412 +    procedure SetAsTime(index: array of integer; aValue: TDateTime; OnDate: TDateTime; aTimeZone: AnsiString); overload;
413 +    procedure SetAsUTCDateTime(index: array of integer; aUTCTime: TDateTime);
414      procedure SetAsLong(index: array of integer; Value: Long);
321    procedure SetAsTime(index: array of integer; Value: TDateTime);
322    procedure SetAsDateTime(index: array of integer; Value: TDateTime);
415      procedure SetAsDouble(index: array of integer; Value: Double);
416      procedure SetAsFloat(index: array of integer; Value: Float);
417      procedure SetAsShort(index: array of integer; Value: Short);
418      procedure SetAsString(index: array of integer; Value: AnsiString);
419      procedure SetAsVariant(index: array of integer; Value: Variant);
420 +    procedure SetAsBcd(index: array of integer; aValue: tBCD);
421      procedure SetBounds(dim, UpperBound, LowerBound: integer);
422      function GetAttachment: IAttachment;
423      function GetTransaction: ITransaction;
# Line 395 | Line 488 | type
488      the output of an SQL Statement.
489    }
490  
491 +  TIBDateTimeFormats = (dfTimestamp, {SQL TIMESTAMP}
492 +                        dfDateTime,   {SQL DATETIME}
493 +                        dfTime,      {SQL TIME}
494 +                        dfTimestampTZ, {SQL_TIMESTAMP_TZ}
495 +                        dfTimeTZ);       {SQLTIME_TZ
496 +
497    { IColumnMetaData }
498  
499    IColumnMetaData = interface
# Line 411 | Line 510 | type
510      function getScale: integer;
511      function getCharSetID: cardinal;
512      function getCodePage: TSystemCodePage;
513 +    function GetCharSetWidth: integer;
514      function getIsNullable: boolean;
515      function GetSize: cardinal;
516      function GetArrayMetaData: IArrayMetaData; {Valid only for Array SQL Type}
517      function GetBlobMetaData: IBlobMetaData; {Valid only for Blob SQL Type}
518 +    function GetDateTimeStrLength(DateTimeFormat: TIBDateTimeFormats): integer;
519 +    function GetStatement: IStatement;
520 +    function GetTransaction: ITransaction;
521 +    function GetAttachment: IAttachment;
522      property Name: AnsiString read GetName;
523      property Size: cardinal read GetSize;
524      property SQLType: cardinal read GetSQLType;
# Line 456 | Line 560 | type
560  
561    ISQLData = interface(IColumnMetaData)
562      ['{3f493e31-7e3f-4606-a07c-b210b9e3619d}']
563 +    function GetStrDataLength: short;
564      function GetAsBoolean: boolean;
565      function GetAsCurrency: Currency;
566      function GetAsInt64: Int64;
567 <    function GetAsDateTime: TDateTime;
567 >    function GetAsDateTime: TDateTime; overload;
568 >    procedure GetAsDateTime(var aDateTime: TDateTime; var dstOffset: smallint; var aTimezoneID: TFBTimeZoneID); overload;
569 >    procedure GetAsDateTime(var aDateTime: TDateTime; var dstOffset: smallint; var aTimezone: AnsiString); overload;
570 >    procedure GetAsTime(var aTime: TDateTime; var dstOffset: smallint; var aTimezoneID: TFBTimeZoneID; OnDate: TDateTime); overload;
571 >    procedure GetAsTime(var aTime: TDateTime; var dstOffset: smallint; var aTimezone: AnsiString; OnDate: TDateTime); overload;
572 >    procedure GetAsTime(var aTime: TDateTime; var dstOffset: smallint; var aTimezoneID: TFBTimeZoneID); overload;
573 >    procedure GetAsTime(var aTime: TDateTime; var dstOffset: smallint; var aTimezone: AnsiString); overload;
574 >    function GetAsUTCDateTime: TDateTime;
575      function GetAsDouble: Double;
576      function GetAsFloat: Float;
577      function GetAsLong: Long;
# Line 472 | Line 584 | type
584      function GetAsBlob: IBlob; overload;
585      function GetAsBlob(BPB: IBPB): IBlob; overload;
586      function GetAsArray: IArray;
587 +    function GetAsBCD: tBCD;
588 +    function GetAsNumeric: IFBNumeric;
589      property AsDate: TDateTime read GetAsDateTime;
590      property AsBoolean:boolean read GetAsBoolean;
591      property AsTime: TDateTime read GetAsDateTime;
# Line 489 | Line 603 | type
603      property AsVariant: Variant read GetAsVariant ;
604      property AsBlob: IBlob read GetAsBlob;
605      property AsArray: IArray read GetAsArray;
606 +    property AsBCD: tBCD read GetAsBCD;
607 +    property AsNumeric: IFBNumeric read GetAsNumeric;
608      property IsNull: Boolean read GetIsNull;
609      property Value: Variant read GetAsVariant;
610    end;
# Line 502 | Line 618 | type
618    IResults = interface
619      ['{e836b2bb-93d1-4bbf-a8eb-7ce535de3bb5}']
620     function getCount: integer;
621 +   function GetStatement: IStatement;
622     function GetTransaction: ITransaction;
623 +   function GetAttachment: IAttachment;
624     function ByName(Idx: AnsiString): ISQLData;
625     function getSQLData(index: integer): ISQLData;
626     procedure GetData(index: integer; var IsNull:boolean; var len: short; var data: PByte);
# Line 518 | Line 636 | type
636    }
637    IResultSet = interface(IResults)
638      ['{0ae4979b-7857-4e8c-8918-ec6f155b51a0}']
639 <    function FetchNext: boolean;
639 >    function FetchNext: boolean; {fetch next record}
640 >    function FetchPrior: boolean; {fetch previous record}
641 >    function FetchFirst:boolean; {fetch first record}
642 >    function FetchLast: boolean; {fetch last record}
643 >    function FetchAbsolute(position: Integer): boolean; {fetch record by its absolute position in result set}
644 >    function FetchRelative(offset: Integer): boolean; {fetch record by position relative to current}
645      function GetCursorName: AnsiString;
646 +    function IsBof: boolean;
647      function IsEof: boolean;
648      procedure Close;
649    end;
650  
651    {The ISQLParam interface is used to provide access to each parameter in a
652 <   parametised SQL Statement. It subclasses IColumnMetaData and this part of
529 <   the interface may be used to access information on the expected SQL Type, etc.
530 <
531 <   It also subclasses ISQLData and this part of the interface may be used to access
532 <   current values for each parameter.
533 <
534 <   Otherwise, the interface comprises the Setter Methods and properties used to
652 >   parametised SQL Statement. The interface comprises the Setter Methods and properties used to
653     set the value of each parameter.
654  
655     Automatic conversion is provided to and from strings. That is GetAsString and
656     SetAsString are safe to use for sql types other than boolean - provided automatic
657     conversion is possible.
658 +
659 +   ISQLParam is subclassed from the IParamMetaData interface. This interface provides
660 +   access to the parameter metadata. This metadata is mutable and can change after
661 +   a parameter is set to a given value. This is acceptable as long as the parameter
662 +   metadata is type compatible with the underlying column metadata and hence the
663 +   parameter value can be converted by Firebird into a value acceptable by the
664 +   underlying column. The column metadata, which is unmutable, can be obtained
665 +   by the ISQLParam.getColMetadata interface. When a statement is prepared, the
666 +   parameter metadata is always initialised to the column metadata.
667    }
668  
669 <  ISQLParam = interface
670 <    ['{b22b4578-6d41-4807-a9a9-d2ec8d1d5a14}']
544 <    function GetIndex: integer;
669 >  IParamMetaData = interface
670 >  ['{4e148c4e-2d48-4991-a263-f66eca05c6aa}']
671      function GetSQLType: cardinal;
672      function GetSQLTypeName: AnsiString;
673      function getSubtype: integer;
548    function getName: AnsiString;
674      function getScale: integer;
675      function getCharSetID: cardinal;
676      function getCodePage: TSystemCodePage;
677      function getIsNullable: boolean;
678      function GetSize: cardinal;
679 +    property SQLType: cardinal read GetSQLType;
680 +  end;
681 +
682 +  ISQLParam = interface(IParamMetaData)
683 +    ['{b22b4578-6d41-4807-a9a9-d2ec8d1d5a14}']
684 +    function getColMetadata: IParamMetaData;
685 +    function GetStatement: IStatement;
686 +    function GetTransaction: ITransaction;
687 +    function GetAttachment: IAttachment;
688 +    function GetIndex: integer;
689 +    function getName: AnsiString;
690      function GetAsBoolean: boolean;
691      function GetAsCurrency: Currency;
692      function GetAsInt64: Int64;
693 <    function GetAsDateTime: TDateTime;
693 >    function GetAsDateTime: TDateTime; overload;
694 >    procedure GetAsDateTime(var aDateTime: TDateTime; var dstOffset: smallint; var aTimezoneID: TFBTimeZoneID); overload;
695 >    procedure GetAsDateTime(var aDateTime: TDateTime; var dstOffset: smallint; var aTimezone: AnsiString); overload;
696 >    procedure GetAsTime(var aTime: TDateTime; var dstOffset: smallint; var aTimezoneID: TFBTimeZoneID; OnDate: TDateTime); overload;
697 >    procedure GetAsTime(var aTime: TDateTime; var dstOffset: smallint; var aTimezone: AnsiString; OnDate: TDateTime); overload;
698 >    procedure GetAsTime(var aTime: TDateTime; var dstOffset: smallint; var aTimezoneID: TFBTimeZoneID); overload;
699 >    procedure GetAsTime(var aTime: TDateTime; var dstOffset: smallint; var aTimezone: AnsiString); overload;
700 >    function GetAsUTCDateTime: TDateTime;
701      function GetAsDouble: Double;
702      function GetAsFloat: Float;
703      function GetAsLong: Long;
# Line 566 | Line 709 | type
709      function GetAsVariant: Variant;
710      function GetAsBlob: IBlob;
711      function GetAsArray: IArray;
712 +    function GetAsBCD: tBCD;
713 +    function GetAsNumeric: IFBNumeric;
714      procedure Clear;
715      function GetModified: boolean;
716      procedure SetAsBoolean(AValue: boolean);
# Line 573 | Line 718 | type
718      procedure SetAsInt64(aValue: Int64);
719      procedure SetAsDate(aValue: TDateTime);
720      procedure SetAsLong(aValue: Long);
721 <    procedure SetAsTime(aValue: TDateTime);
722 <    procedure SetAsDateTime(aValue: TDateTime);
721 >    procedure SetAsTime(aValue: TDateTime); overload;
722 >    procedure SetAsTime(aValue: TDateTime; OnDate: TDateTime; aTimeZoneID: TFBTimeZoneID); overload;
723 >    procedure SetAsTime(aValue: TDateTime; OnDate: TDateTime; aTimeZone: AnsiString); overload;
724 >    procedure SetAsTime(aValue: TDateTime; aTimeZoneID: TFBTimeZoneID); overload;
725 >    procedure SetAsTime(aValue: TDateTime; aTimeZone: AnsiString); overload;
726 >    procedure SetAsDateTime(aValue: TDateTime); overload;
727 >    procedure SetAsDateTime(aValue: TDateTime; aTimeZoneID: TFBTimeZoneID); overload;
728 >    procedure SetAsDateTime(aValue: TDateTime; aTimeZone: AnsiString); overload;
729 >    procedure SetAsUTCDateTime(aUTCTime: TDateTime);
730      procedure SetAsDouble(aValue: Double);
731      procedure SetAsFloat(aValue: Float);
732      procedure SetAsPointer(aValue: Pointer);
# Line 586 | Line 738 | type
738      procedure SetAsArray(anArray: IArray);
739      procedure SetAsQuad(aValue: TISC_QUAD);
740      procedure SetCharSetID(aValue: cardinal);
741 +    procedure SetAsBcd(aValue: tBCD);
742 +    procedure SetAsNumeric(Value: IFBNumeric);
743      property AsDate: TDateTime read GetAsDateTime write SetAsDate;
744      property AsBoolean:boolean read GetAsBoolean write SetAsBoolean;
745      property AsTime: TDateTime read GetAsDateTime write SetAsTime;
# Line 602 | Line 756 | type
756      property AsVariant: Variant read GetAsVariant write SetAsVariant;
757      property AsBlob: IBlob read GetAsBlob write SetAsBlob;
758      property AsArray: IArray read GetAsArray write SetAsArray;
759 +    property AsBCD: tBCD read GetAsBCD write SetAsBCD;
760 +    property AsNumeric: IFBNumeric read GetAsNumeric write SetAsNumeric;
761      property AsQuad: TISC_QUAD read GetAsQuad write SetAsQuad;
762      property Value: Variant read GetAsVariant write SetAsVariant;
763      property IsNull: Boolean read GetIsNull write SetIsNull;
764      property IsNullable: Boolean read GetIsNullable;
765      property Modified: Boolean read getModified;
766      property Name: AnsiString read GetName;
611    property SQLType: cardinal read GetSQLType;
767    end;
768  
769     {
# Line 622 | Line 777 | type
777      function getSQLParam(index: integer): ISQLParam;
778      function ByName(Idx: AnsiString): ISQLParam ;
779      function GetModified: Boolean;
780 +    function GetHasCaseSensitiveParams: Boolean;
781 +    function GetStatement: IStatement;
782 +    function GetTransaction: ITransaction;
783 +    function GetAttachment: IAttachment;
784 +    procedure Clear;
785      property Modified: Boolean read GetModified;
786      property Params[index: integer]: ISQLParam read getSQLParam; default;
787      property Count: integer read getCount;
# Line 634 | Line 794 | type
794  
795    TPerfCounters = array[TPerfStats] of Int64;
796  
797 +  {Batch Query Execution Support}
798 +
799 +  TBatchCompletionState = (bcExecuteFailed, bcSuccessNoInfo, bcNoMoreErrors);
800 +
801 +  IBatchCompletion = interface
802 +  ['{9bc3d49d-16d9-4606-94e5-ee987103ad92}']
803 +    function getTotalProcessed: cardinal;
804 +    function getState(updateNo: cardinal): TBatchCompletionState;
805 +    function getStatusMessage(updateNo: cardinal): AnsiString;
806 +    function getUpdated: integer;
807 +    function getErrorStatus(var RowNo: integer; var status: IStatus): boolean;
808 +    end;
809 +
810    {The IStatement interface provides access to an SQL Statement once it has been
811     initially prepared. The interface is returned from the IAttachment interface.
812     }
813  
814 +  TStatementFlag = (stHasCursor,stRepeatExecute,stScrollable);
815 +  TStatementFlags = set of TStatementFlag;
816 +
817    IStatement = interface
818      ['{a260576d-a07d-4a66-b02d-1b72543fd7cf}']
819      function GetMetaData: IMetaData;  {Output Metadata}
# Line 645 | Line 821 | type
821      function GetPlan: AnsiString;
822      function GetRowsAffected(var SelectCount, InsertCount, UpdateCount, DeleteCount: integer): boolean;
823      function GetSQLStatementType: TIBSQLStatementTypes;
824 +    function GetSQLStatementTypeName: AnsiString;
825      function GetSQLText: AnsiString;
826 +    function GetProcessedSQLText: AnsiString;
827      function GetSQLDialect: integer;
828 +    function GetFlags: TStatementFlags;
829      function IsPrepared: boolean;
830 <    procedure Prepare(aTransaction: ITransaction=nil);
830 >    function HasBatchMode: boolean;
831 >    function IsInBatchMode: boolean;
832 >    procedure Prepare(aTransaction: ITransaction=nil); overload;
833 >    procedure Prepare(CursorName: AnsiString; aTransaction: ITransaction=nil); overload;
834      function Execute(aTransaction: ITransaction=nil): IResults;
835 <    function OpenCursor(aTransaction: ITransaction=nil): IResultSet;
835 >    function OpenCursor(aTransaction: ITransaction=nil): IResultSet; overload;
836 >    function OpenCursor(Scrollable: boolean; aTransaction: ITransaction=nil): IResultSet; overload;
837      function GetAttachment: IAttachment;
838      function GetTransaction: ITransaction;
839      procedure SetRetainInterfaces(aValue: boolean);
840      procedure EnableStatistics(aValue: boolean);
841      function GetPerfStatistics(var stats: TPerfCounters): boolean;
842 +    {IBatch interface support}
843 +    procedure AddToBatch;
844 +    function ExecuteBatch(aTransaction: ITransaction=nil): IBatchCompletion;
845 +    procedure CancelBatch;
846 +    function GetBatchCompletion: IBatchCompletion;
847 +    function GetBatchRowLimit: integer;
848 +    procedure SetBatchRowLimit(aLimit: integer);
849 +    {Stale Reference Check}
850 +    procedure SetStaleReferenceChecks(Enable:boolean); {default true}
851 +    function GetStaleReferenceChecks: boolean;
852 +
853      property MetaData: IMetaData read GetMetaData;
854      property SQLParams: ISQLParams read GetSQLParams;
855      property SQLStatementType: TIBSQLStatementTypes read GetSQLStatementType;
856    end;
857  
858 +  ITrInfoItem = interface
859 +    ['{41455e1a-f84e-4e26-aff0-1a78e8b69cfe}']
860 +    function getItemType: byte;
861 +    function getSize: integer;
862 +    function getAsString: AnsiString;
863 +    function getAsInteger: int64;
864 +    procedure DecodeTraIsolation(var IsolationType, RecVersion: byte);
865 +  end;
866 +
867 +  { ITrInformation }
868 +
869 +  ITrInformation = interface
870 +    ['{e6ea4a52-c1a1-44ba-9609-c8bcc7cba7b2}']
871 +    function GetCount: integer;
872 +    function GetItem(index: integer): ITrInfoItem;
873 +    function Find(ItemType: byte): ITrInfoItem;
874 +    procedure PrintBuf; {can be used to print buffer in hex for debugging}
875 +    property Count: integer read GetCount;
876 +    property Items[index: integer]: ITrInfoItem read getItem; default;
877 +  end;
878 +
879    {Transaction Parameter Block: (TPB)
880  
881     The TPB provides the parameters used when starting a transaction. It is allocated
# Line 672 | Line 887 | type
887     found in the Interbase 6.0 API Guide.
888    }
889  
890 <  ITPBItem = interface(IParameterBlockItem)
890 >  ITPBItem = interface(IParameterBlockItemWithTypeName)
891      ['{544c1f2b-7c12-4a87-a4a5-face7ea72671}']
892    end;
893  
894 <  ITPB = interface(IParameterBlock<ITPBItem>)
894 >  ITPB = interface(IParameterBlockWithTypeNames<ITPBItem>)
895      ['{7369b0ff-defe-437b-81fe-19b211d42d25}']
896 +    function AsText: AnsiString;
897    end;
898  
899    {The ITransactionAction interface provides access to a Transaction once it
# Line 696 | Line 912 | type
912      function getTPB: ITPB;
913      procedure Start(DefaultCompletion: TTransactionCompletion=taCommit);
914      function GetInTransaction: boolean;
915 +    function GetIsReadOnly: boolean;
916 +    function GetTransactionID: integer;
917 +    function GetJournalingActive(attachment: IAttachment): boolean;
918 +    function GetDefaultCompletion: TTransactionCompletion;
919      procedure PrepareForCommit; {Two phase commit - stage 1}
920      procedure Commit(Force: boolean=false);
921      procedure CommitRetaining;
# Line 704 | Line 924 | type
924      procedure RollbackRetaining;
925      function GetAttachmentCount: integer;
926      function GetAttachment(index: integer): IAttachment;
927 +    function GetTrInformation(Requests: array of byte): ITrInformation; overload;
928 +    function GetTrInformation(Request: byte): ITrInformation; overload;
929 +    function GetTransactionName: AnsiString;
930 +    procedure SetTransactionName(aValue: AnsiString);
931      property InTransaction: boolean read GetInTransaction;
932 +    property TransactionName: AnsiString read GetTransactionName write SetTransactionName;
933    end;
934  
935    { The IEvents Interface is used to handle events from a single database. The
# Line 734 | Line 959 | type
959      ['{6a0be233-ed08-4524-889c-2e45d0c20e5f}']
960      procedure GetEvents(EventNames: TStrings);
961      procedure SetEvents(EventNames: TStrings); overload;
962 <    procedure SetEvents(EventName: AnsiString); overload;
962 >    procedure SetEvents(EventName: string); overload;
963      procedure Cancel;
964      function ExtractEventCounts: TEventCounts;
965      procedure WaitForEvent;
# Line 742 | Line 967 | type
967      function GetAttachment: IAttachment;
968    end;
969  
970 +  TTZTextOptions = (tzOffset,      {Time Zone Rendered as an offset to GMT}
971 +                    tzGMT,         {No Time Zone. Time part is always rendered in GMT}
972 +                    tzOriginalID); {Time Zone shown as originally entered}
973 +
974 +  {The ITimeZoneServices interface provides access to the time zone database
975 +   used for the attachment. It may be used in support of TIMESTAMP WITH TIME ZONE
976 +   and TIME WITH TIME ZONE data types.}
977 +
978 +  ITimeZoneServices = interface
979 +    ['{163821f5-ebef-42b9-ac60-8ac4b5c09954}']
980 +    {utility functions}
981 +    function TimeZoneID2TimeZoneName(aTimeZoneID: TFBTimeZoneID): AnsiString;
982 +    function TimeZoneName2TimeZoneID(aTimeZone: AnsiString): TFBTimeZoneID;
983 +    function LocalTimeToGMT(aLocalTime: TDateTime; aTimeZone: AnsiString): TDateTime; overload;
984 +    function LocalTimeToGMT(aLocalTime: TDateTime; aTimeZoneID: TFBTimeZoneID): TDateTime; overload;
985 +    function GMTToLocalTime(aGMTTime: TDateTime; aTimeZone: AnsiString): TDateTime; overload;
986 +    function GMTToLocalTime(aGMTTime: TDateTime; aTimeZoneID: TFBTimeZoneID): TDateTime; overload;
987 +    function GetEffectiveOffsetMins(aLocalTime: TDateTime; aTimeZone: AnsiString): integer; overload;
988 +    function GetEffectiveOffsetMins(aLocalTime: TDateTime; aTimeZoneID: TFBTimeZoneID): integer; overload;
989 +
990 +    {Time Zone DB Information}
991 +    function UsingRemoteTZDB: boolean;
992 +    procedure SetUseLocalTZDB(useLocalTZDB: boolean);
993 +    function GetLocalTimeZoneName: AnsiString;
994 +    function GetLocalTimeZoneID: TFBTimeZoneID;
995 +    procedure GetTimeZoneInfo(aTimeZone: AnsiString; OnDate: TDateTime;
996 +                           var ZoneOffset, DSTOffset, EffectiveOffset: integer);
997 +    {Configurable Options}
998 +    function GetTimeTZDate: TDateTime;
999 +    procedure SetTimeTZDate(aDate: TDateTime);
1000 +    function GetTZTextOption: TTZTextOptions;
1001 +    procedure SetTZTextOption(aOptionValue: TTZTextOptions);
1002 +  end;
1003 +
1004    {The IDBInformation Interface.
1005  
1006     An IDBInformation interface is returned by the  IAttachment GetDBInformation
# Line 770 | Line 1029 | type
1029      function getSize: integer;
1030      procedure getRawBytes(var Buffer);
1031      function getAsString: AnsiString;
1032 <    function getAsInteger: integer;
1032 >    function getAsInteger: int64;
1033      procedure DecodeIDCluster(var ConnectionType: integer; var DBFileName, DBSiteName: AnsiString);
1034      function getAsBytes: TByteArray;
1035      function getAsDateTime: TDateTime;
# Line 782 | Line 1041 | type
1041      function GetCount: integer;
1042      function GetItem(index: integer): IDBInfoItem;
1043      function Find(ItemType: byte): IDBInfoItem;
1044 <    property AsInteger: integer read getAsInteger;
1044 >    property AsInteger: int64 read getAsInteger;
1045      property AsString: AnsiString read GetAsString;
1046      property Count: integer read GetCount;
1047      property Items[index: integer]: IDBInfoItem read getItem; default;
# Line 825 | Line 1084 | type
1084     found in the Interbase 6.0 API Guide.
1085     }
1086  
1087 <  IDPBItem = interface(IParameterBlockItem)
1087 >  IDPBItem = interface(IParameterBlockItemWithTypeName)
1088      ['{123d4ad0-087a-4cd1-a344-1b3d03b30673}']
1089    end;
1090  
1091 <  IDPB = interface(IParameterBlock<IDPBItem>)
1092 <    ['{e676067b-1cf4-4eba-9256-9724f57e0d16}']
1093 <  end;
1091 >   IDPB = interface(IParameterBlockWithTypeNames<IDPBItem>)
1092 >     ['{e676067b-1cf4-4eba-9256-9724f57e0d16}']
1093 >   end;
1094 >
1095 >   {Journaling options. Default is [joReadWriteTransactions,joModifyQueries] }
1096 >
1097 >   TJournalOption = (joReadOnlyTransactions, joReadWriteTransactions,
1098 >                     joModifyQueries, joReadOnlyQueries,joNoServerTable);
1099 >
1100 >   TJournalOptions = set of TJournalOption;
1101  
1102    {The IAttachment interface provides access to a Database Connection. It may be
1103     used to:
# Line 862 | Line 1128 | type
1128  
1129    IAttachment = interface
1130      ['{466e9b67-9def-4807-b3e7-e08a35e7185c}']
1131 +    function getFirebirdAPI: IFirebirdAPI;
1132      function getDPB: IDPB;
1133      function AllocateBPB: IBPB;
1134      function AllocateDIRB: IDIRB;
# Line 869 | Line 1136 | type
1136      procedure Disconnect(Force: boolean=false);
1137      function IsConnected: boolean;
1138      procedure DropDatabase;
1139 <    function StartTransaction(TPB: array of byte; DefaultCompletion: TTransactionCompletion=taCommit): ITransaction; overload;
1140 <    function StartTransaction(TPB: ITPB; DefaultCompletion: TTransactionCompletion=taCommit): ITransaction; overload;
1139 >    function StartTransaction(TPB: array of byte;
1140 >                              DefaultCompletion: TTransactionCompletion=taCommit;
1141 >                              aName: AnsiString=''): ITransaction; overload;
1142 >    function StartTransaction(TPB: ITPB;
1143 >                              DefaultCompletion: TTransactionCompletion=taCommit;
1144 >                              aName: AnsiString=''): ITransaction; overload;
1145      procedure ExecImmediate(transaction: ITransaction; sql: AnsiString; SQLDialect: integer); overload;
1146      procedure ExecImmediate(TPB: array of byte; sql: AnsiString; SQLDialect: integer); overload;
1147      procedure ExecImmediate(transaction: ITransaction; sql: AnsiString); overload;
# Line 879 | Line 1150 | type
1150      function ExecuteSQL(transaction: ITransaction; sql: AnsiString; SQLDialect: integer; params: array of const): IResults; overload;
1151      function ExecuteSQL(TPB: array of byte; sql: AnsiString; params: array of const): IResults; overload;
1152      function ExecuteSQL(transaction: ITransaction; sql: AnsiString; params: array of const): IResults; overload;
1153 <    function OpenCursor(transaction: ITransaction; sql: AnsiString; aSQLDialect: integer): IResultSet; overload;
1153 >    function OpenCursor(transaction: ITransaction; sql: AnsiString; aSQLDialect: integer;
1154 >                             Scrollable: boolean=false): IResultSet; overload;
1155      function OpenCursor(transaction: ITransaction; sql: AnsiString; aSQLDialect: integer;
1156                               params: array of const): IResultSet; overload;
1157 <    function OpenCursor(transaction: ITransaction; sql: AnsiString): IResultSet; overload;
1157 >    function OpenCursor(transaction: ITransaction; sql: AnsiString; Scrollable: boolean=false): IResultSet; overload;
1158 >    function OpenCursor(transaction: ITransaction; sql: AnsiString; Scrollable: boolean;
1159 >                             params: array of const): IResultSet; overload;
1160      function OpenCursor(transaction: ITransaction; sql: AnsiString;
1161                               params: array of const): IResultSet; overload;
1162 <    function OpenCursorAtStart(transaction: ITransaction; sql: AnsiString; aSQLDialect: integer): IResultSet; overload;
1162 >    function OpenCursor(transaction: ITransaction; sql: AnsiString; aSQLDialect: integer; Scrollable: boolean;
1163 >                             params: array of const): IResultSet; overload;
1164      function OpenCursorAtStart(transaction: ITransaction; sql: AnsiString; aSQLDialect: integer;
1165 +                             Scrollable: boolean=false): IResultSet; overload;
1166 +    function OpenCursorAtStart(transaction: ITransaction; sql: AnsiString; aSQLDialect: integer;
1167 +                             params: array of const): IResultSet; overload;
1168 +    function OpenCursorAtStart(transaction: ITransaction; sql: AnsiString; aSQLDialect: integer; Scrollable: boolean;
1169                               params: array of const): IResultSet; overload;
1170 <    function OpenCursorAtStart(transaction: ITransaction; sql: AnsiString): IResultSet; overload;
1170 >    function OpenCursorAtStart(transaction: ITransaction; sql: AnsiString; Scrollable: boolean=false): IResultSet; overload;
1171      function OpenCursorAtStart(transaction: ITransaction; sql: AnsiString;
1172                               params: array of const): IResultSet; overload;
1173 <    function OpenCursorAtStart(sql: AnsiString): IResultSet; overload;
1173 >    function OpenCursorAtStart(transaction: ITransaction; sql: AnsiString; Scrollable: boolean;
1174 >                             params: array of const): IResultSet; overload;
1175 >    function OpenCursorAtStart(sql: AnsiString; Scrollable: boolean=false): IResultSet; overload;
1176 >    function OpenCursorAtStart(sql: AnsiString; Scrollable: boolean;
1177 >                             params: array of const): IResultSet; overload;
1178      function OpenCursorAtStart(sql: AnsiString;
1179                               params: array of const): IResultSet; overload;
1180 <    function Prepare(transaction: ITransaction; sql: AnsiString; aSQLDialect: integer): IStatement; overload;
1181 <    function Prepare(transaction: ITransaction; sql: AnsiString): IStatement; overload;
1180 >    function Prepare(transaction: ITransaction; sql: AnsiString; aSQLDialect: integer; CursorName: AnsiString=''): IStatement; overload;
1181 >    function Prepare(transaction: ITransaction; sql: AnsiString; CursorName: AnsiString=''): IStatement; overload;
1182      function PrepareWithNamedParameters(transaction: ITransaction; sql: AnsiString;
1183 <                       aSQLDialect: integer; GenerateParamNames: boolean=false): IStatement; overload;
1183 >                       aSQLDialect: integer; GenerateParamNames: boolean=false;
1184 >                       CaseSensitiveParams: boolean = false; CursorName: AnsiString=''): IStatement; overload;
1185      function PrepareWithNamedParameters(transaction: ITransaction; sql: AnsiString;
1186 <                       GenerateParamNames: boolean=false): IStatement; overload;
1186 >                       GenerateParamNames: boolean=false;
1187 >                       CaseSensitiveParams: boolean = false; CursorName: AnsiString=''): IStatement; overload;
1188  
1189      {Events}
1190      function GetEventHandler(Events: TStrings): IEvents; overload;
# Line 910 | Line 1195 | type
1195      function CreateBlob(transaction: ITransaction; RelationName, ColumnName: AnsiString; BPB: IBPB=nil): IBlob; overload;
1196      function CreateBlob(transaction: ITransaction; BlobMetaData: IBlobMetaData; BPB: IBPB=nil): IBlob; overload;
1197      function CreateBlob(transaction: ITransaction; SubType: integer; CharSetID: cardinal=0; BPB: IBPB=nil): IBlob; overload;
1198 <    function OpenBlob(transaction: ITransaction; RelationName, ColumnName: AnsiString; BlobID: TISC_QUAD; BPB: IBPB=nil): IBlob;
1198 >    function OpenBlob(transaction: ITransaction; RelationName, ColumnName: AnsiString; BlobID: TISC_QUAD; BPB: IBPB=nil): IBlob; overload;
1199 >    function OpenBlob(transaction: ITransaction; BlobMetaData: IBlobMetaData; BlobID: TISC_QUAD; BPB: IBPB=nil): IBlob;  overload;
1200 >    function GetInlineBlobLimit: integer;
1201 >    procedure SetInlineBlobLimit(limit: integer);
1202  
1203      {Array - may use to open existing arrays. However, ISQLData.AsArray is preferred}
1204  
1205 <    function OpenArray(transaction: ITransaction; RelationName, ColumnName: AnsiString; ArrayID: TISC_QUAD): IArray;
1205 >    function OpenArray(transaction: ITransaction; RelationName, ColumnName: AnsiString; ArrayID: TISC_QUAD): IArray; overload;
1206 >    function OpenArray(transaction: ITransaction; ArrayMetaData: IArrayMetaData; ArrayID: TISC_QUAD): IArray; overload;
1207      function CreateArray(transaction: ITransaction; RelationName, ColumnName: AnsiString): IArray; overload;
1208      function CreateArray(transaction: ITransaction; ArrayMetaData: IArrayMetaData): IArray; overload;
1209      function CreateArrayMetaData(SQLType: cardinal; tableName: AnsiString; columnName: AnsiString;
# Line 923 | Line 1212 | type
1212  
1213      {Database Information}
1214      function GetSQLDialect: integer;
1215 +    function GetAttachmentID: integer;
1216      function GetBlobMetaData(Transaction: ITransaction; tableName, columnName: AnsiString): IBlobMetaData;
1217      function GetArrayMetaData(Transaction: ITransaction; tableName, columnName: AnsiString): IArrayMetaData;
1218      function GetDBInformation(Requests: array of byte): IDBInformation; overload;
# Line 934 | Line 1224 | type
1224      function GetSecurityDatabase: AnsiString;
1225      function GetODSMajorVersion: integer;
1226      function GetODSMinorVersion: integer;
1227 +    procedure getFBVersion(version: TStrings);
1228      function HasActivity: boolean;
1229 +    function HasDecFloatSupport: boolean;
1230 +    function HasBatchMode: boolean;
1231 +    function HasScollableCursors: boolean;
1232 +    function HasTable(aTableName: AnsiString): boolean;  {case sensitive}
1233 +    function HasFunction(aFunctionName: AnsiString): boolean; {case sensitive}
1234 +    function HasProcedure(aProcName: AnsiString): boolean; {case sensitive}
1235  
1236      {Character Sets}
1237 +    function GetCharSetID: integer; {connection character set}
1238      function HasDefaultCharSet: boolean;
1239      function GetDefaultCharSetID: integer;
1240      function GetCharsetName(CharSetID: integer): AnsiString;
# Line 946 | Line 1244 | type
1244      function CharSetWidth(CharSetID: integer; var Width: integer): boolean;
1245      procedure RegisterCharSet(CharSetName: AnsiString; CodePage: TSystemCodePage;
1246        AllowReverseLookup:boolean; out CharSetID: integer);
1247 <  end;
1247 >
1248 >    {Time Zone Database}
1249 >    function GetTimeZoneServices: ITimeZoneServices;
1250 >    function HasTimeZoneSupport: boolean;
1251 >
1252 >    {Client side Journaling}
1253 >    function JournalingActive: boolean;
1254 >    function GetJournalOptions: TJournalOptions;
1255 >    function StartJournaling(aJournalLogFile: AnsiString): integer; overload;
1256 >    function StartJournaling(aJournalLogFile: AnsiString; Options: TJournalOptions): integer; overload;
1257 >    function StartJournaling(S: TStream; Options: TJournalOptions): integer; overload;
1258 >    procedure StopJournaling(RetainJournal: boolean);
1259 > end;
1260  
1261    TProtocolAll = (TCP, SPX, NamedPipe, Local, inet, inet4, inet6, wnet, xnet, unknownProtocol);
1262    TProtocol = TCP..xnet;
# Line 963 | Line 1273 | type
1273  
1274    }
1275  
1276 <  ISPBItem = interface(IParameterBlockItem)
1276 >  ISPBItem = interface(IParameterBlockItemWithTypeName)
1277      ['{5d08ae2b-4519-41bd-8b40-97cd451c3f6a}']
1278    end;
1279  
1280 <  ISPB = interface(IParameterBlock<ISPBItem>)
1280 >  ISPB = interface(IParameterBlockWithTypeNames<ISPBItem>)
1281      ['{2c5836fd-41ed-4426-9b7d-5af580ec2659}']
1282    end;
1283  
# Line 1027 | Line 1337 | type
1337      function getSize: integer;
1338      procedure getRawBytes(var Buffer);
1339      function getAsString: AnsiString;
1340 <    function getAsInteger: integer;
1340 >    function getAsInteger: int64;
1341      function getAsByte: byte;
1342      function CopyTo(stream: TStream; count: integer): integer;
1343      property AsString: AnsiString read getAsString;
1344 <    property AsInteger: integer read getAsInteger;
1344 >    property AsInteger: int64 read getAsInteger;
1345      property AsByte: byte read getAsByte;
1346    end;
1347  
# Line 1054 | Line 1364 | type
1364      property Count: integer read getCount;
1365    end;
1366  
1367 +  IFirebirdLibrary = interface;
1368 +
1369    {The IServiceManager interface provides access to a service manager. It can
1370     used to Detach and re-attach to Service Manager, to start services and to
1371     query the service manager.
# Line 1065 | Line 1377 | type
1377  
1378    IServiceManager = interface
1379      ['{905b587d-1e1f-4e40-a3f8-a3519f852e48}']
1380 +    function getFirebirdAPI: IFirebirdAPI;
1381      function getSPB: ISPB;
1382      function getServerName: AnsiString;
1383      function getProtocol: TProtocol;
# Line 1079 | Line 1392 | type
1392      function Query(Request: ISRB; RaiseExceptionOnError: boolean=true) :IServiceQueryResults; overload;
1393    end;
1394  
1395 +  {Tbe Firebird Library API used to get information about the Firebird library}
1396 +
1397 +
1398 +  IFirebirdLibrary = interface
1399 +    ['{3c04e0a1-12e0-428a-b2e1-bc6fcd97b79b}']
1400 +    function GetHandle: TLibHandle;
1401 +    function GetLibraryName: string;
1402 +    function GetLibraryFilePath: string;
1403 +    function GetFirebirdAPI: IFirebirdAPI;
1404 +  end;
1405 +
1406    {The Firebird API.
1407  
1408     This is the base interface and is used to create/open a database connection, to
# Line 1087 | Line 1411 | type
1411     The interface is returned by the FirebirdAPI function.
1412    }
1413  
1414 +  { IFirebirdAPI }
1415 +
1416    IFirebirdAPI = interface
1417      ['{edeee691-c8d3-4dcf-a780-cd7e432821d5}']
1418      {Database connections}
# Line 1098 | Line 1424 | type
1424      {Start Transaction against multiple databases}
1425      function AllocateTPB: ITPB;
1426      function StartTransaction(Attachments: array of IAttachment;
1427 <             TPB: array of byte; DefaultCompletion: TTransactionCompletion=taCommit): ITransaction; overload;
1427 >             TPB: array of byte; DefaultCompletion: TTransactionCompletion=taCommit;
1428 >             aName: AnsiString=''): ITransaction; overload;
1429      function StartTransaction(Attachments: array of IAttachment;
1430 <             TPB: ITPB; DefaultCompletion: TTransactionCompletion=taCommit): ITransaction; overload;
1430 >             TPB: ITPB; DefaultCompletion: TTransactionCompletion=taCommit;
1431 >             aName: AnsiString=''): ITransaction; overload;
1432  
1433      {Service Manager}
1434      function HasServiceAPI: boolean;
# Line 1110 | Line 1438 | type
1438  
1439      {Information}
1440      function GetStatus: IStatus;
1113    function GetLibraryName: string;
1441      function HasRollbackRetaining: boolean;
1442      function IsEmbeddedServer: boolean;
1443      function GetImplementationVersion: AnsiString;
1444 +    function GetClientMajor: integer;
1445 +    function GetClientMinor: integer;
1446 +    function HasDecFloatSupport: boolean;
1447 +    function HasLocalTZDB: boolean;
1448 +    function HasTimeZoneSupport: boolean;
1449 +    function HasExtendedTZSupport: boolean;
1450  
1451      {Firebird 3 API}
1452      function HasMasterIntf: boolean;
1453 <    function GetIMaster: TObject;
1453 >    function GetIMaster: TObject;  deprecated 'Use FirebirdAPI.QueryInterface and FBClientLib.pas IFBIMasterProvider instead';
1454 >    function GetFBLibrary: IFirebirdLibrary;
1455   end;
1456  
1457   type
# Line 1143 | Line 1477 | type
1477     EIBInterBaseError = class(EIBError)
1478     private
1479       FIBErrorCode: Long;
1480 +     FStatus: IStatus;
1481     public
1482 <     constructor Create(Status: IStatus); overload;
1482 >     constructor Create(aStatus: IStatus); overload;
1483       constructor Create(ASQLCode: Long; AIBErrorCode: Long; Msg: AnsiString); overload;
1484       property IBErrorCode: Long read FIBErrorCode;
1485 +     property Status: IStatus read FStatus;
1486     end;
1487  
1488     {IB Client Exceptions}
1489     EIBClientError = class(EIBError);
1490  
1491 < {IBError is used internally and by IBX to throw an EIBClientError}
1492 <
1157 < procedure IBError(ErrMess: TIBClientError; const Args: array of const);
1491 >   {Used to explicitly report a Batch Buffer overflow}
1492 >   EIBBatchBufferOverflow = class(EIBError);
1493  
1494   {The Firebird API function is used to access the IFirebirdAPI interface.
1495  
# Line 1165 | Line 1500 | procedure IBError(ErrMess: TIBClientErro
1500   function FirebirdAPI: IFirebirdAPI;
1501  
1502   {IBX support functions. Probably best ignored i.e. always used the FirebirdAPI
1503 < functino to load the library and check if it's loaded.}
1503 > function to load the library and check if it's loaded.}
1504  
1505   function TryIBLoad: Boolean;
1506   procedure CheckIBLoaded;
1507  
1508 + {If you want to explicitly load the Firebird library from a
1509 + non-default location then use this function and its GetFirebirdAPI function
1510 + to get the API.}
1511 +
1512 + function LoadFBLibrary(aLibPathName: string): IFirebirdLibrary;
1513 +
1514 + {$if not declared(Null)} {Needed for Delphi}
1515 + function Null: Variant;       // Null standard constant
1516 + {$define NEEDNULLFUNCTION}
1517 + {$ifend}
1518 +
1519   implementation
1520  
1521 < uses FBClientAPI
1521 > uses FBClientAPI {$if not declared(NULL)}, Variants {$ifend}
1522    {$IFDEF USELEGACYFIREBIRDAPI}, FB25ClientAPI {$ENDIF}
1523    {$IFDEF USEFIREBIRD3API}, FB30ClientAPI {$ENDIF};
1524  
1525 < var FFirebirdAPI: IFirebirdAPI;
1525 > var FDefaultFBLibrary: IFirebirdLibrary;
1526 >
1527 > type
1528 >
1529 >  { TFBLibrary }
1530 >
1531 >  TFBLibraryImpl = class(TFBLibrary)
1532 >  protected
1533 >    function GetFirebird3API: IFirebirdAPI; override;
1534 >    function GetLegacyFirebirdAPI: IFirebirdAPI; override;
1535 >  end;
1536 >
1537 > function TFBLibraryImpl.GetFirebird3API: IFirebirdAPI;
1538 > begin
1539 > {$IFDEF USEFIREBIRD3API}
1540 > Result := TFB30ClientAPI.Create(self);
1541 > {$ELSE}
1542 > Result := nil;
1543 > {$ENDIF}
1544 > end;
1545 >
1546 > function TFBLibraryImpl.GetLegacyFirebirdAPI: IFirebirdAPI;
1547 > begin
1548 >  {$IFDEF USELEGACYFIREBIRDAPI}
1549 >  Result := TFB25ClientAPI.Create(self);
1550 >  {$ELSE}
1551 >  Result := nil;
1552 >  {$ENDIF}
1553 > end;
1554  
1555   function FirebirdAPI: IFirebirdAPI;
1556   begin
1557 <  if FFirebirdAPI = nil then
1557 >  if FDefaultFBLibrary = nil then
1558      CheckIBLoaded;
1559 <  Result := FFirebirdAPI;
1559 >  Result := FDefaultFBLibrary.GetFirebirdAPI;
1560   end;
1561  
1562   function TryIBLoad: Boolean;
1563 + var fblib: IFirebirdLibrary;
1564   begin
1565 < Result := FFirebirdAPI <> nil;
1565 > Result := FDefaultFBLibrary <> nil;
1566   try
1192  {$IFDEF USEFIREBIRD3API}
1567    if not Result then
1568    begin
1569 <    FFirebirdAPI := TFB30ClientAPI.Create;
1570 <    Result := FFirebirdAPI.HasMasterIntf;
1571 <  end;
1572 <  {$ENDIF}
1199 <  {$IFDEF USELEGACYFIREBIRDAPI}
1200 <  if not Result then
1201 <  begin
1202 <    FFirebirdAPI := nil;
1203 <    FFirebirdAPI := TFB25ClientAPI.Create;
1204 <    Result := true;
1205 <  end;
1206 <  {$ENDIF}
1207 <  if Result and not (FFirebirdAPI as TFBClientAPI).IsLibraryLoaded then
1208 <  begin
1209 <    Result := false;
1210 <    FFirebirdAPI := nil;
1569 >    fblib := TFBLibraryImpl.Create;
1570 >    if (fblib <> nil) and (fblib.GetFirebirdAPI <> nil) then
1571 >      FDefaultFBLibrary := fblib;
1572 >    Result := FDefaultFBLibrary <> nil;
1573    end;
1574   except
1575     SysUtils.showexception(ExceptObject,ExceptAddr);
# Line 1221 | Line 1583 | begin
1583      IBError(ibxeInterBaseMissing, [nil]);
1584   end;
1585  
1586 + function LoadFBLibrary(aLibPathName: string): IFirebirdLibrary;
1587 + var fblib: IFirebirdLibrary;
1588 + begin
1589 +  if trim(aLibPathName) = '' then
1590 +  begin
1591 +    CheckIBLoaded;
1592 +    Result := FDefaultFBLibrary;
1593 +  end
1594 +  else
1595 +  begin
1596 +    fblib := TFBLibraryImpl.GetFBLibrary(aLibPathName);
1597 +    if (fblib = nil) or (fblib.GetFirebirdAPI = nil) then
1598 +      IBError(ibxeInterBaseMissing, [nil]);
1599 +    Result := fblib;
1600 +  end;
1601 + end;
1602 +
1603   { EIBError }
1604  
1605   constructor EIBError.Create(ASQLCode: Long; Msg: AnsiString);
# Line 1231 | Line 1610 | end;
1610  
1611   { EIBInterBaseError }
1612  
1613 < constructor EIBInterBaseError.Create(Status: IStatus);
1613 > constructor EIBInterBaseError.Create(aStatus: IStatus);
1614   begin
1615 <  inherited Create(Status.Getsqlcode,Status.GetMessage);
1616 <  FIBErrorCode := Status.GetIBErrorCode;
1615 >  inherited Create(aStatus.Getsqlcode,aStatus.GetMessage);
1616 >  FIBErrorCode := aStatus.GetIBErrorCode;
1617 >  FStatus := aStatus.Clone;
1618   end;
1619  
1620   constructor EIBInterBaseError.Create(ASQLCode: Long; AIBErrorCode: Long;
# Line 1244 | Line 1624 | begin
1624    FIBErrorCode := AIBErrorCode;
1625   end;
1626  
1627 < procedure IBError(ErrMess: TIBClientError; const Args: array of const);
1628 < begin
1629 <  raise EIBClientError.Create(Ord(ErrMess),
1630 <                              Format(GetErrorMessage(ErrMess), Args));
1631 < end;
1627 > {$ifdef NEEDNULLFUNCTION}
1628 > function Null: Variant;       // Null standard constant
1629 >   begin
1630 >     VarClearProc(TVarData(Result));
1631 >     TVarData(Result).VType := varnull;
1632 >   end;
1633 > {$endif}
1634  
1635   initialization
1636 <  FFirebirdAPI := nil;
1636 >  FDefaultFBLibrary := nil;
1637  
1638   finalization
1639 <  FFirebirdAPI := nil;
1639 >  FDefaultFBLibrary := nil;
1640  
1641   end.
1642  

Comparing:
ibx/trunk/fbintf/IB.pas (property svn:eol-style), Revision 241 by tony, Thu Oct 25 13:57:12 2018 UTC vs.
ibx/branches/udr/client/IB.pas (property svn:eol-style), Revision 386 by tony, Tue Jan 18 12:05:35 2022 UTC

# Line 0 | Line 1
1 + native

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines