erro batch insert firebird

Discussion of open issues, suggestions and bugs regarding UniDAC (Universal Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
gss200610
Posts: 35
Joined: Mon 23 May 2016 22:29

erro batch insert firebird

Post by gss200610 » Fri 26 Aug 2016 11:26

I am using the following code to perform an insert 100 records, and returns me the following error:

var
I: Integer;
begin
UniQuery1.Close;
UniQuery1.SQL.Text := 'UPDATE OR INSERT INTO CARTAS(COD_CARTA, NOME_CARTA) VALUES(:A, :B) MATCHING( COD_CARTA)';

UniQuery1.Params.ValueCount := 100;
for I := 0 to 100 -1 do
begin
UniQuery1.Params[0].AsInteger := i + 1;
UniQuery1.Params[1].AsString := 'CARTA ';

end;
UniQuery1.Execute(100);
ShowMessage('OK');

DA Dynamic SQL Error
Too many Contexts of Relation/Procedure/Views. Maximum allowed is 255

I always have to specify the type of parameters before filling in the parameters array, as example?
Query1.Params[0].DataType := ftInteger;


I changed the command, find that does not work with update or insert into sql clausa. more noticed a strange thing, the string type parameter so writes the first character in the database.

UniQuery1.Params[1].AsString := 'CARTA '; -> so the letter C recorded in the database, even passing the type parameter to ftstring

ViktorV
Devart Team
Posts: 3168
Joined: Wed 30 Jul 2014 07:16

Re: erro batch insert firebird

Post by ViktorV » Fri 26 Aug 2016 12:50

Thank you for the information. We have reproduced the issue and investigation is in progress. We will inform you when we have any results.
For correct functioning of batch operations, you should set the parameter type before filling in it.

gss200610
Posts: 35
Joined: Mon 23 May 2016 22:29

Re: erro batch insert firebird

Post by gss200610 » Fri 26 Aug 2016 18:01

is there any alternative, must import 30 000 lines of a text file, and tried with cached updates and always give conflicting primary key, not entedir why using UNIQUERY with firebird. game data to query, and when you apply updates, UPDATE ERROR MESSAGE. there is some property of tuniquery I need to mark it? because the ID accusing UNIQUE KEY error, I generate it before playing in uniquery (a sequential banks bank) and to apply, always error not know what else to do.

ViktorV
Devart Team
Posts: 3168
Joined: Wed 30 Jul 2014 07:16

Re: erro batch insert firebird

Post by ViktorV » Mon 29 Aug 2016 07:35

Please compose a small sample demonstrating the described behavior and send it to viktorv*devart*com, including scripts creating database objects in order to get a detailed answer.

Post Reply