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

Comparing ibx/trunk/fbintf/IB.pas (file contents):
Revision 45 by tony, Tue Dec 6 10:33:46 2016 UTC vs.
Revision 309 by tony, Tue Jul 21 08:00:42 2020 UTC

# Line 60 | Line 60
60   {                                                                        }
61   {************************************************************************}
62   unit IB;
63 + {$IFDEF MSWINDOWS}
64 + {$DEFINE WINDOWS}
65 + {$ENDIF}
66  
67   {$IFDEF FPC}
68 < {$mode objfpc}{$H+}
68 > {$mode delphi}
69   {$codepage UTF8}
70   {$interfaces COM}
71 < {$IF FPC_FULLVERSION < 30000 }
71 > {$IF defined(FPC) and (FPC_FULLVERSION < 30000) }
72   {$ERROR FPC Version 3.0.0 or later is required}
73 < {$ENDIF}
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 103 | Line 110 | unit IB;
110  
111    5. Straightforward progammatic access to the Firebird API from Pascal programs.
112  
113 +  6. FPC and Delphi Support.
114 +
115    String Types
116    ============
117  
# Line 117 | 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;
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';
140  
141   {These include files are converted from the 'C' originals in the Firebird API
142   and define the various constants used by the API}
143  
144 < {$I consts_pub.inc}
145 < {$I inf_pub.inc}
146 < {$I configkeys.inc}
144 > {$I 'include/consts_pub.inc'}
145 > {$I 'include/inf_pub.inc'}
146 > {$I 'include/configkeys.inc'}
147  
148   {The following constants define the values return by calls to the GetSQLType
149   methods provided by several of the interfaces defined below.}
# Line 160 | Line 179 | type
179     PGDS__QUAD           = ^TGDS__QUAD;
180     PISC_QUAD            = ^TISC_QUAD;
181  
182 + {$IFNDEF FPC}
183 + {Delphi missing definitions}
184 + type
185 +  TLibHandle = THandle;
186 +
187 + const
188 +  NilHandle = 0;
189 +  DirectorySeparator = '\';
190 +
191 + {Delphi only seems to define CP_UTF8 and CP_UTF16}
192 + const
193 +  CP_ACP     = 0;     // default to ANSI code page
194 +  CP_OEMCP   = 1;     // default to OEM (console) code page
195 +  CP_UTF16BE = 1201;  // unicodeFFFE
196 +  CP_UTF7    = 65000; // utf-7
197 +  CP_ASCII   = 20127; // us-ascii
198 +  CP_NONE    = $FFFF; // rawbytestring encoding
199 +
200 + {$ENDIF}
201 +
202 + type
203 + {$IF not declared(TSystemCodePage)}
204 +  TSystemCodePage = word; {not defined in Delphi}
205 + {$IFEND}
206 +
207    TIBSQLStatementTypes =
208                   (SQLUnknown, SQLSelect, SQLInsert,
209                    SQLUpdate, SQLDelete, SQLDDL,
210                    SQLGetSegment, SQLPutSegment,
211                    SQLExecProcedure, SQLStartTransaction,
212                    SQLCommit, SQLRollback,
213 <                  SQLSelectForUpdate, SQLSetGenerator);
213 >                  SQLSelectForUpdate, SQLSetGenerator,
214 >                  SQLSavePoint);
215  
216    TFBStatusCode = cardinal;
217    TByteArray = array of byte;
218  
219 +  IFirebirdAPI = interface;
220    IAttachment = interface;
221    ITransaction = interface;
222 +  IStatement = interface;
223  
224 <  {The IParameterBlock generic interface provides the template for all parameter
224 >  {The IParameterBlock interface provides the template for all parameter
225     block interfaces}
226  
227 <  generic IParameterBlock<_IItem> = interface
227 >  IParameterBlock<_IItem> = interface
228      function getCount: integer;
229      function Add(ParamType: byte): _IItem;
230      function getItems(index: integer): _IItem;
# Line 191 | Line 238 | type
238     different parameter block items }
239  
240    IParameterBlockItem = interface
241 +    ['{53b23f7b-abda-46a5-9aa5-07bd5e723266}']
242      function getParamType: byte;
243      function getAsInteger: integer;
244 <    function getAsString: string;
244 >    function getAsString: AnsiString;
245      function getAsByte: byte;
246 <    procedure setAsString(aValue: string);
246 >    procedure setAsString(aValue: AnsiString);
247      procedure setAsByte(aValue: byte);
248      procedure SetAsInteger(aValue: integer);
249 <    property AsString: string read getAsString write setAsString;
249 >    property AsString: AnsiString read getAsString write setAsString;
250      property AsByte: byte read getAsByte write setAsByte;
251      property AsInteger: integer read getAsInteger write SetAsInteger;
252    end;
# Line 211 | Line 259 | type
259     This interface can be accessed from IFirebirdAPI.
260     }
261  
262 +   TIBDataBaseErrorMessage    = (ShowSQLCode,
263 +                                   ShowIBMessage,
264 +                                   ShowSQLMessage);
265 +
266 +   TIBDataBaseErrorMessages   = set of TIBDataBaseErrorMessage;
267 +
268    IStatus = interface
269 +    ['{34167722-af38-4831-b08a-93162d58ede3}']
270      function GetIBErrorCode: Long;
271      function Getsqlcode: Long;
272 <    function GetMessage: string;
272 >    function GetMessage: AnsiString;
273      function CheckStatusVector(ErrorCodes: array of TFBStatusCode): Boolean;
274      function GetIBDataBaseErrorMessages: TIBDataBaseErrorMessages;
275      procedure SetIBDataBaseErrorMessages(Value: TIBDataBaseErrorMessages);
# Line 231 | Line 286 | type
286    TArrayBounds = array of TArrayBound;
287  
288    IArrayMetaData = interface
289 +    ['{7dd0aea4-59af-4c2a-b958-565d5025c489}']
290      function GetSQLType: cardinal;
291 <    function GetSQLTypeName: string;
291 >    function GetSQLTypeName: AnsiString;
292      function GetScale: integer;
293      function GetSize: cardinal;
294 +    function GetCharSetWidth: integer;
295      function GetCharSetID: cardinal;
296 <    function GetTableName: string;
297 <    function GetColumnName: string;
296 >    function GetTableName: AnsiString;
297 >    function GetColumnName: AnsiString;
298      function GetDimensions: integer;
299      function GetBounds: TArrayBounds;
300    end;
# Line 262 | Line 319 | type
319    TArrayEventHandler = procedure(Sender: IArray; Reason: TArrayEventReason) of object;
320  
321    IArray = interface(IArrayMetaData)
322 +    ['{631c6bb1-fb49-44fb-a64a-c49859632b88}']
323      function GetArrayID: TISC_QUAD;
324      procedure Clear;
325      function IsEmpty: boolean;
# Line 277 | Line 335 | type
335      function GetAsFloat(index: array of integer): Float;
336      function GetAsLong(index: array of integer): Long;
337      function GetAsShort(index: array of integer): Short;
338 <    function GetAsString(index: array of integer): String;
338 >    function GetAsString(index: array of integer): AnsiString;
339      function GetAsVariant(index: array of integer): Variant;
340      procedure SetAsInteger(index: array of integer; AValue: integer);
341      procedure SetAsBoolean(index: array of integer; AValue: boolean);
# Line 290 | Line 348 | type
348      procedure SetAsDouble(index: array of integer; Value: Double);
349      procedure SetAsFloat(index: array of integer; Value: Float);
350      procedure SetAsShort(index: array of integer; Value: Short);
351 <    procedure SetAsString(index: array of integer; Value: String);
351 >    procedure SetAsString(index: array of integer; Value: AnsiString);
352      procedure SetAsVariant(index: array of integer; Value: Variant);
353      procedure SetBounds(dim, UpperBound, LowerBound: integer);
354      function GetAttachment: IAttachment;
# Line 304 | Line 362 | type
362    }
363  
364    IBlobMetaData = interface
365 +    ['{575f3c61-bb33-46a5-8975-bb7d1b6e37cc}']
366      function GetSubType: integer;
367      function GetCharSetID: cardinal;
368      function GetCodePage: TSystemCodePage;
369      function GetSegmentSize: cardinal;
370 <    function GetRelationName: string;
371 <    function GetColumnName: string;
370 >    function GetRelationName: AnsiString;
371 >    function GetColumnName: AnsiString;
372    end;
373  
374    {The Blob Parameter block is used to select a Blob Filter}
375  
376 <  IBPBItem = interface (IParameterBlockItem) end;
376 >  IBPBItem = interface (IParameterBlockItem)
377 >    ['{660822a5-3114-4c16-b6cb-c1a7b2aba70d}']
378 >  end;
379  
380 <  IBPB = specialize IParameterBlock<IBPBItem>;
380 >  IBPB = interface (IParameterBlock<IBPBItem>)
381 >    ['{e0cb9eb5-17f7-4416-b7d1-3cddd1dfca76}']
382 >  end;
383  
384    { The Blob Interface provides access to a blob data item.
385  
# Line 330 | Line 393 | type
393    TBlobType = (btSegmented,btStream);
394  
395    IBlob = interface(IBlobMetaData)
396 +    ['{3090a145-7780-442b-b15b-efd4568b8611}']
397      function GetBPB: IBPB;
398      procedure Cancel;
399      procedure Close;
# Line 340 | Line 404 | type
404                        TotalSize: Int64; var BlobType: TBlobType);
405      function Read(var Buffer; Count: Longint): Longint;
406      function Write(const Buffer; Count: Longint): Longint;
407 <    function LoadFromFile(Filename: string): IBlob;
407 >    function LoadFromFile(Filename: AnsiString): IBlob;
408      function LoadFromStream(S: TStream) : IBlob;
409 <    function SaveToFile(Filename: string): IBlob;
409 >    function SaveToFile(Filename: AnsiString): IBlob;
410      function SaveToStream(S: TStream): IBlob;
411      function GetAsString: rawbytestring;
412      procedure SetAsString(aValue: rawbytestring);
# Line 356 | Line 420 | type
420      the output of an SQL Statement.
421    }
422  
423 +  TIBDateTimeFormats = (dfTimestamp, {SQL TIMESTAMP}
424 +                        dfDateTime,   {SQL DATETIME}
425 +                        dfTime);      {SQL TIME}
426 +
427    { IColumnMetaData }
428  
429    IColumnMetaData = interface
430 +    ['{c222e6c3-53c1-469f-9e05-0a5c3ef232d8}']
431      function GetIndex: integer;
432      function GetSQLType: cardinal;
433 <    function GetSQLTypeName: string;
433 >    function GetSQLTypeName: AnsiString;
434      function getSubtype: integer;
435 <    function getRelationName: string;
436 <    function getOwnerName: string;
437 <    function getSQLName: string;    {Name of the column}
438 <    function getAliasName: string;  {Alias Name of column or Column Name if no alias}
439 <    function getName: string;       {Disambiguated uppercase Field Name}
435 >    function getRelationName: AnsiString;
436 >    function getOwnerName: AnsiString;
437 >    function getSQLName: AnsiString;    {Name of the column}
438 >    function getAliasName: AnsiString;  {Alias Name of column or Column Name if no alias}
439 >    function getName: AnsiString;       {Disambiguated uppercase Field Name}
440      function getScale: integer;
441      function getCharSetID: cardinal;
442      function getCodePage: TSystemCodePage;
# Line 375 | Line 444 | type
444      function GetSize: cardinal;
445      function GetArrayMetaData: IArrayMetaData; {Valid only for Array SQL Type}
446      function GetBlobMetaData: IBlobMetaData; {Valid only for Blob SQL Type}
447 <    property Name: string read GetName;
447 >    function GetDateTimeStrLength(DateTimeFormat: TIBDateTimeFormats): integer;
448 >    function GetStatement: IStatement;
449 >    function GetTransaction: ITransaction;
450 >    property Name: AnsiString read GetName;
451      property Size: cardinal read GetSize;
452      property SQLType: cardinal read GetSQLType;
453      property Scale: integer read getScale;
# Line 391 | Line 463 | type
463    { IMetaData }
464  
465    IMetaData = interface
466 +    ['{4dafdbb6-0d36-4f1f-9c95-8b132804b965}']
467      function getCount: integer;
468      function getColumnMetaData(index: integer): IColumnMetaData;
469 <    function GetUniqueRelationName: string; {Non empty if all columns come from the same table}
470 <    function ByName(Idx: String): IColumnMetaData;
469 >    function GetUniqueRelationName: AnsiString; {Non empty if all columns come from the same table}
470 >    function ByName(Idx: AnsiString): IColumnMetaData;
471      property ColMetaData[index: integer]: IColumnMetaData read getColumnMetaData; default;
472      property Count: integer read getCount;
473    end;
# Line 414 | Line 487 | type
487  
488  
489    ISQLData = interface(IColumnMetaData)
490 +    ['{3f493e31-7e3f-4606-a07c-b210b9e3619d}']
491 +    function GetStrDataLength: short;
492      function GetAsBoolean: boolean;
493      function GetAsCurrency: Currency;
494      function GetAsInt64: Int64;
# Line 424 | Line 499 | type
499      function GetAsPointer: Pointer;
500      function GetAsQuad: TISC_QUAD;
501      function GetAsShort: short;
502 <    function GetAsString: String;
502 >    function GetAsString: AnsiString;
503      function GetIsNull: Boolean;
504      function GetAsVariant: Variant;
505      function GetAsBlob: IBlob; overload;
# Line 443 | Line 518 | type
518      property AsPointer: Pointer read GetAsPointer;
519      property AsQuad: TISC_QUAD read GetAsQuad;
520      property AsShort: short read GetAsShort;
521 <    property AsString: String read GetAsString;
521 >    property AsString: AnsiString read GetAsString;
522      property AsVariant: Variant read GetAsVariant ;
523      property AsBlob: IBlob read GetAsBlob;
524      property AsArray: IArray read GetAsArray;
# Line 458 | Line 533 | type
533    }
534  
535    IResults = interface
536 +    ['{e836b2bb-93d1-4bbf-a8eb-7ce535de3bb5}']
537     function getCount: integer;
538 +   function GetStatement: IStatement;
539     function GetTransaction: ITransaction;
540 <   function ByName(Idx: String): ISQLData;
540 >   function ByName(Idx: AnsiString): ISQLData;
541     function getSQLData(index: integer): ISQLData;
542 <   procedure GetData(index: integer; var IsNull:boolean; var len: short; var data: PChar);
542 >   procedure GetData(index: integer; var IsNull:boolean; var len: short; var data: PByte);
543     procedure SetRetainInterfaces(aValue: boolean);
544     property Data[index: integer]: ISQLData read getSQLData; default;
545     property Count: integer read getCount;
# Line 474 | Line 551 | type
551      in turn, used to access the data returned by each field of the current row.
552    }
553    IResultSet = interface(IResults)
554 +    ['{0ae4979b-7857-4e8c-8918-ec6f155b51a0}']
555      function FetchNext: boolean;
556 <    function GetCursorName: string;
556 >    function GetCursorName: AnsiString;
557      function IsEof: boolean;
558      procedure Close;
559    end;
# Line 496 | Line 574 | type
574    }
575  
576    ISQLParam = interface
577 +    ['{b22b4578-6d41-4807-a9a9-d2ec8d1d5a14}']
578      function GetIndex: integer;
579      function GetSQLType: cardinal;
580 <    function GetSQLTypeName: string;
580 >    function GetSQLTypeName: AnsiString;
581      function getSubtype: integer;
582 <    function getName: string;
582 >    function getName: AnsiString;
583      function getScale: integer;
584      function getCharSetID: cardinal;
585      function getCodePage: TSystemCodePage;
# Line 516 | Line 595 | type
595      function GetAsPointer: Pointer;
596      function GetAsQuad: TISC_QUAD;
597      function GetAsShort: short;
598 <    function GetAsString: String;
598 >    function GetAsString: AnsiString;
599      function GetIsNull: boolean;
600      function GetAsVariant: Variant;
601      function GetAsBlob: IBlob;
# Line 534 | Line 613 | type
613      procedure SetAsFloat(aValue: Float);
614      procedure SetAsPointer(aValue: Pointer);
615      procedure SetAsShort(aValue: Short);
616 <    procedure SetAsString(aValue: String);
616 >    procedure SetAsString(aValue: AnsiString);
617      procedure SetAsVariant(aValue: Variant);
618      procedure SetIsNull(aValue: Boolean);
619      procedure SetAsBlob(aValue: IBlob);
# Line 553 | Line 632 | type
632      property AsLong: Long read GetAsLong write SetAsLong;
633      property AsPointer: Pointer read GetAsPointer write SetAsPointer;
634      property AsShort: Short read GetAsShort write SetAsShort;
635 <    property AsString: String read GetAsString write SetAsString;
635 >    property AsString: AnsiString read GetAsString write SetAsString;
636      property AsVariant: Variant read GetAsVariant write SetAsVariant;
637      property AsBlob: IBlob read GetAsBlob write SetAsBlob;
638      property AsArray: IArray read GetAsArray write SetAsArray;
# Line 562 | Line 641 | type
641      property IsNull: Boolean read GetIsNull write SetIsNull;
642      property IsNullable: Boolean read GetIsNullable;
643      property Modified: Boolean read getModified;
644 <    property Name: string read GetName;
644 >    property Name: AnsiString read GetName;
645      property SQLType: cardinal read GetSQLType;
646    end;
647  
# Line 572 | Line 651 | type
651    }
652  
653    ISQLParams = interface
654 +    ['{c6d95ac7-b2b7-461b-b890-afef0acbb077}']
655      function getCount: integer;
656      function getSQLParam(index: integer): ISQLParam;
657 <    function ByName(Idx: String): ISQLParam ;
657 >    function ByName(Idx: AnsiString): ISQLParam ;
658      function GetModified: Boolean;
659 +    function GetHasCaseSensitiveParams: Boolean;
660      property Modified: Boolean read GetModified;
661      property Params[index: integer]: ISQLParam read getSQLParam; default;
662      property Count: integer read getCount;
663    end;
664  
665 +
666 +  TPerfStats = (psCurrentMemory, psMaxMemory,
667 +                psRealTime, psUserTime, psBuffers,
668 +                psReads, psWrites, psFetches,psDeltaMemory);
669 +
670 +  TPerfCounters = array[TPerfStats] of Int64;
671 +
672    {The IStatement interface provides access to an SQL Statement once it has been
673     initially prepared. The interface is returned from the IAttachment interface.
674     }
675  
676    IStatement = interface
677 +    ['{a260576d-a07d-4a66-b02d-1b72543fd7cf}']
678      function GetMetaData: IMetaData;  {Output Metadata}
679      function GetSQLParams: ISQLParams;{Statement Parameters}
680 <    function GetPlan: String;
680 >    function GetPlan: AnsiString;
681      function GetRowsAffected(var SelectCount, InsertCount, UpdateCount, DeleteCount: integer): boolean;
682      function GetSQLStatementType: TIBSQLStatementTypes;
683 <    function GetSQLText: string;
683 >    function GetSQLText: AnsiString;
684 >    function GetProcessedSQLText: AnsiString;
685      function GetSQLDialect: integer;
686      function IsPrepared: boolean;
687      procedure Prepare(aTransaction: ITransaction=nil);
# Line 600 | Line 690 | type
690      function GetAttachment: IAttachment;
691      function GetTransaction: ITransaction;
692      procedure SetRetainInterfaces(aValue: boolean);
693 +    procedure EnableStatistics(aValue: boolean);
694 +    function GetPerfStatistics(var stats: TPerfCounters): boolean;
695      property MetaData: IMetaData read GetMetaData;
696      property SQLParams: ISQLParams read GetSQLParams;
697      property SQLStatementType: TIBSQLStatementTypes read GetSQLStatementType;
# Line 616 | Line 708 | type
708     found in the Interbase 6.0 API Guide.
709    }
710  
711 <  ITPBItem = interface(IParameterBlockItem) end;
711 >  ITPBItem = interface(IParameterBlockItem)
712 >    ['{544c1f2b-7c12-4a87-a4a5-face7ea72671}']
713 >  end;
714  
715 <  ITPB = specialize IParameterBlock<ITPBItem>;
715 >  ITPB = interface(IParameterBlock<ITPBItem>)
716 >    ['{7369b0ff-defe-437b-81fe-19b211d42d25}']
717 >  end;
718  
719    {The ITransactionAction interface provides access to a Transaction once it
720     has been initially started. After a Commit or Rollback, a transaction
# Line 632 | Line 728 | type
728    TTransactionCompletion = TARollback.. TACommit;
729  
730    ITransaction = interface
731 +    ['{30928d0e-a9d7-4c61-b7cf-14f4f38abe2a}']
732      function getTPB: ITPB;
733      procedure Start(DefaultCompletion: TTransactionCompletion=taCommit);
734      function GetInTransaction: boolean;
# Line 659 | Line 756 | type
756    }
757  
758    TEventInfo = record
759 <    EventName: string;
759 >    EventName: AnsiString;
760      Count: integer;
761    end;
762  
# Line 670 | Line 767 | type
767    { IEvents }
768  
769    IEvents = interface
770 +    ['{6a0be233-ed08-4524-889c-2e45d0c20e5f}']
771      procedure GetEvents(EventNames: TStrings);
772      procedure SetEvents(EventNames: TStrings); overload;
773 <    procedure SetEvents(EventName: string); overload;
773 >    procedure SetEvents(EventName: AnsiString); overload;
774      procedure Cancel;
775      function ExtractEventCounts: TEventCounts;
776      procedure WaitForEvent;
# Line 703 | Line 801 | type
801    TDBOperationCounts = array of TDBOperationCount;
802  
803    IDBInfoItem = interface
804 +    ['{eeb97b51-ec0f-473f-9f75-c1721f055fcb}']
805      function getItemType: byte;
806      function getSize: integer;
807      procedure getRawBytes(var Buffer);
808 <    function getAsString: string;
808 >    function getAsString: AnsiString;
809      function getAsInteger: integer;
810 <    procedure DecodeIDCluster(var ConnectionType: integer; var DBFileName, DBSiteName: string);
810 >    procedure DecodeIDCluster(var ConnectionType: integer; var DBFileName, DBSiteName: AnsiString);
811      function getAsBytes: TByteArray;
812 <    procedure DecodeVersionString(var Version: byte; var VersionString: string);
812 >    function getAsDateTime: TDateTime;
813 >    procedure DecodeVersionString(var Version: byte; var VersionString: AnsiString);
814      function getOperationCounts: TDBOperationCounts;
815      procedure DecodeUserNames(UserNames: TStrings);
816  
# Line 719 | Line 819 | type
819      function GetItem(index: integer): IDBInfoItem;
820      function Find(ItemType: byte): IDBInfoItem;
821      property AsInteger: integer read getAsInteger;
822 <    property AsString: string read GetAsString;
822 >    property AsString: AnsiString read GetAsString;
823      property Count: integer read GetCount;
824      property Items[index: integer]: IDBInfoItem read getItem; default;
825    end;
# Line 727 | Line 827 | type
827    { IDBInformation }
828  
829    IDBInformation = interface
830 +    ['{7ac6777f-f0a9-498a-9f5c-4a57a554df81}']
831      function GetCount: integer;
832      function GetItem(index: integer): IDBInfoItem;
833      function Find(ItemType: byte): IDBInfoItem;
# Line 735 | Line 836 | type
836      property Items[index: integer]: IDBInfoItem read getItem; default;
837    end;
838  
839 +  {The Database Information Request Block is used to pass requests for
840 +   database information where at least one item requested has a parameter.
841 +   At present, this is only fb_info_page_contents which has a single
842 +   integer parameter.}
843 +
844 +  IDIRBItem = interface(IParameterBlockItem)
845 +    ['{d34a7511-8435-4a24-81a7-5103d218d234}']
846 +  end;
847 +
848 +  IDIRB = interface(IParameterBlock<IDIRBItem>)
849 +    ['{1010e5ac-0a8f-403b-a302-91625e9d9579}']
850 +  end;
851 +
852 +
853    {The Database Parameter Block (DPB).
854  
855     The DPB provides the parameters used when connecting to a database. It is allocated
# Line 746 | Line 861 | type
861     found in the Interbase 6.0 API Guide.
862     }
863  
864 <  IDPBItem = interface(IParameterBlockItem) end;
864 >  IDPBItem = interface(IParameterBlockItem)
865 >    ['{123d4ad0-087a-4cd1-a344-1b3d03b30673}']
866 >  end;
867  
868 <  IDPB = specialize IParameterBlock<IDPBItem>;
868 >  IDPB = interface(IParameterBlock<IDPBItem>)
869 >    ['{e676067b-1cf4-4eba-9256-9724f57e0d16}']
870 >  end;
871  
872    {The IAttachment interface provides access to a Database Connection. It may be
873     used to:
# Line 778 | Line 897 | type
897    { IAttachment }
898  
899    IAttachment = interface
900 +    ['{466e9b67-9def-4807-b3e7-e08a35e7185c}']
901 +    function getFirebirdAPI: IFirebirdAPI;
902      function getDPB: IDPB;
903      function AllocateBPB: IBPB;
904 +    function AllocateDIRB: IDIRB;
905      procedure Connect;
906      procedure Disconnect(Force: boolean=false);
907      function IsConnected: boolean;
908      procedure DropDatabase;
909      function StartTransaction(TPB: array of byte; DefaultCompletion: TTransactionCompletion=taCommit): ITransaction; overload;
910      function StartTransaction(TPB: ITPB; DefaultCompletion: TTransactionCompletion=taCommit): ITransaction; overload;
911 <    procedure ExecImmediate(transaction: ITransaction; sql: string; SQLDialect: integer); overload;
912 <    procedure ExecImmediate(TPB: array of byte; sql: string; SQLDialect: integer); overload;
913 <    procedure ExecImmediate(transaction: ITransaction; sql: string); overload;
914 <    procedure ExecImmediate(TPB: array of byte; sql: string); overload;
915 <    function ExecuteSQL(TPB: array of byte; sql: string; SQLDialect: integer; params: array of const): IResults; overload;
916 <    function ExecuteSQL(transaction: ITransaction; sql: string; SQLDialect: integer; params: array of const): IResults; overload;
917 <    function ExecuteSQL(TPB: array of byte; sql: string; params: array of const): IResults; overload;
918 <    function ExecuteSQL(transaction: ITransaction; sql: string; params: array of const): IResults; overload;
919 <    function OpenCursor(transaction: ITransaction; sql: string; aSQLDialect: integer): IResultSet; overload;
920 <    function OpenCursor(transaction: ITransaction; sql: string; aSQLDialect: integer;
911 >    procedure ExecImmediate(transaction: ITransaction; sql: AnsiString; SQLDialect: integer); overload;
912 >    procedure ExecImmediate(TPB: array of byte; sql: AnsiString; SQLDialect: integer); overload;
913 >    procedure ExecImmediate(transaction: ITransaction; sql: AnsiString); overload;
914 >    procedure ExecImmediate(TPB: array of byte; sql: AnsiString); overload;
915 >    function ExecuteSQL(TPB: array of byte; sql: AnsiString; SQLDialect: integer; params: array of const): IResults; overload;
916 >    function ExecuteSQL(transaction: ITransaction; sql: AnsiString; SQLDialect: integer; params: array of const): IResults; overload;
917 >    function ExecuteSQL(TPB: array of byte; sql: AnsiString; params: array of const): IResults; overload;
918 >    function ExecuteSQL(transaction: ITransaction; sql: AnsiString; params: array of const): IResults; overload;
919 >    function OpenCursor(transaction: ITransaction; sql: AnsiString; aSQLDialect: integer): IResultSet; overload;
920 >    function OpenCursor(transaction: ITransaction; sql: AnsiString; aSQLDialect: integer;
921                               params: array of const): IResultSet; overload;
922 <    function OpenCursor(transaction: ITransaction; sql: string): IResultSet; overload;
923 <    function OpenCursor(transaction: ITransaction; sql: string;
922 >    function OpenCursor(transaction: ITransaction; sql: AnsiString): IResultSet; overload;
923 >    function OpenCursor(transaction: ITransaction; sql: AnsiString;
924                               params: array of const): IResultSet; overload;
925 <    function OpenCursorAtStart(transaction: ITransaction; sql: string; aSQLDialect: integer): IResultSet; overload;
926 <    function OpenCursorAtStart(transaction: ITransaction; sql: string; aSQLDialect: integer;
925 >    function OpenCursorAtStart(transaction: ITransaction; sql: AnsiString; aSQLDialect: integer): IResultSet; overload;
926 >    function OpenCursorAtStart(transaction: ITransaction; sql: AnsiString; aSQLDialect: integer;
927                               params: array of const): IResultSet; overload;
928 <    function OpenCursorAtStart(transaction: ITransaction; sql: string): IResultSet; overload;
929 <    function OpenCursorAtStart(transaction: ITransaction; sql: string;
928 >    function OpenCursorAtStart(transaction: ITransaction; sql: AnsiString): IResultSet; overload;
929 >    function OpenCursorAtStart(transaction: ITransaction; sql: AnsiString;
930                               params: array of const): IResultSet; overload;
931 <    function OpenCursorAtStart(sql: string): IResultSet; overload;
932 <    function OpenCursorAtStart(sql: string;
931 >    function OpenCursorAtStart(sql: AnsiString): IResultSet; overload;
932 >    function OpenCursorAtStart(sql: AnsiString;
933                               params: array of const): IResultSet; overload;
934 <    function Prepare(transaction: ITransaction; sql: string; aSQLDialect: integer): IStatement; overload;
935 <    function Prepare(transaction: ITransaction; sql: string): IStatement; overload;
936 <    function PrepareWithNamedParameters(transaction: ITransaction; sql: string;
937 <                       aSQLDialect: integer; GenerateParamNames: boolean=false): IStatement; overload;
938 <    function PrepareWithNamedParameters(transaction: ITransaction; sql: string;
939 <                       GenerateParamNames: boolean=false): IStatement; overload;
934 >    function Prepare(transaction: ITransaction; sql: AnsiString; aSQLDialect: integer): IStatement; overload;
935 >    function Prepare(transaction: ITransaction; sql: AnsiString): IStatement; overload;
936 >    function PrepareWithNamedParameters(transaction: ITransaction; sql: AnsiString;
937 >                       aSQLDialect: integer; GenerateParamNames: boolean=false;
938 >                       CaseSensitiveParams: boolean = false): IStatement; overload;
939 >    function PrepareWithNamedParameters(transaction: ITransaction; sql: AnsiString;
940 >                       GenerateParamNames: boolean=false;
941 >                       CaseSensitiveParams: boolean = false): IStatement; overload;
942  
943      {Events}
944      function GetEventHandler(Events: TStrings): IEvents; overload;
945 <    function GetEventHandler(Event: string): IEvents; overload;
945 >    function GetEventHandler(Event: AnsiString): IEvents; overload;
946  
947      {Blob - may use to open existing Blobs. However, ISQLData.AsBlob is preferred}
948  
949 <    function CreateBlob(transaction: ITransaction; RelationName, ColumnName: string; BPB: IBPB=nil): IBlob; overload;
949 >    function CreateBlob(transaction: ITransaction; RelationName, ColumnName: AnsiString; BPB: IBPB=nil): IBlob; overload;
950      function CreateBlob(transaction: ITransaction; BlobMetaData: IBlobMetaData; BPB: IBPB=nil): IBlob; overload;
951      function CreateBlob(transaction: ITransaction; SubType: integer; CharSetID: cardinal=0; BPB: IBPB=nil): IBlob; overload;
952 <    function OpenBlob(transaction: ITransaction; RelationName, ColumnName: string; BlobID: TISC_QUAD; BPB: IBPB=nil): IBlob;
952 >    function OpenBlob(transaction: ITransaction; RelationName, ColumnName: AnsiString; BlobID: TISC_QUAD; BPB: IBPB=nil): IBlob; overload;
953 >    function OpenBlob(transaction: ITransaction; BlobMetaData: IBlobMetaData; BlobID: TISC_QUAD; BPB: IBPB=nil): IBlob;  overload;
954  
955      {Array - may use to open existing arrays. However, ISQLData.AsArray is preferred}
956  
957 <    function OpenArray(transaction: ITransaction; RelationName, ColumnName: string; ArrayID: TISC_QUAD): IArray;
958 <    function CreateArray(transaction: ITransaction; RelationName, ColumnName: string): IArray; overload;
957 >    function OpenArray(transaction: ITransaction; RelationName, ColumnName: AnsiString; ArrayID: TISC_QUAD): IArray; overload;
958 >    function OpenArray(transaction: ITransaction; ArrayMetaData: IArrayMetaData; ArrayID: TISC_QUAD): IArray; overload;
959 >    function CreateArray(transaction: ITransaction; RelationName, ColumnName: AnsiString): IArray; overload;
960      function CreateArray(transaction: ITransaction; ArrayMetaData: IArrayMetaData): IArray; overload;
961 +    function CreateArrayMetaData(SQLType: cardinal; tableName: AnsiString; columnName: AnsiString;
962 +                  Scale: integer; size: cardinal; charSetID: cardinal; dimensions: cardinal;
963 +                  bounds: TArrayBounds): IArrayMetaData;
964  
965      {Database Information}
966      function GetSQLDialect: integer;
967 <    function GetBlobMetaData(Transaction: ITransaction; tableName, columnName: string): IBlobMetaData;
968 <    function GetArrayMetaData(Transaction: ITransaction; tableName, columnName: string): IArrayMetaData;
967 >    function GetBlobMetaData(Transaction: ITransaction; tableName, columnName: AnsiString): IBlobMetaData;
968 >    function GetArrayMetaData(Transaction: ITransaction; tableName, columnName: AnsiString): IArrayMetaData;
969      function GetDBInformation(Requests: array of byte): IDBInformation; overload;
970      function GetDBInformation(Request: byte): IDBInformation; overload;
971 +    function GetDBInformation(Requests: IDIRB): IDBInformation; overload;
972 +    function GetConnectString: AnsiString;
973 +    function GetRemoteProtocol: AnsiString;
974 +    function GetAuthenticationMethod: AnsiString;
975 +    function GetSecurityDatabase: AnsiString;
976 +    function GetODSMajorVersion: integer;
977 +    function GetODSMinorVersion: integer;
978 +    procedure getFBVersion(version: TStrings);
979      function HasActivity: boolean;
980 +
981 +    {Character Sets}
982 +    function HasDefaultCharSet: boolean;
983 +    function GetDefaultCharSetID: integer;
984 +    function GetCharsetName(CharSetID: integer): AnsiString;
985 +    function CharSetID2CodePage(CharSetID: integer; var CodePage: TSystemCodePage): boolean;
986 +    function CodePage2CharSetID(CodePage: TSystemCodePage; var CharSetID: integer): boolean;
987 +    function CharSetName2CharSetID(CharSetName: AnsiString; var CharSetID: integer): boolean;
988 +    function CharSetWidth(CharSetID: integer; var Width: integer): boolean;
989 +    procedure RegisterCharSet(CharSetName: AnsiString; CodePage: TSystemCodePage;
990 +      AllowReverseLookup:boolean; out CharSetID: integer);
991    end;
992  
993 <  TProtocol = (TCP, SPX, NamedPipe, Local);
993 >  TProtocolAll = (TCP, SPX, NamedPipe, Local, inet, inet4, inet6, wnet, xnet, unknownProtocol);
994 >  TProtocol = TCP..xnet;
995  
996    {Service Parameter Block (SPB).
997  
# Line 856 | Line 1005 | type
1005  
1006    }
1007  
1008 <  ISPBItem = interface(IParameterBlockItem) end;
1008 >  ISPBItem = interface(IParameterBlockItem)
1009 >    ['{5d08ae2b-4519-41bd-8b40-97cd451c3f6a}']
1010 >  end;
1011  
1012 <  ISPB = specialize IParameterBlock<ISPBItem>;
1012 >  ISPB = interface(IParameterBlock<ISPBItem>)
1013 >    ['{2c5836fd-41ed-4426-9b7d-5af580ec2659}']
1014 >  end;
1015  
1016    {Service Query Parameter Block (SQPB).
1017  
# Line 867 | Line 1020 | type
1020    }
1021  
1022    ISQPBItem = interface(IParameterBlockItem)
1023 +    ['{b07841a6-33b3-47f0-b5a2-028cbc86dc97}']
1024      function CopyFrom(source: TStream; count: integer): integer;
1025    end;
1026  
1027 <  ISQPB = specialize IParameterBlock<ISQPBItem>;
1027 >  ISQPB = interface(IParameterBlock<ISQPBItem>)
1028 >    ['{8553e66b-ee62-498b-8431-dff030211447}']
1029 >  end;
1030  
1031    {Service Request Block (SRB).
1032  
# Line 884 | Line 1040 | type
1040  
1041    }
1042  
1043 <  ISRBItem = interface(IParameterBlockItem) end;
1043 >  ISRBItem = interface(IParameterBlockItem)
1044 >    ['{47ec790e-f265-4b30-9dcd-261e51677245}']
1045 >   end;
1046  
1047 <  ISRB = specialize IParameterBlock<ISRBItem>;
1047 >  ISRB = interface(IParameterBlock<ISRBItem>)
1048 >    ['{9f2e204f-3c33-4e44-90f9-9135e95dafb9}']
1049 >  end;
1050  
1051    {The Service Query Results Interface.
1052  
# Line 904 | Line 1064 | type
1064    }
1065  
1066    IServiceQueryResultSubItem = interface
1067 +    ['{8a4c381e-9923-4cc9-a96b-553729248640}']
1068      function getItemType: byte;
1069      function getSize: integer;
1070      procedure getRawBytes(var Buffer);
1071 <    function getAsString: string;
1071 >    function getAsString: AnsiString;
1072      function getAsInteger: integer;
1073      function getAsByte: byte;
1074      function CopyTo(stream: TStream; count: integer): integer;
1075 <    property AsString: string read getAsString;
1075 >    property AsString: AnsiString read getAsString;
1076      property AsInteger: integer read getAsInteger;
1077      property AsByte: byte read getAsByte;
1078    end;
1079  
1080    IServiceQueryResultItem = interface(IServiceQueryResultSubItem)
1081 +    ['{b2806886-206c-4024-8df9-5fe0a7630a5e}']
1082      function getCount: integer;
1083      function getItem(index: integer): IServiceQueryResultSubItem;
1084      function find(ItemType: byte): IServiceQueryResultSubItem;
# Line 925 | Line 1087 | type
1087    end;
1088  
1089    IServiceQueryResults = interface
1090 +    ['{8fbbef7d-fe03-4409-828a-a787d34ef531}']
1091      function getCount: integer;
1092      function getItem(index: integer): IServiceQueryResultItem;
1093      function find(ItemType: byte): IServiceQueryResultItem;
# Line 933 | Line 1096 | type
1096      property Count: integer read getCount;
1097    end;
1098  
1099 +  IFirebirdLibrary = interface;
1100 +
1101    {The IServiceManager interface provides access to a service manager. It can
1102     used to Detach and re-attach to Service Manager, to start services and to
1103     query the service manager.
# Line 943 | Line 1108 | type
1108    { IServiceManager }
1109  
1110    IServiceManager = interface
1111 +    ['{905b587d-1e1f-4e40-a3f8-a3519f852e48}']
1112 +    function getFirebirdAPI: IFirebirdAPI;
1113      function getSPB: ISPB;
1114 <    function getServerName: string;
1114 >    function getServerName: AnsiString;
1115 >    function getProtocol: TProtocol;
1116 >    function getPortNo: AnsiString;
1117      procedure Attach;
1118      procedure Detach(Force: boolean=false);
1119      function IsAttached: boolean;
1120      function AllocateSRB: ISRB;
1121      function AllocateSQPB: ISQPB;
1122 <    procedure Start(Request: ISRB);
1123 <    function Query(SQPB: ISQPB; Request: ISRB) :IServiceQueryResults; overload;
1124 <    function Query(Request: ISRB) :IServiceQueryResults; overload;
1122 >    function Start(Request: ISRB; RaiseExceptionOnError: boolean=true): boolean;
1123 >    function Query(SQPB: ISQPB; Request: ISRB; RaiseExceptionOnError: boolean=true) :IServiceQueryResults; overload;
1124 >    function Query(Request: ISRB; RaiseExceptionOnError: boolean=true) :IServiceQueryResults; overload;
1125 >  end;
1126 >
1127 >  {Tbe Firebird Library API used to get information about the Firebird library}
1128 >
1129 >
1130 >  IFirebirdLibrary = interface
1131 >    ['{3c04e0a1-12e0-428a-b2e1-bc6fcd97b79b}']
1132 >    function GetHandle: TLibHandle;
1133 >    function GetLibraryName: string;
1134 >    function GetLibraryFilePath: string;
1135 >    function GetFirebirdAPI: IFirebirdAPI;
1136    end;
1137  
1138    {The Firebird API.
# Line 964 | Line 1144 | type
1144    }
1145  
1146    IFirebirdAPI = interface
1147 +    ['{edeee691-c8d3-4dcf-a780-cd7e432821d5}']
1148      {Database connections}
1149      function AllocateDPB: IDPB;
1150 <    function OpenDatabase(DatabaseName: string; DPB: IDPB; RaiseExceptionOnConnectError: boolean=true): IAttachment;
1151 <    function CreateDatabase(DatabaseName: string; DPB: IDPB; RaiseExceptionOnError: boolean=true): IAttachment;
1150 >    function OpenDatabase(DatabaseName: AnsiString; DPB: IDPB; RaiseExceptionOnConnectError: boolean=true): IAttachment;
1151 >    function CreateDatabase(DatabaseName: AnsiString; DPB: IDPB; RaiseExceptionOnError: boolean=true): IAttachment; overload;
1152 >    function CreateDatabase(sql: AnsiString; aSQLDialect: integer; RaiseExceptionOnError: boolean=true): IAttachment; overload;
1153  
1154      {Start Transaction against multiple databases}
1155      function AllocateTPB: ITPB;
# Line 979 | Line 1161 | type
1161      {Service Manager}
1162      function HasServiceAPI: boolean;
1163      function AllocateSPB: ISPB;
1164 <    function GetServiceManager(ServerName: string; Protocol: TProtocol; SPB: ISPB): IServiceManager;
1164 >    function GetServiceManager(ServerName: AnsiString; Protocol: TProtocol; SPB: ISPB): IServiceManager; overload;
1165 >    function GetServiceManager(ServerName: AnsiString; Port: AnsiString; Protocol: TProtocol; SPB: ISPB): IServiceManager; overload;
1166  
1167      {Information}
1168      function GetStatus: IStatus;
986    function GetLibraryName: string;
1169      function HasRollbackRetaining: boolean;
1170      function IsEmbeddedServer: boolean;
1171 <    function GetImplementationVersion: string;
1171 >    function GetImplementationVersion: AnsiString;
1172 >    function GetClientMajor: integer;
1173 >    function GetClientMinor: integer;
1174  
1175      {Firebird 3 API}
1176      function HasMasterIntf: boolean;
1177      function GetIMaster: TObject;
1178 <
995 <    {utility}
996 <    function GetCharsetName(CharSetID: integer): string;
997 <    function CharSetID2CodePage(CharSetID: integer; var CodePage: TSystemCodePage): boolean;
998 <    function CodePage2CharSetID(CodePage: TSystemCodePage; var CharSetID: integer): boolean;
999 <    function CharSetName2CharSetID(CharSetName: string; var CharSetID: integer): boolean;
1000 <    function CharSetWidth(CharSetID: integer; var Width: integer): boolean;
1178 >    function GetFBLibrary: IFirebirdLibrary;
1179   end;
1180  
1181   type
# Line 1014 | Line 1192 | type
1192     private
1193       FSQLCode: Long;
1194     public
1195 <     constructor Create(ASQLCode: Long; Msg: string);
1195 >     constructor Create(ASQLCode: Long; Msg: AnsiString);
1196       property SQLCode: Long read FSQLCode;
1197     end;
1198  
# Line 1025 | Line 1203 | type
1203       FIBErrorCode: Long;
1204     public
1205       constructor Create(Status: IStatus); overload;
1206 <     constructor Create(ASQLCode: Long; AIBErrorCode: Long; Msg: string); overload;
1206 >     constructor Create(ASQLCode: Long; AIBErrorCode: Long; Msg: AnsiString); overload;
1207       property IBErrorCode: Long read FIBErrorCode;
1208     end;
1209  
1210     {IB Client Exceptions}
1211     EIBClientError = class(EIBError);
1212  
1035 {IBError is used internally and by IBX to throw an EIBClientError}
1036
1037 procedure IBError(ErrMess: TIBClientError; const Args: array of const);
1038
1213   {The Firebird API function is used to access the IFirebirdAPI interface.
1214  
1215   It will load the Firebird Client Library if this is not already loaded and
# Line 1050 | Line 1224 | function FirebirdAPI: IFirebirdAPI;
1224   function TryIBLoad: Boolean;
1225   procedure CheckIBLoaded;
1226  
1227 + {If you want to explicitly load the Firebird library from a
1228 + non-default location then use this function and its GetFirebirdAPI function
1229 + to get the API.}
1230 +
1231 + function LoadFBLibrary(aLibPathName: string): IFirebirdLibrary;
1232 +
1233   implementation
1234  
1235   uses FBClientAPI
1236    {$IFDEF USELEGACYFIREBIRDAPI}, FB25ClientAPI {$ENDIF}
1237    {$IFDEF USEFIREBIRD3API}, FB30ClientAPI {$ENDIF};
1238  
1239 < var FFirebirdAPI: IFirebirdAPI;
1239 > var FDefaultFBLibrary: IFirebirdLibrary;
1240 >
1241 > type
1242 >
1243 >  { TFBLibrary }
1244 >
1245 >  TFBLibraryImpl = class(TFBLibrary)
1246 >  protected
1247 >    function GetFirebird3API: IFirebirdAPI; override;
1248 >    function GetLegacyFirebirdAPI: IFirebirdAPI; override;
1249 >  end;
1250 >
1251 > function TFBLibraryImpl.GetFirebird3API: IFirebirdAPI;
1252 > begin
1253 > {$IFDEF USEFIREBIRD3API}
1254 > Result := TFB30ClientAPI.Create(self);
1255 > {$ELSE}
1256 > Result := nil;
1257 > {$ENDIF}
1258 > end;
1259 >
1260 > function TFBLibraryImpl.GetLegacyFirebirdAPI: IFirebirdAPI;
1261 > begin
1262 >  {$IFDEF USELEGACYFIREBIRDAPI}
1263 >  Result := TFB25ClientAPI.Create(self);
1264 >  {$ELSE}
1265 >  Result := nil;
1266 >  {$ENDIF}
1267 > end;
1268  
1269   function FirebirdAPI: IFirebirdAPI;
1270   begin
1271 <  if FFirebirdAPI = nil then
1271 >  if FDefaultFBLibrary = nil then
1272      CheckIBLoaded;
1273 <  Result := FFirebirdAPI;
1273 >  Result := FDefaultFBLibrary.GetFirebirdAPI;
1274   end;
1275  
1276   function TryIBLoad: Boolean;
1277 + var fblib: IFirebirdLibrary;
1278   begin
1279 < Result := FFirebirdAPI <> nil;
1279 > Result := FDefaultFBLibrary <> nil;
1280   try
1072  {$IFDEF USEFIREBIRD3API}
1281    if not Result then
1282    begin
1283 <    FFirebirdAPI := TFB30ClientAPI.Create;
1284 <    Result := FFirebirdAPI.HasMasterIntf;
1285 <  end;
1286 <  {$ENDIF}
1079 <  {$IFDEF USELEGACYFIREBIRDAPI}
1080 <  if not Result then
1081 <  begin
1082 <    FFirebirdAPI := nil;
1083 <    FFirebirdAPI := TFB25ClientAPI.Create;
1084 <    Result := true;
1085 <  end;
1086 <  {$ENDIF}
1087 <  if Result and not (FFirebirdAPI as TFBClientAPI).IsLibraryLoaded then
1088 <  begin
1089 <    Result := false;
1090 <    FFirebirdAPI := nil;
1283 >    fblib := TFBLibraryImpl.Create;
1284 >    if (fblib <> nil) and (fblib.GetFirebirdAPI <> nil) then
1285 >      FDefaultFBLibrary := fblib;
1286 >    Result := FDefaultFBLibrary <> nil;
1287    end;
1288   except
1289     SysUtils.showexception(ExceptObject,ExceptAddr);
# Line 1101 | Line 1297 | begin
1297      IBError(ibxeInterBaseMissing, [nil]);
1298   end;
1299  
1300 + function LoadFBLibrary(aLibPathName: string): IFirebirdLibrary;
1301 + var fblib: IFirebirdLibrary;
1302 + begin
1303 +  if trim(aLibPathName) = '' then
1304 +  begin
1305 +    CheckIBLoaded;
1306 +    Result := FDefaultFBLibrary;
1307 +  end
1308 +  else
1309 +  begin
1310 +    fblib := TFBLibraryImpl.GetFBLibrary(aLibPathName);
1311 +    if (fblib = nil) or (fblib.GetFirebirdAPI = nil) then
1312 +      IBError(ibxeInterBaseMissing, [nil]);
1313 +    Result := fblib;
1314 +  end;
1315 + end;
1316 +
1317   { EIBError }
1318  
1319 < constructor EIBError.Create(ASQLCode: Long; Msg: string);
1319 > constructor EIBError.Create(ASQLCode: Long; Msg: AnsiString);
1320   begin
1321    inherited Create(Msg);
1322    FSQLCode := ASQLCode;
# Line 1118 | Line 1331 | begin
1331   end;
1332  
1333   constructor EIBInterBaseError.Create(ASQLCode: Long; AIBErrorCode: Long;
1334 <  Msg: string);
1334 >  Msg: AnsiString);
1335   begin
1336    inherited Create(ASQLCode,Msg);
1337    FIBErrorCode := AIBErrorCode;
1338   end;
1339  
1127 procedure IBError(ErrMess: TIBClientError; const Args: array of const);
1128 begin
1129  raise EIBClientError.Create(Ord(ErrMess),
1130                              Format(GetErrorMessage(ErrMess), Args));
1131 end;
1340  
1341   initialization
1342 <  FFirebirdAPI := nil;
1342 >  FDefaultFBLibrary := nil;
1343  
1344 + finalization
1345 +  FDefaultFBLibrary := nil;
1346  
1347   end.
1348  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines