ViewVC Help
View File | Revision Log | Show Annotations | Download File | View Changeset | Root Listing
root/public/ibx/trunk/fbintf/client/2.5/FB25ClientAPI.pas
(Generate patch)

Comparing ibx/trunk/fbintf/client/2.5/FB25ClientAPI.pas (file contents):
Revision 45 by tony, Tue Dec 6 10:33:46 2016 UTC vs.
Revision 56 by tony, Mon Mar 6 10:20:02 2017 UTC

# Line 60 | Line 60
60   {                                                                        }
61   {************************************************************************}
62   unit FB25ClientAPI;
63 + {$IFDEF MSWINDOWS}
64 + {$DEFINE WINDOWS}
65 + {$ENDIF}
66  
67   {$IFDEF FPC}
68   {$mode delphi}
# Line 165 | Line 168 | type
168  
169    public
170      {Helper Functions}
171 <    function DecodeInteger(bufptr: PChar; len: short): integer; override;
172 <    procedure SQLEncodeDate(aDate: TDateTime; bufptr: PChar); override;
173 <    function SQLDecodeDate(bufptr: PChar): TDateTime; override;
174 <    procedure SQLEncodeTime(aTime: TDateTime; bufptr: PChar); override;
175 <    function SQLDecodeTime(bufptr: PChar): TDateTime;  override;
176 <    procedure SQLEncodeDateTime(aDateTime: TDateTime; bufptr: PChar); override;
177 <    function SQLDecodeDateTime(bufptr: PChar): TDateTime; override;
171 >    function DecodeInteger(bufptr: PByte; len: short): integer; override;
172 >    procedure SQLEncodeDate(aDate: TDateTime; bufptr: PByte); override;
173 >    function SQLDecodeDate(bufptr: PByte): TDateTime; override;
174 >    procedure SQLEncodeTime(aTime: TDateTime; bufptr: PByte); override;
175 >    function SQLDecodeTime(bufptr: PByte): TDateTime;  override;
176 >    procedure SQLEncodeDateTime(aDateTime: TDateTime; bufptr: PByte); override;
177 >    function SQLDecodeDateTime(bufptr: PByte): TDateTime; override;
178  
179    public
180      {IFirebirdAPI}
181  
182      {Database connections}
183      function AllocateDPB: IDPB;
184 <    function OpenDatabase(DatabaseName: string; DPB: IDPB; RaiseExceptionOnConnectError: boolean=true): IAttachment;
185 <    function CreateDatabase(DatabaseName: string; DPB: IDPB; RaiseExceptionOnError: boolean=true): IAttachment;
184 >    function OpenDatabase(DatabaseName: AnsiString; DPB: IDPB; RaiseExceptionOnConnectError: boolean=true): IAttachment;
185 >    function CreateDatabase(DatabaseName: AnsiString; DPB: IDPB; RaiseExceptionOnError: boolean=true): IAttachment;  overload;
186 >    function CreateDatabase(sql: AnsiString; aSQLDialect: integer; RaiseExceptionOnError: boolean=true): IAttachment; overload;
187  
188      {Start Transaction against multiple databases}
189      function AllocateTPB: ITPB;
# Line 191 | Line 195 | type
195      {Service Manager}
196      function AllocateSPB: ISPB;
197      function HasServiceAPI: boolean;
198 <    function GetServiceManager(ServerName: string; Protocol: TProtocol; SPB: ISPB): IServiceManager;
198 >    function GetServiceManager(ServerName: AnsiString; Protocol: TProtocol; SPB: ISPB): IServiceManager;
199  
200      {Information}
201      function GetStatus: IStatus; override;
202      function HasRollbackRetaining: boolean;
203      function IsEmbeddedServer: boolean; override;
204 <    function GetImplementationVersion: string;
204 >    function GetImplementationVersion: AnsiString;
205  
206      {Firebird 3 API}
207      function HasMasterIntf: boolean;
# Line 205 | Line 209 | type
209  
210     end;
211  
212 < const
212 > var
213    Firebird25ClientAPI: TFB25ClientAPI = nil;
214  
215   implementation
216  
217 < uses FBMessages, dynlibs, FB25Attachment, FB25Transaction, FB25Services, FBParamBlock,
217 > uses FBMessages,
218 >    {$IFDEF WINDOWS}Windows, {$ENDIF}
219 >    {$IFDEF FPC} Dynlibs, {$ENDIF}
220 >  FB25Attachment, FB25Transaction, FB25Services, FBParamBlock,
221    IBUtils;
222  
223   { Stubs for 6.0 only functions }
# Line 224 | Line 231 | end;
231  
232   function isc_service_attach_stub(status_vector      : PISC_STATUS;
233                                   isc_arg2           : UShort;
234 <                                 isc_arg3           : PChar;
234 >                                 isc_arg3           : PAnsiChar;
235                                   service_handle     : PISC_SVC_HANDLE;
236                                   isc_arg5           : UShort;
237 <                                 isc_arg6           : PChar):
237 >                                 isc_arg6           : PAnsiChar):
238                                   ISC_STATUS; {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
239   begin
240    Result := 0;
# Line 246 | Line 253 | function isc_service_query_stub(status_v
253                                  service_handle       : PISC_SVC_HANDLE;
254                                  recv_handle          : PISC_SVC_HANDLE;
255                                  isc_arg4             : UShort;
256 <                                isc_arg5             : PChar;
256 >                                isc_arg5             : PAnsiChar;
257                                  isc_arg6             : UShort;
258 <                                isc_arg7             : PChar;
258 >                                isc_arg7             : PAnsiChar;
259                                  isc_arg8             : UShort;
260 <                                isc_arg9             : PChar):
260 >                                isc_arg9             : PAnsiChar):
261                                  ISC_STATUS; {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
262   begin
263    Result := 0;
# Line 261 | Line 268 | function isc_service_start_stub(status_v
268                                  service_handle       : PISC_SVC_HANDLE;
269                                  recv_handle          : PISC_SVC_HANDLE;
270                                  isc_arg4             : UShort;
271 <                                isc_arg5             : PChar):
271 >                                isc_arg5             : PAnsiChar):
272                                  ISC_STATUS; {$IFDEF WINDOWS} stdcall; {$ELSE} cdecl; {$ENDIF}
273   begin
274    Result := 0;
# Line 440 | Line 447 | begin
447    Result := TDPB.Create;
448   end;
449  
450 < function TFB25ClientAPI.OpenDatabase(DatabaseName: string; DPB: IDPB;
450 > function TFB25ClientAPI.OpenDatabase(DatabaseName: AnsiString; DPB: IDPB;
451                                      RaiseExceptionOnConnectError: boolean): IAttachment;
452   begin
453     Result := TFB25Attachment.Create(DatabaseName,DPB,RaiseExceptionOnConnectError);
# Line 448 | Line 455 | begin
455       Result := nil;
456   end;
457  
458 < function TFB25ClientAPI.CreateDatabase(DatabaseName: string; DPB: IDPB;
458 > function TFB25ClientAPI.CreateDatabase(DatabaseName: AnsiString; DPB: IDPB;
459    RaiseExceptionOnError: boolean): IAttachment;
460   begin
461    Result := TFB25Attachment.CreateDatabase(DatabaseName, DPB, RaiseExceptionOnError );
# Line 456 | Line 463 | begin
463       Result := nil;
464   end;
465  
466 + function TFB25ClientAPI.CreateDatabase(sql: AnsiString; aSQLDialect: integer;
467 +  RaiseExceptionOnError: boolean): IAttachment;
468 + begin
469 +  Result := TFB25Attachment.CreateDatabase(sql,aSQLDialect, RaiseExceptionOnError );
470 +   if (Result <> nil) and not Result.IsConnected then
471 +     Result := nil;
472 + end;
473 +
474   function TFB25ClientAPI.AllocateSPB: ISPB;
475   begin
476    Result := TSPB.Create;
# Line 466 | Line 481 | begin
481    Result := TTPB.Create;
482   end;
483  
484 < function TFB25ClientAPI.GetServiceManager(ServerName: string;
484 > function TFB25ClientAPI.GetServiceManager(ServerName: AnsiString;
485    Protocol: TProtocol; SPB: ISPB): IServiceManager;
486   begin
487    if HasServiceAPI then
# Line 518 | Line 533 | begin
533    Result := nil;
534   end;
535  
536 < function TFB25ClientAPI.GetImplementationVersion: string;
536 > function TFB25ClientAPI.GetImplementationVersion: AnsiString;
537   begin
538    Result := FBClientInterfaceVersion;
539   end;
540  
541 < function TFB25ClientAPI.DecodeInteger(bufptr: PChar; len: short): integer;
541 > function TFB25ClientAPI.DecodeInteger(bufptr: PByte; len: short): integer;
542   begin
543    Result := isc_portable_integer(bufptr,len);
544   end;
545  
546 < procedure TFB25ClientAPI.SQLEncodeDate(aDate: TDateTime; bufptr: PChar);
546 > procedure TFB25ClientAPI.SQLEncodeDate(aDate: TDateTime; bufptr: PByte);
547   var
548    tm_date: TCTimeStructure;
549    Yr, Mn, Dy: Word;
# Line 545 | Line 560 | begin
560    isc_encode_sql_date(@tm_date, PISC_DATE(bufptr));
561   end;
562  
563 < function TFB25ClientAPI.SQLDecodeDate(bufptr: PChar): TDateTime;
563 > function TFB25ClientAPI.SQLDecodeDate(bufptr: PByte): TDateTime;
564   var
565    tm_date: TCTimeStructure;
566   begin
# Line 560 | Line 575 | begin
575    end;
576   end;
577  
578 < procedure TFB25ClientAPI.SQLEncodeTime(aTime: TDateTime; bufptr: PChar);
578 > procedure TFB25ClientAPI.SQLEncodeTime(aTime: TDateTime; bufptr: PByte);
579   var
580    tm_date: TCTimeStructure;
581    Hr, Mt, S, Ms: Word;
# Line 580 | Line 595 | begin
595      Inc(PISC_TIME(bufptr)^,Ms*10);
596   end;
597  
598 < function TFB25ClientAPI.SQLDecodeTime(bufptr: PChar): TDateTime;
598 > function TFB25ClientAPI.SQLDecodeTime(bufptr: PByte): TDateTime;
599   var
600    tm_date: TCTimeStructure;
601    msecs: Word;
# Line 597 | Line 612 | begin
612    end;
613   end;
614  
615 < procedure TFB25ClientAPI.SQLEncodeDateTime(aDateTime: TDateTime; bufptr: PChar);
615 > procedure TFB25ClientAPI.SQLEncodeDateTime(aDateTime: TDateTime; bufptr: PByte);
616   var
617    tm_date: TCTimeStructure;
618    Yr, Mn, Dy, Hr, Mt, S, Ms: Word;
# Line 617 | Line 632 | begin
632      Inc(PISC_TIMESTAMP(bufptr)^.timestamp_time,Ms*10);
633   end;
634  
635 < function TFB25ClientAPI.SQLDecodeDateTime(bufptr: PChar): TDateTime;
635 > function TFB25ClientAPI.SQLDecodeDateTime(bufptr: PByte): TDateTime;
636   var
637    tm_date: TCTimeStructure;
638    msecs: Word;
# Line 642 | Line 657 | end;
657  
658   end.
659  
660 +

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines