About BreakExec and Executing
Posted: Tue 11 Dec 2007 10:08
Hello
I have a problem here and I am not sure what am I doing wrong.
I have a main form, and a thread that does some data updates.
When I press a button on the main form a new thread starts. It creates a new connection to mysql server and a new query. First I am opening the records I need to check. This may take quite a long time, from 10s to 1-2 min. I want when I close the main form the opening of the records to break, the connection to close and the thread to terminate.
This sounded very easy since TCustomDADataSet has a nice method Executing and TCustomMyDataSet has a nice method BreakExec.
But I found out the following:
- even if the query is executing at the moment Executing returns False !!!
- even if I call BreakExec query execution does not break !!!
Both are called from the main thread.
I have solved this by creating my own boolean variable and by creating my own mechanism for killing thread. But I would like to use MyDAC functionality. Maybe I am doing sth wrong, or there is a bug somewhere.
I would appreciate very much your advice. Thank you
I have a problem here and I am not sure what am I doing wrong.
I have a main form, and a thread that does some data updates.
When I press a button on the main form a new thread starts. It creates a new connection to mysql server and a new query. First I am opening the records I need to check. This may take quite a long time, from 10s to 1-2 min. I want when I close the main form the opening of the records to break, the connection to close and the thread to terminate.
This sounded very easy since TCustomDADataSet has a nice method Executing and TCustomMyDataSet has a nice method BreakExec.
But I found out the following:
- even if the query is executing at the moment Executing returns False !!!
- even if I call BreakExec query execution does not break !!!
Both are called from the main thread.
I have solved this by creating my own boolean variable and by creating my own mechanism for killing thread. But I would like to use MyDAC functionality. Maybe I am doing sth wrong, or there is a bug somewhere.
I would appreciate very much your advice. Thank you