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

Comparing ibx/trunk/fbintf/client/FBClientAPI.pas (file contents):
Revision 307 by tony, Thu Dec 6 15:55:01 2018 UTC vs.
Revision 308 by tony, Sat Jul 18 10:26:30 2020 UTC

# Line 90 | Line 90 | FIREBIRD_CLIENT = 'fbclient.dll'; {do no
90   FIREBIRD_EMBEDDED = 'fbembed.dll';
91   {$ENDIF}
92  
93 + const
94 +  IBLocalBufferLength = 512;
95 +  IBBigLocalBufferLength = IBLocalBufferLength * 2;
96 +  IBHugeLocalBufferLength = IBBigLocalBufferLength * 20;
97 +
98   type
99    TStatusVector              = array[0..19] of NativeInt;
100    PStatusVector              = ^TStatusVector;
# Line 160 | Line 165 | type
165      {Taken from legacy API}
166      isc_sqlcode: Tisc_sqlcode;
167      isc_sql_interprete: Tisc_sql_interprete;
163    isc_interprete: Tisc_interprete;
168      isc_event_counts: Tisc_event_counts;
169      isc_event_block: Tisc_event_block;
170      isc_free: Tisc_free;
# Line 183 | Line 187 | type
187      function SQLDecodeTime(bufptr: PByte): TDateTime;  virtual; abstract;
188      procedure SQLEncodeDateTime(aDateTime: TDateTime; bufptr: PByte); virtual; abstract;
189      function SQLDecodeDateTime(bufptr: PByte): TDateTime; virtual; abstract;
190 <
190 >    function FormatStatus(Status: TFBStatus): AnsiString; virtual; abstract;
191  
192      {IFirebirdAPI}
193      function GetStatus: IStatus; virtual; abstract;
194      function IsLibraryLoaded: boolean;
195      function IsEmbeddedServer: boolean; virtual; abstract;
196      function GetFBLibrary: IFirebirdLibrary;
197 +    function GetImplementationVersion: AnsiString;
198 +    function GetClientMajor: integer;  virtual; abstract;
199 +    function GetClientMinor: integer;  virtual; abstract;
200   end;
201  
202   implementation
# Line 205 | Line 212 | WinDirs,
212   {$ENDIF}
213   SysUtils;
214  
208 const
209  IBLocalBufferLength = 512;
210  IBBigLocalBufferLength = IBLocalBufferLength * 2;
211  IBHugeLocalBufferLength = IBBigLocalBufferLength * 20;
212
215   {$IFDEF UNIX}
216   {$I 'include/uloadlibrary.inc'}
217   {$ELSE}
# Line 366 | Line 368 | begin
368    Result := FFBLibrary;
369   end;
370  
371 + function TFBClientAPI.GetImplementationVersion: AnsiString;
372 + begin
373 +  Result := Format('%d.%d',[GetClientMajor,GetClientMinor]);
374 + end;
375 +
376   function TFBClientAPI.GetProcAddr(ProcName: PAnsiChar): Pointer;
377   begin
378    Result := GetProcAddress(FFBLibrary.IBLibrary, ProcName);
# Line 377 | Line 384 | function TFBClientAPI.LoadInterface: boo
384   begin
385    isc_sqlcode := GetProcAddr('isc_sqlcode'); {do not localize}
386    isc_sql_interprete := GetProcAddr('isc_sql_interprete'); {do not localize}
380  isc_interprete := GetProcAddr('isc_interprete'); {do not localize}
387    isc_event_counts := GetProcAddr('isc_event_counts'); {do not localize}
388    isc_event_block := GetProcAddr('isc_event_block'); {do not localize}
389    isc_free := GetProcAddr('isc_free'); {do not localize}
# Line 408 | Line 414 | function TFBStatus.GetMessage: AnsiStrin
414   var local_buffer: array[0..IBHugeLocalBufferLength - 1] of AnsiChar;
415      IBDataBaseErrorMessages: TIBDataBaseErrorMessages;
416      sqlcode: Long;
411    psb: PStatusVector;
417   begin
418    Result := '';
419    IBDataBaseErrorMessages := FIBDataBaseErrorMessages;
# Line 420 | Line 425 | begin
425    if (ShowSQLMessage in IBDataBaseErrorMessages) then
426    begin
427      with FOwner do
428 <      isc_sql_interprete(sqlcode, local_buffer, IBLocalBufferLength);
428 >      isc_sql_interprete(sqlcode, local_buffer, sizeof(local_buffer));
429      if (ShowSQLCode in FIBDataBaseErrorMessages) then
430        Result := Result + CRLF;
431      Result := Result + strpas(local_buffer);
# Line 430 | Line 435 | begin
435    begin
436      if (ShowSQLCode in IBDataBaseErrorMessages) or
437         (ShowSQLMessage in IBDataBaseErrorMessages) then
438 <      Result := Result + CRLF;
439 <    psb := StatusVector;
435 <    with FOwner do
436 <    while (isc_interprete(@local_buffer, @psb) > 0) do
437 <    begin
438 <      if (Result <> '') and (Result[Length(Result)] <> LF) then
439 <        Result := Result + CRLF;
440 <      Result := Result + strpas(local_buffer);
441 <    end;
438 >      Result := Result + LineEnding;
439 >    Result := Result + LineEnding + FOwner.FormatStatus(self);
440    end;
441    if (Result <> '') and (Result[Length(Result)] = '.') then
442      Delete(Result, Length(Result), 1);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines