我的代码执行以下操作:
TFDConnection
TFDConnection
TT_SYS_WEEKS
TFDConnections可以嵌入或不嵌入Firebird。在所有组合中都可以正常工作,除非同时嵌入了两者。
在步骤6中,执行后
DROP INDEX <OWNER>TT_I1_SYS_WEEKS
ALTER TABLE <OWNER>TT_SYS_WEEKS DROP CONSTRAINT TT_I0_SYS_WEEKS
该声明
DROP TABLE TT_SYS_WEEKS
失败[FireDAC][FB][Phys]unsuccesful metadata update Table TT_SYS_WEEKS already exists
。
在步骤3、4、5中已经执行了完全相同的删除和创建表/索引的操作。TT_SYS_WEEKS
不是最后复制的表。
设计时间目标连接及其TFDPhysFBDriverLink
设置如下:
AConnection.TxOptions.AutoCommit := true;
AFDPhysDriverLink.DriverID := 'FBEmbeddedBase'; // JD 28-3-2018
AFDPhysDriverLink.VendorLib := 'fbembed.dll'; // 32-bits only
AConnection.Params.DriverID := 'FBEmbeddedBase'; // AConnection
AConnection.Params.Database := 'full GDB file';
SetFireBirdMapRules(AConnection); // Some mapping rules
AConnection.UpdateOptions.LockWait := False;
AConnection.UpdateOptions.LockMode := lmNone;
运行时源连接和TFDPhysFBDriverLink
设置如下:
// Create 'own' TFDPhysFBDriverLink for embedded connection
// https://stackoverflow.com/questions/46691699/setting-up-a-second-tfdphysfbdriverlink-possible-and-necessary
lDriverLink := TFDPhysFBDriverLink.Create(Application);
lDriverLink.DriverID := 'FBEmbedded';
lDriverLink.VendorLib := 'fbembed.dll'; // 32-bits embedded
LRestoreDB := TFDConnection.Create(Application);
LRestoreDB.UpdateOptions.RequestLive := false;
LRestoreDB.ResourceOptions.AutoReconnect := true;
LRestoreDB.Params.DriverID := lDriverLink.DriverID;
with LRestoreDB do
begin
Params.Database := AFBFileName;
Params.UserName := '***';
Params.Password := '***';
LoginPrompt := False;
// ResourceOptions.KeepConnection is default true
FetchOptions.Mode := fmAll;
end;
SetFireBirdMapRules(LRestoreDB); // Some mapping rules
怎么回事?
我还有什么可以调查的吗?
其他背景信息:
您需要在步骤4、5和6(当然还有7)之后执行一次提交。Firebird中的某些DDL仅在提交时才真正执行,因此,如果您在一个事务中运行所有内容,则实际上并不会在步骤3和4中删除并重新创建索引,而在步骤6中的表删除可能会被阻止当您尝试在步骤7中重新创建它时,步骤5中的早期DML和步骤6中的表删除将尚未执行。
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句