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

Comparing ibx/trunk/fbintf/client/FBBlob.pas (file contents):
Revision 55 by tony, Mon Jan 9 15:31:51 2017 UTC vs.
Revision 56 by tony, Mon Mar 6 10:20:02 2017 UTC

# Line 28 | Line 28
28   *
29   *)
30   unit FBBlob;
31 + {$IFDEF MSWINDOWS}
32 + {$DEFINE WINDOWS}
33 + {$ENDIF}
34  
35   {$IFDEF FPC}
36 < {$mode objfpc}{$H+}
36 > {$mode delphi}
37   {$interfaces COM}
38   {$ENDIF}
39  
40   interface
41  
42   uses
43 <  Classes, SysUtils, IB, FBActivityMonitor, FBTransaction, FBClientAPI;
43 >  Classes, SysUtils, IB, FBActivityMonitor, FBTransaction, FBClientAPI,
44 >  FBOutputBlock;
45  
46   type
47  
# Line 45 | Line 49 | type
49  
50    TFBBlobMetaData  = class(TActivityReporter)
51    private
52 <    FRelationName: string;
53 <    FColumnName: string;
52 >    FRelationName: AnsiString;
53 >    FColumnName: AnsiString;
54    protected
55      FUnconfirmedCharacterSet: boolean;
56      FHasSubType: boolean;
# Line 56 | Line 60 | type
60      procedure NeedFullMetadata; virtual; abstract;
61      procedure NeedSubType;
62    public
63 <    constructor Create(Transaction: TFBTransaction; RelationName, ColumnName: string
63 >    constructor Create(Transaction: TFBTransaction; RelationName, ColumnName: AnsiString
64        );
65      procedure SetCharSetID(aValue: integer);
66  
# Line 66 | Line 70 | type
70     function GetCharSetID: cardinal;
71     function GetCodePage: TSystemCodePage;
72     function GetSegmentSize: cardinal;
73 <   function GetRelationName: string;
74 <   function GetColumnName: string;
73 >   function GetRelationName: AnsiString;
74 >   function GetColumnName: AnsiString;
75     function GetUnconfirmedCharacterSet: boolean;
76    end;
77  
# Line 86 | Line 90 | type
90      procedure CheckWritable; virtual; abstract;
91      procedure ClearStringCache;
92      function GetIntf: IBlob; virtual; abstract;
93 +    procedure GetInfo(Request: array of byte; Response: IBlobInfo); overload; virtual; abstract;
94      procedure InternalClose(Force: boolean); virtual; abstract;
95      procedure InternalCancel(Force: boolean); virtual; abstract;
96    public
# Line 102 | Line 107 | type
107     function GetCharSetID: cardinal;
108     function GetCodePage: TSystemCodePage;
109     function GetSegmentSize: cardinal;
110 <   function GetRelationName: string;
111 <   function GetColumnName: string;
110 >   function GetRelationName: AnsiString;
111 >   function GetColumnName: AnsiString;
112     function GetUnconfirmedCharacterSet: boolean;
113  
114     {IBlob}
# Line 112 | Line 117 | type
117      procedure Close;
118      function GetBlobSize: Int64;
119      procedure GetInfo(var NumSegments: Int64; var MaxSegmentSize, TotalSize: Int64;
120 <      var BlobType: TBlobType); virtual; abstract;
120 >      var BlobType: TBlobType); overload;
121      function GetBlobID: TISC_QUAD;
122      function GetBlobMode: TFBBlobMode;
123      function Read(var Buffer; Count: Longint): Longint; virtual; abstract;
124      function Write(const Buffer; Count: Longint): Longint;  virtual; abstract;
125 <    function LoadFromFile(Filename: string): IBlob;
125 >    function LoadFromFile(Filename: AnsiString): IBlob;
126      function LoadFromStream(S: TStream) : IBlob;
127 <    function SaveToFile(Filename: string): IBlob;
127 >    function SaveToFile(Filename: AnsiString): IBlob;
128      function SaveToStream(S: TStream): IBlob;
129      function GetAttachment: IAttachment;
130      function GetTransaction: ITransaction;
# Line 173 | Line 178 | end;
178   procedure TFBBlob.TransactionEnding(aTransaction: TFBTransaction;
179    Force: boolean);
180   begin
181 <  if aTransaction <> FTransaction then
181 >  if aTransaction  <> (FTransaction as TFBTransaction)  then
182      Exit;
183    if FCreating then
184      InternalCancel(Force)
# Line 201 | Line 206 | begin
206    Result := FMetaData.GetSegmentSize;
207   end;
208  
209 < function TFBBlob.GetRelationName: string;
209 > function TFBBlob.GetRelationName: AnsiString;
210   begin
211    Result := FMetaData.GetRelationName;
212   end;
213  
214 < function TFBBlob.GetColumnName: string;
214 > function TFBBlob.GetColumnName: AnsiString;
215   begin
216    Result := FMetaData.GetColumnName;
217   end;
# Line 239 | Line 244 | begin
244    GetInfo(NumSegments,MaxSegmentSize,Result,BlobType);
245   end;
246  
247 + procedure TFBBlob.GetInfo(var NumSegments: Int64; var MaxSegmentSize,
248 +  TotalSize: Int64; var BlobType: TBlobType);
249 + var BlobInfo: IBlobInfo;
250 +    i: integer;
251 + begin
252 +  NumSegments := 0;
253 +  MaxSegmentSize := 0;
254 +  TotalSize := 0;
255 +  BlobType := btSegmented;
256 +
257 +  BlobInfo := TBlobInfo.Create;
258 +  GetInfo([isc_info_blob_num_segments,
259 +           isc_info_blob_max_segment,
260 +           isc_info_blob_total_length,
261 +           isc_info_blob_type],BlobInfo);
262 +
263 +  for i := 0 to BlobInfo.Count - 1 do
264 +  with BlobInfo[i] do
265 +  case getItemType of
266 +  isc_info_blob_num_segments:
267 +    NumSegments := GetAsInteger;
268 +  isc_info_blob_max_segment:
269 +    MaxSegmentSize := GetAsInteger;
270 +  isc_info_blob_total_length:
271 +    TotalSize := GetAsInteger;
272 +  isc_info_blob_type:
273 +    if GetAsInteger = 0 then
274 +      BlobType := btSegmented
275 +    else
276 +      BlobType := btStream;
277 +  end;
278 + end;
279 +
280   function TFBBlob.GetBlobID: TISC_QUAD;
281   begin
282    Result := FBlobID;
# Line 252 | Line 290 | begin
290      Result := fbmRead;
291   end;
292  
293 < function TFBBlob.LoadFromFile(Filename: string): IBlob;
293 > function TFBBlob.LoadFromFile(Filename: AnsiString): IBlob;
294   var
295    Stream: TStream;
296   begin
# Line 280 | Line 318 | begin
318    Result := GetIntf;
319   end;
320  
321 < function TFBBlob.SaveToFile(Filename: string): IBlob;
321 > function TFBBlob.SaveToFile(Filename: AnsiString): IBlob;
322   var
323    Stream: TStream;
324   begin
# Line 375 | Line 413 | begin
413   end;
414  
415   constructor TFBBlobMetaData.Create(Transaction: TFBTransaction; RelationName,
416 <  ColumnName: string);
416 >  ColumnName: AnsiString);
417   begin
418    inherited Create(Transaction);
419   //  if (RelationName = '') or (ColumnName = '') then
# Line 416 | Line 454 | begin
454    Result := FSegmentSize;
455   end;
456  
457 < function TFBBlobMetaData.GetRelationName: string;
457 > function TFBBlobMetaData.GetRelationName: AnsiString;
458   begin
459    Result := FRelationName;
460   end;
461  
462 < function TFBBlobMetaData.GetColumnName: string;
462 > function TFBBlobMetaData.GetColumnName: AnsiString;
463   begin
464    Result := FColumnName;
465   end;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines