procedure TConvertForm.CopyTable(FromDir, SrcTblName, ToDir, DestTblName: String);
var
DBHandle: HDBIDB;
ResultCode: DBIResult;
Src, Dest, Err: Array[0..255] of Char;
SrcTbl, DestTbl: TTable;
begin
SrcTbl := TTable.Create(Application);
DestTbl := TTable.Create(Application);
try
SrcTbl.DatabaseName := FromDir;
SrcTbl.TableName := SrcTblName;
SrcTbl.Open;
DBHandle := SrcTbl.DBHandle;
SrcTbl.Close;
ResultCode := DbiCopyTable(DBHandle,false,
StrPCopy(Src,FromDir + '\' + SrcTblName),nil,
StrPCopy(Dest,ToDir + '\' + DestTblName));
if (ResultCode <> DBIERR_NONE) then
begin
DbiGetErrorString(ResultCode,Err);
raise EDatabaseError.Create('При копировании ' +
FromDir + '\' + SrcTblName + ' в ' +
ToDir + '\' + DestTblName + ' ,'
+ 'BDE сгенерировал ошибку '''
+ StrPas(Err) + '''');
end;
finally
SrcTbl.Free;
DestTbl.Free;
end;
end;
procedure TConvertForm.DeleteTable(Dir, TblName: String);
var
DBHandle: HDBIDB;
ResultCode: DBIResult;
tbl, Err: Array[0..255] of Char;
SrcTbl, DestTbl: TTable;
SrcTbl := TTable.Create(Application);
try
SrcTbl.DatabaseName := Dir;
SrcTbl.TableName := TblName;
SrcTbl.Open;
DBHandle := SrcTbl.DBHandle;
SrcTbl.Close;
ResultCode := DbiDeleteTable(DBHandle,
StrPCopy(Tbl,Dir + '\' + TblName),nil);
if (ResultCode <> DBIERR_NONE) then
begin
DbiGetErrorString(ResultCode,Err);
raise EDatabaseError.Create('Удаляя ' +
Dir + '\' + TblName + ', BDE ' +
'сгенерировал ошибку '''
+ StrPas(Err) + '''');
end;
finally
SrcTbl.Free;
end;
end;