Hello. I'm trying to use Array DML with SQLite (native mode) and I get this exception: Exception class EListError with message 'List index out of bounds (1)'. Project zip: http://www9.zippyshare.com/v/cOW0euhW/file.html Code: {code} const NUM_INSERTS = 10000; procedure TForm7.Button3Click(Sender: TObject); var i: integer; t: integer; begin t := GetTickCount; FDQuery1.Params.BindMode := pbByNumber; // !!!!! <= !!!!!! FDQuery1.Connection.ExecSQL('DROP TABLE IF EXISTS tbl;'); FDQuery1.Connection.ExecSQL('CREATE TABLE tbl(BaseNum INTEGER);'); FDQuery1.SQL.Text := 'INSERT INTO tbl (BaseNum) VALUES (:BN)'; FDQuery1.Connection.StartTransaction; try FDQuery1.Params.ArraySize := NUM_INSERTS; for i := 0 to NUM_INSERTS - 1 do begin FDQuery1.Params[0].AsIntegers[i] := i; end; FDQuery1.Execute(NUM_INSERTS, 0); FDQuery1.Connection.Commit; except FDQuery1.Connection.Rollback; raise; end; (Sender as TButton).Caption := FloatToStr((GetTickCount() - t) / 1000); end; {code} Connection: {code} object FDConnection1: TFDConnection Params.Strings = ( 'DriverID=SQLite') ResourceOptions.AssignedValues = [rvArrayDMLSize] ResourceOptions.ArrayDMLSize = 150 LoginPrompt = False Left = 115 Top = 25 end {code} Query: {code} object FDQuery1: TFDQuery Connection = FDConnection1 ResourceOptions.AssignedValues = [rvArrayDMLSize] ResourceOptions.ArrayDMLSize = 150 Left = 179 Top = 25 end {code}
![]() |
0 |
![]() |
This is a bug in FireDAC SQLite driver. There are two workarounds: * do not use pbByNumber, but that will disable native array DML support; * do not set ResourceOptions.ArrayDMLSize, but you will need to keep eyes open when you will have large array size. -- With best regards, Dmitry Arefiev / FireDAC Architect
![]() |
0 |
![]() |