Mike: What Christof said. 1) You'll need a separate connection for each running SQLEXEC. 2) Unless you have a super-powerful multi-thread server running highly parallel queries, you may not gain very much. Two at once might work fairly well, but I doubt if it's worth inventing a fancy multi-threading mechanism to manage the SQLEXECs.
Dan On 01/27/12 02:47, Christof Wollenhaupt wrote: > Hi Mike, > > >> I've got lots of SQLEXECs to fire off and I didn't want to wait for each >> one to finish before firing off the next one. Are there any gotchas I >> should be aware of by taking the SQLSETPROP(giHandle,'Asynchronous',.T.) >> route? >> > > The connection is busy while the query is still executing. You therefore > need a separate connection for each query or send multiple statements in > one batch if the server supports this. This could be an issue if you have > transactions open or read from the same tables, as you might not see data > on a different connection or run into a locking issue. > > If you have code that generically queries the return value of SQLEXEC(), be > aware of the value 0 indicating that it is still executing. You won't get > back 1 as usual. > > The cursors are created before the function returns for the first time, so > you can safely bind controls and grids. However, as the cursor is filling > in the background you should not call any function that requires the cursor > to be fully available. That is, no RECCOUNT() call, no GO BOTTOM, COUNT > FOR, etc. Otherwise you end up in a blocking situation. There's a > CURSORGETPROP() call to retrieve the number of records in the cursor. > > SQLEXEC() only returns when the server has reported the structure of the > resulting cursor. Some do this right after sending the statement, some > along with the first batch of data. If the time consuming part is therefore > preparing data on the server side due to aggregate functions or sorting the > result cursor, you might not see a lot of performance improvement. > > Christof > > > --- StripMime Report -- processed MIME parts --- > multipart/alternative > text/plain (text body -- kept) > text/html > --- > [excessive quoting removed by server] _______________________________________________ Post Messages to: [email protected] Subscription Maintenance: http://leafe.com/mailman/listinfo/profox OT-free version of this list: http://leafe.com/mailman/listinfo/profoxtech Searchable Archive: http://leafe.com/archives/search/profox This message: http://leafe.com/archives/byMID/profox/[email protected] ** All postings, unless explicitly stated otherwise, are the opinions of the author, and do not constitute legal or medical advice. This statement is added to the messages for those lawyers who are too stupid to see the obvious.

