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

Comparing ibx/trunk/iblocaldb/IBXUpgradeConfFile.pas (file contents):
Revision 79 by tony, Mon Feb 15 14:44:25 2016 UTC vs.
Revision 80 by tony, Mon Jan 1 11:31:07 2018 UTC

# Line 90 | Line 90 | unit IBXUpgradeConfFile;
90   interface
91  
92   uses
93 <  Classes, SysUtils, IniFiles;
93 >  Classes, SysUtils, IniFiles, IB, DB;
94  
95   type
96    TUpgradeInfo = record
# Line 114 | Line 114 | type
114      function CheckUpgradeAvailable(RequiredVersionNo: integer): boolean;
115      function GetUpgradeInfo(VersionNo: integer; var UpgradeInfo: TUpgradeInfo): boolean;
116      function GetSourceFile(aName: string; var FileName: string): boolean;
117 +    procedure GetParamValue(Sender: TObject; ParamName: string; var BlobID: TISC_QUAD);
118      property UpgradeAvailableToVersion: integer read GetUpgradeAvailableToVersion;
119    end;
120  
# Line 122 | Line 123 | type
123  
124   implementation
125  
126 + uses ZStream, IBBlob, ibxscript;
127 +
128   const
129    sSectionheader      = 'Version.%.3d';
130  
# Line 203 | Line 206 | begin
206    Result := FileExists(FileName);
207   end;
208  
209 + procedure TUpgradeConfFile.GetParamValue(Sender: TObject; ParamName: string;
210 +  var BlobID: TISC_QUAD);
211 + var Blob: TIBBlobStream;
212 +    Source: TStream;
213 +    FileName: string;
214 + begin
215 +  Blob := TIBBlobStream.Create;
216 +  try
217 +    Blob.Database := (Sender as TIBXScript).Database;
218 +    Blob.Transaction := (Sender as TIBXScript).Transaction;
219 +    Blob.Mode := bmWrite;
220 +    if not GetSourceFile(ParamName,FileName) then Exit;
221 +
222 +    if CompareText(ExtractFileExt(FileName),'.gz') = 0 then  {gzip compressed file}
223 +      Source := TGZFileStream.Create(FileName,gzopenread)
224 +    else
225 +      Source := TFileStream.Create(FileName,fmOpenRead or fmShareDenyNone);
226 +    try
227 +      Blob.CopyFrom(Source,0)
228 +    finally
229 +      Source.Free
230 +    end;
231 +    Blob.Finalize;
232 +    BlobID := Blob.BlobID
233 +  finally
234 +    Blob.Free
235 +  end
236 + end;
237 +
238   end.
239  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines