首页  编辑  

备份数据库

Tags: /超级猛料/Database.数据库相关/BDE和InterBase/   Date Created:

备份数据库

procedure QuickCopyTable(T: TTable; DestTblName: string; Overwrite: Boolean);

var

DBType: DBINAME;

WasOpen: Boolean;

NumCopied: Word;

begin

//save table active state

WasOpen := T.Active;

if not WasOpen then T.Open; //ensure the table is open

//Get driver type string

Check(DbiGetProp(hDBIObj(T.Handle), drvDRIVERTYPE, @DBType, SizeOf(DBINAME), NumCopied));

//Copy the table

Check(DBICopyTable(T.DBHandle, Overwrite, PChar(T.Tablename),

DBType, PChar(DestTblName)));

//Restore active state

T.Active := WasOpen;

end;