multiple TQuery.Open lockup problems in TThread
Posted on 1998-01-24
Here is my story:
I wrote an application which
a) opens a query (which is placed on a form and is a simple select) on
the remote server, then closes it
b) creates a simple thread
c) the thread Create does this:
Query := TQuery.Create( MainForm );
Query.DatabaseName := 'database';
Inherited Create( False );
d) the thread Execute does this:
Query.SQL.Add( 'SELECT * FROM SOMETABLE' );
Now at point d) the Query.Open just NEVER returns!!!
If I skip (comment out) a) it works just fine!
If I put c) and d) in the main thread it works just fine!
If I give nil or Application to TQuery.Create() instead of MainForm it
If I allocate the Query in d) it's hangs all the same. If I use a TTable
instead of FirstQuery it's all the same.
Once I somehow changed the program to hang even earlier on
I tried to monitor the ODBC calls and the last ones I got was
PrepareStatement and ExecStatement or smth like that. Then you can just
wait for the results to be returned - forever.
So is it a problem with my thread creating or my query creating? Or is
it a BDE or an ODBC problem? Is it supposed to be that way?
I'm getting totally confused and desperate on this issue... :-(
Any ideas would be really appreciated.