rows affected batchupdate

Discussion of open issues, suggestions and bugs regarding UniDAC (Universal Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
albourgz
Posts: 160
Joined: Wed 06 May 2009 12:17
Location: belgium

rows affected batchupdate

Post by albourgz » Mon 26 Jul 2021 10:36

Hi,

I would like to use batchUpdate, giving an array of values to run updates.
However, for each line in the parameter array, I would like to know how many values were updated.

is there any return value like rowsaffected[i] that could be used?

evgeniym
Devart Team
Posts: 103
Joined: Thu 13 May 2021 07:08

Re: rows affected batchupdate

Post by evgeniym » Tue 27 Jul 2021 10:31

Hi There,
Unfortunately, it’s not possible to check the information regarding the number of changes for each string.
If you use batchUpdate you may check only general results of all executed queries. In case you need information regarding each query separately, you need to execute them separately.
You may find more information about Batch operation in our documentation:
https://blog.devart.com/using-batch-ope ... nents.html
Regards,
Evgeniy

albourgz
Posts: 160
Joined: Wed 06 May 2009 12:17
Location: belgium

Re: rows affected batchupdate

Post by albourgz » Tue 27 Jul 2021 10:37

"it’s not possible" or ", it’s not YET possible"?

This would be a nice improvement in a future release, it just costs an DynamicArray<__int64>.

Thanks.

evgeniym
Devart Team
Posts: 103
Joined: Thu 13 May 2021 07:08

Re: rows affected batchupdate

Post by evgeniym » Wed 28 Jul 2021 11:11

Hi there,
When executing BatchUpdate server receives all data as one query, accordingly it may return one result only. It allows to significantly speed up the data refresh.
In order to extract data for each query they need to be executed separately and results saved separately as well. However, in such case the sense of BatchUpdate is lost because the speed will be almost similar to sequential execution of all requests. You may implement the sequential query behavior yourself using the method:

Execute(Iters: integer; Offset: integer = 0)

For instance:

Code: Select all

for i := 0 to RowCount do begin 
   SQL.Execute(1, i); 
   ar[i] := SQL.RowsAffected; 
   ..... 
end; 
Regards,
Evgeniy

albourgz
Posts: 160
Joined: Wed 06 May 2009 12:17
Location: belgium

Re: rows affected batchupdate

Post by albourgz » Wed 28 Jul 2021 11:40

you say " server receives all data as one query"
=> If parameters are in where clause, I guess that at db server they are split somewhere, no??????

evgeniym
Devart Team
Posts: 103
Joined: Thu 13 May 2021 07:08

Re: rows affected batchupdate

Post by evgeniym » Thu 29 Jul 2021 08:48

Hi There,
We can investigate this option.
If you want us to implement support of data display in RowsAffected for each query in BatchUpdate please post this suggestion at our user voice forum:
https://devart.uservoice.com/forums/104 ... components
If the suggestion gets a lot of votes, we will consider the possibility to implement it.
At the moment you may follow the steps we described before.

Regards,
Evgeniy

albourgz
Posts: 160
Joined: Wed 06 May 2009 12:17
Location: belgium

Re: rows affected batchupdate

Post by albourgz » Mon 02 Aug 2021 11:12

ok, thanks!

evgeniym
Devart Team
Posts: 103
Joined: Thu 13 May 2021 07:08

Re: rows affected batchupdate

Post by evgeniym » Tue 03 Aug 2021 07:57

Hi There,
Thanks for using our product.
Feel free to contact us anytime- we are always ready to help.

Regards,
Evgeniy

Post Reply