List:MySQL++« Previous MessageNext Message »
From:Jonathan Wakely Date:July 4 2011 11:07am
Subject:Re: exception in subqueries
View as plain text  
On 4 July 2011 11:54, Access-Dev wrote:
>
> Sorry, my message was not clear enough, by subquery I mean excetuing a query
> for each row
>
> eg:
>
> pseudocode
>
> query = "SELECT * FROM table";
>
> for each (row){
>
>    subquery = "SELECT COUNT(*) FROM anothertable WHERE table_id=
> TABLEID_FROM_MAINQUERY
>
> }

It's not clear from your first piece of incomplete code or the not
very helpful pseudocode, but I assume you're calling query.use() in
both cases. With a UseQueryResult you can't issue another query on the
connection until you've finished processing the results of the first.
This is documented too:
http://tangentsoft.net/mysql++/doc/html/userman/tutorial.html#concurrentqueries


You should either do a single query as Shaun suggests, or use
QueryStoreResult for the first query.
Thread
exception in subqueriesAccess-Dev4 Jul
  • Re: exception in subqueriesJonathan Wakely4 Jul
    • Re: exception in subqueriesAccess-Dev4 Jul
      • RE: exception in subqueriesShaun Brown4 Jul
        • Re: exception in subqueriesAccess-Dev4 Jul
          • Re: exception in subqueriesWarren Young5 Jul
      • Re: exception in subqueriesJonathan Wakely4 Jul