Retrieving updated TDataSet data in a background thread

Discussion of open issues, suggestions and bugs regarding IBDAC (InterBase Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
Fabrice
Posts: 44
Joined: Tue 07 Sep 2010 09:44

Retrieving updated TDataSet data in a background thread

Post by Fabrice » Mon 22 Jun 2020 08:07

Hello,


I'am testing multithreading with IBDac. For the moment the solution I have found is :
1) Execute a TIbcquery in a thread
2) Copy the result of 1) into a Memory Dataset (in the main thread) when 1) finished.

I would like to know if it possible to do something like Firedac :
https://delphi.programmingpedia.net/en/ ... und-thread
or
https://riptutorial.com/fr/delphi/examp ... le-firedac


The very interesting to transfer data between Query is the property :

Code: Select all

 Form.FDQuery1.Data := Query.Data;

oleg0k
Devart Team
Posts: 89
Joined: Wed 11 Mar 2020 08:28

Re: Retrieving updated TDataSet data in a background thread

Post by oleg0k » Thu 25 Jun 2020 11:08

Hello,

Our components don't have such functionality.
You are welcome to leave a feature suggestion on our UserVoice page ( https://devart.uservoice.com/forums/104 ... y_id=18939 ). If your suggestion receives many upvotes, we'll implement it.

wbr, Oleg
Devart Team

Fabrice
Posts: 44
Joined: Tue 07 Sep 2010 09:44

Re: Retrieving updated TDataSet data in a background thread

Post by Fabrice » Thu 02 Jul 2020 08:08

Hello oleg0k,

Thank you for answer : I have added my suggestion !

frickler
Posts: 15
Joined: Wed 04 Apr 2018 08:30

Re: Retrieving updated TDataSet data in a background thread

Post by frickler » Tue 11 Aug 2020 14:18

You cannot transfer from query to query, but from query to virtual dataset using Assign.

costasd
Posts: 4
Joined: Fri 13 Jul 2018 11:44

Re: Retrieving updated TDataSet data in a background thread

Post by costasd » Mon 14 Sep 2020 22:49

I do it differently. First of all, I presume that the reason to execute a Query in a thread is to keep the application responsive during long running queries, which often return large amounts of data. Therefore, copying the data from one DataSet to another is a bit inefficient, time wise and memory wise.

I define the query in the main thread but execute it in a background thread. There is no problem in doing this as long as your application does not "bother" the Query while it is executing in a thread. For example, don't call Query.Close in the main thread while the background thread is executing, you will probably create some havoc. It works perfectly for me and allows me to interrupt the query if it takes too long and also update the user on the fetch status (when fetching of data starts).

I must say that I am using TUniQuery for my purposes but I am fairly confident it works with TIBCQuery as well.

Let me know if you need an example.

Post Reply