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 350 by tony, Wed Oct 20 14:58:56 2021 UTC vs.
ibx/branches/udr/client/IB.pas (file contents), Revision 390 by tony, Sat Jan 22 16:15:12 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 305 | Line 322 | type
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  
# Line 500 | Line 519 | type
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;
# Line 566 | Line 586 | type
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;
# Line 584 | Line 605 | type
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;
# Line 599 | Line 621 | type
621     function getCount: integer;
622     function GetStatement: IStatement;
623     function GetTransaction: ITransaction;
624 +   function GetAttachment: IAttachment;
625     function ByName(Idx: AnsiString): ISQLData;
626     function getSQLData(index: integer): ISQLData;
627     procedure GetData(index: integer; var IsNull:boolean; var len: short; var data: PByte);
# Line 660 | Line 683 | type
683    ISQLParam = interface(IParamMetaData)
684      ['{b22b4578-6d41-4807-a9a9-d2ec8d1d5a14}']
685      function getColMetadata: IParamMetaData;
686 +    function GetStatement: IStatement;
687 +    function GetTransaction: ITransaction;
688 +    function GetAttachment: IAttachment;
689      function GetIndex: integer;
690      function getName: AnsiString;
691      function GetAsBoolean: boolean;
# Line 685 | Line 711 | type
711      function GetAsBlob: IBlob;
712      function GetAsArray: IArray;
713      function GetAsBCD: tBCD;
714 <    function GetStatement: IStatement;
689 <    function GetTransaction: ITransaction;
714 >    function GetAsNumeric: IFBNumeric;
715      procedure Clear;
716      function GetModified: boolean;
717      procedure SetAsBoolean(AValue: boolean);
# Line 715 | Line 740 | type
740      procedure SetAsQuad(aValue: TISC_QUAD);
741      procedure SetCharSetID(aValue: cardinal);
742      procedure SetAsBcd(aValue: tBCD);
743 +    procedure SetAsNumeric(Value: IFBNumeric);
744      property AsDate: TDateTime read GetAsDateTime write SetAsDate;
745      property AsBoolean:boolean read GetAsBoolean write SetAsBoolean;
746      property AsTime: TDateTime read GetAsDateTime write SetAsTime;
# Line 732 | Line 758 | type
758      property AsBlob: IBlob read GetAsBlob write SetAsBlob;
759      property AsArray: IArray read GetAsArray write SetAsArray;
760      property AsBCD: tBCD read GetAsBCD write SetAsBCD;
761 +    property AsNumeric: IFBNumeric read GetAsNumeric write SetAsNumeric;
762      property AsQuad: TISC_QUAD read GetAsQuad write SetAsQuad;
763      property Value: Variant read GetAsVariant write SetAsVariant;
764      property IsNull: Boolean read GetIsNull write SetIsNull;
# Line 752 | Line 779 | type
779      function ByName(Idx: AnsiString): ISQLParam ;
780      function GetModified: Boolean;
781      function GetHasCaseSensitiveParams: Boolean;
782 +    function GetStatement: IStatement;
783 +    function GetTransaction: ITransaction;
784 +    function GetAttachment: IAttachment;
785 +    procedure Clear;
786      property Modified: Boolean read GetModified;
787      property Params[index: integer]: ISQLParam read getSQLParam; default;
788      property Count: integer read getCount;
# Line 781 | Line 812 | type
812     initially prepared. The interface is returned from the IAttachment interface.
813     }
814  
815 +  TStatementFlag = (stHasCursor,stRepeatExecute,stScrollable);
816 +  TStatementFlags = set of TStatementFlag;
817 +
818    IStatement = interface
819      ['{a260576d-a07d-4a66-b02d-1b72543fd7cf}']
820      function GetMetaData: IMetaData;  {Output Metadata}
# Line 792 | Line 826 | type
826      function GetSQLText: AnsiString;
827      function GetProcessedSQLText: AnsiString;
828      function GetSQLDialect: integer;
829 +    function GetFlags: TStatementFlags;
830      function IsPrepared: boolean;
831      function HasBatchMode: boolean;
832      function IsInBatchMode: boolean;
# Line 821 | Line 856 | type
856      property SQLStatementType: TIBSQLStatementTypes read GetSQLStatementType;
857    end;
858  
859 +  ITrInfoItem = interface
860 +    ['{41455e1a-f84e-4e26-aff0-1a78e8b69cfe}']
861 +    function getItemType: byte;
862 +    function getSize: integer;
863 +    function getAsString: AnsiString;
864 +    function getAsInteger: int64;
865 +    procedure DecodeTraIsolation(var IsolationType, RecVersion: byte);
866 +  end;
867 +
868 +  { ITrInformation }
869 +
870 +  ITrInformation = interface
871 +    ['{e6ea4a52-c1a1-44ba-9609-c8bcc7cba7b2}']
872 +    function GetCount: integer;
873 +    function GetItem(index: integer): ITrInfoItem;
874 +    function Find(ItemType: byte): ITrInfoItem;
875 +    procedure PrintBuf; {can be used to print buffer in hex for debugging}
876 +    property Count: integer read GetCount;
877 +    property Items[index: integer]: ITrInfoItem read getItem; default;
878 +  end;
879 +
880    {Transaction Parameter Block: (TPB)
881  
882     The TPB provides the parameters used when starting a transaction. It is allocated
# Line 834 | Line 890 | type
890  
891    ITPBItem = interface(IParameterBlockItemWithTypeName)
892      ['{544c1f2b-7c12-4a87-a4a5-face7ea72671}']
837    function getParamTypeName: AnsiString;
893    end;
894  
895    ITPB = interface(IParameterBlockWithTypeNames<ITPBItem>)
896      ['{7369b0ff-defe-437b-81fe-19b211d42d25}']
897 +    function AsText: AnsiString;
898    end;
899  
900    {The ITransactionAction interface provides access to a Transaction once it
# Line 851 | Line 907 | type
907  
908    TTransactionAction  = (TARollback, TACommit, TACommitRetaining, TARollbackRetaining);
909    TTransactionCompletion = TARollback.. TACommit;
910 +  TTrCompletionState = (trCommitted, trRolledback, trCommitFailed, trRollbackFailed);
911 +
912  
913    ITransaction = interface
914      ['{30928d0e-a9d7-4c61-b7cf-14f4f38abe2a}']
915      function getTPB: ITPB;
916      procedure Start(DefaultCompletion: TTransactionCompletion=taCommit);
917      function GetInTransaction: boolean;
918 +    function GetIsReadOnly: boolean;
919 +    function GetTransactionID: integer;
920 +    function GetJournalingActive(attachment: IAttachment): boolean;
921 +    function GetDefaultCompletion: TTransactionCompletion;
922      procedure PrepareForCommit; {Two phase commit - stage 1}
923 <    procedure Commit(Force: boolean=false);
923 >    function Commit(Force: boolean=false): TTrCompletionState;
924      procedure CommitRetaining;
925      function HasActivity: boolean;
926 <    procedure Rollback(Force: boolean=false);
926 >    function Rollback(Force: boolean=false): TTrCompletionState;
927      procedure RollbackRetaining;
928      function GetAttachmentCount: integer;
929      function GetAttachment(index: integer): IAttachment;
930 +    function GetTrInformation(Requests: array of byte): ITrInformation; overload;
931 +    function GetTrInformation(Request: byte): ITrInformation; overload;
932 +    function GetTransactionName: AnsiString;
933 +    procedure SetTransactionName(aValue: AnsiString);
934      property InTransaction: boolean read GetInTransaction;
935 +    property TransactionName: AnsiString read GetTransactionName write SetTransactionName;
936    end;
937  
938    { The IEvents Interface is used to handle events from a single database. The
# Line 895 | Line 962 | type
962      ['{6a0be233-ed08-4524-889c-2e45d0c20e5f}']
963      procedure GetEvents(EventNames: TStrings);
964      procedure SetEvents(EventNames: TStrings); overload;
965 <    procedure SetEvents(EventName: AnsiString); overload;
965 >    procedure SetEvents(EventName: string); overload;
966      procedure Cancel;
967      function ExtractEventCounts: TEventCounts;
968      procedure WaitForEvent;
# Line 1028 | Line 1095 | type
1095       ['{e676067b-1cf4-4eba-9256-9724f57e0d16}']
1096     end;
1097  
1098 +   {Journaling options. Default is [joReadWriteTransactions,joModifyQueries] }
1099 +
1100 +   TJournalOption = (joReadOnlyTransactions, joReadWriteTransactions,
1101 +                     joModifyQueries, joReadOnlyQueries,joNoServerTable);
1102 +
1103 +   TJournalOptions = set of TJournalOption;
1104 +
1105    {The IAttachment interface provides access to a Database Connection. It may be
1106     used to:
1107  
# Line 1065 | Line 1139 | type
1139      procedure Disconnect(Force: boolean=false);
1140      function IsConnected: boolean;
1141      procedure DropDatabase;
1142 <    function StartTransaction(TPB: array of byte; DefaultCompletion: TTransactionCompletion=taCommit): ITransaction; overload;
1143 <    function StartTransaction(TPB: ITPB; DefaultCompletion: TTransactionCompletion=taCommit): ITransaction; overload;
1142 >    function StartTransaction(TPB: array of byte;
1143 >                              DefaultCompletion: TTransactionCompletion=taCommit;
1144 >                              aName: AnsiString=''): ITransaction; overload;
1145 >    function StartTransaction(TPB: ITPB;
1146 >                              DefaultCompletion: TTransactionCompletion=taCommit;
1147 >                              aName: AnsiString=''): ITransaction; overload;
1148      procedure ExecImmediate(transaction: ITransaction; sql: AnsiString; SQLDialect: integer); overload;
1149      procedure ExecImmediate(TPB: array of byte; sql: AnsiString; SQLDialect: integer); overload;
1150      procedure ExecImmediate(transaction: ITransaction; sql: AnsiString); overload;
# Line 1137 | Line 1215 | type
1215  
1216      {Database Information}
1217      function GetSQLDialect: integer;
1218 +    function GetAttachmentID: integer;
1219      function GetBlobMetaData(Transaction: ITransaction; tableName, columnName: AnsiString): IBlobMetaData;
1220      function GetArrayMetaData(Transaction: ITransaction; tableName, columnName: AnsiString): IArrayMetaData;
1221      function GetDBInformation(Requests: array of byte): IDBInformation; overload;
# Line 1152 | Line 1231 | type
1231      function HasActivity: boolean;
1232      function HasDecFloatSupport: boolean;
1233      function HasBatchMode: boolean;
1234 +    function HasScollableCursors: boolean;
1235 +    function HasTable(aTableName: AnsiString): boolean;  {case sensitive}
1236 +    function HasFunction(aFunctionName: AnsiString): boolean; {case sensitive}
1237 +    function HasProcedure(aProcName: AnsiString): boolean; {case sensitive}
1238  
1239      {Character Sets}
1240 +    function GetCharSetID: integer; {connection character set}
1241      function HasDefaultCharSet: boolean;
1242      function GetDefaultCharSetID: integer;
1243      function GetCharsetName(CharSetID: integer): AnsiString;
# Line 1167 | Line 1251 | type
1251      {Time Zone Database}
1252      function GetTimeZoneServices: ITimeZoneServices;
1253      function HasTimeZoneSupport: boolean;
1254 +
1255 +    {Client side Journaling}
1256 +    function JournalingActive: boolean;
1257 +    function GetJournalOptions: TJournalOptions;
1258 +    function StartJournaling(aJournalLogFile: AnsiString): integer; overload;
1259 +    function StartJournaling(aJournalLogFile: AnsiString; Options: TJournalOptions): integer; overload;
1260 +    function StartJournaling(S: TStream; Options: TJournalOptions): integer; overload;
1261 +    procedure StopJournaling(RetainJournal: boolean);
1262   end;
1263  
1264    TProtocolAll = (TCP, SPX, NamedPipe, Local, inet, inet4, inet6, wnet, xnet, unknownProtocol);
# Line 1335 | Line 1427 | type
1427      {Start Transaction against multiple databases}
1428      function AllocateTPB: ITPB;
1429      function StartTransaction(Attachments: array of IAttachment;
1430 <             TPB: array of byte; DefaultCompletion: TTransactionCompletion=taCommit): ITransaction; overload;
1430 >             TPB: array of byte; DefaultCompletion: TTransactionCompletion=taCommit;
1431 >             aName: AnsiString=''): ITransaction; overload;
1432      function StartTransaction(Attachments: array of IAttachment;
1433 <             TPB: ITPB; DefaultCompletion: TTransactionCompletion=taCommit): ITransaction; overload;
1433 >             TPB: ITPB; DefaultCompletion: TTransactionCompletion=taCommit;
1434 >             aName: AnsiString=''): ITransaction; overload;
1435  
1436      {Service Manager}
1437      function HasServiceAPI: boolean;
# Line 1356 | Line 1450 | type
1450      function HasLocalTZDB: boolean;
1451      function HasTimeZoneSupport: boolean;
1452      function HasExtendedTZSupport: boolean;
1359    function HasScollableCursors: boolean;
1453  
1454      {Firebird 3 API}
1455      function HasMasterIntf: boolean;
# Line 1387 | Line 1480 | type
1480     EIBInterBaseError = class(EIBError)
1481     private
1482       FIBErrorCode: Long;
1483 +     FStatus: IStatus;
1484     public
1485 <     constructor Create(Status: IStatus); overload;
1485 >     constructor Create(aStatus: IStatus); overload;
1486       constructor Create(ASQLCode: Long; AIBErrorCode: Long; Msg: AnsiString); overload;
1487       property IBErrorCode: Long read FIBErrorCode;
1488 +     property Status: IStatus read FStatus;
1489     end;
1490  
1491     {IB Client Exceptions}
# Line 1419 | Line 1514 | procedure CheckIBLoaded;
1514  
1515   function LoadFBLibrary(aLibPathName: string): IFirebirdLibrary;
1516  
1517 + {$if not declared(Null)} {Needed for Delphi}
1518 + function Null: Variant;       // Null standard constant
1519 + {$define NEEDNULLFUNCTION}
1520 + {$ifend}
1521  
1522   implementation
1523  
1524 < uses FBClientAPI
1524 > uses FBClientAPI {$if not declared(NULL)}, Variants {$ifend}
1525    {$IFDEF USELEGACYFIREBIRDAPI}, FB25ClientAPI {$ENDIF}
1526    {$IFDEF USEFIREBIRD3API}, FB30ClientAPI {$ENDIF};
1527  
# Line 1514 | Line 1613 | end;
1613  
1614   { EIBInterBaseError }
1615  
1616 < constructor EIBInterBaseError.Create(Status: IStatus);
1616 > constructor EIBInterBaseError.Create(aStatus: IStatus);
1617   begin
1618 <  inherited Create(Status.Getsqlcode,Status.GetMessage);
1619 <  FIBErrorCode := Status.GetIBErrorCode;
1618 >  inherited Create(aStatus.Getsqlcode,aStatus.GetMessage);
1619 >  FIBErrorCode := aStatus.GetIBErrorCode;
1620 >  FStatus := aStatus.Clone;
1621   end;
1622  
1623   constructor EIBInterBaseError.Create(ASQLCode: Long; AIBErrorCode: Long;
# Line 1527 | Line 1627 | begin
1627    FIBErrorCode := AIBErrorCode;
1628   end;
1629  
1630 + {$ifdef NEEDNULLFUNCTION}
1631 + function Null: Variant;       // Null standard constant
1632 +   begin
1633 +     VarClearProc(TVarData(Result));
1634 +     TVarData(Result).VType := varnull;
1635 +   end;
1636 + {$endif}
1637  
1638   initialization
1639    FDefaultFBLibrary := nil;

Comparing:
ibx/trunk/fbintf/IB.pas (property svn:eol-style), Revision 350 by tony, Wed Oct 20 14:58:56 2021 UTC vs.
ibx/branches/udr/client/IB.pas (property svn:eol-style), Revision 390 by tony, Sat Jan 22 16:15:12 2022 UTC

# Line 0 | Line 1
1 + native

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines