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.
Revision 315 by tony, Thu Feb 25 11:56:36 2021 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 = 2;
138 >  FBIntf_Release = 0;
139 >  FBIntf_Version = '1.2.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;
# Line 234 | Line 261 | type
261      property Items[index: integer]: _IItem read getItems; default;
262    end;
263  
264 +  IParameterBlockWithTypeNames<_IItem> = interface(IParameterBlock<_IItem>)
265 +    function AddByTypeName(ParamTypeName: AnsiString): _IItem;
266 +    function GetDPBParamTypeName(ParamType: byte): Ansistring;
267 +  end;
268 +
269    {IParameterBlockItem is not used on its own but instead provides a base type for
270     different parameter block items }
271  
# Line 251 | Line 283 | type
283      property AsInteger: integer read getAsInteger write SetAsInteger;
284    end;
285  
286 +  IParameterBlockItemWithTypeName = interface(IParameterBlockItem)
287 +    function getParamTypeName: AnsiString;
288 +  end;
289  
290    {The IStatus interface provides access to error information, if any, returned
291     by the last API call. It can also be used to customise the error message
# Line 330 | Line 365 | type
365      function GetAsBoolean(index: array of integer): boolean;
366      function GetAsCurrency(index: array of integer): Currency;
367      function GetAsInt64(index: array of integer): Int64;
368 <    function GetAsDateTime(index: array of integer): TDateTime;
368 >    function GetAsDateTime(index: array of integer): TDateTime; overload;
369 >    procedure GetAsDateTime(index: array of integer; var aDateTime: TDateTime; var dstOffset: smallint; var aTimezoneID: TFBTimeZoneID); overload;
370 >    procedure GetAsDateTime(index: array of integer; var aDateTime: TDateTime; var dstOffset: smallint; var aTimezone: AnsiString); overload;
371 >    procedure GetAsTime(index: array of integer; var aTime: TDateTime; var dstOffset: smallint; var aTimezoneID: TFBTimeZoneID; OnDate: TDateTime); overload;
372 >    procedure GetAsTime(index: array of integer; var aTime: TDateTime; var dstOffset: smallint; var aTimezone: AnsiString; OnDate: TDateTime); overload;
373 >    function GetAsUTCDateTime(index: array of integer): TDateTime;
374      function GetAsDouble(index: array of integer): Double;
375      function GetAsFloat(index: array of integer): Float;
376      function GetAsLong(index: array of integer): Long;
377      function GetAsShort(index: array of integer): Short;
378      function GetAsString(index: array of integer): AnsiString;
379      function GetAsVariant(index: array of integer): Variant;
380 +    function GetAsBCD(index: array of integer): tBCD;
381      procedure SetAsInteger(index: array of integer; AValue: integer);
382      procedure SetAsBoolean(index: array of integer; AValue: boolean);
383      procedure SetAsCurrency(index: array of integer; Value: Currency);
384      procedure SetAsInt64(index: array of integer; Value: Int64);
385      procedure SetAsDate(index: array of integer; Value: TDateTime);
386 +    procedure SetAsDateTime(index: array of integer; Value: TDateTime); overload;
387 +    procedure SetAsDateTime(index: array of integer; aValue: TDateTime; aTimeZoneID: TFBTimeZoneID); overload;
388 +    procedure SetAsDateTime(index: array of integer; aValue: TDateTime; aTimeZone: AnsiString); overload;
389 +    procedure SetAsTime(index: array of integer; Value: TDateTime); overload;
390 +    procedure SetAsTime(index: array of integer; aValue: TDateTime; OnDate: TDateTime; aTimeZoneID: TFBTimeZoneID); overload;
391 +    procedure SetAsTime(index: array of integer; aValue: TDateTime; OnDate: TDateTime; aTimeZone: AnsiString); overload;
392 +    procedure SetAsUTCDateTime(index: array of integer; aUTCTime: TDateTime);
393      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);
394      procedure SetAsDouble(index: array of integer; Value: Double);
395      procedure SetAsFloat(index: array of integer; Value: Float);
396      procedure SetAsShort(index: array of integer; Value: Short);
397      procedure SetAsString(index: array of integer; Value: AnsiString);
398      procedure SetAsVariant(index: array of integer; Value: Variant);
399 +    procedure SetAsBcd(index: array of integer; aValue: tBCD);
400      procedure SetBounds(dim, UpperBound, LowerBound: integer);
401      function GetAttachment: IAttachment;
402      function GetTransaction: ITransaction;
# Line 422 | Line 469 | type
469  
470    TIBDateTimeFormats = (dfTimestamp, {SQL TIMESTAMP}
471                          dfDateTime,   {SQL DATETIME}
472 <                        dfTime);      {SQL TIME}
472 >                        dfTime,      {SQL TIME}
473 >                        dfTimestampTZ, {SQL_TIMESTAMP_TZ}
474 >                        dfTimeTZ);       {SQLTIME_TZ
475  
476    { IColumnMetaData }
477  
# Line 493 | Line 542 | type
542      function GetAsBoolean: boolean;
543      function GetAsCurrency: Currency;
544      function GetAsInt64: Int64;
545 <    function GetAsDateTime: TDateTime;
545 >    function GetAsDateTime: TDateTime; overload;
546 >    procedure GetAsDateTime(var aDateTime: TDateTime; var dstOffset: smallint; var aTimezoneID: TFBTimeZoneID); overload;
547 >    procedure GetAsDateTime(var aDateTime: TDateTime; var dstOffset: smallint; var aTimezone: AnsiString); overload;
548 >    procedure GetAsTime(var aTime: TDateTime; var dstOffset: smallint; var aTimezoneID: TFBTimeZoneID; OnDate: TDateTime); overload;
549 >    procedure GetAsTime(var aTime: TDateTime; var dstOffset: smallint; var aTimezone: AnsiString; OnDate: TDateTime); overload;
550 >    procedure GetAsTime(var aTime: TDateTime; var dstOffset: smallint; var aTimezoneID: TFBTimeZoneID); overload;
551 >    procedure GetAsTime(var aTime: TDateTime; var dstOffset: smallint; var aTimezone: AnsiString); overload;
552 >    function GetAsUTCDateTime: TDateTime;
553      function GetAsDouble: Double;
554      function GetAsFloat: Float;
555      function GetAsLong: Long;
# Line 506 | Line 562 | type
562      function GetAsBlob: IBlob; overload;
563      function GetAsBlob(BPB: IBPB): IBlob; overload;
564      function GetAsArray: IArray;
565 +    function GetAsBCD: tBCD;
566      property AsDate: TDateTime read GetAsDateTime;
567      property AsBoolean:boolean read GetAsBoolean;
568      property AsTime: TDateTime read GetAsDateTime;
# Line 523 | Line 580 | type
580      property AsVariant: Variant read GetAsVariant ;
581      property AsBlob: IBlob read GetAsBlob;
582      property AsArray: IArray read GetAsArray;
583 +    property AsBCD: tBCD read GetAsBCD;
584      property IsNull: Boolean read GetIsNull;
585      property Value: Variant read GetAsVariant;
586    end;
# Line 589 | Line 647 | type
647      function GetAsBoolean: boolean;
648      function GetAsCurrency: Currency;
649      function GetAsInt64: Int64;
650 <    function GetAsDateTime: TDateTime;
650 >    function GetAsDateTime: TDateTime; overload;
651 >    procedure GetAsDateTime(var aDateTime: TDateTime; var dstOffset: smallint; var aTimezoneID: TFBTimeZoneID); overload;
652 >    procedure GetAsDateTime(var aDateTime: TDateTime; var dstOffset: smallint; var aTimezone: AnsiString); overload;
653 >    procedure GetAsTime(var aTime: TDateTime; var dstOffset: smallint; var aTimezoneID: TFBTimeZoneID; OnDate: TDateTime); overload;
654 >    procedure GetAsTime(var aTime: TDateTime; var dstOffset: smallint; var aTimezone: AnsiString; OnDate: TDateTime); overload;
655 >    procedure GetAsTime(var aTime: TDateTime; var dstOffset: smallint; var aTimezoneID: TFBTimeZoneID); overload;
656 >    procedure GetAsTime(var aTime: TDateTime; var dstOffset: smallint; var aTimezone: AnsiString); overload;
657 >    function GetAsUTCDateTime: TDateTime;
658      function GetAsDouble: Double;
659      function GetAsFloat: Float;
660      function GetAsLong: Long;
# Line 601 | Line 666 | type
666      function GetAsVariant: Variant;
667      function GetAsBlob: IBlob;
668      function GetAsArray: IArray;
669 +    function GetAsBCD: tBCD;
670 +    function GetStatement: IStatement;
671 +    function GetTransaction: ITransaction;
672      procedure Clear;
673      function GetModified: boolean;
674      procedure SetAsBoolean(AValue: boolean);
# Line 608 | Line 676 | type
676      procedure SetAsInt64(aValue: Int64);
677      procedure SetAsDate(aValue: TDateTime);
678      procedure SetAsLong(aValue: Long);
679 <    procedure SetAsTime(aValue: TDateTime);
680 <    procedure SetAsDateTime(aValue: TDateTime);
679 >    procedure SetAsTime(aValue: TDateTime); overload;
680 >    procedure SetAsTime(aValue: TDateTime; OnDate: TDateTime; aTimeZoneID: TFBTimeZoneID); overload;
681 >    procedure SetAsTime(aValue: TDateTime; OnDate: TDateTime; aTimeZone: AnsiString); overload;
682 >    procedure SetAsTime(aValue: TDateTime; aTimeZoneID: TFBTimeZoneID); overload;
683 >    procedure SetAsTime(aValue: TDateTime; aTimeZone: AnsiString); overload;
684 >    procedure SetAsDateTime(aValue: TDateTime); overload;
685 >    procedure SetAsDateTime(aValue: TDateTime; aTimeZoneID: TFBTimeZoneID); overload;
686 >    procedure SetAsDateTime(aValue: TDateTime; aTimeZone: AnsiString); overload;
687 >    procedure SetAsUTCDateTime(aUTCTime: TDateTime);
688      procedure SetAsDouble(aValue: Double);
689      procedure SetAsFloat(aValue: Float);
690      procedure SetAsPointer(aValue: Pointer);
# Line 621 | Line 696 | type
696      procedure SetAsArray(anArray: IArray);
697      procedure SetAsQuad(aValue: TISC_QUAD);
698      procedure SetCharSetID(aValue: cardinal);
699 +    procedure SetAsBcd(aValue: tBCD);
700      property AsDate: TDateTime read GetAsDateTime write SetAsDate;
701      property AsBoolean:boolean read GetAsBoolean write SetAsBoolean;
702      property AsTime: TDateTime read GetAsDateTime write SetAsTime;
# Line 637 | Line 713 | type
713      property AsVariant: Variant read GetAsVariant write SetAsVariant;
714      property AsBlob: IBlob read GetAsBlob write SetAsBlob;
715      property AsArray: IArray read GetAsArray write SetAsArray;
716 +    property AsBCD: tBCD read GetAsBCD write SetAsBCD;
717      property AsQuad: TISC_QUAD read GetAsQuad write SetAsQuad;
718      property Value: Variant read GetAsVariant write SetAsVariant;
719      property IsNull: Boolean read GetIsNull write SetIsNull;
# Line 709 | Line 786 | type
786     found in the Interbase 6.0 API Guide.
787    }
788  
789 <  ITPBItem = interface(IParameterBlockItem)
789 >  ITPBItem = interface(IParameterBlockItemWithTypeName)
790      ['{544c1f2b-7c12-4a87-a4a5-face7ea72671}']
791 +    function getParamTypeName: AnsiString;
792    end;
793  
794 <  ITPB = interface(IParameterBlock<ITPBItem>)
794 >  ITPB = interface(IParameterBlockWithTypeNames<ITPBItem>)
795      ['{7369b0ff-defe-437b-81fe-19b211d42d25}']
796    end;
797  
# Line 779 | Line 857 | type
857      function GetAttachment: IAttachment;
858    end;
859  
860 +  TTZTextOptions = (tzOffset,      {Time Zone Rendered as an offset to GMT}
861 +                    tzGMT,         {No Time Zone. Time part is always rendered in GMT}
862 +                    tzOriginalID); {Time Zone shown as originally entered}
863 +
864 +  {The ITimeZoneServices interface provides access to the time zone database
865 +   used for the attachment. It may be used in support of TIMESTAMP WITH TIME ZONE
866 +   and TIME WITH TIME ZONE data types.}
867 +
868 +  ITimeZoneServices = interface
869 +    ['{163821f5-ebef-42b9-ac60-8ac4b5c09954}']
870 +    {utility functions}
871 +    function TimeZoneID2TimeZoneName(aTimeZoneID: TFBTimeZoneID): AnsiString;
872 +    function TimeZoneName2TimeZoneID(aTimeZone: AnsiString): TFBTimeZoneID;
873 +    function LocalTimeToGMT(aLocalTime: TDateTime; aTimeZone: AnsiString): TDateTime; overload;
874 +    function LocalTimeToGMT(aLocalTime: TDateTime; aTimeZoneID: TFBTimeZoneID): TDateTime; overload;
875 +    function GMTToLocalTime(aGMTTime: TDateTime; aTimeZone: AnsiString): TDateTime; overload;
876 +    function GMTToLocalTime(aGMTTime: TDateTime; aTimeZoneID: TFBTimeZoneID): TDateTime; overload;
877 +    function GetEffectiveOffsetMins(aLocalTime: TDateTime; aTimeZone: AnsiString): integer; overload;
878 +    function GetEffectiveOffsetMins(aLocalTime: TDateTime; aTimeZoneID: TFBTimeZoneID): integer; overload;
879 +
880 +    {Time Zone DB Information}
881 +    function UsingRemoteTZDB: boolean;
882 +    procedure SetUseLocalTZDB(useLocalTZDB: boolean);
883 +    function GetLocalTimeZoneName: AnsiString;
884 +    function GetLocalTimeZoneID: TFBTimeZoneID;
885 +    procedure GetTimeZoneInfo(aTimeZone: AnsiString; OnDate: TDateTime;
886 +                           var ZoneOffset, DSTOffset, EffectiveOffset: integer);
887 +    {Configurable Options}
888 +    function GetTimeTZDate: TDateTime;
889 +    procedure SetTimeTZDate(aDate: TDateTime);
890 +    function GetTZTextOption: TTZTextOptions;
891 +    procedure SetTZTextOption(aOptionValue: TTZTextOptions);
892 +  end;
893 +
894    {The IDBInformation Interface.
895  
896     An IDBInformation interface is returned by the  IAttachment GetDBInformation
# Line 862 | Line 974 | type
974     found in the Interbase 6.0 API Guide.
975     }
976  
977 <  IDPBItem = interface(IParameterBlockItem)
977 >  IDPBItem = interface(IParameterBlockItemWithTypeName)
978      ['{123d4ad0-087a-4cd1-a344-1b3d03b30673}']
979    end;
980  
981 <  IDPB = interface(IParameterBlock<IDPBItem>)
982 <    ['{e676067b-1cf4-4eba-9256-9724f57e0d16}']
983 <  end;
981 >   IDPB = interface(IParameterBlockWithTypeNames<IDPBItem>)
982 >     ['{e676067b-1cf4-4eba-9256-9724f57e0d16}']
983 >   end;
984  
985    {The IAttachment interface provides access to a Database Connection. It may be
986     used to:
# Line 978 | Line 1090 | type
1090      function GetODSMinorVersion: integer;
1091      procedure getFBVersion(version: TStrings);
1092      function HasActivity: boolean;
1093 +    function HasDecFloatSupport: boolean;
1094  
1095      {Character Sets}
1096      function HasDefaultCharSet: boolean;
# Line 989 | Line 1102 | type
1102      function CharSetWidth(CharSetID: integer; var Width: integer): boolean;
1103      procedure RegisterCharSet(CharSetName: AnsiString; CodePage: TSystemCodePage;
1104        AllowReverseLookup:boolean; out CharSetID: integer);
1105 <  end;
1105 >
1106 >    {Time Zone Database}
1107 >    function GetTimeZoneServices: ITimeZoneServices;
1108 >    function HasTimeZoneSupport: boolean;
1109 > end;
1110  
1111    TProtocolAll = (TCP, SPX, NamedPipe, Local, inet, inet4, inet6, wnet, xnet, unknownProtocol);
1112    TProtocol = TCP..xnet;
# Line 1006 | Line 1123 | type
1123  
1124    }
1125  
1126 <  ISPBItem = interface(IParameterBlockItem)
1126 >  ISPBItem = interface(IParameterBlockItemWithTypeName)
1127      ['{5d08ae2b-4519-41bd-8b40-97cd451c3f6a}']
1128    end;
1129  
1130 <  ISPB = interface(IParameterBlock<ISPBItem>)
1130 >  ISPB = interface(IParameterBlockWithTypeNames<ISPBItem>)
1131      ['{2c5836fd-41ed-4426-9b7d-5af580ec2659}']
1132    end;
1133  
# Line 1144 | Line 1261 | type
1261     The interface is returned by the FirebirdAPI function.
1262    }
1263  
1264 +  { IFirebirdAPI }
1265 +
1266    IFirebirdAPI = interface
1267      ['{edeee691-c8d3-4dcf-a780-cd7e432821d5}']
1268      {Database connections}
# Line 1172 | Line 1291 | type
1291      function GetImplementationVersion: AnsiString;
1292      function GetClientMajor: integer;
1293      function GetClientMinor: integer;
1294 +    function HasDecFloatSupport: boolean;
1295 +    function HasLocalTZDB: boolean;
1296 +    function HasTimeZoneSupport: boolean;
1297 +    function HasExtendedTZSupport: boolean;
1298  
1299      {Firebird 3 API}
1300      function HasMasterIntf: boolean;
1301 <    function GetIMaster: TObject;
1301 >    function GetIMaster: TObject;  deprecated 'Use FirebirdAPI.QueryInterface and FBClientLib.pas IFBIMasterProvider instead';
1302      function GetFBLibrary: IFirebirdLibrary;
1303   end;
1304  
# Line 1220 | Line 1343 | type
1343   function FirebirdAPI: IFirebirdAPI;
1344  
1345   {IBX support functions. Probably best ignored i.e. always used the FirebirdAPI
1346 < functino to load the library and check if it's loaded.}
1346 > function to load the library and check if it's loaded.}
1347  
1348   function TryIBLoad: Boolean;
1349   procedure CheckIBLoaded;
# Line 1231 | Line 1354 | procedure CheckIBLoaded;
1354  
1355   function LoadFBLibrary(aLibPathName: string): IFirebirdLibrary;
1356  
1357 +
1358   implementation
1359  
1360   uses FBClientAPI

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines