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 |
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 |
|
|
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 = 0; |
138 |
< |
FBIntf_Release = 1; |
139 |
< |
FBIntf_Version = '1.0.1'; |
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 consts_pub.inc} |
160 |
< |
{$I inf_pub.inc} |
161 |
< |
{$I configkeys.inc} |
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.} |
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 |
205 |
|
PGDS__QUAD = ^TGDS__QUAD; |
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 |
220 |
+ |
CP_OEMCP = 1; // default to OEM (console) code page |
221 |
+ |
CP_UTF16BE = 1201; // unicodeFFFE |
222 |
+ |
CP_UTF7 = 65000; // utf-7 |
223 |
+ |
CP_ASCII = 20127; // us-ascii |
224 |
+ |
CP_NONE = $FFFF; // rawbytestring encoding |
225 |
+ |
|
226 |
+ |
{$ENDIF} |
227 |
+ |
|
228 |
+ |
type |
229 |
+ |
{$IF not declared(TSystemCodePage)} |
230 |
+ |
TSystemCodePage = word; {not defined in Delphi} |
231 |
+ |
{$IFEND} |
232 |
+ |
|
233 |
|
TIBSQLStatementTypes = |
234 |
|
(SQLUnknown, SQLSelect, SQLInsert, |
235 |
|
SQLUpdate, SQLDelete, SQLDDL, |
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 IParameterBlock generic interface provides the template for all parameter |
251 |
> |
{The IParameterBlock interface provides the template for all parameter |
252 |
|
block interfaces} |
253 |
|
|
254 |
< |
generic IParameterBlock<_IItem> = interface |
254 |
> |
IParameterBlock<_IItem> = interface |
255 |
|
function getCount: integer; |
256 |
|
function Add(ParamType: byte): _IItem; |
257 |
|
function getItems(index: integer): _IItem; |
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 |
|
|
272 |
|
IParameterBlockItem = interface |
273 |
+ |
['{53b23f7b-abda-46a5-9aa5-07bd5e723266}'] |
274 |
|
function getParamType: byte; |
275 |
|
function getAsInteger: integer; |
276 |
< |
function getAsString: string; |
276 |
> |
function getAsString: AnsiString; |
277 |
|
function getAsByte: byte; |
278 |
< |
procedure setAsString(aValue: string); |
278 |
> |
procedure setAsString(aValue: AnsiString); |
279 |
|
procedure setAsByte(aValue: byte); |
280 |
|
procedure SetAsInteger(aValue: integer); |
281 |
< |
property AsString: string read getAsString write setAsString; |
281 |
> |
property AsString: AnsiString read getAsString write setAsString; |
282 |
|
property AsByte: byte read getAsByte write setAsByte; |
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 |
294 |
|
This interface can be accessed from IFirebirdAPI. |
295 |
|
} |
296 |
|
|
297 |
+ |
TIBDataBaseErrorMessage = (ShowSQLCode, |
298 |
+ |
ShowIBMessage, |
299 |
+ |
ShowSQLMessage); |
300 |
+ |
|
301 |
+ |
TIBDataBaseErrorMessages = set of TIBDataBaseErrorMessage; |
302 |
+ |
|
303 |
|
IStatus = interface |
304 |
+ |
['{34167722-af38-4831-b08a-93162d58ede3}'] |
305 |
|
function GetIBErrorCode: Long; |
306 |
|
function Getsqlcode: Long; |
307 |
< |
function GetMessage: string; |
307 |
> |
function GetMessage: AnsiString; |
308 |
|
function CheckStatusVector(ErrorCodes: array of TFBStatusCode): Boolean; |
309 |
|
function GetIBDataBaseErrorMessages: TIBDataBaseErrorMessages; |
310 |
|
procedure SetIBDataBaseErrorMessages(Value: TIBDataBaseErrorMessages); |
321 |
|
TArrayBounds = array of TArrayBound; |
322 |
|
|
323 |
|
IArrayMetaData = interface |
324 |
+ |
['{7dd0aea4-59af-4c2a-b958-565d5025c489}'] |
325 |
|
function GetSQLType: cardinal; |
326 |
< |
function GetSQLTypeName: string; |
326 |
> |
function GetSQLTypeName: AnsiString; |
327 |
|
function GetScale: integer; |
328 |
|
function GetSize: cardinal; |
329 |
+ |
function GetCharSetWidth: integer; |
330 |
|
function GetCharSetID: cardinal; |
331 |
< |
function GetTableName: string; |
332 |
< |
function GetColumnName: string; |
331 |
> |
function GetTableName: AnsiString; |
332 |
> |
function GetColumnName: AnsiString; |
333 |
|
function GetDimensions: integer; |
334 |
|
function GetBounds: TArrayBounds; |
335 |
|
end; |
354 |
|
TArrayEventHandler = procedure(Sender: IArray; Reason: TArrayEventReason) of object; |
355 |
|
|
356 |
|
IArray = interface(IArrayMetaData) |
357 |
+ |
['{631c6bb1-fb49-44fb-a64a-c49859632b88}'] |
358 |
|
function GetArrayID: TISC_QUAD; |
359 |
|
procedure Clear; |
360 |
|
function IsEmpty: boolean; |
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): String; |
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); |
295 |
– |
procedure SetAsTime(index: array of integer; Value: TDateTime); |
296 |
– |
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: String); |
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; |
409 |
|
} |
410 |
|
|
411 |
|
IBlobMetaData = interface |
412 |
+ |
['{575f3c61-bb33-46a5-8975-bb7d1b6e37cc}'] |
413 |
|
function GetSubType: integer; |
414 |
|
function GetCharSetID: cardinal; |
415 |
|
function GetCodePage: TSystemCodePage; |
416 |
|
function GetSegmentSize: cardinal; |
417 |
< |
function GetRelationName: string; |
418 |
< |
function GetColumnName: string; |
417 |
> |
function GetRelationName: AnsiString; |
418 |
> |
function GetColumnName: AnsiString; |
419 |
|
end; |
420 |
|
|
421 |
|
{The Blob Parameter block is used to select a Blob Filter} |
422 |
|
|
423 |
< |
IBPBItem = interface (IParameterBlockItem) end; |
423 |
> |
IBPBItem = interface (IParameterBlockItem) |
424 |
> |
['{660822a5-3114-4c16-b6cb-c1a7b2aba70d}'] |
425 |
> |
end; |
426 |
|
|
427 |
< |
IBPB = specialize IParameterBlock<IBPBItem>; |
427 |
> |
IBPB = interface (IParameterBlock<IBPBItem>) |
428 |
> |
['{e0cb9eb5-17f7-4416-b7d1-3cddd1dfca76}'] |
429 |
> |
end; |
430 |
|
|
431 |
|
{ The Blob Interface provides access to a blob data item. |
432 |
|
|
440 |
|
TBlobType = (btSegmented,btStream); |
441 |
|
|
442 |
|
IBlob = interface(IBlobMetaData) |
443 |
+ |
['{3090a145-7780-442b-b15b-efd4568b8611}'] |
444 |
|
function GetBPB: IBPB; |
445 |
|
procedure Cancel; |
446 |
|
procedure Close; |
451 |
|
TotalSize: Int64; var BlobType: TBlobType); |
452 |
|
function Read(var Buffer; Count: Longint): Longint; |
453 |
|
function Write(const Buffer; Count: Longint): Longint; |
454 |
< |
function LoadFromFile(Filename: string): IBlob; |
454 |
> |
function LoadFromFile(Filename: AnsiString): IBlob; |
455 |
|
function LoadFromStream(S: TStream) : IBlob; |
456 |
< |
function SaveToFile(Filename: string): IBlob; |
456 |
> |
function SaveToFile(Filename: AnsiString): IBlob; |
457 |
|
function SaveToStream(S: TStream): IBlob; |
458 |
|
function GetAsString: rawbytestring; |
459 |
|
procedure SetAsString(aValue: rawbytestring); |
467 |
|
the output of an SQL Statement. |
468 |
|
} |
469 |
|
|
470 |
+ |
TIBDateTimeFormats = (dfTimestamp, {SQL TIMESTAMP} |
471 |
+ |
dfDateTime, {SQL DATETIME} |
472 |
+ |
dfTime, {SQL TIME} |
473 |
+ |
dfTimestampTZ, {SQL_TIMESTAMP_TZ} |
474 |
+ |
dfTimeTZ); {SQLTIME_TZ |
475 |
+ |
|
476 |
|
{ IColumnMetaData } |
477 |
|
|
478 |
|
IColumnMetaData = interface |
479 |
+ |
['{c222e6c3-53c1-469f-9e05-0a5c3ef232d8}'] |
480 |
|
function GetIndex: integer; |
481 |
|
function GetSQLType: cardinal; |
482 |
< |
function GetSQLTypeName: string; |
482 |
> |
function GetSQLTypeName: AnsiString; |
483 |
|
function getSubtype: integer; |
484 |
< |
function getRelationName: string; |
485 |
< |
function getOwnerName: string; |
486 |
< |
function getSQLName: string; {Name of the column} |
487 |
< |
function getAliasName: string; {Alias Name of column or Column Name if no alias} |
488 |
< |
function getName: string; {Disambiguated uppercase Field Name} |
484 |
> |
function getRelationName: AnsiString; |
485 |
> |
function getOwnerName: AnsiString; |
486 |
> |
function getSQLName: AnsiString; {Name of the column} |
487 |
> |
function getAliasName: AnsiString; {Alias Name of column or Column Name if no alias} |
488 |
> |
function getName: AnsiString; {Disambiguated uppercase Field Name} |
489 |
|
function getScale: integer; |
490 |
|
function getCharSetID: cardinal; |
491 |
|
function getCodePage: TSystemCodePage; |
492 |
+ |
function GetCharSetWidth: integer; |
493 |
|
function getIsNullable: boolean; |
494 |
|
function GetSize: cardinal; |
495 |
|
function GetArrayMetaData: IArrayMetaData; {Valid only for Array SQL Type} |
496 |
|
function GetBlobMetaData: IBlobMetaData; {Valid only for Blob SQL Type} |
497 |
< |
property Name: string read GetName; |
497 |
> |
function GetDateTimeStrLength(DateTimeFormat: TIBDateTimeFormats): integer; |
498 |
> |
function GetStatement: IStatement; |
499 |
> |
function GetTransaction: ITransaction; |
500 |
> |
property Name: AnsiString read GetName; |
501 |
|
property Size: cardinal read GetSize; |
502 |
|
property SQLType: cardinal read GetSQLType; |
503 |
|
property Scale: integer read getScale; |
513 |
|
{ IMetaData } |
514 |
|
|
515 |
|
IMetaData = interface |
516 |
+ |
['{4dafdbb6-0d36-4f1f-9c95-8b132804b965}'] |
517 |
|
function getCount: integer; |
518 |
|
function getColumnMetaData(index: integer): IColumnMetaData; |
519 |
< |
function GetUniqueRelationName: string; {Non empty if all columns come from the same table} |
520 |
< |
function ByName(Idx: String): IColumnMetaData; |
519 |
> |
function GetUniqueRelationName: AnsiString; {Non empty if all columns come from the same table} |
520 |
> |
function ByName(Idx: AnsiString): IColumnMetaData; |
521 |
|
property ColMetaData[index: integer]: IColumnMetaData read getColumnMetaData; default; |
522 |
|
property Count: integer read getCount; |
523 |
|
end; |
537 |
|
|
538 |
|
|
539 |
|
ISQLData = interface(IColumnMetaData) |
540 |
+ |
['{3f493e31-7e3f-4606-a07c-b210b9e3619d}'] |
541 |
+ |
function GetStrDataLength: short; |
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; |
556 |
|
function GetAsPointer: Pointer; |
557 |
|
function GetAsQuad: TISC_QUAD; |
558 |
|
function GetAsShort: short; |
559 |
< |
function GetAsString: String; |
559 |
> |
function GetAsString: AnsiString; |
560 |
|
function GetIsNull: Boolean; |
561 |
|
function GetAsVariant: Variant; |
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; |
576 |
|
property AsPointer: Pointer read GetAsPointer; |
577 |
|
property AsQuad: TISC_QUAD read GetAsQuad; |
578 |
|
property AsShort: short read GetAsShort; |
579 |
< |
property AsString: String read GetAsString; |
579 |
> |
property AsString: AnsiString read GetAsString; |
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; |
592 |
|
} |
593 |
|
|
594 |
|
IResults = interface |
595 |
+ |
['{e836b2bb-93d1-4bbf-a8eb-7ce535de3bb5}'] |
596 |
|
function getCount: integer; |
597 |
+ |
function GetStatement: IStatement; |
598 |
|
function GetTransaction: ITransaction; |
599 |
< |
function ByName(Idx: String): ISQLData; |
599 |
> |
function ByName(Idx: AnsiString): ISQLData; |
600 |
|
function getSQLData(index: integer): ISQLData; |
601 |
< |
procedure GetData(index: integer; var IsNull:boolean; var len: short; var data: PChar); |
601 |
> |
procedure GetData(index: integer; var IsNull:boolean; var len: short; var data: PByte); |
602 |
|
procedure SetRetainInterfaces(aValue: boolean); |
603 |
|
property Data[index: integer]: ISQLData read getSQLData; default; |
604 |
|
property Count: integer read getCount; |
610 |
|
in turn, used to access the data returned by each field of the current row. |
611 |
|
} |
612 |
|
IResultSet = interface(IResults) |
613 |
+ |
['{0ae4979b-7857-4e8c-8918-ec6f155b51a0}'] |
614 |
|
function FetchNext: boolean; |
615 |
< |
function GetCursorName: string; |
615 |
> |
function GetCursorName: AnsiString; |
616 |
|
function IsEof: boolean; |
617 |
|
procedure Close; |
618 |
|
end; |
633 |
|
} |
634 |
|
|
635 |
|
ISQLParam = interface |
636 |
+ |
['{b22b4578-6d41-4807-a9a9-d2ec8d1d5a14}'] |
637 |
|
function GetIndex: integer; |
638 |
|
function GetSQLType: cardinal; |
639 |
< |
function GetSQLTypeName: string; |
639 |
> |
function GetSQLTypeName: AnsiString; |
640 |
|
function getSubtype: integer; |
641 |
< |
function getName: string; |
641 |
> |
function getName: AnsiString; |
642 |
|
function getScale: integer; |
643 |
|
function getCharSetID: cardinal; |
644 |
|
function getCodePage: TSystemCodePage; |
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; |
661 |
|
function GetAsPointer: Pointer; |
662 |
|
function GetAsQuad: TISC_QUAD; |
663 |
|
function GetAsShort: short; |
664 |
< |
function GetAsString: String; |
664 |
> |
function GetAsString: AnsiString; |
665 |
|
function GetIsNull: boolean; |
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); |
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); |
691 |
|
procedure SetAsShort(aValue: Short); |
692 |
< |
procedure SetAsString(aValue: String); |
692 |
> |
procedure SetAsString(aValue: AnsiString); |
693 |
|
procedure SetAsVariant(aValue: Variant); |
694 |
|
procedure SetIsNull(aValue: Boolean); |
695 |
|
procedure SetAsBlob(aValue: IBlob); |
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; |
709 |
|
property AsLong: Long read GetAsLong write SetAsLong; |
710 |
|
property AsPointer: Pointer read GetAsPointer write SetAsPointer; |
711 |
|
property AsShort: Short read GetAsShort write SetAsShort; |
712 |
< |
property AsString: String read GetAsString write SetAsString; |
712 |
> |
property AsString: AnsiString read GetAsString write SetAsString; |
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; |
720 |
|
property IsNullable: Boolean read GetIsNullable; |
721 |
|
property Modified: Boolean read getModified; |
722 |
< |
property Name: string read GetName; |
722 |
> |
property Name: AnsiString read GetName; |
723 |
|
property SQLType: cardinal read GetSQLType; |
724 |
|
end; |
725 |
|
|
729 |
|
} |
730 |
|
|
731 |
|
ISQLParams = interface |
732 |
+ |
['{c6d95ac7-b2b7-461b-b890-afef0acbb077}'] |
733 |
|
function getCount: integer; |
734 |
|
function getSQLParam(index: integer): ISQLParam; |
735 |
< |
function ByName(Idx: String): ISQLParam ; |
735 |
> |
function ByName(Idx: AnsiString): ISQLParam ; |
736 |
|
function GetModified: Boolean; |
737 |
+ |
function GetHasCaseSensitiveParams: Boolean; |
738 |
|
property Modified: Boolean read GetModified; |
739 |
|
property Params[index: integer]: ISQLParam read getSQLParam; default; |
740 |
|
property Count: integer read getCount; |
752 |
|
} |
753 |
|
|
754 |
|
IStatement = interface |
755 |
+ |
['{a260576d-a07d-4a66-b02d-1b72543fd7cf}'] |
756 |
|
function GetMetaData: IMetaData; {Output Metadata} |
757 |
|
function GetSQLParams: ISQLParams;{Statement Parameters} |
758 |
< |
function GetPlan: String; |
758 |
> |
function GetPlan: AnsiString; |
759 |
|
function GetRowsAffected(var SelectCount, InsertCount, UpdateCount, DeleteCount: integer): boolean; |
760 |
|
function GetSQLStatementType: TIBSQLStatementTypes; |
761 |
< |
function GetSQLText: string; |
761 |
> |
function GetSQLText: AnsiString; |
762 |
> |
function GetProcessedSQLText: AnsiString; |
763 |
|
function GetSQLDialect: integer; |
764 |
|
function IsPrepared: boolean; |
765 |
|
procedure Prepare(aTransaction: ITransaction=nil); |
786 |
|
found in the Interbase 6.0 API Guide. |
787 |
|
} |
788 |
|
|
789 |
< |
ITPBItem = interface(IParameterBlockItem) end; |
789 |
> |
ITPBItem = interface(IParameterBlockItemWithTypeName) |
790 |
> |
['{544c1f2b-7c12-4a87-a4a5-face7ea72671}'] |
791 |
> |
function getParamTypeName: AnsiString; |
792 |
> |
end; |
793 |
|
|
794 |
< |
ITPB = specialize IParameterBlock<ITPBItem>; |
794 |
> |
ITPB = interface(IParameterBlockWithTypeNames<ITPBItem>) |
795 |
> |
['{7369b0ff-defe-437b-81fe-19b211d42d25}'] |
796 |
> |
end; |
797 |
|
|
798 |
|
{The ITransactionAction interface provides access to a Transaction once it |
799 |
|
has been initially started. After a Commit or Rollback, a transaction |
807 |
|
TTransactionCompletion = TARollback.. TACommit; |
808 |
|
|
809 |
|
ITransaction = interface |
810 |
+ |
['{30928d0e-a9d7-4c61-b7cf-14f4f38abe2a}'] |
811 |
|
function getTPB: ITPB; |
812 |
|
procedure Start(DefaultCompletion: TTransactionCompletion=taCommit); |
813 |
|
function GetInTransaction: boolean; |
835 |
|
} |
836 |
|
|
837 |
|
TEventInfo = record |
838 |
< |
EventName: string; |
838 |
> |
EventName: AnsiString; |
839 |
|
Count: integer; |
840 |
|
end; |
841 |
|
|
846 |
|
{ IEvents } |
847 |
|
|
848 |
|
IEvents = interface |
849 |
+ |
['{6a0be233-ed08-4524-889c-2e45d0c20e5f}'] |
850 |
|
procedure GetEvents(EventNames: TStrings); |
851 |
|
procedure SetEvents(EventNames: TStrings); overload; |
852 |
< |
procedure SetEvents(EventName: string); overload; |
852 |
> |
procedure SetEvents(EventName: AnsiString); overload; |
853 |
|
procedure Cancel; |
854 |
|
function ExtractEventCounts: TEventCounts; |
855 |
|
procedure WaitForEvent; |
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 |
914 |
|
TDBOperationCounts = array of TDBOperationCount; |
915 |
|
|
916 |
|
IDBInfoItem = interface |
917 |
+ |
['{eeb97b51-ec0f-473f-9f75-c1721f055fcb}'] |
918 |
|
function getItemType: byte; |
919 |
|
function getSize: integer; |
920 |
|
procedure getRawBytes(var Buffer); |
921 |
< |
function getAsString: string; |
921 |
> |
function getAsString: AnsiString; |
922 |
|
function getAsInteger: integer; |
923 |
< |
procedure DecodeIDCluster(var ConnectionType: integer; var DBFileName, DBSiteName: string); |
923 |
> |
procedure DecodeIDCluster(var ConnectionType: integer; var DBFileName, DBSiteName: AnsiString); |
924 |
|
function getAsBytes: TByteArray; |
925 |
< |
procedure DecodeVersionString(var Version: byte; var VersionString: string); |
925 |
> |
function getAsDateTime: TDateTime; |
926 |
> |
procedure DecodeVersionString(var Version: byte; var VersionString: AnsiString); |
927 |
|
function getOperationCounts: TDBOperationCounts; |
928 |
|
procedure DecodeUserNames(UserNames: TStrings); |
929 |
|
|
932 |
|
function GetItem(index: integer): IDBInfoItem; |
933 |
|
function Find(ItemType: byte): IDBInfoItem; |
934 |
|
property AsInteger: integer read getAsInteger; |
935 |
< |
property AsString: string read GetAsString; |
935 |
> |
property AsString: AnsiString read GetAsString; |
936 |
|
property Count: integer read GetCount; |
937 |
|
property Items[index: integer]: IDBInfoItem read getItem; default; |
938 |
|
end; |
940 |
|
{ IDBInformation } |
941 |
|
|
942 |
|
IDBInformation = interface |
943 |
+ |
['{7ac6777f-f0a9-498a-9f5c-4a57a554df81}'] |
944 |
|
function GetCount: integer; |
945 |
|
function GetItem(index: integer): IDBInfoItem; |
946 |
|
function Find(ItemType: byte): IDBInfoItem; |
949 |
|
property Items[index: integer]: IDBInfoItem read getItem; default; |
950 |
|
end; |
951 |
|
|
952 |
+ |
{The Database Information Request Block is used to pass requests for |
953 |
+ |
database information where at least one item requested has a parameter. |
954 |
+ |
At present, this is only fb_info_page_contents which has a single |
955 |
+ |
integer parameter.} |
956 |
+ |
|
957 |
+ |
IDIRBItem = interface(IParameterBlockItem) |
958 |
+ |
['{d34a7511-8435-4a24-81a7-5103d218d234}'] |
959 |
+ |
end; |
960 |
+ |
|
961 |
+ |
IDIRB = interface(IParameterBlock<IDIRBItem>) |
962 |
+ |
['{1010e5ac-0a8f-403b-a302-91625e9d9579}'] |
963 |
+ |
end; |
964 |
+ |
|
965 |
+ |
|
966 |
|
{The Database Parameter Block (DPB). |
967 |
|
|
968 |
|
The DPB provides the parameters used when connecting to a database. It is allocated |
974 |
|
found in the Interbase 6.0 API Guide. |
975 |
|
} |
976 |
|
|
977 |
< |
IDPBItem = interface(IParameterBlockItem) end; |
977 |
> |
IDPBItem = interface(IParameterBlockItemWithTypeName) |
978 |
> |
['{123d4ad0-087a-4cd1-a344-1b3d03b30673}'] |
979 |
> |
end; |
980 |
|
|
981 |
< |
IDPB = specialize IParameterBlock<IDPBItem>; |
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: |
1010 |
|
{ IAttachment } |
1011 |
|
|
1012 |
|
IAttachment = interface |
1013 |
+ |
['{466e9b67-9def-4807-b3e7-e08a35e7185c}'] |
1014 |
+ |
function getFirebirdAPI: IFirebirdAPI; |
1015 |
|
function getDPB: IDPB; |
1016 |
|
function AllocateBPB: IBPB; |
1017 |
+ |
function AllocateDIRB: IDIRB; |
1018 |
|
procedure Connect; |
1019 |
|
procedure Disconnect(Force: boolean=false); |
1020 |
|
function IsConnected: boolean; |
1021 |
|
procedure DropDatabase; |
1022 |
|
function StartTransaction(TPB: array of byte; DefaultCompletion: TTransactionCompletion=taCommit): ITransaction; overload; |
1023 |
|
function StartTransaction(TPB: ITPB; DefaultCompletion: TTransactionCompletion=taCommit): ITransaction; overload; |
1024 |
< |
procedure ExecImmediate(transaction: ITransaction; sql: string; SQLDialect: integer); overload; |
1025 |
< |
procedure ExecImmediate(TPB: array of byte; sql: string; SQLDialect: integer); overload; |
1026 |
< |
procedure ExecImmediate(transaction: ITransaction; sql: string); overload; |
1027 |
< |
procedure ExecImmediate(TPB: array of byte; sql: string); overload; |
1028 |
< |
function ExecuteSQL(TPB: array of byte; sql: string; SQLDialect: integer; params: array of const): IResults; overload; |
1029 |
< |
function ExecuteSQL(transaction: ITransaction; sql: string; SQLDialect: integer; params: array of const): IResults; overload; |
1030 |
< |
function ExecuteSQL(TPB: array of byte; sql: string; params: array of const): IResults; overload; |
1031 |
< |
function ExecuteSQL(transaction: ITransaction; sql: string; params: array of const): IResults; overload; |
1032 |
< |
function OpenCursor(transaction: ITransaction; sql: string; aSQLDialect: integer): IResultSet; overload; |
1033 |
< |
function OpenCursor(transaction: ITransaction; sql: string; aSQLDialect: integer; |
1024 |
> |
procedure ExecImmediate(transaction: ITransaction; sql: AnsiString; SQLDialect: integer); overload; |
1025 |
> |
procedure ExecImmediate(TPB: array of byte; sql: AnsiString; SQLDialect: integer); overload; |
1026 |
> |
procedure ExecImmediate(transaction: ITransaction; sql: AnsiString); overload; |
1027 |
> |
procedure ExecImmediate(TPB: array of byte; sql: AnsiString); overload; |
1028 |
> |
function ExecuteSQL(TPB: array of byte; sql: AnsiString; SQLDialect: integer; params: array of const): IResults; overload; |
1029 |
> |
function ExecuteSQL(transaction: ITransaction; sql: AnsiString; SQLDialect: integer; params: array of const): IResults; overload; |
1030 |
> |
function ExecuteSQL(TPB: array of byte; sql: AnsiString; params: array of const): IResults; overload; |
1031 |
> |
function ExecuteSQL(transaction: ITransaction; sql: AnsiString; params: array of const): IResults; overload; |
1032 |
> |
function OpenCursor(transaction: ITransaction; sql: AnsiString; aSQLDialect: integer): IResultSet; overload; |
1033 |
> |
function OpenCursor(transaction: ITransaction; sql: AnsiString; aSQLDialect: integer; |
1034 |
|
params: array of const): IResultSet; overload; |
1035 |
< |
function OpenCursor(transaction: ITransaction; sql: string): IResultSet; overload; |
1036 |
< |
function OpenCursor(transaction: ITransaction; sql: string; |
1035 |
> |
function OpenCursor(transaction: ITransaction; sql: AnsiString): IResultSet; overload; |
1036 |
> |
function OpenCursor(transaction: ITransaction; sql: AnsiString; |
1037 |
|
params: array of const): IResultSet; overload; |
1038 |
< |
function OpenCursorAtStart(transaction: ITransaction; sql: string; aSQLDialect: integer): IResultSet; overload; |
1039 |
< |
function OpenCursorAtStart(transaction: ITransaction; sql: string; aSQLDialect: integer; |
1038 |
> |
function OpenCursorAtStart(transaction: ITransaction; sql: AnsiString; aSQLDialect: integer): IResultSet; overload; |
1039 |
> |
function OpenCursorAtStart(transaction: ITransaction; sql: AnsiString; aSQLDialect: integer; |
1040 |
|
params: array of const): IResultSet; overload; |
1041 |
< |
function OpenCursorAtStart(transaction: ITransaction; sql: string): IResultSet; overload; |
1042 |
< |
function OpenCursorAtStart(transaction: ITransaction; sql: string; |
1041 |
> |
function OpenCursorAtStart(transaction: ITransaction; sql: AnsiString): IResultSet; overload; |
1042 |
> |
function OpenCursorAtStart(transaction: ITransaction; sql: AnsiString; |
1043 |
|
params: array of const): IResultSet; overload; |
1044 |
< |
function OpenCursorAtStart(sql: string): IResultSet; overload; |
1045 |
< |
function OpenCursorAtStart(sql: string; |
1044 |
> |
function OpenCursorAtStart(sql: AnsiString): IResultSet; overload; |
1045 |
> |
function OpenCursorAtStart(sql: AnsiString; |
1046 |
|
params: array of const): IResultSet; overload; |
1047 |
< |
function Prepare(transaction: ITransaction; sql: string; aSQLDialect: integer): IStatement; overload; |
1048 |
< |
function Prepare(transaction: ITransaction; sql: string): IStatement; overload; |
1049 |
< |
function PrepareWithNamedParameters(transaction: ITransaction; sql: string; |
1050 |
< |
aSQLDialect: integer; GenerateParamNames: boolean=false): IStatement; overload; |
1051 |
< |
function PrepareWithNamedParameters(transaction: ITransaction; sql: string; |
1052 |
< |
GenerateParamNames: boolean=false): IStatement; overload; |
1047 |
> |
function Prepare(transaction: ITransaction; sql: AnsiString; aSQLDialect: integer): IStatement; overload; |
1048 |
> |
function Prepare(transaction: ITransaction; sql: AnsiString): IStatement; overload; |
1049 |
> |
function PrepareWithNamedParameters(transaction: ITransaction; sql: AnsiString; |
1050 |
> |
aSQLDialect: integer; GenerateParamNames: boolean=false; |
1051 |
> |
CaseSensitiveParams: boolean = false): IStatement; overload; |
1052 |
> |
function PrepareWithNamedParameters(transaction: ITransaction; sql: AnsiString; |
1053 |
> |
GenerateParamNames: boolean=false; |
1054 |
> |
CaseSensitiveParams: boolean = false): IStatement; overload; |
1055 |
|
|
1056 |
|
{Events} |
1057 |
|
function GetEventHandler(Events: TStrings): IEvents; overload; |
1058 |
< |
function GetEventHandler(Event: string): IEvents; overload; |
1058 |
> |
function GetEventHandler(Event: AnsiString): IEvents; overload; |
1059 |
|
|
1060 |
|
{Blob - may use to open existing Blobs. However, ISQLData.AsBlob is preferred} |
1061 |
|
|
1062 |
< |
function CreateBlob(transaction: ITransaction; RelationName, ColumnName: string; BPB: IBPB=nil): IBlob; overload; |
1062 |
> |
function CreateBlob(transaction: ITransaction; RelationName, ColumnName: AnsiString; BPB: IBPB=nil): IBlob; overload; |
1063 |
|
function CreateBlob(transaction: ITransaction; BlobMetaData: IBlobMetaData; BPB: IBPB=nil): IBlob; overload; |
1064 |
|
function CreateBlob(transaction: ITransaction; SubType: integer; CharSetID: cardinal=0; BPB: IBPB=nil): IBlob; overload; |
1065 |
< |
function OpenBlob(transaction: ITransaction; RelationName, ColumnName: string; BlobID: TISC_QUAD; BPB: IBPB=nil): IBlob; |
1065 |
> |
function OpenBlob(transaction: ITransaction; RelationName, ColumnName: AnsiString; BlobID: TISC_QUAD; BPB: IBPB=nil): IBlob; overload; |
1066 |
> |
function OpenBlob(transaction: ITransaction; BlobMetaData: IBlobMetaData; BlobID: TISC_QUAD; BPB: IBPB=nil): IBlob; overload; |
1067 |
|
|
1068 |
|
{Array - may use to open existing arrays. However, ISQLData.AsArray is preferred} |
1069 |
|
|
1070 |
< |
function OpenArray(transaction: ITransaction; RelationName, ColumnName: string; ArrayID: TISC_QUAD): IArray; |
1071 |
< |
function CreateArray(transaction: ITransaction; RelationName, ColumnName: string): IArray; overload; |
1070 |
> |
function OpenArray(transaction: ITransaction; RelationName, ColumnName: AnsiString; ArrayID: TISC_QUAD): IArray; overload; |
1071 |
> |
function OpenArray(transaction: ITransaction; ArrayMetaData: IArrayMetaData; ArrayID: TISC_QUAD): IArray; overload; |
1072 |
> |
function CreateArray(transaction: ITransaction; RelationName, ColumnName: AnsiString): IArray; overload; |
1073 |
|
function CreateArray(transaction: ITransaction; ArrayMetaData: IArrayMetaData): IArray; overload; |
1074 |
< |
function CreateArrayMetaData(SQLType: cardinal; tableName: string; columnName: string; |
1074 |
> |
function CreateArrayMetaData(SQLType: cardinal; tableName: AnsiString; columnName: AnsiString; |
1075 |
|
Scale: integer; size: cardinal; charSetID: cardinal; dimensions: cardinal; |
1076 |
|
bounds: TArrayBounds): IArrayMetaData; |
1077 |
|
|
1078 |
|
{Database Information} |
1079 |
|
function GetSQLDialect: integer; |
1080 |
< |
function GetBlobMetaData(Transaction: ITransaction; tableName, columnName: string): IBlobMetaData; |
1081 |
< |
function GetArrayMetaData(Transaction: ITransaction; tableName, columnName: string): IArrayMetaData; |
1080 |
> |
function GetBlobMetaData(Transaction: ITransaction; tableName, columnName: AnsiString): IBlobMetaData; |
1081 |
> |
function GetArrayMetaData(Transaction: ITransaction; tableName, columnName: AnsiString): IArrayMetaData; |
1082 |
|
function GetDBInformation(Requests: array of byte): IDBInformation; overload; |
1083 |
|
function GetDBInformation(Request: byte): IDBInformation; overload; |
1084 |
+ |
function GetDBInformation(Requests: IDIRB): IDBInformation; overload; |
1085 |
+ |
function GetConnectString: AnsiString; |
1086 |
+ |
function GetRemoteProtocol: AnsiString; |
1087 |
+ |
function GetAuthenticationMethod: AnsiString; |
1088 |
+ |
function GetSecurityDatabase: AnsiString; |
1089 |
+ |
function GetODSMajorVersion: integer; |
1090 |
+ |
function GetODSMinorVersion: integer; |
1091 |
+ |
procedure getFBVersion(version: TStrings); |
1092 |
|
function HasActivity: boolean; |
1093 |
< |
end; |
1093 |
> |
function HasDecFloatSupport: boolean; |
1094 |
> |
|
1095 |
> |
{Character Sets} |
1096 |
> |
function HasDefaultCharSet: boolean; |
1097 |
> |
function GetDefaultCharSetID: integer; |
1098 |
> |
function GetCharsetName(CharSetID: integer): AnsiString; |
1099 |
> |
function CharSetID2CodePage(CharSetID: integer; var CodePage: TSystemCodePage): boolean; |
1100 |
> |
function CodePage2CharSetID(CodePage: TSystemCodePage; var CharSetID: integer): boolean; |
1101 |
> |
function CharSetName2CharSetID(CharSetName: AnsiString; var CharSetID: integer): boolean; |
1102 |
> |
function CharSetWidth(CharSetID: integer; var Width: integer): boolean; |
1103 |
> |
procedure RegisterCharSet(CharSetName: AnsiString; CodePage: TSystemCodePage; |
1104 |
> |
AllowReverseLookup:boolean; out CharSetID: integer); |
1105 |
> |
|
1106 |
> |
{Time Zone Database} |
1107 |
> |
function GetTimeZoneServices: ITimeZoneServices; |
1108 |
> |
function HasTimeZoneSupport: boolean; |
1109 |
> |
end; |
1110 |
|
|
1111 |
< |
TProtocol = (TCP, SPX, NamedPipe, Local); |
1111 |
> |
TProtocolAll = (TCP, SPX, NamedPipe, Local, inet, inet4, inet6, wnet, xnet, unknownProtocol); |
1112 |
> |
TProtocol = TCP..xnet; |
1113 |
|
|
1114 |
|
{Service Parameter Block (SPB). |
1115 |
|
|
1123 |
|
|
1124 |
|
} |
1125 |
|
|
1126 |
< |
ISPBItem = interface(IParameterBlockItem) end; |
1126 |
> |
ISPBItem = interface(IParameterBlockItemWithTypeName) |
1127 |
> |
['{5d08ae2b-4519-41bd-8b40-97cd451c3f6a}'] |
1128 |
> |
end; |
1129 |
|
|
1130 |
< |
ISPB = specialize IParameterBlock<ISPBItem>; |
1130 |
> |
ISPB = interface(IParameterBlockWithTypeNames<ISPBItem>) |
1131 |
> |
['{2c5836fd-41ed-4426-9b7d-5af580ec2659}'] |
1132 |
> |
end; |
1133 |
|
|
1134 |
|
{Service Query Parameter Block (SQPB). |
1135 |
|
|
1138 |
|
} |
1139 |
|
|
1140 |
|
ISQPBItem = interface(IParameterBlockItem) |
1141 |
+ |
['{b07841a6-33b3-47f0-b5a2-028cbc86dc97}'] |
1142 |
|
function CopyFrom(source: TStream; count: integer): integer; |
1143 |
|
end; |
1144 |
|
|
1145 |
< |
ISQPB = specialize IParameterBlock<ISQPBItem>; |
1145 |
> |
ISQPB = interface(IParameterBlock<ISQPBItem>) |
1146 |
> |
['{8553e66b-ee62-498b-8431-dff030211447}'] |
1147 |
> |
end; |
1148 |
|
|
1149 |
|
{Service Request Block (SRB). |
1150 |
|
|
1158 |
|
|
1159 |
|
} |
1160 |
|
|
1161 |
< |
ISRBItem = interface(IParameterBlockItem) end; |
1161 |
> |
ISRBItem = interface(IParameterBlockItem) |
1162 |
> |
['{47ec790e-f265-4b30-9dcd-261e51677245}'] |
1163 |
> |
end; |
1164 |
|
|
1165 |
< |
ISRB = specialize IParameterBlock<ISRBItem>; |
1165 |
> |
ISRB = interface(IParameterBlock<ISRBItem>) |
1166 |
> |
['{9f2e204f-3c33-4e44-90f9-9135e95dafb9}'] |
1167 |
> |
end; |
1168 |
|
|
1169 |
|
{The Service Query Results Interface. |
1170 |
|
|
1182 |
|
} |
1183 |
|
|
1184 |
|
IServiceQueryResultSubItem = interface |
1185 |
+ |
['{8a4c381e-9923-4cc9-a96b-553729248640}'] |
1186 |
|
function getItemType: byte; |
1187 |
|
function getSize: integer; |
1188 |
|
procedure getRawBytes(var Buffer); |
1189 |
< |
function getAsString: string; |
1189 |
> |
function getAsString: AnsiString; |
1190 |
|
function getAsInteger: integer; |
1191 |
|
function getAsByte: byte; |
1192 |
|
function CopyTo(stream: TStream; count: integer): integer; |
1193 |
< |
property AsString: string read getAsString; |
1193 |
> |
property AsString: AnsiString read getAsString; |
1194 |
|
property AsInteger: integer read getAsInteger; |
1195 |
|
property AsByte: byte read getAsByte; |
1196 |
|
end; |
1197 |
|
|
1198 |
|
IServiceQueryResultItem = interface(IServiceQueryResultSubItem) |
1199 |
+ |
['{b2806886-206c-4024-8df9-5fe0a7630a5e}'] |
1200 |
|
function getCount: integer; |
1201 |
|
function getItem(index: integer): IServiceQueryResultSubItem; |
1202 |
|
function find(ItemType: byte): IServiceQueryResultSubItem; |
1205 |
|
end; |
1206 |
|
|
1207 |
|
IServiceQueryResults = interface |
1208 |
+ |
['{8fbbef7d-fe03-4409-828a-a787d34ef531}'] |
1209 |
|
function getCount: integer; |
1210 |
|
function getItem(index: integer): IServiceQueryResultItem; |
1211 |
|
function find(ItemType: byte): IServiceQueryResultItem; |
1214 |
|
property Count: integer read getCount; |
1215 |
|
end; |
1216 |
|
|
1217 |
+ |
IFirebirdLibrary = interface; |
1218 |
+ |
|
1219 |
|
{The IServiceManager interface provides access to a service manager. It can |
1220 |
|
used to Detach and re-attach to Service Manager, to start services and to |
1221 |
|
query the service manager. |
1226 |
|
{ IServiceManager } |
1227 |
|
|
1228 |
|
IServiceManager = interface |
1229 |
+ |
['{905b587d-1e1f-4e40-a3f8-a3519f852e48}'] |
1230 |
+ |
function getFirebirdAPI: IFirebirdAPI; |
1231 |
|
function getSPB: ISPB; |
1232 |
< |
function getServerName: string; |
1232 |
> |
function getServerName: AnsiString; |
1233 |
> |
function getProtocol: TProtocol; |
1234 |
> |
function getPortNo: AnsiString; |
1235 |
|
procedure Attach; |
1236 |
|
procedure Detach(Force: boolean=false); |
1237 |
|
function IsAttached: boolean; |
1238 |
|
function AllocateSRB: ISRB; |
1239 |
|
function AllocateSQPB: ISQPB; |
1240 |
< |
procedure Start(Request: ISRB); |
1241 |
< |
function Query(SQPB: ISQPB; Request: ISRB) :IServiceQueryResults; overload; |
1242 |
< |
function Query(Request: ISRB) :IServiceQueryResults; overload; |
1240 |
> |
function Start(Request: ISRB; RaiseExceptionOnError: boolean=true): boolean; |
1241 |
> |
function Query(SQPB: ISQPB; Request: ISRB; RaiseExceptionOnError: boolean=true) :IServiceQueryResults; overload; |
1242 |
> |
function Query(Request: ISRB; RaiseExceptionOnError: boolean=true) :IServiceQueryResults; overload; |
1243 |
> |
end; |
1244 |
> |
|
1245 |
> |
{Tbe Firebird Library API used to get information about the Firebird library} |
1246 |
> |
|
1247 |
> |
|
1248 |
> |
IFirebirdLibrary = interface |
1249 |
> |
['{3c04e0a1-12e0-428a-b2e1-bc6fcd97b79b}'] |
1250 |
> |
function GetHandle: TLibHandle; |
1251 |
> |
function GetLibraryName: string; |
1252 |
> |
function GetLibraryFilePath: string; |
1253 |
> |
function GetFirebirdAPI: IFirebirdAPI; |
1254 |
|
end; |
1255 |
|
|
1256 |
|
{The Firebird API. |
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} |
1269 |
|
function AllocateDPB: IDPB; |
1270 |
< |
function OpenDatabase(DatabaseName: string; DPB: IDPB; RaiseExceptionOnConnectError: boolean=true): IAttachment; |
1271 |
< |
function CreateDatabase(DatabaseName: string; DPB: IDPB; RaiseExceptionOnError: boolean=true): IAttachment; overload; |
1272 |
< |
function CreateDatabase(sql: string; aSQLDialect: integer; RaiseExceptionOnError: boolean=true): IAttachment; overload; |
1270 |
> |
function OpenDatabase(DatabaseName: AnsiString; DPB: IDPB; RaiseExceptionOnConnectError: boolean=true): IAttachment; |
1271 |
> |
function CreateDatabase(DatabaseName: AnsiString; DPB: IDPB; RaiseExceptionOnError: boolean=true): IAttachment; overload; |
1272 |
> |
function CreateDatabase(sql: AnsiString; aSQLDialect: integer; RaiseExceptionOnError: boolean=true): IAttachment; overload; |
1273 |
|
|
1274 |
|
{Start Transaction against multiple databases} |
1275 |
|
function AllocateTPB: ITPB; |
1281 |
|
{Service Manager} |
1282 |
|
function HasServiceAPI: boolean; |
1283 |
|
function AllocateSPB: ISPB; |
1284 |
< |
function GetServiceManager(ServerName: string; Protocol: TProtocol; SPB: ISPB): IServiceManager; |
1284 |
> |
function GetServiceManager(ServerName: AnsiString; Protocol: TProtocol; SPB: ISPB): IServiceManager; overload; |
1285 |
> |
function GetServiceManager(ServerName: AnsiString; Port: AnsiString; Protocol: TProtocol; SPB: ISPB): IServiceManager; overload; |
1286 |
|
|
1287 |
|
{Information} |
1288 |
|
function GetStatus: IStatus; |
1006 |
– |
function GetLibraryName: string; |
1289 |
|
function HasRollbackRetaining: boolean; |
1290 |
|
function IsEmbeddedServer: boolean; |
1291 |
< |
function GetImplementationVersion: string; |
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; |
1302 |
< |
|
1015 |
< |
{utility} |
1016 |
< |
function GetCharsetName(CharSetID: integer): string; |
1017 |
< |
function CharSetID2CodePage(CharSetID: integer; var CodePage: TSystemCodePage): boolean; |
1018 |
< |
function CodePage2CharSetID(CodePage: TSystemCodePage; var CharSetID: integer): boolean; |
1019 |
< |
function CharSetName2CharSetID(CharSetName: string; var CharSetID: integer): boolean; |
1020 |
< |
function CharSetWidth(CharSetID: integer; var Width: integer): boolean; |
1301 |
> |
function GetIMaster: TObject; deprecated 'Use FirebirdAPI.QueryInterface and FBClientLib.pas IFBIMasterProvider instead'; |
1302 |
> |
function GetFBLibrary: IFirebirdLibrary; |
1303 |
|
end; |
1304 |
|
|
1305 |
|
type |
1316 |
|
private |
1317 |
|
FSQLCode: Long; |
1318 |
|
public |
1319 |
< |
constructor Create(ASQLCode: Long; Msg: string); |
1319 |
> |
constructor Create(ASQLCode: Long; Msg: AnsiString); |
1320 |
|
property SQLCode: Long read FSQLCode; |
1321 |
|
end; |
1322 |
|
|
1327 |
|
FIBErrorCode: Long; |
1328 |
|
public |
1329 |
|
constructor Create(Status: IStatus); overload; |
1330 |
< |
constructor Create(ASQLCode: Long; AIBErrorCode: Long; Msg: string); overload; |
1330 |
> |
constructor Create(ASQLCode: Long; AIBErrorCode: Long; Msg: AnsiString); overload; |
1331 |
|
property IBErrorCode: Long read FIBErrorCode; |
1332 |
|
end; |
1333 |
|
|
1334 |
|
{IB Client Exceptions} |
1335 |
|
EIBClientError = class(EIBError); |
1336 |
|
|
1055 |
– |
{IBError is used internally and by IBX to throw an EIBClientError} |
1056 |
– |
|
1057 |
– |
procedure IBError(ErrMess: TIBClientError; const Args: array of const); |
1058 |
– |
|
1337 |
|
{The Firebird API function is used to access the IFirebirdAPI interface. |
1338 |
|
|
1339 |
|
It will load the Firebird Client Library if this is not already loaded and |
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; |
1350 |
|
|
1351 |
+ |
{If you want to explicitly load the Firebird library from a |
1352 |
+ |
non-default location then use this function and its GetFirebirdAPI function |
1353 |
+ |
to get the API.} |
1354 |
+ |
|
1355 |
+ |
function LoadFBLibrary(aLibPathName: string): IFirebirdLibrary; |
1356 |
+ |
|
1357 |
+ |
|
1358 |
|
implementation |
1359 |
|
|
1360 |
|
uses FBClientAPI |
1361 |
|
{$IFDEF USELEGACYFIREBIRDAPI}, FB25ClientAPI {$ENDIF} |
1362 |
|
{$IFDEF USEFIREBIRD3API}, FB30ClientAPI {$ENDIF}; |
1363 |
|
|
1364 |
< |
var FFirebirdAPI: IFirebirdAPI; |
1364 |
> |
var FDefaultFBLibrary: IFirebirdLibrary; |
1365 |
> |
|
1366 |
> |
type |
1367 |
> |
|
1368 |
> |
{ TFBLibrary } |
1369 |
> |
|
1370 |
> |
TFBLibraryImpl = class(TFBLibrary) |
1371 |
> |
protected |
1372 |
> |
function GetFirebird3API: IFirebirdAPI; override; |
1373 |
> |
function GetLegacyFirebirdAPI: IFirebirdAPI; override; |
1374 |
> |
end; |
1375 |
> |
|
1376 |
> |
function TFBLibraryImpl.GetFirebird3API: IFirebirdAPI; |
1377 |
> |
begin |
1378 |
> |
{$IFDEF USEFIREBIRD3API} |
1379 |
> |
Result := TFB30ClientAPI.Create(self); |
1380 |
> |
{$ELSE} |
1381 |
> |
Result := nil; |
1382 |
> |
{$ENDIF} |
1383 |
> |
end; |
1384 |
> |
|
1385 |
> |
function TFBLibraryImpl.GetLegacyFirebirdAPI: IFirebirdAPI; |
1386 |
> |
begin |
1387 |
> |
{$IFDEF USELEGACYFIREBIRDAPI} |
1388 |
> |
Result := TFB25ClientAPI.Create(self); |
1389 |
> |
{$ELSE} |
1390 |
> |
Result := nil; |
1391 |
> |
{$ENDIF} |
1392 |
> |
end; |
1393 |
|
|
1394 |
|
function FirebirdAPI: IFirebirdAPI; |
1395 |
|
begin |
1396 |
< |
if FFirebirdAPI = nil then |
1396 |
> |
if FDefaultFBLibrary = nil then |
1397 |
|
CheckIBLoaded; |
1398 |
< |
Result := FFirebirdAPI; |
1398 |
> |
Result := FDefaultFBLibrary.GetFirebirdAPI; |
1399 |
|
end; |
1400 |
|
|
1401 |
|
function TryIBLoad: Boolean; |
1402 |
+ |
var fblib: IFirebirdLibrary; |
1403 |
|
begin |
1404 |
< |
Result := FFirebirdAPI <> nil; |
1404 |
> |
Result := FDefaultFBLibrary <> nil; |
1405 |
|
try |
1092 |
– |
{$IFDEF USEFIREBIRD3API} |
1093 |
– |
if not Result then |
1094 |
– |
begin |
1095 |
– |
FFirebirdAPI := TFB30ClientAPI.Create; |
1096 |
– |
Result := FFirebirdAPI.HasMasterIntf; |
1097 |
– |
end; |
1098 |
– |
{$ENDIF} |
1099 |
– |
{$IFDEF USELEGACYFIREBIRDAPI} |
1406 |
|
if not Result then |
1407 |
|
begin |
1408 |
< |
FFirebirdAPI := nil; |
1409 |
< |
FFirebirdAPI := TFB25ClientAPI.Create; |
1410 |
< |
Result := true; |
1411 |
< |
end; |
1106 |
< |
{$ENDIF} |
1107 |
< |
if Result and not (FFirebirdAPI as TFBClientAPI).IsLibraryLoaded then |
1108 |
< |
begin |
1109 |
< |
Result := false; |
1110 |
< |
FFirebirdAPI := nil; |
1408 |
> |
fblib := TFBLibraryImpl.Create; |
1409 |
> |
if (fblib <> nil) and (fblib.GetFirebirdAPI <> nil) then |
1410 |
> |
FDefaultFBLibrary := fblib; |
1411 |
> |
Result := FDefaultFBLibrary <> nil; |
1412 |
|
end; |
1413 |
|
except |
1414 |
|
SysUtils.showexception(ExceptObject,ExceptAddr); |
1422 |
|
IBError(ibxeInterBaseMissing, [nil]); |
1423 |
|
end; |
1424 |
|
|
1425 |
+ |
function LoadFBLibrary(aLibPathName: string): IFirebirdLibrary; |
1426 |
+ |
var fblib: IFirebirdLibrary; |
1427 |
+ |
begin |
1428 |
+ |
if trim(aLibPathName) = '' then |
1429 |
+ |
begin |
1430 |
+ |
CheckIBLoaded; |
1431 |
+ |
Result := FDefaultFBLibrary; |
1432 |
+ |
end |
1433 |
+ |
else |
1434 |
+ |
begin |
1435 |
+ |
fblib := TFBLibraryImpl.GetFBLibrary(aLibPathName); |
1436 |
+ |
if (fblib = nil) or (fblib.GetFirebirdAPI = nil) then |
1437 |
+ |
IBError(ibxeInterBaseMissing, [nil]); |
1438 |
+ |
Result := fblib; |
1439 |
+ |
end; |
1440 |
+ |
end; |
1441 |
+ |
|
1442 |
|
{ EIBError } |
1443 |
|
|
1444 |
< |
constructor EIBError.Create(ASQLCode: Long; Msg: string); |
1444 |
> |
constructor EIBError.Create(ASQLCode: Long; Msg: AnsiString); |
1445 |
|
begin |
1446 |
|
inherited Create(Msg); |
1447 |
|
FSQLCode := ASQLCode; |
1456 |
|
end; |
1457 |
|
|
1458 |
|
constructor EIBInterBaseError.Create(ASQLCode: Long; AIBErrorCode: Long; |
1459 |
< |
Msg: string); |
1459 |
> |
Msg: AnsiString); |
1460 |
|
begin |
1461 |
|
inherited Create(ASQLCode,Msg); |
1462 |
|
FIBErrorCode := AIBErrorCode; |
1463 |
|
end; |
1464 |
|
|
1147 |
– |
procedure IBError(ErrMess: TIBClientError; const Args: array of const); |
1148 |
– |
begin |
1149 |
– |
raise EIBClientError.Create(Ord(ErrMess), |
1150 |
– |
Format(GetErrorMessage(ErrMess), Args)); |
1151 |
– |
end; |
1465 |
|
|
1466 |
|
initialization |
1467 |
< |
FFirebirdAPI := nil; |
1467 |
> |
FDefaultFBLibrary := nil; |
1468 |
|
|
1469 |
+ |
finalization |
1470 |
+ |
FDefaultFBLibrary := nil; |
1471 |
|
|
1472 |
|
end. |
1473 |
|
|