112 |
|
destructor Destroy; override; |
113 |
|
class function IsAbsolutePath(aPath: string): boolean; |
114 |
|
function CheckUpgradeAvailable(RequiredVersionNo: integer): boolean; |
115 |
< |
function GetUpgradeInfo(VersionNo: integer; var UpgradeInfo: TUpgradeInfo): boolean; |
115 |
> |
function GetUpgradeInfo(SectionHeaderTemplate: string; VersionNo: integer; |
116 |
> |
var UpgradeInfo: TUpgradeInfo): boolean; |
117 |
|
function GetSourceFile(aName: string; var FileName: string): boolean; |
118 |
|
procedure GetParamValue(Sender: TObject; ParamName: string; var BlobID: TISC_QUAD); |
119 |
|
property UpgradeAvailableToVersion: integer read GetUpgradeAvailableToVersion; |
126 |
|
|
127 |
|
uses ZStream, IBBlob, ibxscript, IBMessages; |
128 |
|
|
128 |
– |
const |
129 |
– |
sSectionheader = 'Version.%.3d'; |
130 |
– |
|
129 |
|
resourcestring |
130 |
|
sInvalidConfFile = 'Database Upgrade Required, but the Upgrade File (%s) is missing or not specified'; |
131 |
|
sUpgradeRequired = 'Database Upgrade Required, but the Upgrade File is out of Date. '+ |
175 |
|
raise EUpgradeConfFileError.CreateFmt(sUpgradeRequired, [RequiredVersionNo,CurVersion]); |
176 |
|
end; |
177 |
|
|
178 |
< |
function TUpgradeConfFile.GetUpgradeInfo(VersionNo: integer; |
178 |
> |
function TUpgradeConfFile.GetUpgradeInfo(SectionHeaderTemplate: string; VersionNo: integer; |
179 |
|
var UpgradeInfo: TUpgradeInfo): boolean; |
180 |
|
begin |
181 |
|
Result := false; |
182 |
< |
FCurrentVersion := Format(sSectionheader,[VersionNo]); |
182 |
> |
FCurrentVersion := Format(SectionHeaderTemplate,[VersionNo]); |
183 |
|
UpgradeInfo.UserMessage := FUpgradeInfo.ReadString(FCurrentVersion,'Msg', |
184 |
|
Format(sNoInfo,[VersionNo])); |
185 |
|
UpgradeInfo.UpdateSQLFile := FUpgradeInfo.ReadString(FCurrentVersion,'Upgrade',''); |
190 |
|
if not IsAbsolutePath(UpgradeInfo.UpdateSQLFile) then |
191 |
|
UpgradeInfo.UpdateSQLFile := ExtractFilePath(FConfFileName) + UpgradeInfo.UpdateSQLFile; |
192 |
|
UpgradeInfo.BackupDB := CompareText(FUpgradeInfo.ReadString(FCurrentVersion,'BackupDatabase','no'),'yes') = 0; |
193 |
< |
Result := FileExists(UpgradeInfo.UpdateSQLFile); |
193 |
> |
if not FileExists(UpgradeInfo.UpdateSQLFile) then |
194 |
> |
IBError(ibxePatchFileNotFound,[FUpgradeInfo.FileName,UpgradeInfo.UpdateSQLFile, FCurrentVersion]) |
195 |
> |
else |
196 |
> |
Result := true; |
197 |
|
end; |
198 |
|
end; |
199 |
|
|