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 |
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; |
137 |
> |
FBIntf_Minor = 3; |
138 |
|
FBIntf_Release = 2; |
139 |
< |
FBIntf_Version = '1.0.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 '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 |
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 |
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 interface provides the template for all parameter |
252 |
|
block interfaces} |
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 |
|
|
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 |
|
['{34167722-af38-4831-b08a-93162d58ede3}'] |
308 |
< |
function GetIBErrorCode: Long; |
309 |
< |
function Getsqlcode: Long; |
308 |
> |
function GetIBErrorCode: TStatusCode; |
309 |
> |
function Getsqlcode: TStatusCode; |
310 |
|
function GetMessage: AnsiString; |
311 |
|
function CheckStatusVector(ErrorCodes: array of TFBStatusCode): Boolean; |
312 |
|
function GetIBDataBaseErrorMessages: TIBDataBaseErrorMessages; |
329 |
|
function GetSQLTypeName: AnsiString; |
330 |
|
function GetScale: integer; |
331 |
|
function GetSize: cardinal; |
332 |
+ |
function GetCharSetWidth: integer; |
333 |
|
function GetCharSetID: cardinal; |
334 |
|
function GetTableName: AnsiString; |
335 |
|
function GetColumnName: AnsiString; |
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): 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); |
321 |
– |
procedure SetAsTime(index: array of integer; Value: TDateTime); |
322 |
– |
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: 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; |
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 |
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 |
+ |
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; |
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; |
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; |
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; |
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: AnsiString): ISQLData; |
603 |
|
function getSQLData(index: integer): ISQLData; |
614 |
|
} |
615 |
|
IResultSet = interface(IResults) |
616 |
|
['{0ae4979b-7857-4e8c-8918-ec6f155b51a0}'] |
617 |
< |
function FetchNext: boolean; |
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 |
529 |
< |
the interface may be used to access information on the expected SQL Type, etc. |
530 |
< |
|
531 |
< |
It also subclasses ISQLData and this part of the interface may be used to access |
532 |
< |
current values for each parameter. |
533 |
< |
|
534 |
< |
Otherwise, the interface comprises the Setter Methods and properties used to |
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 |
< |
['{b22b4578-6d41-4807-a9a9-d2ec8d1d5a14}'] |
544 |
< |
function GetIndex: integer; |
647 |
> |
IParamMetaData = interface |
648 |
> |
['{4e148c4e-2d48-4991-a263-f66eca05c6aa}'] |
649 |
|
function GetSQLType: cardinal; |
650 |
|
function GetSQLTypeName: AnsiString; |
651 |
|
function getSubtype: integer; |
548 |
– |
function getName: AnsiString; |
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; |
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); |
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; |
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: AnsiString read GetName; |
611 |
– |
property SQLType: cardinal read GetSQLType; |
741 |
|
end; |
742 |
|
|
743 |
|
{ |
751 |
|
function getSQLParam(index: integer): 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; |
762 |
|
psRealTime, psUserTime, psBuffers, |
763 |
|
psReads, psWrites, psFetches,psDeltaMemory); |
764 |
|
|
765 |
< |
TPerfCounters = array[TPerfStats] of comp; |
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 |
+ |
TStatementFlag = (stHasCursor,stRepeatExecute,stScrollable); |
785 |
+ |
TStatementFlags = set of TStatementFlag; |
786 |
+ |
|
787 |
|
IStatement = interface |
788 |
|
['{a260576d-a07d-4a66-b02d-1b72543fd7cf}'] |
789 |
|
function GetMetaData: IMetaData; {Output Metadata} |
791 |
|
function GetPlan: AnsiString; |
792 |
|
function GetRowsAffected(var SelectCount, InsertCount, UpdateCount, DeleteCount: integer): boolean; |
793 |
|
function GetSQLStatementType: TIBSQLStatementTypes; |
794 |
+ |
function GetSQLStatementTypeName: AnsiString; |
795 |
|
function GetSQLText: AnsiString; |
796 |
+ |
function GetProcessedSQLText: AnsiString; |
797 |
|
function GetSQLDialect: integer; |
798 |
+ |
function GetFlags: TStatementFlags; |
799 |
|
function IsPrepared: boolean; |
800 |
< |
procedure Prepare(aTransaction: ITransaction=nil); |
800 |
> |
function HasBatchMode: boolean; |
801 |
> |
function IsInBatchMode: boolean; |
802 |
> |
procedure Prepare(aTransaction: ITransaction=nil); overload; |
803 |
> |
procedure Prepare(CursorName: AnsiString; aTransaction: ITransaction=nil); overload; |
804 |
|
function Execute(aTransaction: ITransaction=nil): IResults; |
805 |
< |
function OpenCursor(aTransaction: ITransaction=nil): IResultSet; |
805 |
> |
function OpenCursor(aTransaction: ITransaction=nil): IResultSet; overload; |
806 |
> |
function OpenCursor(Scrollable: boolean; aTransaction: ITransaction=nil): IResultSet; overload; |
807 |
|
function GetAttachment: IAttachment; |
808 |
|
function GetTransaction: ITransaction; |
809 |
|
procedure SetRetainInterfaces(aValue: boolean); |
810 |
|
procedure EnableStatistics(aValue: boolean); |
811 |
|
function GetPerfStatistics(var stats: TPerfCounters): boolean; |
812 |
+ |
{IBatch interface support} |
813 |
+ |
procedure AddToBatch; |
814 |
+ |
function ExecuteBatch(aTransaction: ITransaction=nil): IBatchCompletion; |
815 |
+ |
procedure CancelBatch; |
816 |
+ |
function GetBatchCompletion: IBatchCompletion; |
817 |
+ |
function GetBatchRowLimit: integer; |
818 |
+ |
procedure SetBatchRowLimit(aLimit: integer); |
819 |
+ |
{Stale Reference Check} |
820 |
+ |
procedure SetStaleReferenceChecks(Enable:boolean); {default true} |
821 |
+ |
function GetStaleReferenceChecks: boolean; |
822 |
+ |
|
823 |
|
property MetaData: IMetaData read GetMetaData; |
824 |
|
property SQLParams: ISQLParams read GetSQLParams; |
825 |
|
property SQLStatementType: TIBSQLStatementTypes read GetSQLStatementType; |
826 |
|
end; |
827 |
|
|
828 |
+ |
ITrInfoItem = interface |
829 |
+ |
['{41455e1a-f84e-4e26-aff0-1a78e8b69cfe}'] |
830 |
+ |
function getItemType: byte; |
831 |
+ |
function getSize: integer; |
832 |
+ |
function getAsString: AnsiString; |
833 |
+ |
function getAsInteger: int64; |
834 |
+ |
procedure DecodeTraIsolation(var IsolationType, RecVersion: byte); |
835 |
+ |
end; |
836 |
+ |
|
837 |
+ |
{ ITrInformation } |
838 |
+ |
|
839 |
+ |
ITrInformation = interface |
840 |
+ |
['{e6ea4a52-c1a1-44ba-9609-c8bcc7cba7b2}'] |
841 |
+ |
function GetCount: integer; |
842 |
+ |
function GetItem(index: integer): ITrInfoItem; |
843 |
+ |
function Find(ItemType: byte): ITrInfoItem; |
844 |
+ |
procedure PrintBuf; {can be used to print buffer in hex for debugging} |
845 |
+ |
property Count: integer read GetCount; |
846 |
+ |
property Items[index: integer]: ITrInfoItem read getItem; default; |
847 |
+ |
end; |
848 |
+ |
|
849 |
|
{Transaction Parameter Block: (TPB) |
850 |
|
|
851 |
|
The TPB provides the parameters used when starting a transaction. It is allocated |
857 |
|
found in the Interbase 6.0 API Guide. |
858 |
|
} |
859 |
|
|
860 |
< |
ITPBItem = interface(IParameterBlockItem) |
860 |
> |
ITPBItem = interface(IParameterBlockItemWithTypeName) |
861 |
|
['{544c1f2b-7c12-4a87-a4a5-face7ea72671}'] |
862 |
|
end; |
863 |
|
|
864 |
< |
ITPB = interface(IParameterBlock<ITPBItem>) |
864 |
> |
ITPB = interface(IParameterBlockWithTypeNames<ITPBItem>) |
865 |
|
['{7369b0ff-defe-437b-81fe-19b211d42d25}'] |
866 |
+ |
function AsText: AnsiString; |
867 |
|
end; |
868 |
|
|
869 |
|
{The ITransactionAction interface provides access to a Transaction once it |
882 |
|
function getTPB: ITPB; |
883 |
|
procedure Start(DefaultCompletion: TTransactionCompletion=taCommit); |
884 |
|
function GetInTransaction: boolean; |
885 |
+ |
function GetIsReadOnly: boolean; |
886 |
+ |
function GetTransactionID: integer; |
887 |
+ |
function GetJournalingActive(attachment: IAttachment): boolean; |
888 |
+ |
function GetDefaultCompletion: TTransactionCompletion; |
889 |
|
procedure PrepareForCommit; {Two phase commit - stage 1} |
890 |
|
procedure Commit(Force: boolean=false); |
891 |
|
procedure CommitRetaining; |
894 |
|
procedure RollbackRetaining; |
895 |
|
function GetAttachmentCount: integer; |
896 |
|
function GetAttachment(index: integer): IAttachment; |
897 |
+ |
function GetTrInformation(Requests: array of byte): ITrInformation; overload; |
898 |
+ |
function GetTrInformation(Request: byte): ITrInformation; overload; |
899 |
+ |
function GetTransactionName: AnsiString; |
900 |
+ |
procedure SetTransactionName(aValue: AnsiString); |
901 |
|
property InTransaction: boolean read GetInTransaction; |
902 |
+ |
property TransactionName: AnsiString read GetTransactionName write SetTransactionName; |
903 |
|
end; |
904 |
|
|
905 |
|
{ The IEvents Interface is used to handle events from a single database. The |
937 |
|
function GetAttachment: IAttachment; |
938 |
|
end; |
939 |
|
|
940 |
+ |
TTZTextOptions = (tzOffset, {Time Zone Rendered as an offset to GMT} |
941 |
+ |
tzGMT, {No Time Zone. Time part is always rendered in GMT} |
942 |
+ |
tzOriginalID); {Time Zone shown as originally entered} |
943 |
+ |
|
944 |
+ |
{The ITimeZoneServices interface provides access to the time zone database |
945 |
+ |
used for the attachment. It may be used in support of TIMESTAMP WITH TIME ZONE |
946 |
+ |
and TIME WITH TIME ZONE data types.} |
947 |
+ |
|
948 |
+ |
ITimeZoneServices = interface |
949 |
+ |
['{163821f5-ebef-42b9-ac60-8ac4b5c09954}'] |
950 |
+ |
{utility functions} |
951 |
+ |
function TimeZoneID2TimeZoneName(aTimeZoneID: TFBTimeZoneID): AnsiString; |
952 |
+ |
function TimeZoneName2TimeZoneID(aTimeZone: AnsiString): TFBTimeZoneID; |
953 |
+ |
function LocalTimeToGMT(aLocalTime: TDateTime; aTimeZone: AnsiString): TDateTime; overload; |
954 |
+ |
function LocalTimeToGMT(aLocalTime: TDateTime; aTimeZoneID: TFBTimeZoneID): TDateTime; overload; |
955 |
+ |
function GMTToLocalTime(aGMTTime: TDateTime; aTimeZone: AnsiString): TDateTime; overload; |
956 |
+ |
function GMTToLocalTime(aGMTTime: TDateTime; aTimeZoneID: TFBTimeZoneID): TDateTime; overload; |
957 |
+ |
function GetEffectiveOffsetMins(aLocalTime: TDateTime; aTimeZone: AnsiString): integer; overload; |
958 |
+ |
function GetEffectiveOffsetMins(aLocalTime: TDateTime; aTimeZoneID: TFBTimeZoneID): integer; overload; |
959 |
+ |
|
960 |
+ |
{Time Zone DB Information} |
961 |
+ |
function UsingRemoteTZDB: boolean; |
962 |
+ |
procedure SetUseLocalTZDB(useLocalTZDB: boolean); |
963 |
+ |
function GetLocalTimeZoneName: AnsiString; |
964 |
+ |
function GetLocalTimeZoneID: TFBTimeZoneID; |
965 |
+ |
procedure GetTimeZoneInfo(aTimeZone: AnsiString; OnDate: TDateTime; |
966 |
+ |
var ZoneOffset, DSTOffset, EffectiveOffset: integer); |
967 |
+ |
{Configurable Options} |
968 |
+ |
function GetTimeTZDate: TDateTime; |
969 |
+ |
procedure SetTimeTZDate(aDate: TDateTime); |
970 |
+ |
function GetTZTextOption: TTZTextOptions; |
971 |
+ |
procedure SetTZTextOption(aOptionValue: TTZTextOptions); |
972 |
+ |
end; |
973 |
+ |
|
974 |
|
{The IDBInformation Interface. |
975 |
|
|
976 |
|
An IDBInformation interface is returned by the IAttachment GetDBInformation |
999 |
|
function getSize: integer; |
1000 |
|
procedure getRawBytes(var Buffer); |
1001 |
|
function getAsString: AnsiString; |
1002 |
< |
function getAsInteger: integer; |
1002 |
> |
function getAsInteger: int64; |
1003 |
|
procedure DecodeIDCluster(var ConnectionType: integer; var DBFileName, DBSiteName: AnsiString); |
1004 |
|
function getAsBytes: TByteArray; |
1005 |
+ |
function getAsDateTime: TDateTime; |
1006 |
|
procedure DecodeVersionString(var Version: byte; var VersionString: AnsiString); |
1007 |
|
function getOperationCounts: TDBOperationCounts; |
1008 |
|
procedure DecodeUserNames(UserNames: TStrings); |
1011 |
|
function GetCount: integer; |
1012 |
|
function GetItem(index: integer): IDBInfoItem; |
1013 |
|
function Find(ItemType: byte): IDBInfoItem; |
1014 |
< |
property AsInteger: integer read getAsInteger; |
1014 |
> |
property AsInteger: int64 read getAsInteger; |
1015 |
|
property AsString: AnsiString read GetAsString; |
1016 |
|
property Count: integer read GetCount; |
1017 |
|
property Items[index: integer]: IDBInfoItem read getItem; default; |
1029 |
|
property Items[index: integer]: IDBInfoItem read getItem; default; |
1030 |
|
end; |
1031 |
|
|
1032 |
+ |
{The Database Information Request Block is used to pass requests for |
1033 |
+ |
database information where at least one item requested has a parameter. |
1034 |
+ |
At present, this is only fb_info_page_contents which has a single |
1035 |
+ |
integer parameter.} |
1036 |
+ |
|
1037 |
+ |
IDIRBItem = interface(IParameterBlockItem) |
1038 |
+ |
['{d34a7511-8435-4a24-81a7-5103d218d234}'] |
1039 |
+ |
end; |
1040 |
+ |
|
1041 |
+ |
IDIRB = interface(IParameterBlock<IDIRBItem>) |
1042 |
+ |
['{1010e5ac-0a8f-403b-a302-91625e9d9579}'] |
1043 |
+ |
end; |
1044 |
+ |
|
1045 |
+ |
|
1046 |
|
{The Database Parameter Block (DPB). |
1047 |
|
|
1048 |
|
The DPB provides the parameters used when connecting to a database. It is allocated |
1054 |
|
found in the Interbase 6.0 API Guide. |
1055 |
|
} |
1056 |
|
|
1057 |
< |
IDPBItem = interface(IParameterBlockItem) |
1057 |
> |
IDPBItem = interface(IParameterBlockItemWithTypeName) |
1058 |
|
['{123d4ad0-087a-4cd1-a344-1b3d03b30673}'] |
1059 |
|
end; |
1060 |
|
|
1061 |
< |
IDPB = interface(IParameterBlock<IDPBItem>) |
1062 |
< |
['{e676067b-1cf4-4eba-9256-9724f57e0d16}'] |
1063 |
< |
end; |
1061 |
> |
IDPB = interface(IParameterBlockWithTypeNames<IDPBItem>) |
1062 |
> |
['{e676067b-1cf4-4eba-9256-9724f57e0d16}'] |
1063 |
> |
end; |
1064 |
> |
|
1065 |
> |
{Journaling options. Default is [joReadWriteTransactions,joModifyQueries] } |
1066 |
> |
|
1067 |
> |
TJournalOption = (joReadOnlyTransactions, joReadWriteTransactions, |
1068 |
> |
joModifyQueries, joReadOnlyQueries); |
1069 |
> |
|
1070 |
> |
TJournalOptions = set of TJournalOption; |
1071 |
|
|
1072 |
|
{The IAttachment interface provides access to a Database Connection. It may be |
1073 |
|
used to: |
1098 |
|
|
1099 |
|
IAttachment = interface |
1100 |
|
['{466e9b67-9def-4807-b3e7-e08a35e7185c}'] |
1101 |
+ |
function getFirebirdAPI: IFirebirdAPI; |
1102 |
|
function getDPB: IDPB; |
1103 |
|
function AllocateBPB: IBPB; |
1104 |
+ |
function AllocateDIRB: IDIRB; |
1105 |
|
procedure Connect; |
1106 |
|
procedure Disconnect(Force: boolean=false); |
1107 |
|
function IsConnected: boolean; |
1108 |
|
procedure DropDatabase; |
1109 |
< |
function StartTransaction(TPB: array of byte; DefaultCompletion: TTransactionCompletion=taCommit): ITransaction; overload; |
1110 |
< |
function StartTransaction(TPB: ITPB; DefaultCompletion: TTransactionCompletion=taCommit): ITransaction; overload; |
1109 |
> |
function StartTransaction(TPB: array of byte; |
1110 |
> |
DefaultCompletion: TTransactionCompletion=taCommit; |
1111 |
> |
aName: AnsiString=''): ITransaction; overload; |
1112 |
> |
function StartTransaction(TPB: ITPB; |
1113 |
> |
DefaultCompletion: TTransactionCompletion=taCommit; |
1114 |
> |
aName: AnsiString=''): ITransaction; overload; |
1115 |
|
procedure ExecImmediate(transaction: ITransaction; sql: AnsiString; SQLDialect: integer); overload; |
1116 |
|
procedure ExecImmediate(TPB: array of byte; sql: AnsiString; SQLDialect: integer); overload; |
1117 |
|
procedure ExecImmediate(transaction: ITransaction; sql: AnsiString); overload; |
1120 |
|
function ExecuteSQL(transaction: ITransaction; sql: AnsiString; SQLDialect: integer; params: array of const): IResults; overload; |
1121 |
|
function ExecuteSQL(TPB: array of byte; sql: AnsiString; params: array of const): IResults; overload; |
1122 |
|
function ExecuteSQL(transaction: ITransaction; sql: AnsiString; params: array of const): IResults; overload; |
1123 |
< |
function OpenCursor(transaction: ITransaction; sql: AnsiString; aSQLDialect: integer): IResultSet; overload; |
1123 |
> |
function OpenCursor(transaction: ITransaction; sql: AnsiString; aSQLDialect: integer; |
1124 |
> |
Scrollable: boolean=false): IResultSet; overload; |
1125 |
|
function OpenCursor(transaction: ITransaction; sql: AnsiString; aSQLDialect: integer; |
1126 |
|
params: array of const): IResultSet; overload; |
1127 |
< |
function OpenCursor(transaction: ITransaction; sql: AnsiString): IResultSet; overload; |
1127 |
> |
function OpenCursor(transaction: ITransaction; sql: AnsiString; Scrollable: boolean=false): IResultSet; overload; |
1128 |
> |
function OpenCursor(transaction: ITransaction; sql: AnsiString; Scrollable: boolean; |
1129 |
> |
params: array of const): IResultSet; overload; |
1130 |
|
function OpenCursor(transaction: ITransaction; sql: AnsiString; |
1131 |
|
params: array of const): IResultSet; overload; |
1132 |
< |
function OpenCursorAtStart(transaction: ITransaction; sql: AnsiString; aSQLDialect: integer): IResultSet; overload; |
1132 |
> |
function OpenCursor(transaction: ITransaction; sql: AnsiString; aSQLDialect: integer; Scrollable: boolean; |
1133 |
> |
params: array of const): IResultSet; overload; |
1134 |
|
function OpenCursorAtStart(transaction: ITransaction; sql: AnsiString; aSQLDialect: integer; |
1135 |
+ |
Scrollable: boolean=false): IResultSet; overload; |
1136 |
+ |
function OpenCursorAtStart(transaction: ITransaction; sql: AnsiString; aSQLDialect: integer; |
1137 |
+ |
params: array of const): IResultSet; overload; |
1138 |
+ |
function OpenCursorAtStart(transaction: ITransaction; sql: AnsiString; aSQLDialect: integer; Scrollable: boolean; |
1139 |
|
params: array of const): IResultSet; overload; |
1140 |
< |
function OpenCursorAtStart(transaction: ITransaction; sql: AnsiString): IResultSet; overload; |
1140 |
> |
function OpenCursorAtStart(transaction: ITransaction; sql: AnsiString; Scrollable: boolean=false): IResultSet; overload; |
1141 |
|
function OpenCursorAtStart(transaction: ITransaction; sql: AnsiString; |
1142 |
|
params: array of const): IResultSet; overload; |
1143 |
< |
function OpenCursorAtStart(sql: AnsiString): IResultSet; overload; |
1143 |
> |
function OpenCursorAtStart(transaction: ITransaction; sql: AnsiString; Scrollable: boolean; |
1144 |
> |
params: array of const): IResultSet; overload; |
1145 |
> |
function OpenCursorAtStart(sql: AnsiString; Scrollable: boolean=false): IResultSet; overload; |
1146 |
> |
function OpenCursorAtStart(sql: AnsiString; Scrollable: boolean; |
1147 |
> |
params: array of const): IResultSet; overload; |
1148 |
|
function OpenCursorAtStart(sql: AnsiString; |
1149 |
|
params: array of const): IResultSet; overload; |
1150 |
< |
function Prepare(transaction: ITransaction; sql: AnsiString; aSQLDialect: integer): IStatement; overload; |
1151 |
< |
function Prepare(transaction: ITransaction; sql: AnsiString): IStatement; overload; |
1150 |
> |
function Prepare(transaction: ITransaction; sql: AnsiString; aSQLDialect: integer; CursorName: AnsiString=''): IStatement; overload; |
1151 |
> |
function Prepare(transaction: ITransaction; sql: AnsiString; CursorName: AnsiString=''): IStatement; overload; |
1152 |
|
function PrepareWithNamedParameters(transaction: ITransaction; sql: AnsiString; |
1153 |
< |
aSQLDialect: integer; GenerateParamNames: boolean=false): IStatement; overload; |
1153 |
> |
aSQLDialect: integer; GenerateParamNames: boolean=false; |
1154 |
> |
CaseSensitiveParams: boolean = false; CursorName: AnsiString=''): IStatement; overload; |
1155 |
|
function PrepareWithNamedParameters(transaction: ITransaction; sql: AnsiString; |
1156 |
< |
GenerateParamNames: boolean=false): IStatement; overload; |
1156 |
> |
GenerateParamNames: boolean=false; |
1157 |
> |
CaseSensitiveParams: boolean = false; CursorName: AnsiString=''): IStatement; overload; |
1158 |
|
|
1159 |
|
{Events} |
1160 |
|
function GetEventHandler(Events: TStrings): IEvents; overload; |
1165 |
|
function CreateBlob(transaction: ITransaction; RelationName, ColumnName: AnsiString; BPB: IBPB=nil): IBlob; overload; |
1166 |
|
function CreateBlob(transaction: ITransaction; BlobMetaData: IBlobMetaData; BPB: IBPB=nil): IBlob; overload; |
1167 |
|
function CreateBlob(transaction: ITransaction; SubType: integer; CharSetID: cardinal=0; BPB: IBPB=nil): IBlob; overload; |
1168 |
< |
function OpenBlob(transaction: ITransaction; RelationName, ColumnName: AnsiString; BlobID: TISC_QUAD; BPB: IBPB=nil): IBlob; |
1168 |
> |
function OpenBlob(transaction: ITransaction; RelationName, ColumnName: AnsiString; BlobID: TISC_QUAD; BPB: IBPB=nil): IBlob; overload; |
1169 |
> |
function OpenBlob(transaction: ITransaction; BlobMetaData: IBlobMetaData; BlobID: TISC_QUAD; BPB: IBPB=nil): IBlob; overload; |
1170 |
> |
function GetInlineBlobLimit: integer; |
1171 |
> |
procedure SetInlineBlobLimit(limit: integer); |
1172 |
|
|
1173 |
|
{Array - may use to open existing arrays. However, ISQLData.AsArray is preferred} |
1174 |
|
|
1175 |
< |
function OpenArray(transaction: ITransaction; RelationName, ColumnName: AnsiString; ArrayID: TISC_QUAD): IArray; |
1175 |
> |
function OpenArray(transaction: ITransaction; RelationName, ColumnName: AnsiString; ArrayID: TISC_QUAD): IArray; overload; |
1176 |
> |
function OpenArray(transaction: ITransaction; ArrayMetaData: IArrayMetaData; ArrayID: TISC_QUAD): IArray; overload; |
1177 |
|
function CreateArray(transaction: ITransaction; RelationName, ColumnName: AnsiString): IArray; overload; |
1178 |
|
function CreateArray(transaction: ITransaction; ArrayMetaData: IArrayMetaData): IArray; overload; |
1179 |
|
function CreateArrayMetaData(SQLType: cardinal; tableName: AnsiString; columnName: AnsiString; |
1182 |
|
|
1183 |
|
{Database Information} |
1184 |
|
function GetSQLDialect: integer; |
1185 |
+ |
function GetAttachmentID: integer; |
1186 |
|
function GetBlobMetaData(Transaction: ITransaction; tableName, columnName: AnsiString): IBlobMetaData; |
1187 |
|
function GetArrayMetaData(Transaction: ITransaction; tableName, columnName: AnsiString): IArrayMetaData; |
1188 |
|
function GetDBInformation(Requests: array of byte): IDBInformation; overload; |
1189 |
|
function GetDBInformation(Request: byte): IDBInformation; overload; |
1190 |
+ |
function GetDBInformation(Requests: IDIRB): IDBInformation; overload; |
1191 |
+ |
function GetConnectString: AnsiString; |
1192 |
+ |
function GetRemoteProtocol: AnsiString; |
1193 |
+ |
function GetAuthenticationMethod: AnsiString; |
1194 |
+ |
function GetSecurityDatabase: AnsiString; |
1195 |
+ |
function GetODSMajorVersion: integer; |
1196 |
+ |
function GetODSMinorVersion: integer; |
1197 |
+ |
procedure getFBVersion(version: TStrings); |
1198 |
|
function HasActivity: boolean; |
1199 |
+ |
function HasDecFloatSupport: boolean; |
1200 |
+ |
function HasBatchMode: boolean; |
1201 |
+ |
function HasScollableCursors: boolean; |
1202 |
+ |
function HasTable(aTableName: AnsiString): boolean; |
1203 |
|
|
1204 |
|
{Character Sets} |
1205 |
|
function HasDefaultCharSet: boolean; |
1211 |
|
function CharSetWidth(CharSetID: integer; var Width: integer): boolean; |
1212 |
|
procedure RegisterCharSet(CharSetName: AnsiString; CodePage: TSystemCodePage; |
1213 |
|
AllowReverseLookup:boolean; out CharSetID: integer); |
926 |
– |
end; |
1214 |
|
|
1215 |
< |
TProtocol = (TCP, SPX, NamedPipe, Local); |
1215 |
> |
{Time Zone Database} |
1216 |
> |
function GetTimeZoneServices: ITimeZoneServices; |
1217 |
> |
function HasTimeZoneSupport: boolean; |
1218 |
> |
|
1219 |
> |
{Client side Journaling} |
1220 |
> |
function JournalingActive: boolean; |
1221 |
> |
function GetJournalOptions: TJournalOptions; |
1222 |
> |
function StartJournaling(aJournalLogFile: AnsiString): integer; overload; |
1223 |
> |
function StartJournaling(aJournalLogFile: AnsiString; Options: TJournalOptions): integer; overload; |
1224 |
> |
procedure StopJournaling(RetainJournal: boolean); |
1225 |
> |
end; |
1226 |
> |
|
1227 |
> |
TProtocolAll = (TCP, SPX, NamedPipe, Local, inet, inet4, inet6, wnet, xnet, unknownProtocol); |
1228 |
> |
TProtocol = TCP..xnet; |
1229 |
|
|
1230 |
|
{Service Parameter Block (SPB). |
1231 |
|
|
1239 |
|
|
1240 |
|
} |
1241 |
|
|
1242 |
< |
ISPBItem = interface(IParameterBlockItem) |
1242 |
> |
ISPBItem = interface(IParameterBlockItemWithTypeName) |
1243 |
|
['{5d08ae2b-4519-41bd-8b40-97cd451c3f6a}'] |
1244 |
|
end; |
1245 |
|
|
1246 |
< |
ISPB = interface(IParameterBlock<ISPBItem>) |
1246 |
> |
ISPB = interface(IParameterBlockWithTypeNames<ISPBItem>) |
1247 |
|
['{2c5836fd-41ed-4426-9b7d-5af580ec2659}'] |
1248 |
|
end; |
1249 |
|
|
1303 |
|
function getSize: integer; |
1304 |
|
procedure getRawBytes(var Buffer); |
1305 |
|
function getAsString: AnsiString; |
1306 |
< |
function getAsInteger: integer; |
1306 |
> |
function getAsInteger: int64; |
1307 |
|
function getAsByte: byte; |
1308 |
|
function CopyTo(stream: TStream; count: integer): integer; |
1309 |
|
property AsString: AnsiString read getAsString; |
1310 |
< |
property AsInteger: integer read getAsInteger; |
1310 |
> |
property AsInteger: int64 read getAsInteger; |
1311 |
|
property AsByte: byte read getAsByte; |
1312 |
|
end; |
1313 |
|
|
1330 |
|
property Count: integer read getCount; |
1331 |
|
end; |
1332 |
|
|
1333 |
+ |
IFirebirdLibrary = interface; |
1334 |
+ |
|
1335 |
|
{The IServiceManager interface provides access to a service manager. It can |
1336 |
|
used to Detach and re-attach to Service Manager, to start services and to |
1337 |
|
query the service manager. |
1343 |
|
|
1344 |
|
IServiceManager = interface |
1345 |
|
['{905b587d-1e1f-4e40-a3f8-a3519f852e48}'] |
1346 |
+ |
function getFirebirdAPI: IFirebirdAPI; |
1347 |
|
function getSPB: ISPB; |
1348 |
|
function getServerName: AnsiString; |
1349 |
+ |
function getProtocol: TProtocol; |
1350 |
+ |
function getPortNo: AnsiString; |
1351 |
|
procedure Attach; |
1352 |
|
procedure Detach(Force: boolean=false); |
1353 |
|
function IsAttached: boolean; |
1354 |
|
function AllocateSRB: ISRB; |
1355 |
|
function AllocateSQPB: ISQPB; |
1356 |
< |
procedure Start(Request: ISRB); |
1357 |
< |
function Query(SQPB: ISQPB; Request: ISRB) :IServiceQueryResults; overload; |
1358 |
< |
function Query(Request: ISRB) :IServiceQueryResults; overload; |
1356 |
> |
function Start(Request: ISRB; RaiseExceptionOnError: boolean=true): boolean; |
1357 |
> |
function Query(SQPB: ISQPB; Request: ISRB; RaiseExceptionOnError: boolean=true) :IServiceQueryResults; overload; |
1358 |
> |
function Query(Request: ISRB; RaiseExceptionOnError: boolean=true) :IServiceQueryResults; overload; |
1359 |
> |
end; |
1360 |
> |
|
1361 |
> |
{Tbe Firebird Library API used to get information about the Firebird library} |
1362 |
> |
|
1363 |
> |
|
1364 |
> |
IFirebirdLibrary = interface |
1365 |
> |
['{3c04e0a1-12e0-428a-b2e1-bc6fcd97b79b}'] |
1366 |
> |
function GetHandle: TLibHandle; |
1367 |
> |
function GetLibraryName: string; |
1368 |
> |
function GetLibraryFilePath: string; |
1369 |
> |
function GetFirebirdAPI: IFirebirdAPI; |
1370 |
|
end; |
1371 |
|
|
1372 |
|
{The Firebird API. |
1377 |
|
The interface is returned by the FirebirdAPI function. |
1378 |
|
} |
1379 |
|
|
1380 |
+ |
{ IFirebirdAPI } |
1381 |
+ |
|
1382 |
|
IFirebirdAPI = interface |
1383 |
|
['{edeee691-c8d3-4dcf-a780-cd7e432821d5}'] |
1384 |
|
{Database connections} |
1390 |
|
{Start Transaction against multiple databases} |
1391 |
|
function AllocateTPB: ITPB; |
1392 |
|
function StartTransaction(Attachments: array of IAttachment; |
1393 |
< |
TPB: array of byte; DefaultCompletion: TTransactionCompletion=taCommit): ITransaction; overload; |
1393 |
> |
TPB: array of byte; DefaultCompletion: TTransactionCompletion=taCommit; |
1394 |
> |
aName: AnsiString=''): ITransaction; overload; |
1395 |
|
function StartTransaction(Attachments: array of IAttachment; |
1396 |
< |
TPB: ITPB; DefaultCompletion: TTransactionCompletion=taCommit): ITransaction; overload; |
1396 |
> |
TPB: ITPB; DefaultCompletion: TTransactionCompletion=taCommit; |
1397 |
> |
aName: AnsiString=''): ITransaction; overload; |
1398 |
|
|
1399 |
|
{Service Manager} |
1400 |
|
function HasServiceAPI: boolean; |
1401 |
|
function AllocateSPB: ISPB; |
1402 |
< |
function GetServiceManager(ServerName: AnsiString; Protocol: TProtocol; SPB: ISPB): IServiceManager; |
1402 |
> |
function GetServiceManager(ServerName: AnsiString; Protocol: TProtocol; SPB: ISPB): IServiceManager; overload; |
1403 |
> |
function GetServiceManager(ServerName: AnsiString; Port: AnsiString; Protocol: TProtocol; SPB: ISPB): IServiceManager; overload; |
1404 |
|
|
1405 |
|
{Information} |
1406 |
|
function GetStatus: IStatus; |
1086 |
– |
function GetLibraryName: string; |
1407 |
|
function HasRollbackRetaining: boolean; |
1408 |
|
function IsEmbeddedServer: boolean; |
1409 |
|
function GetImplementationVersion: AnsiString; |
1410 |
+ |
function GetClientMajor: integer; |
1411 |
+ |
function GetClientMinor: integer; |
1412 |
+ |
function HasDecFloatSupport: boolean; |
1413 |
+ |
function HasLocalTZDB: boolean; |
1414 |
+ |
function HasTimeZoneSupport: boolean; |
1415 |
+ |
function HasExtendedTZSupport: boolean; |
1416 |
|
|
1417 |
|
{Firebird 3 API} |
1418 |
|
function HasMasterIntf: boolean; |
1419 |
< |
function GetIMaster: TObject; |
1419 |
> |
function GetIMaster: TObject; deprecated 'Use FirebirdAPI.QueryInterface and FBClientLib.pas IFBIMasterProvider instead'; |
1420 |
> |
function GetFBLibrary: IFirebirdLibrary; |
1421 |
|
end; |
1422 |
|
|
1423 |
|
type |
1452 |
|
{IB Client Exceptions} |
1453 |
|
EIBClientError = class(EIBError); |
1454 |
|
|
1455 |
< |
{IBError is used internally and by IBX to throw an EIBClientError} |
1456 |
< |
|
1130 |
< |
procedure IBError(ErrMess: TIBClientError; const Args: array of const); |
1455 |
> |
{Used to explicitly report a Batch Buffer overflow} |
1456 |
> |
EIBBatchBufferOverflow = class(EIBError); |
1457 |
|
|
1458 |
|
{The Firebird API function is used to access the IFirebirdAPI interface. |
1459 |
|
|
1464 |
|
function FirebirdAPI: IFirebirdAPI; |
1465 |
|
|
1466 |
|
{IBX support functions. Probably best ignored i.e. always used the FirebirdAPI |
1467 |
< |
functino to load the library and check if it's loaded.} |
1467 |
> |
function to load the library and check if it's loaded.} |
1468 |
|
|
1469 |
|
function TryIBLoad: Boolean; |
1470 |
|
procedure CheckIBLoaded; |
1471 |
|
|
1472 |
+ |
{If you want to explicitly load the Firebird library from a |
1473 |
+ |
non-default location then use this function and its GetFirebirdAPI function |
1474 |
+ |
to get the API.} |
1475 |
+ |
|
1476 |
+ |
function LoadFBLibrary(aLibPathName: string): IFirebirdLibrary; |
1477 |
+ |
|
1478 |
+ |
{$if not declared(NULL)} {Needed for Delphi} |
1479 |
+ |
function Null: Variant; // Null standard constant |
1480 |
+ |
{$define NEEDNULLFUNCTION} |
1481 |
+ |
{$ifend} |
1482 |
+ |
|
1483 |
|
implementation |
1484 |
|
|
1485 |
< |
uses FBClientAPI |
1485 |
> |
uses FBClientAPI {$if not declared(NULL)}, Variants {$ifend} |
1486 |
|
{$IFDEF USELEGACYFIREBIRDAPI}, FB25ClientAPI {$ENDIF} |
1487 |
|
{$IFDEF USEFIREBIRD3API}, FB30ClientAPI {$ENDIF}; |
1488 |
|
|
1489 |
< |
var FFirebirdAPI: IFirebirdAPI; |
1489 |
> |
var FDefaultFBLibrary: IFirebirdLibrary; |
1490 |
> |
|
1491 |
> |
type |
1492 |
> |
|
1493 |
> |
{ TFBLibrary } |
1494 |
> |
|
1495 |
> |
TFBLibraryImpl = class(TFBLibrary) |
1496 |
> |
protected |
1497 |
> |
function GetFirebird3API: IFirebirdAPI; override; |
1498 |
> |
function GetLegacyFirebirdAPI: IFirebirdAPI; override; |
1499 |
> |
end; |
1500 |
> |
|
1501 |
> |
function TFBLibraryImpl.GetFirebird3API: IFirebirdAPI; |
1502 |
> |
begin |
1503 |
> |
{$IFDEF USEFIREBIRD3API} |
1504 |
> |
Result := TFB30ClientAPI.Create(self); |
1505 |
> |
{$ELSE} |
1506 |
> |
Result := nil; |
1507 |
> |
{$ENDIF} |
1508 |
> |
end; |
1509 |
> |
|
1510 |
> |
function TFBLibraryImpl.GetLegacyFirebirdAPI: IFirebirdAPI; |
1511 |
> |
begin |
1512 |
> |
{$IFDEF USELEGACYFIREBIRDAPI} |
1513 |
> |
Result := TFB25ClientAPI.Create(self); |
1514 |
> |
{$ELSE} |
1515 |
> |
Result := nil; |
1516 |
> |
{$ENDIF} |
1517 |
> |
end; |
1518 |
|
|
1519 |
|
function FirebirdAPI: IFirebirdAPI; |
1520 |
|
begin |
1521 |
< |
if FFirebirdAPI = nil then |
1521 |
> |
if FDefaultFBLibrary = nil then |
1522 |
|
CheckIBLoaded; |
1523 |
< |
Result := FFirebirdAPI; |
1523 |
> |
Result := FDefaultFBLibrary.GetFirebirdAPI; |
1524 |
|
end; |
1525 |
|
|
1526 |
|
function TryIBLoad: Boolean; |
1527 |
+ |
var fblib: IFirebirdLibrary; |
1528 |
|
begin |
1529 |
< |
Result := FFirebirdAPI <> nil; |
1529 |
> |
Result := FDefaultFBLibrary <> nil; |
1530 |
|
try |
1165 |
– |
{$IFDEF USEFIREBIRD3API} |
1166 |
– |
if not Result then |
1167 |
– |
begin |
1168 |
– |
FFirebirdAPI := TFB30ClientAPI.Create; |
1169 |
– |
Result := FFirebirdAPI.HasMasterIntf; |
1170 |
– |
end; |
1171 |
– |
{$ENDIF} |
1172 |
– |
{$IFDEF USELEGACYFIREBIRDAPI} |
1531 |
|
if not Result then |
1532 |
|
begin |
1533 |
< |
FFirebirdAPI := nil; |
1534 |
< |
FFirebirdAPI := TFB25ClientAPI.Create; |
1535 |
< |
Result := true; |
1536 |
< |
end; |
1179 |
< |
{$ENDIF} |
1180 |
< |
if Result and not (FFirebirdAPI as TFBClientAPI).IsLibraryLoaded then |
1181 |
< |
begin |
1182 |
< |
Result := false; |
1183 |
< |
FFirebirdAPI := nil; |
1533 |
> |
fblib := TFBLibraryImpl.Create; |
1534 |
> |
if (fblib <> nil) and (fblib.GetFirebirdAPI <> nil) then |
1535 |
> |
FDefaultFBLibrary := fblib; |
1536 |
> |
Result := FDefaultFBLibrary <> nil; |
1537 |
|
end; |
1538 |
|
except |
1539 |
|
SysUtils.showexception(ExceptObject,ExceptAddr); |
1547 |
|
IBError(ibxeInterBaseMissing, [nil]); |
1548 |
|
end; |
1549 |
|
|
1550 |
+ |
function LoadFBLibrary(aLibPathName: string): IFirebirdLibrary; |
1551 |
+ |
var fblib: IFirebirdLibrary; |
1552 |
+ |
begin |
1553 |
+ |
if trim(aLibPathName) = '' then |
1554 |
+ |
begin |
1555 |
+ |
CheckIBLoaded; |
1556 |
+ |
Result := FDefaultFBLibrary; |
1557 |
+ |
end |
1558 |
+ |
else |
1559 |
+ |
begin |
1560 |
+ |
fblib := TFBLibraryImpl.GetFBLibrary(aLibPathName); |
1561 |
+ |
if (fblib = nil) or (fblib.GetFirebirdAPI = nil) then |
1562 |
+ |
IBError(ibxeInterBaseMissing, [nil]); |
1563 |
+ |
Result := fblib; |
1564 |
+ |
end; |
1565 |
+ |
end; |
1566 |
+ |
|
1567 |
|
{ EIBError } |
1568 |
|
|
1569 |
|
constructor EIBError.Create(ASQLCode: Long; Msg: AnsiString); |
1587 |
|
FIBErrorCode := AIBErrorCode; |
1588 |
|
end; |
1589 |
|
|
1590 |
< |
procedure IBError(ErrMess: TIBClientError; const Args: array of const); |
1591 |
< |
begin |
1592 |
< |
raise EIBClientError.Create(Ord(ErrMess), |
1593 |
< |
Format(GetErrorMessage(ErrMess), Args)); |
1594 |
< |
end; |
1590 |
> |
{$ifdef NEEDNULLFUNCTION} |
1591 |
> |
function Null: Variant; // Null standard constant |
1592 |
> |
begin |
1593 |
> |
VarClearProc(TVarData(Result)); |
1594 |
> |
TVarData(Result).VType := varnull; |
1595 |
> |
end; |
1596 |
> |
{$endif} |
1597 |
|
|
1598 |
|
initialization |
1599 |
< |
FFirebirdAPI := nil; |
1599 |
> |
FDefaultFBLibrary := nil; |
1600 |
|
|
1601 |
+ |
finalization |
1602 |
+ |
FDefaultFBLibrary := nil; |
1603 |
|
|
1604 |
|
end. |
1605 |
|
|