134 |
|
const |
135 |
|
{Interface version information} |
136 |
|
FBIntf_Major = 1; |
137 |
< |
FBIntf_Minor = 3; |
138 |
< |
FBIntf_Release = 2; |
139 |
< |
FBIntf_Version = '1.3.2'; |
137 |
> |
FBIntf_Minor = 4; |
138 |
> |
FBIntf_Release = 0; |
139 |
> |
FBIntf_Version = '1.4.0'; |
140 |
|
|
141 |
|
const |
142 |
|
{DPB, TPB and SPB Parameter Block Name Prefixes} |
248 |
|
ITransaction = interface; |
249 |
|
IStatement = interface; |
250 |
|
|
251 |
+ |
{The IFBNumeric interface provides a managed type for Fixed Point integers |
252 |
+ |
used to hold Firebird Numeric(m,n) types} |
253 |
+ |
|
254 |
+ |
IFBNumeric = interface |
255 |
+ |
['{8bdccfe9-d552-446b-bd82-844ca264455d}'] |
256 |
+ |
function getRawValue: Int64; |
257 |
+ |
function getScale: integer; |
258 |
+ |
function AdjustScaleTo(aNewScale: integer): IFBNumeric; |
259 |
+ |
function getAsString: AnsiString; |
260 |
+ |
function getAsDouble: double; |
261 |
+ |
function getAsBCD: TBCD; |
262 |
+ |
function getAsInt64: Int64; {scaled} |
263 |
+ |
function getAsInteger: integer; {scaled - may be truncated} |
264 |
+ |
function getAsSmallInt: SmallInt; {scaled - may be truncated} |
265 |
+ |
function getAsCurrency: Currency; |
266 |
+ |
end; |
267 |
+ |
|
268 |
|
{The IParameterBlock interface provides the template for all parameter |
269 |
|
block interfaces} |
270 |
|
|
322 |
|
|
323 |
|
IStatus = interface |
324 |
|
['{34167722-af38-4831-b08a-93162d58ede3}'] |
325 |
+ |
function InErrorState: boolean; |
326 |
|
function GetIBErrorCode: TStatusCode; |
327 |
|
function Getsqlcode: TStatusCode; |
328 |
|
function GetMessage: AnsiString; |
329 |
|
function CheckStatusVector(ErrorCodes: array of TFBStatusCode): Boolean; |
330 |
|
function GetIBDataBaseErrorMessages: TIBDataBaseErrorMessages; |
331 |
+ |
function Clone: IStatus; |
332 |
|
procedure SetIBDataBaseErrorMessages(Value: TIBDataBaseErrorMessages); |
333 |
|
end; |
334 |
|
|
519 |
|
function GetDateTimeStrLength(DateTimeFormat: TIBDateTimeFormats): integer; |
520 |
|
function GetStatement: IStatement; |
521 |
|
function GetTransaction: ITransaction; |
522 |
+ |
function GetAttachment: IAttachment; |
523 |
|
property Name: AnsiString read GetName; |
524 |
|
property Size: cardinal read GetSize; |
525 |
|
property SQLType: cardinal read GetSQLType; |
586 |
|
function GetAsBlob(BPB: IBPB): IBlob; overload; |
587 |
|
function GetAsArray: IArray; |
588 |
|
function GetAsBCD: tBCD; |
589 |
+ |
function GetAsNumeric: IFBNumeric; |
590 |
|
property AsDate: TDateTime read GetAsDateTime; |
591 |
|
property AsBoolean:boolean read GetAsBoolean; |
592 |
|
property AsTime: TDateTime read GetAsDateTime; |
605 |
|
property AsBlob: IBlob read GetAsBlob; |
606 |
|
property AsArray: IArray read GetAsArray; |
607 |
|
property AsBCD: tBCD read GetAsBCD; |
608 |
+ |
property AsNumeric: IFBNumeric read GetAsNumeric; |
609 |
|
property IsNull: Boolean read GetIsNull; |
610 |
|
property Value: Variant read GetAsVariant; |
611 |
|
end; |
621 |
|
function getCount: integer; |
622 |
|
function GetStatement: IStatement; |
623 |
|
function GetTransaction: ITransaction; |
624 |
+ |
function GetAttachment: IAttachment; |
625 |
+ |
function FieldExists(Idx: AnsiString): boolean; |
626 |
|
function ByName(Idx: AnsiString): ISQLData; |
627 |
|
function getSQLData(index: integer): ISQLData; |
628 |
|
procedure GetData(index: integer; var IsNull:boolean; var len: short; var data: PByte); |
684 |
|
ISQLParam = interface(IParamMetaData) |
685 |
|
['{b22b4578-6d41-4807-a9a9-d2ec8d1d5a14}'] |
686 |
|
function getColMetadata: IParamMetaData; |
687 |
+ |
function GetStatement: IStatement; |
688 |
+ |
function GetTransaction: ITransaction; |
689 |
+ |
function GetAttachment: IAttachment; |
690 |
|
function GetIndex: integer; |
691 |
|
function getName: AnsiString; |
692 |
|
function GetAsBoolean: boolean; |
712 |
|
function GetAsBlob: IBlob; |
713 |
|
function GetAsArray: IArray; |
714 |
|
function GetAsBCD: tBCD; |
715 |
< |
function GetStatement: IStatement; |
689 |
< |
function GetTransaction: ITransaction; |
715 |
> |
function GetAsNumeric: IFBNumeric; |
716 |
|
procedure Clear; |
717 |
|
function GetModified: boolean; |
718 |
|
procedure SetAsBoolean(AValue: boolean); |
741 |
|
procedure SetAsQuad(aValue: TISC_QUAD); |
742 |
|
procedure SetCharSetID(aValue: cardinal); |
743 |
|
procedure SetAsBcd(aValue: tBCD); |
744 |
+ |
procedure SetAsNumeric(Value: IFBNumeric); |
745 |
|
property AsDate: TDateTime read GetAsDateTime write SetAsDate; |
746 |
|
property AsBoolean:boolean read GetAsBoolean write SetAsBoolean; |
747 |
|
property AsTime: TDateTime read GetAsDateTime write SetAsTime; |
759 |
|
property AsBlob: IBlob read GetAsBlob write SetAsBlob; |
760 |
|
property AsArray: IArray read GetAsArray write SetAsArray; |
761 |
|
property AsBCD: tBCD read GetAsBCD write SetAsBCD; |
762 |
+ |
property AsNumeric: IFBNumeric read GetAsNumeric write SetAsNumeric; |
763 |
|
property AsQuad: TISC_QUAD read GetAsQuad write SetAsQuad; |
764 |
|
property Value: Variant read GetAsVariant write SetAsVariant; |
765 |
|
property IsNull: Boolean read GetIsNull write SetIsNull; |
773 |
|
for the input to an SQL Statement |
774 |
|
} |
775 |
|
|
776 |
+ |
{ ISQLParams } |
777 |
+ |
|
778 |
|
ISQLParams = interface |
779 |
|
['{c6d95ac7-b2b7-461b-b890-afef0acbb077}'] |
780 |
|
function getCount: integer; |
781 |
|
function getSQLParam(index: integer): ISQLParam; |
782 |
+ |
function ParamExists(Idx: AnsiString): boolean; |
783 |
|
function ByName(Idx: AnsiString): ISQLParam ; |
784 |
|
function GetModified: Boolean; |
785 |
|
function GetHasCaseSensitiveParams: Boolean; |
786 |
+ |
function GetStatement: IStatement; |
787 |
+ |
function GetTransaction: ITransaction; |
788 |
+ |
function GetAttachment: IAttachment; |
789 |
+ |
procedure Clear; |
790 |
|
property Modified: Boolean read GetModified; |
791 |
|
property Params[index: integer]: ISQLParam read getSQLParam; default; |
792 |
|
property Count: integer read getCount; |
816 |
|
initially prepared. The interface is returned from the IAttachment interface. |
817 |
|
} |
818 |
|
|
819 |
+ |
TStatementFlag = (stHasCursor,stRepeatExecute,stScrollable); |
820 |
+ |
TStatementFlags = set of TStatementFlag; |
821 |
+ |
|
822 |
|
IStatement = interface |
823 |
|
['{a260576d-a07d-4a66-b02d-1b72543fd7cf}'] |
824 |
|
function GetMetaData: IMetaData; {Output Metadata} |
830 |
|
function GetSQLText: AnsiString; |
831 |
|
function GetProcessedSQLText: AnsiString; |
832 |
|
function GetSQLDialect: integer; |
833 |
+ |
function GetFlags: TStatementFlags; |
834 |
|
function IsPrepared: boolean; |
835 |
|
function HasBatchMode: boolean; |
836 |
|
function IsInBatchMode: boolean; |
860 |
|
property SQLStatementType: TIBSQLStatementTypes read GetSQLStatementType; |
861 |
|
end; |
862 |
|
|
863 |
+ |
ITrInfoItem = interface |
864 |
+ |
['{41455e1a-f84e-4e26-aff0-1a78e8b69cfe}'] |
865 |
+ |
function getItemType: byte; |
866 |
+ |
function getSize: integer; |
867 |
+ |
function getAsString: AnsiString; |
868 |
+ |
function getAsInteger: int64; |
869 |
+ |
procedure DecodeTraIsolation(var IsolationType, RecVersion: byte); |
870 |
+ |
end; |
871 |
+ |
|
872 |
+ |
{ ITrInformation } |
873 |
+ |
|
874 |
+ |
ITrInformation = interface |
875 |
+ |
['{e6ea4a52-c1a1-44ba-9609-c8bcc7cba7b2}'] |
876 |
+ |
function GetCount: integer; |
877 |
+ |
function GetItem(index: integer): ITrInfoItem; |
878 |
+ |
function Find(ItemType: byte): ITrInfoItem; |
879 |
+ |
procedure PrintBuf; {can be used to print buffer in hex for debugging} |
880 |
+ |
property Count: integer read GetCount; |
881 |
+ |
property Items[index: integer]: ITrInfoItem read getItem; default; |
882 |
+ |
end; |
883 |
+ |
|
884 |
|
{Transaction Parameter Block: (TPB) |
885 |
|
|
886 |
|
The TPB provides the parameters used when starting a transaction. It is allocated |
894 |
|
|
895 |
|
ITPBItem = interface(IParameterBlockItemWithTypeName) |
896 |
|
['{544c1f2b-7c12-4a87-a4a5-face7ea72671}'] |
837 |
– |
function getParamTypeName: AnsiString; |
897 |
|
end; |
898 |
|
|
899 |
|
ITPB = interface(IParameterBlockWithTypeNames<ITPBItem>) |
900 |
|
['{7369b0ff-defe-437b-81fe-19b211d42d25}'] |
901 |
+ |
function AsText: AnsiString; |
902 |
|
end; |
903 |
|
|
904 |
|
{The ITransactionAction interface provides access to a Transaction once it |
911 |
|
|
912 |
|
TTransactionAction = (TARollback, TACommit, TACommitRetaining, TARollbackRetaining); |
913 |
|
TTransactionCompletion = TARollback.. TACommit; |
914 |
+ |
TTrCompletionState = (trCommitted, trRolledback, trCommitFailed, trRollbackFailed); |
915 |
+ |
|
916 |
|
|
917 |
|
ITransaction = interface |
918 |
|
['{30928d0e-a9d7-4c61-b7cf-14f4f38abe2a}'] |
919 |
|
function getTPB: ITPB; |
920 |
|
procedure Start(DefaultCompletion: TTransactionCompletion=taCommit); |
921 |
|
function GetInTransaction: boolean; |
922 |
+ |
function GetIsReadOnly: boolean; |
923 |
+ |
function GetTransactionID: integer; |
924 |
+ |
function GetJournalingActive(attachment: IAttachment): boolean; |
925 |
+ |
function GetDefaultCompletion: TTransactionCompletion; |
926 |
|
procedure PrepareForCommit; {Two phase commit - stage 1} |
927 |
< |
procedure Commit(Force: boolean=false); |
927 |
> |
function Commit(Force: boolean=false): TTrCompletionState; |
928 |
|
procedure CommitRetaining; |
929 |
|
function HasActivity: boolean; |
930 |
< |
procedure Rollback(Force: boolean=false); |
930 |
> |
function Rollback(Force: boolean=false): TTrCompletionState; |
931 |
|
procedure RollbackRetaining; |
932 |
|
function GetAttachmentCount: integer; |
933 |
|
function GetAttachment(index: integer): IAttachment; |
934 |
+ |
function GetTrInformation(Requests: array of byte): ITrInformation; overload; |
935 |
+ |
function GetTrInformation(Request: byte): ITrInformation; overload; |
936 |
+ |
function GetTransactionName: AnsiString; |
937 |
+ |
procedure SetTransactionName(aValue: AnsiString); |
938 |
|
property InTransaction: boolean read GetInTransaction; |
939 |
+ |
property TransactionName: AnsiString read GetTransactionName write SetTransactionName; |
940 |
|
end; |
941 |
|
|
942 |
|
{ The IEvents Interface is used to handle events from a single database. The |
966 |
|
['{6a0be233-ed08-4524-889c-2e45d0c20e5f}'] |
967 |
|
procedure GetEvents(EventNames: TStrings); |
968 |
|
procedure SetEvents(EventNames: TStrings); overload; |
969 |
< |
procedure SetEvents(EventName: AnsiString); overload; |
969 |
> |
procedure SetEvents(EventName: string); overload; |
970 |
|
procedure Cancel; |
971 |
|
function ExtractEventCounts: TEventCounts; |
972 |
|
procedure WaitForEvent; |
1099 |
|
['{e676067b-1cf4-4eba-9256-9724f57e0d16}'] |
1100 |
|
end; |
1101 |
|
|
1102 |
+ |
{Journaling options. Default is [joReadWriteTransactions,joModifyQueries] } |
1103 |
+ |
|
1104 |
+ |
TJournalOption = (joReadOnlyTransactions, joReadWriteTransactions, |
1105 |
+ |
joModifyQueries, joReadOnlyQueries,joNoServerTable); |
1106 |
+ |
|
1107 |
+ |
TJournalOptions = set of TJournalOption; |
1108 |
+ |
|
1109 |
|
{The IAttachment interface provides access to a Database Connection. It may be |
1110 |
|
used to: |
1111 |
|
|
1143 |
|
procedure Disconnect(Force: boolean=false); |
1144 |
|
function IsConnected: boolean; |
1145 |
|
procedure DropDatabase; |
1146 |
< |
function StartTransaction(TPB: array of byte; DefaultCompletion: TTransactionCompletion=taCommit): ITransaction; overload; |
1147 |
< |
function StartTransaction(TPB: ITPB; DefaultCompletion: TTransactionCompletion=taCommit): ITransaction; overload; |
1146 |
> |
function StartTransaction(TPB: array of byte; |
1147 |
> |
DefaultCompletion: TTransactionCompletion=taCommit; |
1148 |
> |
aName: AnsiString=''): ITransaction; overload; |
1149 |
> |
function StartTransaction(TPB: ITPB; |
1150 |
> |
DefaultCompletion: TTransactionCompletion=taCommit; |
1151 |
> |
aName: AnsiString=''): ITransaction; overload; |
1152 |
|
procedure ExecImmediate(transaction: ITransaction; sql: AnsiString; SQLDialect: integer); overload; |
1153 |
|
procedure ExecImmediate(TPB: array of byte; sql: AnsiString; SQLDialect: integer); overload; |
1154 |
|
procedure ExecImmediate(transaction: ITransaction; sql: AnsiString); overload; |
1219 |
|
|
1220 |
|
{Database Information} |
1221 |
|
function GetSQLDialect: integer; |
1222 |
+ |
function GetAttachmentID: integer; |
1223 |
|
function GetBlobMetaData(Transaction: ITransaction; tableName, columnName: AnsiString): IBlobMetaData; |
1224 |
|
function GetArrayMetaData(Transaction: ITransaction; tableName, columnName: AnsiString): IArrayMetaData; |
1225 |
|
function GetDBInformation(Requests: array of byte): IDBInformation; overload; |
1236 |
|
function HasDecFloatSupport: boolean; |
1237 |
|
function HasBatchMode: boolean; |
1238 |
|
function HasScollableCursors: boolean; |
1239 |
+ |
function HasTable(aTableName: AnsiString): boolean; {case sensitive} |
1240 |
+ |
function HasFunction(aFunctionName: AnsiString): boolean; {case sensitive} |
1241 |
+ |
function HasProcedure(aProcName: AnsiString): boolean; {case sensitive} |
1242 |
|
|
1243 |
|
{Character Sets} |
1244 |
+ |
function GetCharSetID: integer; {connection character set} |
1245 |
|
function HasDefaultCharSet: boolean; |
1246 |
|
function GetDefaultCharSetID: integer; |
1247 |
|
function GetCharsetName(CharSetID: integer): AnsiString; |
1255 |
|
{Time Zone Database} |
1256 |
|
function GetTimeZoneServices: ITimeZoneServices; |
1257 |
|
function HasTimeZoneSupport: boolean; |
1258 |
+ |
|
1259 |
+ |
{Client side Journaling} |
1260 |
+ |
function JournalingActive: boolean; |
1261 |
+ |
function GetJournalOptions: TJournalOptions; |
1262 |
+ |
function StartJournaling(aJournalLogFile: AnsiString): integer; overload; |
1263 |
+ |
function StartJournaling(aJournalLogFile: AnsiString; Options: TJournalOptions): integer; overload; |
1264 |
+ |
function StartJournaling(S: TStream; Options: TJournalOptions): integer; overload; |
1265 |
+ |
procedure StopJournaling(RetainJournal: boolean); |
1266 |
|
end; |
1267 |
|
|
1268 |
|
TProtocolAll = (TCP, SPX, NamedPipe, Local, inet, inet4, inet6, wnet, xnet, unknownProtocol); |
1431 |
|
{Start Transaction against multiple databases} |
1432 |
|
function AllocateTPB: ITPB; |
1433 |
|
function StartTransaction(Attachments: array of IAttachment; |
1434 |
< |
TPB: array of byte; DefaultCompletion: TTransactionCompletion=taCommit): ITransaction; overload; |
1434 |
> |
TPB: array of byte; DefaultCompletion: TTransactionCompletion=taCommit; |
1435 |
> |
aName: AnsiString=''): ITransaction; overload; |
1436 |
|
function StartTransaction(Attachments: array of IAttachment; |
1437 |
< |
TPB: ITPB; DefaultCompletion: TTransactionCompletion=taCommit): ITransaction; overload; |
1437 |
> |
TPB: ITPB; DefaultCompletion: TTransactionCompletion=taCommit; |
1438 |
> |
aName: AnsiString=''): ITransaction; overload; |
1439 |
|
|
1440 |
|
{Service Manager} |
1441 |
|
function HasServiceAPI: boolean; |
1484 |
|
EIBInterBaseError = class(EIBError) |
1485 |
|
private |
1486 |
|
FIBErrorCode: Long; |
1487 |
+ |
FStatus: IStatus; |
1488 |
|
public |
1489 |
< |
constructor Create(Status: IStatus); overload; |
1489 |
> |
constructor Create(aStatus: IStatus); overload; |
1490 |
|
constructor Create(ASQLCode: Long; AIBErrorCode: Long; Msg: AnsiString); overload; |
1491 |
|
property IBErrorCode: Long read FIBErrorCode; |
1492 |
+ |
property Status: IStatus read FStatus; |
1493 |
|
end; |
1494 |
|
|
1495 |
|
{IB Client Exceptions} |
1518 |
|
|
1519 |
|
function LoadFBLibrary(aLibPathName: string): IFirebirdLibrary; |
1520 |
|
|
1521 |
+ |
{$if not declared(Null)} {Needed for Delphi} |
1522 |
+ |
function Null: Variant; // Null standard constant |
1523 |
+ |
{$define NEEDNULLFUNCTION} |
1524 |
+ |
{$ifend} |
1525 |
|
|
1526 |
|
implementation |
1527 |
|
|
1528 |
< |
uses FBClientAPI |
1528 |
> |
uses FBClientAPI {$if not declared(NULL)}, Variants {$ifend} |
1529 |
|
{$IFDEF USELEGACYFIREBIRDAPI}, FB25ClientAPI {$ENDIF} |
1530 |
|
{$IFDEF USEFIREBIRD3API}, FB30ClientAPI {$ENDIF}; |
1531 |
|
|
1617 |
|
|
1618 |
|
{ EIBInterBaseError } |
1619 |
|
|
1620 |
< |
constructor EIBInterBaseError.Create(Status: IStatus); |
1620 |
> |
constructor EIBInterBaseError.Create(aStatus: IStatus); |
1621 |
|
begin |
1622 |
< |
inherited Create(Status.Getsqlcode,Status.GetMessage); |
1623 |
< |
FIBErrorCode := Status.GetIBErrorCode; |
1622 |
> |
inherited Create(aStatus.Getsqlcode,aStatus.GetMessage); |
1623 |
> |
FIBErrorCode := aStatus.GetIBErrorCode; |
1624 |
> |
FStatus := aStatus.Clone; |
1625 |
|
end; |
1626 |
|
|
1627 |
|
constructor EIBInterBaseError.Create(ASQLCode: Long; AIBErrorCode: Long; |
1631 |
|
FIBErrorCode := AIBErrorCode; |
1632 |
|
end; |
1633 |
|
|
1634 |
+ |
{$ifdef NEEDNULLFUNCTION} |
1635 |
+ |
function Null: Variant; // Null standard constant |
1636 |
+ |
begin |
1637 |
+ |
VarClearProc(TVarData(Result)); |
1638 |
+ |
TVarData(Result).VType := varnull; |
1639 |
+ |
end; |
1640 |
+ |
{$endif} |
1641 |
|
|
1642 |
|
initialization |
1643 |
|
FDefaultFBLibrary := nil; |