小编Rev*_*eer的帖子

在Delphi FireDAC中加载数组DML的最快方法

我使用Delphi XE8和FireDAC来加载一个大的SQLite数据库.为此,我使用Array DML执行技术一次有效地插入大量记录,如下所示:

FDQueryAddINDI.SQL.Text := 'insert into indi values ('
  + ':indikey, :hasdata, :gedcomnames, :sex, :birthdate, :died, '
  + ':deathdate, :changed, :eventlinesneedprocessing, :eventlines, '
  + ':famc, :fams, :linkinfo, :todo, :nextreportindi, :firstancestralloop'
  + ')';
FDQueryAddINDI.Params.Bindmode := pbByNumber; {more efficient than by name }
FDQueryAddINDI.Params.ArraySize := MaxParams; { large enough to load all of them } 

NumParams := 0;
repeat
  { the code to determin IndiKey,... is not shown, but goes here }

  FDQueryAddINDI.Params[0].AsStrings[NumParams] := IndiKey;   
  FDQueryAddINDI.Params[1].AsIntegers[NumParams] := HasData;
  FDQueryAddINDI.Params[2].AsStrings[NumParams] := GedcomNames; …
Run Code Online (Sandbox Code Playgroud)

delphi performance dml tcollection firedac

8
推荐指数
1
解决办法
3090
查看次数

在进行中取消长时间运行的TFDBatchMove

如何在调用TFDBatchMove后取消批量移动.执行,还在进行中吗?例如,如果用户按下表单上的"取消"按钮.我没有在TFDBatchMove上看到任何类型的Cancel方法.

我试过用了

  raise Exception.Create('Aborted');
Run Code Online (Sandbox Code Playgroud)

在TFDBatchMove的OnProgress事件中(检查"取消"按钮设置的"已取消"标志),但在异常消息窗口中按"确定"后,批量移动将继续.

另一种可能性是关闭阅读器组件,或设置Reader := nil在飞行中,但这似乎有点像黑客.

delphi

2
推荐指数
1
解决办法
147
查看次数

标签 统计

delphi ×2

dml ×1

firedac ×1

performance ×1

tcollection ×1