这段过程是获取SQLServer2000备份文件的逻辑信息,备份文件数据库文件的原始路径,备份文件的数据库文件的逻辑文件名,log文件的原始路径及逻辑文件名。
其他信息详见SQLServer2000帮助
procedure GetDBLogPath(DBName: string; var LogicDBName,
LogicLogName, DBPath, LogPath: string);
var
vDataSet: TDataSet;
vSQL: string;
vType: string;
begin
vDataSet := SQLService.CreateDataSet;
try
vSQL := 'RESTORE FILELISTONLY FROM disk=' + QuotedStr(RestoreFileName);
SQLService.GetData(vDataSet, vSQL);
vDataSet.First;
while not vDataSet.Eof do
begin
vType := trim(vDataSet.FieldByName('Type').AsString);
if vType = 'D' then
begin
LogicDBName := trim(vDataSet.FieldByName('LogicalName').AsString);
DBPath := trim(vDataSet.FieldByName('PhysicalName').AsString);
end else
if vType = 'L' then
begin
LogicLogName := trim(vDataSet.FieldByName('LogicalName').AsString);
LogPath := trim(vDataSet.FieldByName('PhysicalName').AsString);
end;
vDataSet.Next;
end;
finally
vDataSet.Free;
end;
end;
其他信息详见SQLServer2000帮助
procedure GetDBLogPath(DBName: string; var LogicDBName,
LogicLogName, DBPath, LogPath: string);
var
vDataSet: TDataSet;
vSQL: string;
vType: string;
begin
vDataSet := SQLService.CreateDataSet;
try
vSQL := 'RESTORE FILELISTONLY FROM disk=' + QuotedStr(RestoreFileName);
SQLService.GetData(vDataSet, vSQL);
vDataSet.First;
while not vDataSet.Eof do
begin
vType := trim(vDataSet.FieldByName('Type').AsString);
if vType = 'D' then
begin
LogicDBName := trim(vDataSet.FieldByName('LogicalName').AsString);
DBPath := trim(vDataSet.FieldByName('PhysicalName').AsString);
end else
if vType = 'L' then
begin
LogicLogName := trim(vDataSet.FieldByName('LogicalName').AsString);
LogPath := trim(vDataSet.FieldByName('PhysicalName').AsString);
end;
vDataSet.Next;
end;
finally
vDataSet.Free;
end;
end;