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

Comparing:
ibx/trunk/fbintf/IB.pas (file contents), Revision 352 by tony, Thu Oct 21 12:17:43 2021 UTC vs.
ibx/branches/udr/client/IB.pas (file contents), Revision 386 by tony, Tue Jan 18 12:05:35 2022 UTC

# Line 134 | Line 134 | uses
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}
# Line 248 | Line 248 | type
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  
# Line 310 | Line 327 | type
327      function GetMessage: AnsiString;
328      function CheckStatusVector(ErrorCodes: array of TFBStatusCode): Boolean;
329      function GetIBDataBaseErrorMessages: TIBDataBaseErrorMessages;
330 +    function Clone: IStatus;
331      procedure SetIBDataBaseErrorMessages(Value: TIBDataBaseErrorMessages);
332    end;
333  
# Line 500 | Line 518 | type
518      function GetDateTimeStrLength(DateTimeFormat: TIBDateTimeFormats): integer;
519      function GetStatement: IStatement;
520      function GetTransaction: ITransaction;
521 +    function GetAttachment: IAttachment;
522      property Name: AnsiString read GetName;
523      property Size: cardinal read GetSize;
524      property SQLType: cardinal read GetSQLType;
# Line 566 | Line 585 | type
585      function GetAsBlob(BPB: IBPB): IBlob; overload;
586      function GetAsArray: IArray;
587      function GetAsBCD: tBCD;
588 +    function GetAsNumeric: IFBNumeric;
589      property AsDate: TDateTime read GetAsDateTime;
590      property AsBoolean:boolean read GetAsBoolean;
591      property AsTime: TDateTime read GetAsDateTime;
# Line 584 | Line 604 | type
604      property AsBlob: IBlob read GetAsBlob;
605      property AsArray: IArray read GetAsArray;
606      property AsBCD: tBCD read GetAsBCD;
607 +    property AsNumeric: IFBNumeric read GetAsNumeric;
608      property IsNull: Boolean read GetIsNull;
609      property Value: Variant read GetAsVariant;
610    end;
# Line 599 | Line 620 | type
620     function getCount: integer;
621     function GetStatement: IStatement;
622     function GetTransaction: ITransaction;
623 +   function GetAttachment: IAttachment;
624     function ByName(Idx: AnsiString): ISQLData;
625     function getSQLData(index: integer): ISQLData;
626     procedure GetData(index: integer; var IsNull:boolean; var len: short; var data: PByte);
# Line 660 | Line 682 | type
682    ISQLParam = interface(IParamMetaData)
683      ['{b22b4578-6d41-4807-a9a9-d2ec8d1d5a14}']
684      function getColMetadata: IParamMetaData;
685 +    function GetStatement: IStatement;
686 +    function GetTransaction: ITransaction;
687 +    function GetAttachment: IAttachment;
688      function GetIndex: integer;
689      function getName: AnsiString;
690      function GetAsBoolean: boolean;
# Line 685 | Line 710 | type
710      function GetAsBlob: IBlob;
711      function GetAsArray: IArray;
712      function GetAsBCD: tBCD;
713 <    function GetStatement: IStatement;
689 <    function GetTransaction: ITransaction;
713 >    function GetAsNumeric: IFBNumeric;
714      procedure Clear;
715      function GetModified: boolean;
716      procedure SetAsBoolean(AValue: boolean);
# Line 715 | Line 739 | type
739      procedure SetAsQuad(aValue: TISC_QUAD);
740      procedure SetCharSetID(aValue: cardinal);
741      procedure SetAsBcd(aValue: tBCD);
742 +    procedure SetAsNumeric(Value: IFBNumeric);
743      property AsDate: TDateTime read GetAsDateTime write SetAsDate;
744      property AsBoolean:boolean read GetAsBoolean write SetAsBoolean;
745      property AsTime: TDateTime read GetAsDateTime write SetAsTime;
# Line 732 | Line 757 | type
757      property AsBlob: IBlob read GetAsBlob write SetAsBlob;
758      property AsArray: IArray read GetAsArray write SetAsArray;
759      property AsBCD: tBCD read GetAsBCD write SetAsBCD;
760 +    property AsNumeric: IFBNumeric read GetAsNumeric write SetAsNumeric;
761      property AsQuad: TISC_QUAD read GetAsQuad write SetAsQuad;
762      property Value: Variant read GetAsVariant write SetAsVariant;
763      property IsNull: Boolean read GetIsNull write SetIsNull;
# Line 752 | Line 778 | type
778      function ByName(Idx: AnsiString): ISQLParam ;
779      function GetModified: Boolean;
780      function GetHasCaseSensitiveParams: Boolean;
781 +    function GetStatement: IStatement;
782 +    function GetTransaction: ITransaction;
783 +    function GetAttachment: IAttachment;
784 +    procedure Clear;
785      property Modified: Boolean read GetModified;
786      property Params[index: integer]: ISQLParam read getSQLParam; default;
787      property Count: integer read getCount;
# Line 781 | Line 811 | type
811     initially prepared. The interface is returned from the IAttachment interface.
812     }
813  
814 +  TStatementFlag = (stHasCursor,stRepeatExecute,stScrollable);
815 +  TStatementFlags = set of TStatementFlag;
816 +
817    IStatement = interface
818      ['{a260576d-a07d-4a66-b02d-1b72543fd7cf}']
819      function GetMetaData: IMetaData;  {Output Metadata}
# Line 792 | Line 825 | type
825      function GetSQLText: AnsiString;
826      function GetProcessedSQLText: AnsiString;
827      function GetSQLDialect: integer;
828 +    function GetFlags: TStatementFlags;
829      function IsPrepared: boolean;
830      function HasBatchMode: boolean;
831      function IsInBatchMode: boolean;
# Line 821 | Line 855 | type
855      property SQLStatementType: TIBSQLStatementTypes read GetSQLStatementType;
856    end;
857  
858 +  ITrInfoItem = interface
859 +    ['{41455e1a-f84e-4e26-aff0-1a78e8b69cfe}']
860 +    function getItemType: byte;
861 +    function getSize: integer;
862 +    function getAsString: AnsiString;
863 +    function getAsInteger: int64;
864 +    procedure DecodeTraIsolation(var IsolationType, RecVersion: byte);
865 +  end;
866 +
867 +  { ITrInformation }
868 +
869 +  ITrInformation = interface
870 +    ['{e6ea4a52-c1a1-44ba-9609-c8bcc7cba7b2}']
871 +    function GetCount: integer;
872 +    function GetItem(index: integer): ITrInfoItem;
873 +    function Find(ItemType: byte): ITrInfoItem;
874 +    procedure PrintBuf; {can be used to print buffer in hex for debugging}
875 +    property Count: integer read GetCount;
876 +    property Items[index: integer]: ITrInfoItem read getItem; default;
877 +  end;
878 +
879    {Transaction Parameter Block: (TPB)
880  
881     The TPB provides the parameters used when starting a transaction. It is allocated
# Line 834 | Line 889 | type
889  
890    ITPBItem = interface(IParameterBlockItemWithTypeName)
891      ['{544c1f2b-7c12-4a87-a4a5-face7ea72671}']
837    function getParamTypeName: AnsiString;
892    end;
893  
894    ITPB = interface(IParameterBlockWithTypeNames<ITPBItem>)
895      ['{7369b0ff-defe-437b-81fe-19b211d42d25}']
896 +    function AsText: AnsiString;
897    end;
898  
899    {The ITransactionAction interface provides access to a Transaction once it
# Line 857 | Line 912 | type
912      function getTPB: ITPB;
913      procedure Start(DefaultCompletion: TTransactionCompletion=taCommit);
914      function GetInTransaction: boolean;
915 +    function GetIsReadOnly: boolean;
916 +    function GetTransactionID: integer;
917 +    function GetJournalingActive(attachment: IAttachment): boolean;
918 +    function GetDefaultCompletion: TTransactionCompletion;
919      procedure PrepareForCommit; {Two phase commit - stage 1}
920      procedure Commit(Force: boolean=false);
921      procedure CommitRetaining;
# Line 865 | Line 924 | type
924      procedure RollbackRetaining;
925      function GetAttachmentCount: integer;
926      function GetAttachment(index: integer): IAttachment;
927 +    function GetTrInformation(Requests: array of byte): ITrInformation; overload;
928 +    function GetTrInformation(Request: byte): ITrInformation; overload;
929 +    function GetTransactionName: AnsiString;
930 +    procedure SetTransactionName(aValue: AnsiString);
931      property InTransaction: boolean read GetInTransaction;
932 +    property TransactionName: AnsiString read GetTransactionName write SetTransactionName;
933    end;
934  
935    { The IEvents Interface is used to handle events from a single database. The
# Line 895 | Line 959 | type
959      ['{6a0be233-ed08-4524-889c-2e45d0c20e5f}']
960      procedure GetEvents(EventNames: TStrings);
961      procedure SetEvents(EventNames: TStrings); overload;
962 <    procedure SetEvents(EventName: AnsiString); overload;
962 >    procedure SetEvents(EventName: string); overload;
963      procedure Cancel;
964      function ExtractEventCounts: TEventCounts;
965      procedure WaitForEvent;
# Line 1028 | Line 1092 | type
1092       ['{e676067b-1cf4-4eba-9256-9724f57e0d16}']
1093     end;
1094  
1095 +   {Journaling options. Default is [joReadWriteTransactions,joModifyQueries] }
1096 +
1097 +   TJournalOption = (joReadOnlyTransactions, joReadWriteTransactions,
1098 +                     joModifyQueries, joReadOnlyQueries,joNoServerTable);
1099 +
1100 +   TJournalOptions = set of TJournalOption;
1101 +
1102    {The IAttachment interface provides access to a Database Connection. It may be
1103     used to:
1104  
# Line 1065 | Line 1136 | type
1136      procedure Disconnect(Force: boolean=false);
1137      function IsConnected: boolean;
1138      procedure DropDatabase;
1139 <    function StartTransaction(TPB: array of byte; DefaultCompletion: TTransactionCompletion=taCommit): ITransaction; overload;
1140 <    function StartTransaction(TPB: ITPB; DefaultCompletion: TTransactionCompletion=taCommit): ITransaction; overload;
1139 >    function StartTransaction(TPB: array of byte;
1140 >                              DefaultCompletion: TTransactionCompletion=taCommit;
1141 >                              aName: AnsiString=''): ITransaction; overload;
1142 >    function StartTransaction(TPB: ITPB;
1143 >                              DefaultCompletion: TTransactionCompletion=taCommit;
1144 >                              aName: AnsiString=''): ITransaction; overload;
1145      procedure ExecImmediate(transaction: ITransaction; sql: AnsiString; SQLDialect: integer); overload;
1146      procedure ExecImmediate(TPB: array of byte; sql: AnsiString; SQLDialect: integer); overload;
1147      procedure ExecImmediate(transaction: ITransaction; sql: AnsiString); overload;
# Line 1137 | Line 1212 | type
1212  
1213      {Database Information}
1214      function GetSQLDialect: integer;
1215 +    function GetAttachmentID: integer;
1216      function GetBlobMetaData(Transaction: ITransaction; tableName, columnName: AnsiString): IBlobMetaData;
1217      function GetArrayMetaData(Transaction: ITransaction; tableName, columnName: AnsiString): IArrayMetaData;
1218      function GetDBInformation(Requests: array of byte): IDBInformation; overload;
# Line 1153 | Line 1229 | type
1229      function HasDecFloatSupport: boolean;
1230      function HasBatchMode: boolean;
1231      function HasScollableCursors: boolean;
1232 +    function HasTable(aTableName: AnsiString): boolean;  {case sensitive}
1233 +    function HasFunction(aFunctionName: AnsiString): boolean; {case sensitive}
1234 +    function HasProcedure(aProcName: AnsiString): boolean; {case sensitive}
1235  
1236      {Character Sets}
1237 +    function GetCharSetID: integer; {connection character set}
1238      function HasDefaultCharSet: boolean;
1239      function GetDefaultCharSetID: integer;
1240      function GetCharsetName(CharSetID: integer): AnsiString;
# Line 1168 | Line 1248 | type
1248      {Time Zone Database}
1249      function GetTimeZoneServices: ITimeZoneServices;
1250      function HasTimeZoneSupport: boolean;
1251 +
1252 +    {Client side Journaling}
1253 +    function JournalingActive: boolean;
1254 +    function GetJournalOptions: TJournalOptions;
1255 +    function StartJournaling(aJournalLogFile: AnsiString): integer; overload;
1256 +    function StartJournaling(aJournalLogFile: AnsiString; Options: TJournalOptions): integer; overload;
1257 +    function StartJournaling(S: TStream; Options: TJournalOptions): integer; overload;
1258 +    procedure StopJournaling(RetainJournal: boolean);
1259   end;
1260  
1261    TProtocolAll = (TCP, SPX, NamedPipe, Local, inet, inet4, inet6, wnet, xnet, unknownProtocol);
# Line 1336 | Line 1424 | type
1424      {Start Transaction against multiple databases}
1425      function AllocateTPB: ITPB;
1426      function StartTransaction(Attachments: array of IAttachment;
1427 <             TPB: array of byte; DefaultCompletion: TTransactionCompletion=taCommit): ITransaction; overload;
1427 >             TPB: array of byte; DefaultCompletion: TTransactionCompletion=taCommit;
1428 >             aName: AnsiString=''): ITransaction; overload;
1429      function StartTransaction(Attachments: array of IAttachment;
1430 <             TPB: ITPB; DefaultCompletion: TTransactionCompletion=taCommit): ITransaction; overload;
1430 >             TPB: ITPB; DefaultCompletion: TTransactionCompletion=taCommit;
1431 >             aName: AnsiString=''): ITransaction; overload;
1432  
1433      {Service Manager}
1434      function HasServiceAPI: boolean;
# Line 1387 | Line 1477 | type
1477     EIBInterBaseError = class(EIBError)
1478     private
1479       FIBErrorCode: Long;
1480 +     FStatus: IStatus;
1481     public
1482 <     constructor Create(Status: IStatus); overload;
1482 >     constructor Create(aStatus: IStatus); overload;
1483       constructor Create(ASQLCode: Long; AIBErrorCode: Long; Msg: AnsiString); overload;
1484       property IBErrorCode: Long read FIBErrorCode;
1485 +     property Status: IStatus read FStatus;
1486     end;
1487  
1488     {IB Client Exceptions}
# Line 1419 | Line 1511 | procedure CheckIBLoaded;
1511  
1512   function LoadFBLibrary(aLibPathName: string): IFirebirdLibrary;
1513  
1514 + {$if not declared(Null)} {Needed for Delphi}
1515 + function Null: Variant;       // Null standard constant
1516 + {$define NEEDNULLFUNCTION}
1517 + {$ifend}
1518  
1519   implementation
1520  
1521 < uses FBClientAPI
1521 > uses FBClientAPI {$if not declared(NULL)}, Variants {$ifend}
1522    {$IFDEF USELEGACYFIREBIRDAPI}, FB25ClientAPI {$ENDIF}
1523    {$IFDEF USEFIREBIRD3API}, FB30ClientAPI {$ENDIF};
1524  
# Line 1514 | Line 1610 | end;
1610  
1611   { EIBInterBaseError }
1612  
1613 < constructor EIBInterBaseError.Create(Status: IStatus);
1613 > constructor EIBInterBaseError.Create(aStatus: IStatus);
1614   begin
1615 <  inherited Create(Status.Getsqlcode,Status.GetMessage);
1616 <  FIBErrorCode := Status.GetIBErrorCode;
1615 >  inherited Create(aStatus.Getsqlcode,aStatus.GetMessage);
1616 >  FIBErrorCode := aStatus.GetIBErrorCode;
1617 >  FStatus := aStatus.Clone;
1618   end;
1619  
1620   constructor EIBInterBaseError.Create(ASQLCode: Long; AIBErrorCode: Long;
# Line 1527 | Line 1624 | begin
1624    FIBErrorCode := AIBErrorCode;
1625   end;
1626  
1627 + {$ifdef NEEDNULLFUNCTION}
1628 + function Null: Variant;       // Null standard constant
1629 +   begin
1630 +     VarClearProc(TVarData(Result));
1631 +     TVarData(Result).VType := varnull;
1632 +   end;
1633 + {$endif}
1634  
1635   initialization
1636    FDefaultFBLibrary := nil;

Comparing:
ibx/trunk/fbintf/IB.pas (property svn:eol-style), Revision 352 by tony, Thu Oct 21 12:17:43 2021 UTC vs.
ibx/branches/udr/client/IB.pas (property svn:eol-style), Revision 386 by tony, Tue Jan 18 12:05:35 2022 UTC

# Line 0 | Line 1
1 + native

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines