I am using batch update functionality with a TUniQuery and Postgres.
In this case I have 2 identical tables and I wrote simple code to insert 2 records in both tables using an Array of Params.
For some reason all records are posted into the first table. How can I reset the TUniQuery component so that Batch operation functions normal for the second table ?
Really strange is that DB monitor shows me the query's I would expect (!)
You need table1 and table two with an Integer and character field to try this code below.
My config : Delphi XE5 ; UniDac 6.4.16 ; DBMonitor 3.0.4 ; Postgres 9.5
Code: Select all
Q1.SQL.Text := 'insert into table1 (val1, val2) values (:PAR0, :PAR1)';
Q1.Params[0].DataType := ftInteger;
Q1.Params[1].DataType := ftString;
//
Q1.Params.ValueCount := 2;
// 1st
Q1.Params[0][0].asInteger := 1;
Q1.Params[1][0].asString := 'test 1';
// 2nd
Q1.Params[0][1].asInteger := 2;
Q1.Params[1][1].asString := 'test 2';
Q1.Execute(2);
/////////////////////
Q1.SQL.Text := 'insert into table2 (val1, val2) values (:PAR0, :PAR1)';
Q1.Params[0].DataType := ftInteger;
Q1.Params[1].DataType := ftString;
//
Q1.Params.ValueCount := 2;
// 1st
Q1.Params[0][0].asInteger := 1;
Q1.Params[1][0].asString := 'test 1';
// 2nd
Q1.Params[0][1].asInteger := 2;
Q1.Params[1][1].asString := 'test 2';
Q1.Execute(2);
Regards,
Pascal