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 = 3; |
138 |
> |
FBIntf_Release = 2; |
139 |
> |
FBIntf_Version = '1.3.2'; |
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; deprecated 'Use Get ParamTypeName'; |
267 |
+ |
function GetParamTypeName(ParamType: byte): Ansistring; |
268 |
+ |
end; |
269 |
+ |
|
270 |
|
{IParameterBlockItem is not used on its own but instead provides a base type for |
271 |
|
different parameter block items } |
272 |
|
|
273 |
|
IParameterBlockItem = interface |
274 |
+ |
['{53b23f7b-abda-46a5-9aa5-07bd5e723266}'] |
275 |
|
function getParamType: byte; |
276 |
|
function getAsInteger: integer; |
277 |
< |
function getAsString: string; |
277 |
> |
function getAsString: AnsiString; |
278 |
|
function getAsByte: byte; |
279 |
< |
procedure setAsString(aValue: string); |
279 |
> |
procedure setAsString(aValue: AnsiString); |
280 |
|
procedure setAsByte(aValue: byte); |
281 |
|
procedure SetAsInteger(aValue: integer); |
282 |
< |
property AsString: string read getAsString write setAsString; |
282 |
> |
property AsString: AnsiString read getAsString write setAsString; |
283 |
|
property AsByte: byte read getAsByte write setAsByte; |
284 |
|
property AsInteger: integer read getAsInteger write SetAsInteger; |
285 |
|
end; |
286 |
|
|
287 |
+ |
IParameterBlockItemWithTypeName = interface(IParameterBlockItem) |
288 |
+ |
function getParamTypeName: AnsiString; |
289 |
+ |
end; |
290 |
|
|
291 |
|
{The IStatus interface provides access to error information, if any, returned |
292 |
|
by the last API call. It can also be used to customise the error message |
295 |
|
This interface can be accessed from IFirebirdAPI. |
296 |
|
} |
297 |
|
|
298 |
+ |
TIBDataBaseErrorMessage = (ShowSQLCode, |
299 |
+ |
ShowIBMessage, |
300 |
+ |
ShowSQLMessage); |
301 |
+ |
|
302 |
+ |
TIBDataBaseErrorMessages = set of TIBDataBaseErrorMessage; |
303 |
+ |
|
304 |
+ |
TStatusCode = long; |
305 |
+ |
|
306 |
|
IStatus = interface |
307 |
< |
function GetIBErrorCode: Long; |
308 |
< |
function Getsqlcode: Long; |
309 |
< |
function GetMessage: string; |
307 |
> |
['{34167722-af38-4831-b08a-93162d58ede3}'] |
308 |
> |
function GetIBErrorCode: TStatusCode; |
309 |
> |
function Getsqlcode: TStatusCode; |
310 |
> |
function GetMessage: AnsiString; |
311 |
|
function CheckStatusVector(ErrorCodes: array of TFBStatusCode): Boolean; |
312 |
|
function GetIBDataBaseErrorMessages: TIBDataBaseErrorMessages; |
313 |
|
procedure SetIBDataBaseErrorMessages(Value: TIBDataBaseErrorMessages); |
324 |
|
TArrayBounds = array of TArrayBound; |
325 |
|
|
326 |
|
IArrayMetaData = interface |
327 |
+ |
['{7dd0aea4-59af-4c2a-b958-565d5025c489}'] |
328 |
|
function GetSQLType: cardinal; |
329 |
< |
function GetSQLTypeName: string; |
329 |
> |
function GetSQLTypeName: AnsiString; |
330 |
|
function GetScale: integer; |
331 |
|
function GetSize: cardinal; |
332 |
+ |
function GetCharSetWidth: integer; |
333 |
|
function GetCharSetID: cardinal; |
334 |
< |
function GetTableName: string; |
335 |
< |
function GetColumnName: string; |
334 |
> |
function GetTableName: AnsiString; |
335 |
> |
function GetColumnName: AnsiString; |
336 |
|
function GetDimensions: integer; |
337 |
|
function GetBounds: TArrayBounds; |
338 |
|
end; |
357 |
|
TArrayEventHandler = procedure(Sender: IArray; Reason: TArrayEventReason) of object; |
358 |
|
|
359 |
|
IArray = interface(IArrayMetaData) |
360 |
+ |
['{631c6bb1-fb49-44fb-a64a-c49859632b88}'] |
361 |
|
function GetArrayID: TISC_QUAD; |
362 |
|
procedure Clear; |
363 |
|
function IsEmpty: boolean; |
368 |
|
function GetAsBoolean(index: array of integer): boolean; |
369 |
|
function GetAsCurrency(index: array of integer): Currency; |
370 |
|
function GetAsInt64(index: array of integer): Int64; |
371 |
< |
function GetAsDateTime(index: array of integer): TDateTime; |
371 |
> |
function GetAsDateTime(index: array of integer): TDateTime; overload; |
372 |
> |
procedure GetAsDateTime(index: array of integer; var aDateTime: TDateTime; var dstOffset: smallint; var aTimezoneID: TFBTimeZoneID); overload; |
373 |
> |
procedure GetAsDateTime(index: array of integer; var aDateTime: TDateTime; var dstOffset: smallint; var aTimezone: AnsiString); overload; |
374 |
> |
procedure GetAsTime(index: array of integer; var aTime: TDateTime; var dstOffset: smallint; var aTimezoneID: TFBTimeZoneID; OnDate: TDateTime); overload; |
375 |
> |
procedure GetAsTime(index: array of integer; var aTime: TDateTime; var dstOffset: smallint; var aTimezone: AnsiString; OnDate: TDateTime); overload; |
376 |
> |
function GetAsUTCDateTime(index: array of integer): TDateTime; |
377 |
|
function GetAsDouble(index: array of integer): Double; |
378 |
|
function GetAsFloat(index: array of integer): Float; |
379 |
|
function GetAsLong(index: array of integer): Long; |
380 |
|
function GetAsShort(index: array of integer): Short; |
381 |
< |
function GetAsString(index: array of integer): String; |
381 |
> |
function GetAsString(index: array of integer): AnsiString; |
382 |
|
function GetAsVariant(index: array of integer): Variant; |
383 |
+ |
function GetAsBCD(index: array of integer): tBCD; |
384 |
|
procedure SetAsInteger(index: array of integer; AValue: integer); |
385 |
|
procedure SetAsBoolean(index: array of integer; AValue: boolean); |
386 |
|
procedure SetAsCurrency(index: array of integer; Value: Currency); |
387 |
|
procedure SetAsInt64(index: array of integer; Value: Int64); |
388 |
|
procedure SetAsDate(index: array of integer; Value: TDateTime); |
389 |
+ |
procedure SetAsDateTime(index: array of integer; Value: TDateTime); overload; |
390 |
+ |
procedure SetAsDateTime(index: array of integer; aValue: TDateTime; aTimeZoneID: TFBTimeZoneID); overload; |
391 |
+ |
procedure SetAsDateTime(index: array of integer; aValue: TDateTime; aTimeZone: AnsiString); overload; |
392 |
+ |
procedure SetAsTime(index: array of integer; Value: TDateTime); overload; |
393 |
+ |
procedure SetAsTime(index: array of integer; aValue: TDateTime; OnDate: TDateTime; aTimeZoneID: TFBTimeZoneID); overload; |
394 |
+ |
procedure SetAsTime(index: array of integer; aValue: TDateTime; OnDate: TDateTime; aTimeZone: AnsiString); overload; |
395 |
+ |
procedure SetAsUTCDateTime(index: array of integer; aUTCTime: TDateTime); |
396 |
|
procedure SetAsLong(index: array of integer; Value: Long); |
288 |
– |
procedure SetAsTime(index: array of integer; Value: TDateTime); |
289 |
– |
procedure SetAsDateTime(index: array of integer; Value: TDateTime); |
397 |
|
procedure SetAsDouble(index: array of integer; Value: Double); |
398 |
|
procedure SetAsFloat(index: array of integer; Value: Float); |
399 |
|
procedure SetAsShort(index: array of integer; Value: Short); |
400 |
< |
procedure SetAsString(index: array of integer; Value: String); |
400 |
> |
procedure SetAsString(index: array of integer; Value: AnsiString); |
401 |
|
procedure SetAsVariant(index: array of integer; Value: Variant); |
402 |
+ |
procedure SetAsBcd(index: array of integer; aValue: tBCD); |
403 |
|
procedure SetBounds(dim, UpperBound, LowerBound: integer); |
404 |
|
function GetAttachment: IAttachment; |
405 |
|
function GetTransaction: ITransaction; |
412 |
|
} |
413 |
|
|
414 |
|
IBlobMetaData = interface |
415 |
+ |
['{575f3c61-bb33-46a5-8975-bb7d1b6e37cc}'] |
416 |
|
function GetSubType: integer; |
417 |
|
function GetCharSetID: cardinal; |
418 |
|
function GetCodePage: TSystemCodePage; |
419 |
|
function GetSegmentSize: cardinal; |
420 |
< |
function GetRelationName: string; |
421 |
< |
function GetColumnName: string; |
420 |
> |
function GetRelationName: AnsiString; |
421 |
> |
function GetColumnName: AnsiString; |
422 |
|
end; |
423 |
|
|
424 |
|
{The Blob Parameter block is used to select a Blob Filter} |
425 |
|
|
426 |
< |
IBPBItem = interface (IParameterBlockItem) end; |
426 |
> |
IBPBItem = interface (IParameterBlockItem) |
427 |
> |
['{660822a5-3114-4c16-b6cb-c1a7b2aba70d}'] |
428 |
> |
end; |
429 |
|
|
430 |
< |
IBPB = specialize IParameterBlock<IBPBItem>; |
430 |
> |
IBPB = interface (IParameterBlock<IBPBItem>) |
431 |
> |
['{e0cb9eb5-17f7-4416-b7d1-3cddd1dfca76}'] |
432 |
> |
end; |
433 |
|
|
434 |
|
{ The Blob Interface provides access to a blob data item. |
435 |
|
|
443 |
|
TBlobType = (btSegmented,btStream); |
444 |
|
|
445 |
|
IBlob = interface(IBlobMetaData) |
446 |
+ |
['{3090a145-7780-442b-b15b-efd4568b8611}'] |
447 |
|
function GetBPB: IBPB; |
448 |
|
procedure Cancel; |
449 |
|
procedure Close; |
454 |
|
TotalSize: Int64; var BlobType: TBlobType); |
455 |
|
function Read(var Buffer; Count: Longint): Longint; |
456 |
|
function Write(const Buffer; Count: Longint): Longint; |
457 |
< |
function LoadFromFile(Filename: string): IBlob; |
457 |
> |
function LoadFromFile(Filename: AnsiString): IBlob; |
458 |
|
function LoadFromStream(S: TStream) : IBlob; |
459 |
< |
function SaveToFile(Filename: string): IBlob; |
459 |
> |
function SaveToFile(Filename: AnsiString): IBlob; |
460 |
|
function SaveToStream(S: TStream): IBlob; |
461 |
|
function GetAsString: rawbytestring; |
462 |
|
procedure SetAsString(aValue: rawbytestring); |
470 |
|
the output of an SQL Statement. |
471 |
|
} |
472 |
|
|
473 |
+ |
TIBDateTimeFormats = (dfTimestamp, {SQL TIMESTAMP} |
474 |
+ |
dfDateTime, {SQL DATETIME} |
475 |
+ |
dfTime, {SQL TIME} |
476 |
+ |
dfTimestampTZ, {SQL_TIMESTAMP_TZ} |
477 |
+ |
dfTimeTZ); {SQLTIME_TZ |
478 |
+ |
|
479 |
|
{ IColumnMetaData } |
480 |
|
|
481 |
|
IColumnMetaData = interface |
482 |
+ |
['{c222e6c3-53c1-469f-9e05-0a5c3ef232d8}'] |
483 |
|
function GetIndex: integer; |
484 |
|
function GetSQLType: cardinal; |
485 |
< |
function GetSQLTypeName: string; |
485 |
> |
function GetSQLTypeName: AnsiString; |
486 |
|
function getSubtype: integer; |
487 |
< |
function getRelationName: string; |
488 |
< |
function getOwnerName: string; |
489 |
< |
function getSQLName: string; {Name of the column} |
490 |
< |
function getAliasName: string; {Alias Name of column or Column Name if no alias} |
491 |
< |
function getName: string; {Disambiguated uppercase Field Name} |
487 |
> |
function getRelationName: AnsiString; |
488 |
> |
function getOwnerName: AnsiString; |
489 |
> |
function getSQLName: AnsiString; {Name of the column} |
490 |
> |
function getAliasName: AnsiString; {Alias Name of column or Column Name if no alias} |
491 |
> |
function getName: AnsiString; {Disambiguated uppercase Field Name} |
492 |
|
function getScale: integer; |
493 |
|
function getCharSetID: cardinal; |
494 |
|
function getCodePage: TSystemCodePage; |
495 |
+ |
function GetCharSetWidth: integer; |
496 |
|
function getIsNullable: boolean; |
497 |
|
function GetSize: cardinal; |
498 |
|
function GetArrayMetaData: IArrayMetaData; {Valid only for Array SQL Type} |
499 |
|
function GetBlobMetaData: IBlobMetaData; {Valid only for Blob SQL Type} |
500 |
< |
property Name: string read GetName; |
500 |
> |
function GetDateTimeStrLength(DateTimeFormat: TIBDateTimeFormats): integer; |
501 |
> |
function GetStatement: IStatement; |
502 |
> |
function GetTransaction: ITransaction; |
503 |
> |
property Name: AnsiString read GetName; |
504 |
|
property Size: cardinal read GetSize; |
505 |
|
property SQLType: cardinal read GetSQLType; |
506 |
|
property Scale: integer read getScale; |
516 |
|
{ IMetaData } |
517 |
|
|
518 |
|
IMetaData = interface |
519 |
+ |
['{4dafdbb6-0d36-4f1f-9c95-8b132804b965}'] |
520 |
|
function getCount: integer; |
521 |
|
function getColumnMetaData(index: integer): IColumnMetaData; |
522 |
< |
function GetUniqueRelationName: string; {Non empty if all columns come from the same table} |
523 |
< |
function ByName(Idx: String): IColumnMetaData; |
522 |
> |
function GetUniqueRelationName: AnsiString; {Non empty if all columns come from the same table} |
523 |
> |
function ByName(Idx: AnsiString): IColumnMetaData; |
524 |
|
property ColMetaData[index: integer]: IColumnMetaData read getColumnMetaData; default; |
525 |
|
property Count: integer read getCount; |
526 |
|
end; |
540 |
|
|
541 |
|
|
542 |
|
ISQLData = interface(IColumnMetaData) |
543 |
+ |
['{3f493e31-7e3f-4606-a07c-b210b9e3619d}'] |
544 |
+ |
function GetStrDataLength: short; |
545 |
|
function GetAsBoolean: boolean; |
546 |
|
function GetAsCurrency: Currency; |
547 |
|
function GetAsInt64: Int64; |
548 |
< |
function GetAsDateTime: TDateTime; |
548 |
> |
function GetAsDateTime: TDateTime; overload; |
549 |
> |
procedure GetAsDateTime(var aDateTime: TDateTime; var dstOffset: smallint; var aTimezoneID: TFBTimeZoneID); overload; |
550 |
> |
procedure GetAsDateTime(var aDateTime: TDateTime; var dstOffset: smallint; var aTimezone: AnsiString); overload; |
551 |
> |
procedure GetAsTime(var aTime: TDateTime; var dstOffset: smallint; var aTimezoneID: TFBTimeZoneID; OnDate: TDateTime); overload; |
552 |
> |
procedure GetAsTime(var aTime: TDateTime; var dstOffset: smallint; var aTimezone: AnsiString; OnDate: TDateTime); overload; |
553 |
> |
procedure GetAsTime(var aTime: TDateTime; var dstOffset: smallint; var aTimezoneID: TFBTimeZoneID); overload; |
554 |
> |
procedure GetAsTime(var aTime: TDateTime; var dstOffset: smallint; var aTimezone: AnsiString); overload; |
555 |
> |
function GetAsUTCDateTime: TDateTime; |
556 |
|
function GetAsDouble: Double; |
557 |
|
function GetAsFloat: Float; |
558 |
|
function GetAsLong: Long; |
559 |
|
function GetAsPointer: Pointer; |
560 |
|
function GetAsQuad: TISC_QUAD; |
561 |
|
function GetAsShort: short; |
562 |
< |
function GetAsString: String; |
562 |
> |
function GetAsString: AnsiString; |
563 |
|
function GetIsNull: Boolean; |
564 |
|
function GetAsVariant: Variant; |
565 |
|
function GetAsBlob: IBlob; overload; |
566 |
|
function GetAsBlob(BPB: IBPB): IBlob; overload; |
567 |
|
function GetAsArray: IArray; |
568 |
+ |
function GetAsBCD: tBCD; |
569 |
|
property AsDate: TDateTime read GetAsDateTime; |
570 |
|
property AsBoolean:boolean read GetAsBoolean; |
571 |
|
property AsTime: TDateTime read GetAsDateTime; |
579 |
|
property AsPointer: Pointer read GetAsPointer; |
580 |
|
property AsQuad: TISC_QUAD read GetAsQuad; |
581 |
|
property AsShort: short read GetAsShort; |
582 |
< |
property AsString: String read GetAsString; |
582 |
> |
property AsString: AnsiString read GetAsString; |
583 |
|
property AsVariant: Variant read GetAsVariant ; |
584 |
|
property AsBlob: IBlob read GetAsBlob; |
585 |
|
property AsArray: IArray read GetAsArray; |
586 |
+ |
property AsBCD: tBCD read GetAsBCD; |
587 |
|
property IsNull: Boolean read GetIsNull; |
588 |
|
property Value: Variant read GetAsVariant; |
589 |
|
end; |
595 |
|
} |
596 |
|
|
597 |
|
IResults = interface |
598 |
+ |
['{e836b2bb-93d1-4bbf-a8eb-7ce535de3bb5}'] |
599 |
|
function getCount: integer; |
600 |
+ |
function GetStatement: IStatement; |
601 |
|
function GetTransaction: ITransaction; |
602 |
< |
function ByName(Idx: String): ISQLData; |
602 |
> |
function ByName(Idx: AnsiString): ISQLData; |
603 |
|
function getSQLData(index: integer): ISQLData; |
604 |
< |
procedure GetData(index: integer; var IsNull:boolean; var len: short; var data: PChar); |
604 |
> |
procedure GetData(index: integer; var IsNull:boolean; var len: short; var data: PByte); |
605 |
|
procedure SetRetainInterfaces(aValue: boolean); |
606 |
|
property Data[index: integer]: ISQLData read getSQLData; default; |
607 |
|
property Count: integer read getCount; |
613 |
|
in turn, used to access the data returned by each field of the current row. |
614 |
|
} |
615 |
|
IResultSet = interface(IResults) |
616 |
< |
function FetchNext: boolean; |
617 |
< |
function GetCursorName: string; |
616 |
> |
['{0ae4979b-7857-4e8c-8918-ec6f155b51a0}'] |
617 |
> |
function FetchNext: boolean; {fetch next record} |
618 |
> |
function FetchPrior: boolean; {fetch previous record} |
619 |
> |
function FetchFirst:boolean; {fetch first record} |
620 |
> |
function FetchLast: boolean; {fetch last record} |
621 |
> |
function FetchAbsolute(position: Integer): boolean; {fetch record by its absolute position in result set} |
622 |
> |
function FetchRelative(offset: Integer): boolean; {fetch record by position relative to current} |
623 |
> |
function GetCursorName: AnsiString; |
624 |
> |
function IsBof: boolean; |
625 |
|
function IsEof: boolean; |
626 |
|
procedure Close; |
627 |
|
end; |
628 |
|
|
629 |
|
{The ISQLParam interface is used to provide access to each parameter in a |
630 |
< |
parametised SQL Statement. It subclasses IColumnMetaData and this part of |
485 |
< |
the interface may be used to access information on the expected SQL Type, etc. |
486 |
< |
|
487 |
< |
It also subclasses ISQLData and this part of the interface may be used to access |
488 |
< |
current values for each parameter. |
489 |
< |
|
490 |
< |
Otherwise, the interface comprises the Setter Methods and properties used to |
630 |
> |
parametised SQL Statement. The interface comprises the Setter Methods and properties used to |
631 |
|
set the value of each parameter. |
632 |
|
|
633 |
|
Automatic conversion is provided to and from strings. That is GetAsString and |
634 |
|
SetAsString are safe to use for sql types other than boolean - provided automatic |
635 |
|
conversion is possible. |
636 |
+ |
|
637 |
+ |
ISQLParam is subclassed from the IParamMetaData interface. This interface provides |
638 |
+ |
access to the parameter metadata. This metadata is mutable and can change after |
639 |
+ |
a parameter is set to a given value. This is acceptable as long as the parameter |
640 |
+ |
metadata is type compatible with the underlying column metadata and hence the |
641 |
+ |
parameter value can be converted by Firebird into a value acceptable by the |
642 |
+ |
underlying column. The column metadata, which is unmutable, can be obtained |
643 |
+ |
by the ISQLParam.getColMetadata interface. When a statement is prepared, the |
644 |
+ |
parameter metadata is always initialised to the column metadata. |
645 |
|
} |
646 |
|
|
647 |
< |
ISQLParam = interface |
648 |
< |
function GetIndex: integer; |
647 |
> |
IParamMetaData = interface |
648 |
> |
['{4e148c4e-2d48-4991-a263-f66eca05c6aa}'] |
649 |
|
function GetSQLType: cardinal; |
650 |
< |
function GetSQLTypeName: string; |
650 |
> |
function GetSQLTypeName: AnsiString; |
651 |
|
function getSubtype: integer; |
503 |
– |
function getName: string; |
652 |
|
function getScale: integer; |
653 |
|
function getCharSetID: cardinal; |
654 |
|
function getCodePage: TSystemCodePage; |
655 |
|
function getIsNullable: boolean; |
656 |
|
function GetSize: cardinal; |
657 |
+ |
property SQLType: cardinal read GetSQLType; |
658 |
+ |
end; |
659 |
+ |
|
660 |
+ |
ISQLParam = interface(IParamMetaData) |
661 |
+ |
['{b22b4578-6d41-4807-a9a9-d2ec8d1d5a14}'] |
662 |
+ |
function getColMetadata: IParamMetaData; |
663 |
+ |
function GetIndex: integer; |
664 |
+ |
function getName: AnsiString; |
665 |
|
function GetAsBoolean: boolean; |
666 |
|
function GetAsCurrency: Currency; |
667 |
|
function GetAsInt64: Int64; |
668 |
< |
function GetAsDateTime: TDateTime; |
668 |
> |
function GetAsDateTime: TDateTime; overload; |
669 |
> |
procedure GetAsDateTime(var aDateTime: TDateTime; var dstOffset: smallint; var aTimezoneID: TFBTimeZoneID); overload; |
670 |
> |
procedure GetAsDateTime(var aDateTime: TDateTime; var dstOffset: smallint; var aTimezone: AnsiString); overload; |
671 |
> |
procedure GetAsTime(var aTime: TDateTime; var dstOffset: smallint; var aTimezoneID: TFBTimeZoneID; OnDate: TDateTime); overload; |
672 |
> |
procedure GetAsTime(var aTime: TDateTime; var dstOffset: smallint; var aTimezone: AnsiString; OnDate: TDateTime); overload; |
673 |
> |
procedure GetAsTime(var aTime: TDateTime; var dstOffset: smallint; var aTimezoneID: TFBTimeZoneID); overload; |
674 |
> |
procedure GetAsTime(var aTime: TDateTime; var dstOffset: smallint; var aTimezone: AnsiString); overload; |
675 |
> |
function GetAsUTCDateTime: TDateTime; |
676 |
|
function GetAsDouble: Double; |
677 |
|
function GetAsFloat: Float; |
678 |
|
function GetAsLong: Long; |
679 |
|
function GetAsPointer: Pointer; |
680 |
|
function GetAsQuad: TISC_QUAD; |
681 |
|
function GetAsShort: short; |
682 |
< |
function GetAsString: String; |
682 |
> |
function GetAsString: AnsiString; |
683 |
|
function GetIsNull: boolean; |
684 |
|
function GetAsVariant: Variant; |
685 |
|
function GetAsBlob: IBlob; |
686 |
|
function GetAsArray: IArray; |
687 |
+ |
function GetAsBCD: tBCD; |
688 |
+ |
function GetStatement: IStatement; |
689 |
+ |
function GetTransaction: ITransaction; |
690 |
|
procedure Clear; |
691 |
|
function GetModified: boolean; |
692 |
|
procedure SetAsBoolean(AValue: boolean); |
694 |
|
procedure SetAsInt64(aValue: Int64); |
695 |
|
procedure SetAsDate(aValue: TDateTime); |
696 |
|
procedure SetAsLong(aValue: Long); |
697 |
< |
procedure SetAsTime(aValue: TDateTime); |
698 |
< |
procedure SetAsDateTime(aValue: TDateTime); |
697 |
> |
procedure SetAsTime(aValue: TDateTime); overload; |
698 |
> |
procedure SetAsTime(aValue: TDateTime; OnDate: TDateTime; aTimeZoneID: TFBTimeZoneID); overload; |
699 |
> |
procedure SetAsTime(aValue: TDateTime; OnDate: TDateTime; aTimeZone: AnsiString); overload; |
700 |
> |
procedure SetAsTime(aValue: TDateTime; aTimeZoneID: TFBTimeZoneID); overload; |
701 |
> |
procedure SetAsTime(aValue: TDateTime; aTimeZone: AnsiString); overload; |
702 |
> |
procedure SetAsDateTime(aValue: TDateTime); overload; |
703 |
> |
procedure SetAsDateTime(aValue: TDateTime; aTimeZoneID: TFBTimeZoneID); overload; |
704 |
> |
procedure SetAsDateTime(aValue: TDateTime; aTimeZone: AnsiString); overload; |
705 |
> |
procedure SetAsUTCDateTime(aUTCTime: TDateTime); |
706 |
|
procedure SetAsDouble(aValue: Double); |
707 |
|
procedure SetAsFloat(aValue: Float); |
708 |
|
procedure SetAsPointer(aValue: Pointer); |
709 |
|
procedure SetAsShort(aValue: Short); |
710 |
< |
procedure SetAsString(aValue: String); |
710 |
> |
procedure SetAsString(aValue: AnsiString); |
711 |
|
procedure SetAsVariant(aValue: Variant); |
712 |
|
procedure SetIsNull(aValue: Boolean); |
713 |
|
procedure SetAsBlob(aValue: IBlob); |
714 |
|
procedure SetAsArray(anArray: IArray); |
715 |
|
procedure SetAsQuad(aValue: TISC_QUAD); |
716 |
|
procedure SetCharSetID(aValue: cardinal); |
717 |
+ |
procedure SetAsBcd(aValue: tBCD); |
718 |
|
property AsDate: TDateTime read GetAsDateTime write SetAsDate; |
719 |
|
property AsBoolean:boolean read GetAsBoolean write SetAsBoolean; |
720 |
|
property AsTime: TDateTime read GetAsDateTime write SetAsTime; |
727 |
|
property AsLong: Long read GetAsLong write SetAsLong; |
728 |
|
property AsPointer: Pointer read GetAsPointer write SetAsPointer; |
729 |
|
property AsShort: Short read GetAsShort write SetAsShort; |
730 |
< |
property AsString: String read GetAsString write SetAsString; |
730 |
> |
property AsString: AnsiString read GetAsString write SetAsString; |
731 |
|
property AsVariant: Variant read GetAsVariant write SetAsVariant; |
732 |
|
property AsBlob: IBlob read GetAsBlob write SetAsBlob; |
733 |
|
property AsArray: IArray read GetAsArray write SetAsArray; |
734 |
+ |
property AsBCD: tBCD read GetAsBCD write SetAsBCD; |
735 |
|
property AsQuad: TISC_QUAD read GetAsQuad write SetAsQuad; |
736 |
|
property Value: Variant read GetAsVariant write SetAsVariant; |
737 |
|
property IsNull: Boolean read GetIsNull write SetIsNull; |
738 |
|
property IsNullable: Boolean read GetIsNullable; |
739 |
|
property Modified: Boolean read getModified; |
740 |
< |
property Name: string read GetName; |
566 |
< |
property SQLType: cardinal read GetSQLType; |
740 |
> |
property Name: AnsiString read GetName; |
741 |
|
end; |
742 |
|
|
743 |
|
{ |
746 |
|
} |
747 |
|
|
748 |
|
ISQLParams = interface |
749 |
+ |
['{c6d95ac7-b2b7-461b-b890-afef0acbb077}'] |
750 |
|
function getCount: integer; |
751 |
|
function getSQLParam(index: integer): ISQLParam; |
752 |
< |
function ByName(Idx: String): ISQLParam ; |
752 |
> |
function ByName(Idx: AnsiString): ISQLParam ; |
753 |
|
function GetModified: Boolean; |
754 |
+ |
function GetHasCaseSensitiveParams: Boolean; |
755 |
|
property Modified: Boolean read GetModified; |
756 |
|
property Params[index: integer]: ISQLParam read getSQLParam; default; |
757 |
|
property Count: integer read getCount; |
758 |
|
end; |
759 |
|
|
760 |
+ |
|
761 |
+ |
TPerfStats = (psCurrentMemory, psMaxMemory, |
762 |
+ |
psRealTime, psUserTime, psBuffers, |
763 |
+ |
psReads, psWrites, psFetches,psDeltaMemory); |
764 |
+ |
|
765 |
+ |
TPerfCounters = array[TPerfStats] of Int64; |
766 |
+ |
|
767 |
+ |
{Batch Query Execution Support} |
768 |
+ |
|
769 |
+ |
TBatchCompletionState = (bcExecuteFailed, bcSuccessNoInfo, bcNoMoreErrors); |
770 |
+ |
|
771 |
+ |
IBatchCompletion = interface |
772 |
+ |
['{9bc3d49d-16d9-4606-94e5-ee987103ad92}'] |
773 |
+ |
function getTotalProcessed: cardinal; |
774 |
+ |
function getState(updateNo: cardinal): TBatchCompletionState; |
775 |
+ |
function getStatusMessage(updateNo: cardinal): AnsiString; |
776 |
+ |
function getUpdated: integer; |
777 |
+ |
function getErrorStatus(var RowNo: integer; var status: IStatus): boolean; |
778 |
+ |
end; |
779 |
+ |
|
780 |
|
{The IStatement interface provides access to an SQL Statement once it has been |
781 |
|
initially prepared. The interface is returned from the IAttachment interface. |
782 |
|
} |
783 |
|
|
784 |
|
IStatement = interface |
785 |
+ |
['{a260576d-a07d-4a66-b02d-1b72543fd7cf}'] |
786 |
|
function GetMetaData: IMetaData; {Output Metadata} |
787 |
|
function GetSQLParams: ISQLParams;{Statement Parameters} |
788 |
< |
function GetPlan: String; |
788 |
> |
function GetPlan: AnsiString; |
789 |
|
function GetRowsAffected(var SelectCount, InsertCount, UpdateCount, DeleteCount: integer): boolean; |
790 |
|
function GetSQLStatementType: TIBSQLStatementTypes; |
791 |
< |
function GetSQLText: string; |
791 |
> |
function GetSQLStatementTypeName: AnsiString; |
792 |
> |
function GetSQLText: AnsiString; |
793 |
> |
function GetProcessedSQLText: AnsiString; |
794 |
|
function GetSQLDialect: integer; |
795 |
|
function IsPrepared: boolean; |
796 |
< |
procedure Prepare(aTransaction: ITransaction=nil); |
796 |
> |
function HasBatchMode: boolean; |
797 |
> |
function IsInBatchMode: boolean; |
798 |
> |
procedure Prepare(aTransaction: ITransaction=nil); overload; |
799 |
> |
procedure Prepare(CursorName: AnsiString; aTransaction: ITransaction=nil); overload; |
800 |
|
function Execute(aTransaction: ITransaction=nil): IResults; |
801 |
< |
function OpenCursor(aTransaction: ITransaction=nil): IResultSet; |
801 |
> |
function OpenCursor(aTransaction: ITransaction=nil): IResultSet; overload; |
802 |
> |
function OpenCursor(Scrollable: boolean; aTransaction: ITransaction=nil): IResultSet; overload; |
803 |
|
function GetAttachment: IAttachment; |
804 |
|
function GetTransaction: ITransaction; |
805 |
|
procedure SetRetainInterfaces(aValue: boolean); |
806 |
+ |
procedure EnableStatistics(aValue: boolean); |
807 |
+ |
function GetPerfStatistics(var stats: TPerfCounters): boolean; |
808 |
+ |
{IBatch interface support} |
809 |
+ |
procedure AddToBatch; |
810 |
+ |
function ExecuteBatch(aTransaction: ITransaction=nil): IBatchCompletion; |
811 |
+ |
procedure CancelBatch; |
812 |
+ |
function GetBatchCompletion: IBatchCompletion; |
813 |
+ |
function GetBatchRowLimit: integer; |
814 |
+ |
procedure SetBatchRowLimit(aLimit: integer); |
815 |
+ |
{Stale Reference Check} |
816 |
+ |
procedure SetStaleReferenceChecks(Enable:boolean); {default true} |
817 |
+ |
function GetStaleReferenceChecks: boolean; |
818 |
+ |
|
819 |
|
property MetaData: IMetaData read GetMetaData; |
820 |
|
property SQLParams: ISQLParams read GetSQLParams; |
821 |
|
property SQLStatementType: TIBSQLStatementTypes read GetSQLStatementType; |
832 |
|
found in the Interbase 6.0 API Guide. |
833 |
|
} |
834 |
|
|
835 |
< |
ITPBItem = interface(IParameterBlockItem) end; |
835 |
> |
ITPBItem = interface(IParameterBlockItemWithTypeName) |
836 |
> |
['{544c1f2b-7c12-4a87-a4a5-face7ea72671}'] |
837 |
> |
function getParamTypeName: AnsiString; |
838 |
> |
end; |
839 |
|
|
840 |
< |
ITPB = specialize IParameterBlock<ITPBItem>; |
840 |
> |
ITPB = interface(IParameterBlockWithTypeNames<ITPBItem>) |
841 |
> |
['{7369b0ff-defe-437b-81fe-19b211d42d25}'] |
842 |
> |
end; |
843 |
|
|
844 |
|
{The ITransactionAction interface provides access to a Transaction once it |
845 |
|
has been initially started. After a Commit or Rollback, a transaction |
853 |
|
TTransactionCompletion = TARollback.. TACommit; |
854 |
|
|
855 |
|
ITransaction = interface |
856 |
+ |
['{30928d0e-a9d7-4c61-b7cf-14f4f38abe2a}'] |
857 |
|
function getTPB: ITPB; |
858 |
|
procedure Start(DefaultCompletion: TTransactionCompletion=taCommit); |
859 |
|
function GetInTransaction: boolean; |
881 |
|
} |
882 |
|
|
883 |
|
TEventInfo = record |
884 |
< |
EventName: string; |
884 |
> |
EventName: AnsiString; |
885 |
|
Count: integer; |
886 |
|
end; |
887 |
|
|
892 |
|
{ IEvents } |
893 |
|
|
894 |
|
IEvents = interface |
895 |
+ |
['{6a0be233-ed08-4524-889c-2e45d0c20e5f}'] |
896 |
|
procedure GetEvents(EventNames: TStrings); |
897 |
|
procedure SetEvents(EventNames: TStrings); overload; |
898 |
< |
procedure SetEvents(EventName: string); overload; |
898 |
> |
procedure SetEvents(EventName: AnsiString); overload; |
899 |
|
procedure Cancel; |
900 |
|
function ExtractEventCounts: TEventCounts; |
901 |
|
procedure WaitForEvent; |
903 |
|
function GetAttachment: IAttachment; |
904 |
|
end; |
905 |
|
|
906 |
+ |
TTZTextOptions = (tzOffset, {Time Zone Rendered as an offset to GMT} |
907 |
+ |
tzGMT, {No Time Zone. Time part is always rendered in GMT} |
908 |
+ |
tzOriginalID); {Time Zone shown as originally entered} |
909 |
+ |
|
910 |
+ |
{The ITimeZoneServices interface provides access to the time zone database |
911 |
+ |
used for the attachment. It may be used in support of TIMESTAMP WITH TIME ZONE |
912 |
+ |
and TIME WITH TIME ZONE data types.} |
913 |
+ |
|
914 |
+ |
ITimeZoneServices = interface |
915 |
+ |
['{163821f5-ebef-42b9-ac60-8ac4b5c09954}'] |
916 |
+ |
{utility functions} |
917 |
+ |
function TimeZoneID2TimeZoneName(aTimeZoneID: TFBTimeZoneID): AnsiString; |
918 |
+ |
function TimeZoneName2TimeZoneID(aTimeZone: AnsiString): TFBTimeZoneID; |
919 |
+ |
function LocalTimeToGMT(aLocalTime: TDateTime; aTimeZone: AnsiString): TDateTime; overload; |
920 |
+ |
function LocalTimeToGMT(aLocalTime: TDateTime; aTimeZoneID: TFBTimeZoneID): TDateTime; overload; |
921 |
+ |
function GMTToLocalTime(aGMTTime: TDateTime; aTimeZone: AnsiString): TDateTime; overload; |
922 |
+ |
function GMTToLocalTime(aGMTTime: TDateTime; aTimeZoneID: TFBTimeZoneID): TDateTime; overload; |
923 |
+ |
function GetEffectiveOffsetMins(aLocalTime: TDateTime; aTimeZone: AnsiString): integer; overload; |
924 |
+ |
function GetEffectiveOffsetMins(aLocalTime: TDateTime; aTimeZoneID: TFBTimeZoneID): integer; overload; |
925 |
+ |
|
926 |
+ |
{Time Zone DB Information} |
927 |
+ |
function UsingRemoteTZDB: boolean; |
928 |
+ |
procedure SetUseLocalTZDB(useLocalTZDB: boolean); |
929 |
+ |
function GetLocalTimeZoneName: AnsiString; |
930 |
+ |
function GetLocalTimeZoneID: TFBTimeZoneID; |
931 |
+ |
procedure GetTimeZoneInfo(aTimeZone: AnsiString; OnDate: TDateTime; |
932 |
+ |
var ZoneOffset, DSTOffset, EffectiveOffset: integer); |
933 |
+ |
{Configurable Options} |
934 |
+ |
function GetTimeTZDate: TDateTime; |
935 |
+ |
procedure SetTimeTZDate(aDate: TDateTime); |
936 |
+ |
function GetTZTextOption: TTZTextOptions; |
937 |
+ |
procedure SetTZTextOption(aOptionValue: TTZTextOptions); |
938 |
+ |
end; |
939 |
+ |
|
940 |
|
{The IDBInformation Interface. |
941 |
|
|
942 |
|
An IDBInformation interface is returned by the IAttachment GetDBInformation |
960 |
|
TDBOperationCounts = array of TDBOperationCount; |
961 |
|
|
962 |
|
IDBInfoItem = interface |
963 |
+ |
['{eeb97b51-ec0f-473f-9f75-c1721f055fcb}'] |
964 |
|
function getItemType: byte; |
965 |
|
function getSize: integer; |
966 |
|
procedure getRawBytes(var Buffer); |
967 |
< |
function getAsString: string; |
968 |
< |
function getAsInteger: integer; |
969 |
< |
procedure DecodeIDCluster(var ConnectionType: integer; var DBFileName, DBSiteName: string); |
967 |
> |
function getAsString: AnsiString; |
968 |
> |
function getAsInteger: int64; |
969 |
> |
procedure DecodeIDCluster(var ConnectionType: integer; var DBFileName, DBSiteName: AnsiString); |
970 |
|
function getAsBytes: TByteArray; |
971 |
< |
procedure DecodeVersionString(var Version: byte; var VersionString: string); |
971 |
> |
function getAsDateTime: TDateTime; |
972 |
> |
procedure DecodeVersionString(var Version: byte; var VersionString: AnsiString); |
973 |
|
function getOperationCounts: TDBOperationCounts; |
974 |
|
procedure DecodeUserNames(UserNames: TStrings); |
975 |
|
|
977 |
|
function GetCount: integer; |
978 |
|
function GetItem(index: integer): IDBInfoItem; |
979 |
|
function Find(ItemType: byte): IDBInfoItem; |
980 |
< |
property AsInteger: integer read getAsInteger; |
981 |
< |
property AsString: string read GetAsString; |
980 |
> |
property AsInteger: int64 read getAsInteger; |
981 |
> |
property AsString: AnsiString read GetAsString; |
982 |
|
property Count: integer read GetCount; |
983 |
|
property Items[index: integer]: IDBInfoItem read getItem; default; |
984 |
|
end; |
986 |
|
{ IDBInformation } |
987 |
|
|
988 |
|
IDBInformation = interface |
989 |
+ |
['{7ac6777f-f0a9-498a-9f5c-4a57a554df81}'] |
990 |
|
function GetCount: integer; |
991 |
|
function GetItem(index: integer): IDBInfoItem; |
992 |
|
function Find(ItemType: byte): IDBInfoItem; |
995 |
|
property Items[index: integer]: IDBInfoItem read getItem; default; |
996 |
|
end; |
997 |
|
|
998 |
+ |
{The Database Information Request Block is used to pass requests for |
999 |
+ |
database information where at least one item requested has a parameter. |
1000 |
+ |
At present, this is only fb_info_page_contents which has a single |
1001 |
+ |
integer parameter.} |
1002 |
+ |
|
1003 |
+ |
IDIRBItem = interface(IParameterBlockItem) |
1004 |
+ |
['{d34a7511-8435-4a24-81a7-5103d218d234}'] |
1005 |
+ |
end; |
1006 |
+ |
|
1007 |
+ |
IDIRB = interface(IParameterBlock<IDIRBItem>) |
1008 |
+ |
['{1010e5ac-0a8f-403b-a302-91625e9d9579}'] |
1009 |
+ |
end; |
1010 |
+ |
|
1011 |
+ |
|
1012 |
|
{The Database Parameter Block (DPB). |
1013 |
|
|
1014 |
|
The DPB provides the parameters used when connecting to a database. It is allocated |
1020 |
|
found in the Interbase 6.0 API Guide. |
1021 |
|
} |
1022 |
|
|
1023 |
< |
IDPBItem = interface(IParameterBlockItem) end; |
1023 |
> |
IDPBItem = interface(IParameterBlockItemWithTypeName) |
1024 |
> |
['{123d4ad0-087a-4cd1-a344-1b3d03b30673}'] |
1025 |
> |
end; |
1026 |
|
|
1027 |
< |
IDPB = specialize IParameterBlock<IDPBItem>; |
1027 |
> |
IDPB = interface(IParameterBlockWithTypeNames<IDPBItem>) |
1028 |
> |
['{e676067b-1cf4-4eba-9256-9724f57e0d16}'] |
1029 |
> |
end; |
1030 |
|
|
1031 |
|
{The IAttachment interface provides access to a Database Connection. It may be |
1032 |
|
used to: |
1056 |
|
{ IAttachment } |
1057 |
|
|
1058 |
|
IAttachment = interface |
1059 |
+ |
['{466e9b67-9def-4807-b3e7-e08a35e7185c}'] |
1060 |
+ |
function getFirebirdAPI: IFirebirdAPI; |
1061 |
|
function getDPB: IDPB; |
1062 |
|
function AllocateBPB: IBPB; |
1063 |
+ |
function AllocateDIRB: IDIRB; |
1064 |
|
procedure Connect; |
1065 |
|
procedure Disconnect(Force: boolean=false); |
1066 |
|
function IsConnected: boolean; |
1067 |
|
procedure DropDatabase; |
1068 |
|
function StartTransaction(TPB: array of byte; DefaultCompletion: TTransactionCompletion=taCommit): ITransaction; overload; |
1069 |
|
function StartTransaction(TPB: ITPB; DefaultCompletion: TTransactionCompletion=taCommit): ITransaction; overload; |
1070 |
< |
procedure ExecImmediate(transaction: ITransaction; sql: string; SQLDialect: integer); overload; |
1071 |
< |
procedure ExecImmediate(TPB: array of byte; sql: string; SQLDialect: integer); overload; |
1072 |
< |
procedure ExecImmediate(transaction: ITransaction; sql: string); overload; |
1073 |
< |
procedure ExecImmediate(TPB: array of byte; sql: string); overload; |
1074 |
< |
function ExecuteSQL(TPB: array of byte; sql: string; SQLDialect: integer; params: array of const): IResults; overload; |
1075 |
< |
function ExecuteSQL(transaction: ITransaction; sql: string; SQLDialect: integer; params: array of const): IResults; overload; |
1076 |
< |
function ExecuteSQL(TPB: array of byte; sql: string; params: array of const): IResults; overload; |
1077 |
< |
function ExecuteSQL(transaction: ITransaction; sql: string; params: array of const): IResults; overload; |
1078 |
< |
function OpenCursor(transaction: ITransaction; sql: string; aSQLDialect: integer): IResultSet; overload; |
1079 |
< |
function OpenCursor(transaction: ITransaction; sql: string; aSQLDialect: integer; |
1070 |
> |
procedure ExecImmediate(transaction: ITransaction; sql: AnsiString; SQLDialect: integer); overload; |
1071 |
> |
procedure ExecImmediate(TPB: array of byte; sql: AnsiString; SQLDialect: integer); overload; |
1072 |
> |
procedure ExecImmediate(transaction: ITransaction; sql: AnsiString); overload; |
1073 |
> |
procedure ExecImmediate(TPB: array of byte; sql: AnsiString); overload; |
1074 |
> |
function ExecuteSQL(TPB: array of byte; sql: AnsiString; SQLDialect: integer; params: array of const): IResults; overload; |
1075 |
> |
function ExecuteSQL(transaction: ITransaction; sql: AnsiString; SQLDialect: integer; params: array of const): IResults; overload; |
1076 |
> |
function ExecuteSQL(TPB: array of byte; sql: AnsiString; params: array of const): IResults; overload; |
1077 |
> |
function ExecuteSQL(transaction: ITransaction; sql: AnsiString; params: array of const): IResults; overload; |
1078 |
> |
function OpenCursor(transaction: ITransaction; sql: AnsiString; aSQLDialect: integer; |
1079 |
> |
Scrollable: boolean=false): IResultSet; overload; |
1080 |
> |
function OpenCursor(transaction: ITransaction; sql: AnsiString; aSQLDialect: integer; |
1081 |
> |
params: array of const): IResultSet; overload; |
1082 |
> |
function OpenCursor(transaction: ITransaction; sql: AnsiString; Scrollable: boolean=false): IResultSet; overload; |
1083 |
> |
function OpenCursor(transaction: ITransaction; sql: AnsiString; Scrollable: boolean; |
1084 |
> |
params: array of const): IResultSet; overload; |
1085 |
> |
function OpenCursor(transaction: ITransaction; sql: AnsiString; |
1086 |
> |
params: array of const): IResultSet; overload; |
1087 |
> |
function OpenCursor(transaction: ITransaction; sql: AnsiString; aSQLDialect: integer; Scrollable: boolean; |
1088 |
|
params: array of const): IResultSet; overload; |
1089 |
< |
function OpenCursor(transaction: ITransaction; sql: string): IResultSet; overload; |
1090 |
< |
function OpenCursor(transaction: ITransaction; sql: string; |
1089 |
> |
function OpenCursorAtStart(transaction: ITransaction; sql: AnsiString; aSQLDialect: integer; |
1090 |
> |
Scrollable: boolean=false): IResultSet; overload; |
1091 |
> |
function OpenCursorAtStart(transaction: ITransaction; sql: AnsiString; aSQLDialect: integer; |
1092 |
|
params: array of const): IResultSet; overload; |
1093 |
< |
function OpenCursorAtStart(transaction: ITransaction; sql: string; aSQLDialect: integer): IResultSet; overload; |
804 |
< |
function OpenCursorAtStart(transaction: ITransaction; sql: string; aSQLDialect: integer; |
1093 |
> |
function OpenCursorAtStart(transaction: ITransaction; sql: AnsiString; aSQLDialect: integer; Scrollable: boolean; |
1094 |
|
params: array of const): IResultSet; overload; |
1095 |
< |
function OpenCursorAtStart(transaction: ITransaction; sql: string): IResultSet; overload; |
1096 |
< |
function OpenCursorAtStart(transaction: ITransaction; sql: string; |
1095 |
> |
function OpenCursorAtStart(transaction: ITransaction; sql: AnsiString; Scrollable: boolean=false): IResultSet; overload; |
1096 |
> |
function OpenCursorAtStart(transaction: ITransaction; sql: AnsiString; |
1097 |
|
params: array of const): IResultSet; overload; |
1098 |
< |
function OpenCursorAtStart(sql: string): IResultSet; overload; |
810 |
< |
function OpenCursorAtStart(sql: string; |
1098 |
> |
function OpenCursorAtStart(transaction: ITransaction; sql: AnsiString; Scrollable: boolean; |
1099 |
|
params: array of const): IResultSet; overload; |
1100 |
< |
function Prepare(transaction: ITransaction; sql: string; aSQLDialect: integer): IStatement; overload; |
1101 |
< |
function Prepare(transaction: ITransaction; sql: string): IStatement; overload; |
1102 |
< |
function PrepareWithNamedParameters(transaction: ITransaction; sql: string; |
1103 |
< |
aSQLDialect: integer; GenerateParamNames: boolean=false): IStatement; overload; |
1104 |
< |
function PrepareWithNamedParameters(transaction: ITransaction; sql: string; |
1105 |
< |
GenerateParamNames: boolean=false): IStatement; overload; |
1100 |
> |
function OpenCursorAtStart(sql: AnsiString; Scrollable: boolean=false): IResultSet; overload; |
1101 |
> |
function OpenCursorAtStart(sql: AnsiString; Scrollable: boolean; |
1102 |
> |
params: array of const): IResultSet; overload; |
1103 |
> |
function OpenCursorAtStart(sql: AnsiString; |
1104 |
> |
params: array of const): IResultSet; overload; |
1105 |
> |
function Prepare(transaction: ITransaction; sql: AnsiString; aSQLDialect: integer; CursorName: AnsiString=''): IStatement; overload; |
1106 |
> |
function Prepare(transaction: ITransaction; sql: AnsiString; CursorName: AnsiString=''): IStatement; overload; |
1107 |
> |
function PrepareWithNamedParameters(transaction: ITransaction; sql: AnsiString; |
1108 |
> |
aSQLDialect: integer; GenerateParamNames: boolean=false; |
1109 |
> |
CaseSensitiveParams: boolean = false; CursorName: AnsiString=''): IStatement; overload; |
1110 |
> |
function PrepareWithNamedParameters(transaction: ITransaction; sql: AnsiString; |
1111 |
> |
GenerateParamNames: boolean=false; |
1112 |
> |
CaseSensitiveParams: boolean = false; CursorName: AnsiString=''): IStatement; overload; |
1113 |
|
|
1114 |
|
{Events} |
1115 |
|
function GetEventHandler(Events: TStrings): IEvents; overload; |
1116 |
< |
function GetEventHandler(Event: string): IEvents; overload; |
1116 |
> |
function GetEventHandler(Event: AnsiString): IEvents; overload; |
1117 |
|
|
1118 |
|
{Blob - may use to open existing Blobs. However, ISQLData.AsBlob is preferred} |
1119 |
|
|
1120 |
< |
function CreateBlob(transaction: ITransaction; RelationName, ColumnName: string; BPB: IBPB=nil): IBlob; overload; |
1120 |
> |
function CreateBlob(transaction: ITransaction; RelationName, ColumnName: AnsiString; BPB: IBPB=nil): IBlob; overload; |
1121 |
|
function CreateBlob(transaction: ITransaction; BlobMetaData: IBlobMetaData; BPB: IBPB=nil): IBlob; overload; |
1122 |
|
function CreateBlob(transaction: ITransaction; SubType: integer; CharSetID: cardinal=0; BPB: IBPB=nil): IBlob; overload; |
1123 |
< |
function OpenBlob(transaction: ITransaction; RelationName, ColumnName: string; BlobID: TISC_QUAD; BPB: IBPB=nil): IBlob; |
1123 |
> |
function OpenBlob(transaction: ITransaction; RelationName, ColumnName: AnsiString; BlobID: TISC_QUAD; BPB: IBPB=nil): IBlob; overload; |
1124 |
> |
function OpenBlob(transaction: ITransaction; BlobMetaData: IBlobMetaData; BlobID: TISC_QUAD; BPB: IBPB=nil): IBlob; overload; |
1125 |
> |
function GetInlineBlobLimit: integer; |
1126 |
> |
procedure SetInlineBlobLimit(limit: integer); |
1127 |
|
|
1128 |
|
{Array - may use to open existing arrays. However, ISQLData.AsArray is preferred} |
1129 |
|
|
1130 |
< |
function OpenArray(transaction: ITransaction; RelationName, ColumnName: string; ArrayID: TISC_QUAD): IArray; |
1131 |
< |
function CreateArray(transaction: ITransaction; RelationName, ColumnName: string): IArray; overload; |
1130 |
> |
function OpenArray(transaction: ITransaction; RelationName, ColumnName: AnsiString; ArrayID: TISC_QUAD): IArray; overload; |
1131 |
> |
function OpenArray(transaction: ITransaction; ArrayMetaData: IArrayMetaData; ArrayID: TISC_QUAD): IArray; overload; |
1132 |
> |
function CreateArray(transaction: ITransaction; RelationName, ColumnName: AnsiString): IArray; overload; |
1133 |
|
function CreateArray(transaction: ITransaction; ArrayMetaData: IArrayMetaData): IArray; overload; |
1134 |
+ |
function CreateArrayMetaData(SQLType: cardinal; tableName: AnsiString; columnName: AnsiString; |
1135 |
+ |
Scale: integer; size: cardinal; charSetID: cardinal; dimensions: cardinal; |
1136 |
+ |
bounds: TArrayBounds): IArrayMetaData; |
1137 |
|
|
1138 |
|
{Database Information} |
1139 |
|
function GetSQLDialect: integer; |
1140 |
< |
function GetBlobMetaData(Transaction: ITransaction; tableName, columnName: string): IBlobMetaData; |
1141 |
< |
function GetArrayMetaData(Transaction: ITransaction; tableName, columnName: string): IArrayMetaData; |
1140 |
> |
function GetBlobMetaData(Transaction: ITransaction; tableName, columnName: AnsiString): IBlobMetaData; |
1141 |
> |
function GetArrayMetaData(Transaction: ITransaction; tableName, columnName: AnsiString): IArrayMetaData; |
1142 |
|
function GetDBInformation(Requests: array of byte): IDBInformation; overload; |
1143 |
|
function GetDBInformation(Request: byte): IDBInformation; overload; |
1144 |
+ |
function GetDBInformation(Requests: IDIRB): IDBInformation; overload; |
1145 |
+ |
function GetConnectString: AnsiString; |
1146 |
+ |
function GetRemoteProtocol: AnsiString; |
1147 |
+ |
function GetAuthenticationMethod: AnsiString; |
1148 |
+ |
function GetSecurityDatabase: AnsiString; |
1149 |
+ |
function GetODSMajorVersion: integer; |
1150 |
+ |
function GetODSMinorVersion: integer; |
1151 |
+ |
procedure getFBVersion(version: TStrings); |
1152 |
|
function HasActivity: boolean; |
1153 |
< |
end; |
1153 |
> |
function HasDecFloatSupport: boolean; |
1154 |
> |
function HasBatchMode: boolean; |
1155 |
> |
function HasScollableCursors: boolean; |
1156 |
> |
|
1157 |
> |
{Character Sets} |
1158 |
> |
function HasDefaultCharSet: boolean; |
1159 |
> |
function GetDefaultCharSetID: integer; |
1160 |
> |
function GetCharsetName(CharSetID: integer): AnsiString; |
1161 |
> |
function CharSetID2CodePage(CharSetID: integer; var CodePage: TSystemCodePage): boolean; |
1162 |
> |
function CodePage2CharSetID(CodePage: TSystemCodePage; var CharSetID: integer): boolean; |
1163 |
> |
function CharSetName2CharSetID(CharSetName: AnsiString; var CharSetID: integer): boolean; |
1164 |
> |
function CharSetWidth(CharSetID: integer; var Width: integer): boolean; |
1165 |
> |
procedure RegisterCharSet(CharSetName: AnsiString; CodePage: TSystemCodePage; |
1166 |
> |
AllowReverseLookup:boolean; out CharSetID: integer); |
1167 |
> |
|
1168 |
> |
{Time Zone Database} |
1169 |
> |
function GetTimeZoneServices: ITimeZoneServices; |
1170 |
> |
function HasTimeZoneSupport: boolean; |
1171 |
> |
end; |
1172 |
|
|
1173 |
< |
TProtocol = (TCP, SPX, NamedPipe, Local); |
1173 |
> |
TProtocolAll = (TCP, SPX, NamedPipe, Local, inet, inet4, inet6, wnet, xnet, unknownProtocol); |
1174 |
> |
TProtocol = TCP..xnet; |
1175 |
|
|
1176 |
|
{Service Parameter Block (SPB). |
1177 |
|
|
1185 |
|
|
1186 |
|
} |
1187 |
|
|
1188 |
< |
ISPBItem = interface(IParameterBlockItem) end; |
1188 |
> |
ISPBItem = interface(IParameterBlockItemWithTypeName) |
1189 |
> |
['{5d08ae2b-4519-41bd-8b40-97cd451c3f6a}'] |
1190 |
> |
end; |
1191 |
|
|
1192 |
< |
ISPB = specialize IParameterBlock<ISPBItem>; |
1192 |
> |
ISPB = interface(IParameterBlockWithTypeNames<ISPBItem>) |
1193 |
> |
['{2c5836fd-41ed-4426-9b7d-5af580ec2659}'] |
1194 |
> |
end; |
1195 |
|
|
1196 |
|
{Service Query Parameter Block (SQPB). |
1197 |
|
|
1200 |
|
} |
1201 |
|
|
1202 |
|
ISQPBItem = interface(IParameterBlockItem) |
1203 |
+ |
['{b07841a6-33b3-47f0-b5a2-028cbc86dc97}'] |
1204 |
|
function CopyFrom(source: TStream; count: integer): integer; |
1205 |
|
end; |
1206 |
|
|
1207 |
< |
ISQPB = specialize IParameterBlock<ISQPBItem>; |
1207 |
> |
ISQPB = interface(IParameterBlock<ISQPBItem>) |
1208 |
> |
['{8553e66b-ee62-498b-8431-dff030211447}'] |
1209 |
> |
end; |
1210 |
|
|
1211 |
|
{Service Request Block (SRB). |
1212 |
|
|
1220 |
|
|
1221 |
|
} |
1222 |
|
|
1223 |
< |
ISRBItem = interface(IParameterBlockItem) end; |
1223 |
> |
ISRBItem = interface(IParameterBlockItem) |
1224 |
> |
['{47ec790e-f265-4b30-9dcd-261e51677245}'] |
1225 |
> |
end; |
1226 |
|
|
1227 |
< |
ISRB = specialize IParameterBlock<ISRBItem>; |
1227 |
> |
ISRB = interface(IParameterBlock<ISRBItem>) |
1228 |
> |
['{9f2e204f-3c33-4e44-90f9-9135e95dafb9}'] |
1229 |
> |
end; |
1230 |
|
|
1231 |
|
{The Service Query Results Interface. |
1232 |
|
|
1244 |
|
} |
1245 |
|
|
1246 |
|
IServiceQueryResultSubItem = interface |
1247 |
+ |
['{8a4c381e-9923-4cc9-a96b-553729248640}'] |
1248 |
|
function getItemType: byte; |
1249 |
|
function getSize: integer; |
1250 |
|
procedure getRawBytes(var Buffer); |
1251 |
< |
function getAsString: string; |
1252 |
< |
function getAsInteger: integer; |
1251 |
> |
function getAsString: AnsiString; |
1252 |
> |
function getAsInteger: int64; |
1253 |
|
function getAsByte: byte; |
1254 |
|
function CopyTo(stream: TStream; count: integer): integer; |
1255 |
< |
property AsString: string read getAsString; |
1256 |
< |
property AsInteger: integer read getAsInteger; |
1255 |
> |
property AsString: AnsiString read getAsString; |
1256 |
> |
property AsInteger: int64 read getAsInteger; |
1257 |
|
property AsByte: byte read getAsByte; |
1258 |
|
end; |
1259 |
|
|
1260 |
|
IServiceQueryResultItem = interface(IServiceQueryResultSubItem) |
1261 |
+ |
['{b2806886-206c-4024-8df9-5fe0a7630a5e}'] |
1262 |
|
function getCount: integer; |
1263 |
|
function getItem(index: integer): IServiceQueryResultSubItem; |
1264 |
|
function find(ItemType: byte): IServiceQueryResultSubItem; |
1267 |
|
end; |
1268 |
|
|
1269 |
|
IServiceQueryResults = interface |
1270 |
+ |
['{8fbbef7d-fe03-4409-828a-a787d34ef531}'] |
1271 |
|
function getCount: integer; |
1272 |
|
function getItem(index: integer): IServiceQueryResultItem; |
1273 |
|
function find(ItemType: byte): IServiceQueryResultItem; |
1276 |
|
property Count: integer read getCount; |
1277 |
|
end; |
1278 |
|
|
1279 |
+ |
IFirebirdLibrary = interface; |
1280 |
+ |
|
1281 |
|
{The IServiceManager interface provides access to a service manager. It can |
1282 |
|
used to Detach and re-attach to Service Manager, to start services and to |
1283 |
|
query the service manager. |
1288 |
|
{ IServiceManager } |
1289 |
|
|
1290 |
|
IServiceManager = interface |
1291 |
+ |
['{905b587d-1e1f-4e40-a3f8-a3519f852e48}'] |
1292 |
+ |
function getFirebirdAPI: IFirebirdAPI; |
1293 |
|
function getSPB: ISPB; |
1294 |
< |
function getServerName: string; |
1294 |
> |
function getServerName: AnsiString; |
1295 |
> |
function getProtocol: TProtocol; |
1296 |
> |
function getPortNo: AnsiString; |
1297 |
|
procedure Attach; |
1298 |
|
procedure Detach(Force: boolean=false); |
1299 |
|
function IsAttached: boolean; |
1300 |
|
function AllocateSRB: ISRB; |
1301 |
|
function AllocateSQPB: ISQPB; |
1302 |
< |
procedure Start(Request: ISRB); |
1303 |
< |
function Query(SQPB: ISQPB; Request: ISRB) :IServiceQueryResults; overload; |
1304 |
< |
function Query(Request: ISRB) :IServiceQueryResults; overload; |
1302 |
> |
function Start(Request: ISRB; RaiseExceptionOnError: boolean=true): boolean; |
1303 |
> |
function Query(SQPB: ISQPB; Request: ISRB; RaiseExceptionOnError: boolean=true) :IServiceQueryResults; overload; |
1304 |
> |
function Query(Request: ISRB; RaiseExceptionOnError: boolean=true) :IServiceQueryResults; overload; |
1305 |
> |
end; |
1306 |
> |
|
1307 |
> |
{Tbe Firebird Library API used to get information about the Firebird library} |
1308 |
> |
|
1309 |
> |
|
1310 |
> |
IFirebirdLibrary = interface |
1311 |
> |
['{3c04e0a1-12e0-428a-b2e1-bc6fcd97b79b}'] |
1312 |
> |
function GetHandle: TLibHandle; |
1313 |
> |
function GetLibraryName: string; |
1314 |
> |
function GetLibraryFilePath: string; |
1315 |
> |
function GetFirebirdAPI: IFirebirdAPI; |
1316 |
|
end; |
1317 |
|
|
1318 |
|
{The Firebird API. |
1323 |
|
The interface is returned by the FirebirdAPI function. |
1324 |
|
} |
1325 |
|
|
1326 |
+ |
{ IFirebirdAPI } |
1327 |
+ |
|
1328 |
|
IFirebirdAPI = interface |
1329 |
+ |
['{edeee691-c8d3-4dcf-a780-cd7e432821d5}'] |
1330 |
|
{Database connections} |
1331 |
|
function AllocateDPB: IDPB; |
1332 |
< |
function OpenDatabase(DatabaseName: string; DPB: IDPB; RaiseExceptionOnConnectError: boolean=true): IAttachment; |
1333 |
< |
function CreateDatabase(DatabaseName: string; DPB: IDPB; RaiseExceptionOnError: boolean=true): IAttachment; |
1332 |
> |
function OpenDatabase(DatabaseName: AnsiString; DPB: IDPB; RaiseExceptionOnConnectError: boolean=true): IAttachment; |
1333 |
> |
function CreateDatabase(DatabaseName: AnsiString; DPB: IDPB; RaiseExceptionOnError: boolean=true): IAttachment; overload; |
1334 |
> |
function CreateDatabase(sql: AnsiString; aSQLDialect: integer; RaiseExceptionOnError: boolean=true): IAttachment; overload; |
1335 |
|
|
1336 |
|
{Start Transaction against multiple databases} |
1337 |
|
function AllocateTPB: ITPB; |
1343 |
|
{Service Manager} |
1344 |
|
function HasServiceAPI: boolean; |
1345 |
|
function AllocateSPB: ISPB; |
1346 |
< |
function GetServiceManager(ServerName: string; Protocol: TProtocol; SPB: ISPB): IServiceManager; |
1346 |
> |
function GetServiceManager(ServerName: AnsiString; Protocol: TProtocol; SPB: ISPB): IServiceManager; overload; |
1347 |
> |
function GetServiceManager(ServerName: AnsiString; Port: AnsiString; Protocol: TProtocol; SPB: ISPB): IServiceManager; overload; |
1348 |
|
|
1349 |
|
{Information} |
1350 |
|
function GetStatus: IStatus; |
986 |
– |
function GetLibraryName: string; |
1351 |
|
function HasRollbackRetaining: boolean; |
1352 |
|
function IsEmbeddedServer: boolean; |
1353 |
< |
function GetImplementationVersion: string; |
1353 |
> |
function GetImplementationVersion: AnsiString; |
1354 |
> |
function GetClientMajor: integer; |
1355 |
> |
function GetClientMinor: integer; |
1356 |
> |
function HasDecFloatSupport: boolean; |
1357 |
> |
function HasLocalTZDB: boolean; |
1358 |
> |
function HasTimeZoneSupport: boolean; |
1359 |
> |
function HasExtendedTZSupport: boolean; |
1360 |
|
|
1361 |
|
{Firebird 3 API} |
1362 |
|
function HasMasterIntf: boolean; |
1363 |
< |
function GetIMaster: TObject; |
1364 |
< |
|
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; |
1363 |
> |
function GetIMaster: TObject; deprecated 'Use FirebirdAPI.QueryInterface and FBClientLib.pas IFBIMasterProvider instead'; |
1364 |
> |
function GetFBLibrary: IFirebirdLibrary; |
1365 |
|
end; |
1366 |
|
|
1367 |
|
type |
1378 |
|
private |
1379 |
|
FSQLCode: Long; |
1380 |
|
public |
1381 |
< |
constructor Create(ASQLCode: Long; Msg: string); |
1381 |
> |
constructor Create(ASQLCode: Long; Msg: AnsiString); |
1382 |
|
property SQLCode: Long read FSQLCode; |
1383 |
|
end; |
1384 |
|
|
1389 |
|
FIBErrorCode: Long; |
1390 |
|
public |
1391 |
|
constructor Create(Status: IStatus); overload; |
1392 |
< |
constructor Create(ASQLCode: Long; AIBErrorCode: Long; Msg: string); overload; |
1392 |
> |
constructor Create(ASQLCode: Long; AIBErrorCode: Long; Msg: AnsiString); overload; |
1393 |
|
property IBErrorCode: Long read FIBErrorCode; |
1394 |
|
end; |
1395 |
|
|
1396 |
|
{IB Client Exceptions} |
1397 |
|
EIBClientError = class(EIBError); |
1398 |
|
|
1399 |
< |
{IBError is used internally and by IBX to throw an EIBClientError} |
1400 |
< |
|
1037 |
< |
procedure IBError(ErrMess: TIBClientError; const Args: array of const); |
1399 |
> |
{Used to explicitly report a Batch Buffer overflow} |
1400 |
> |
EIBBatchBufferOverflow = class(EIBError); |
1401 |
|
|
1402 |
|
{The Firebird API function is used to access the IFirebirdAPI interface. |
1403 |
|
|
1408 |
|
function FirebirdAPI: IFirebirdAPI; |
1409 |
|
|
1410 |
|
{IBX support functions. Probably best ignored i.e. always used the FirebirdAPI |
1411 |
< |
functino to load the library and check if it's loaded.} |
1411 |
> |
function to load the library and check if it's loaded.} |
1412 |
|
|
1413 |
|
function TryIBLoad: Boolean; |
1414 |
|
procedure CheckIBLoaded; |
1415 |
|
|
1416 |
+ |
{If you want to explicitly load the Firebird library from a |
1417 |
+ |
non-default location then use this function and its GetFirebirdAPI function |
1418 |
+ |
to get the API.} |
1419 |
+ |
|
1420 |
+ |
function LoadFBLibrary(aLibPathName: string): IFirebirdLibrary; |
1421 |
+ |
|
1422 |
+ |
|
1423 |
|
implementation |
1424 |
|
|
1425 |
|
uses FBClientAPI |
1426 |
|
{$IFDEF USELEGACYFIREBIRDAPI}, FB25ClientAPI {$ENDIF} |
1427 |
|
{$IFDEF USEFIREBIRD3API}, FB30ClientAPI {$ENDIF}; |
1428 |
|
|
1429 |
< |
var FFirebirdAPI: IFirebirdAPI; |
1429 |
> |
var FDefaultFBLibrary: IFirebirdLibrary; |
1430 |
> |
|
1431 |
> |
type |
1432 |
> |
|
1433 |
> |
{ TFBLibrary } |
1434 |
> |
|
1435 |
> |
TFBLibraryImpl = class(TFBLibrary) |
1436 |
> |
protected |
1437 |
> |
function GetFirebird3API: IFirebirdAPI; override; |
1438 |
> |
function GetLegacyFirebirdAPI: IFirebirdAPI; override; |
1439 |
> |
end; |
1440 |
> |
|
1441 |
> |
function TFBLibraryImpl.GetFirebird3API: IFirebirdAPI; |
1442 |
> |
begin |
1443 |
> |
{$IFDEF USEFIREBIRD3API} |
1444 |
> |
Result := TFB30ClientAPI.Create(self); |
1445 |
> |
{$ELSE} |
1446 |
> |
Result := nil; |
1447 |
> |
{$ENDIF} |
1448 |
> |
end; |
1449 |
> |
|
1450 |
> |
function TFBLibraryImpl.GetLegacyFirebirdAPI: IFirebirdAPI; |
1451 |
> |
begin |
1452 |
> |
{$IFDEF USELEGACYFIREBIRDAPI} |
1453 |
> |
Result := TFB25ClientAPI.Create(self); |
1454 |
> |
{$ELSE} |
1455 |
> |
Result := nil; |
1456 |
> |
{$ENDIF} |
1457 |
> |
end; |
1458 |
|
|
1459 |
|
function FirebirdAPI: IFirebirdAPI; |
1460 |
|
begin |
1461 |
< |
if FFirebirdAPI = nil then |
1461 |
> |
if FDefaultFBLibrary = nil then |
1462 |
|
CheckIBLoaded; |
1463 |
< |
Result := FFirebirdAPI; |
1463 |
> |
Result := FDefaultFBLibrary.GetFirebirdAPI; |
1464 |
|
end; |
1465 |
|
|
1466 |
|
function TryIBLoad: Boolean; |
1467 |
+ |
var fblib: IFirebirdLibrary; |
1468 |
|
begin |
1469 |
< |
Result := FFirebirdAPI <> nil; |
1469 |
> |
Result := FDefaultFBLibrary <> nil; |
1470 |
|
try |
1072 |
– |
{$IFDEF USEFIREBIRD3API} |
1073 |
– |
if not Result then |
1074 |
– |
begin |
1075 |
– |
FFirebirdAPI := TFB30ClientAPI.Create; |
1076 |
– |
Result := FFirebirdAPI.HasMasterIntf; |
1077 |
– |
end; |
1078 |
– |
{$ENDIF} |
1079 |
– |
{$IFDEF USELEGACYFIREBIRDAPI} |
1471 |
|
if not Result then |
1472 |
|
begin |
1473 |
< |
FFirebirdAPI := nil; |
1474 |
< |
FFirebirdAPI := TFB25ClientAPI.Create; |
1475 |
< |
Result := true; |
1476 |
< |
end; |
1086 |
< |
{$ENDIF} |
1087 |
< |
if Result and not (FFirebirdAPI as TFBClientAPI).IsLibraryLoaded then |
1088 |
< |
begin |
1089 |
< |
Result := false; |
1090 |
< |
FFirebirdAPI := nil; |
1473 |
> |
fblib := TFBLibraryImpl.Create; |
1474 |
> |
if (fblib <> nil) and (fblib.GetFirebirdAPI <> nil) then |
1475 |
> |
FDefaultFBLibrary := fblib; |
1476 |
> |
Result := FDefaultFBLibrary <> nil; |
1477 |
|
end; |
1478 |
|
except |
1479 |
|
SysUtils.showexception(ExceptObject,ExceptAddr); |
1487 |
|
IBError(ibxeInterBaseMissing, [nil]); |
1488 |
|
end; |
1489 |
|
|
1490 |
+ |
function LoadFBLibrary(aLibPathName: string): IFirebirdLibrary; |
1491 |
+ |
var fblib: IFirebirdLibrary; |
1492 |
+ |
begin |
1493 |
+ |
if trim(aLibPathName) = '' then |
1494 |
+ |
begin |
1495 |
+ |
CheckIBLoaded; |
1496 |
+ |
Result := FDefaultFBLibrary; |
1497 |
+ |
end |
1498 |
+ |
else |
1499 |
+ |
begin |
1500 |
+ |
fblib := TFBLibraryImpl.GetFBLibrary(aLibPathName); |
1501 |
+ |
if (fblib = nil) or (fblib.GetFirebirdAPI = nil) then |
1502 |
+ |
IBError(ibxeInterBaseMissing, [nil]); |
1503 |
+ |
Result := fblib; |
1504 |
+ |
end; |
1505 |
+ |
end; |
1506 |
+ |
|
1507 |
|
{ EIBError } |
1508 |
|
|
1509 |
< |
constructor EIBError.Create(ASQLCode: Long; Msg: string); |
1509 |
> |
constructor EIBError.Create(ASQLCode: Long; Msg: AnsiString); |
1510 |
|
begin |
1511 |
|
inherited Create(Msg); |
1512 |
|
FSQLCode := ASQLCode; |
1521 |
|
end; |
1522 |
|
|
1523 |
|
constructor EIBInterBaseError.Create(ASQLCode: Long; AIBErrorCode: Long; |
1524 |
< |
Msg: string); |
1524 |
> |
Msg: AnsiString); |
1525 |
|
begin |
1526 |
|
inherited Create(ASQLCode,Msg); |
1527 |
|
FIBErrorCode := AIBErrorCode; |
1528 |
|
end; |
1529 |
|
|
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; |
1530 |
|
|
1531 |
|
initialization |
1532 |
< |
FFirebirdAPI := nil; |
1532 |
> |
FDefaultFBLibrary := nil; |
1533 |
|
|
1534 |
+ |
finalization |
1535 |
+ |
FDefaultFBLibrary := nil; |
1536 |
|
|
1537 |
|
end. |
1538 |
|
|