90 |
|
interface |
91 |
|
|
92 |
|
uses |
93 |
< |
Classes, SysUtils, IniFiles; |
93 |
> |
Classes, SysUtils, IniFiles, IB, DB; |
94 |
|
|
95 |
|
type |
96 |
|
TUpgradeInfo = record |
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 |
|
|
123 |
|
|
124 |
|
implementation |
125 |
|
|
126 |
+ |
uses ZStream, IBBlob, ibxscript; |
127 |
+ |
|
128 |
|
const |
129 |
|
sSectionheader = 'Version.%.3d'; |
130 |
|
|
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 |
|
|