Hi!

>>>>> "Marcello" == Marcello Giovagnoli <[EMAIL PROTECTED]> writes:

Marcello> Hi Monty,
>> Why do you need to retrieve so many rows to the client?  Can't you use
>> LIMIT to restrict the number of result rows?

Marcello> The point is that the program scans the entire table and process each row
Marcello> in a diffrent way, executing other queryes inside the main SQLFetch() loop.
Marcello> Someting like this:

<cut>

Marcello> Reading the manual :( It seems that i can do this ONLY using
Marcello> mysql_store_result(), because each mysqld instance can do
Marcello> only one query at a time, is it correct ?

Yes, you can only use this method with mysql_store_result(), if you
can't do a separate connection to mysqld in the inner loop.

Marcello> If yes, I need some way to reduce the client memory usage, 
Marcello> processing big tables.

Marcello> I can implement something build a select with limit n1,2n
Marcello> re-run the query when SQLFetchRow() fails.

Marcello> I don't have notice how the other databases works in this cases.

They use a cursor to retrieve the rows in blocks from the server;
This consumes less memory but is in may cases much slower.

Marcello> In my opinion the right way to work around this problem should be 
Marcello> to use a temporary file to store results for the big tables, forcing this
Marcello> option with a parameter as SQL_BIG_TABLES=1, in this case
Marcello> mysql_store_result() can store the result in a file, i can issue the
Marcello> SQLFreeResult() and build another query.

Marcello> What do you think about ?

Do you mean that mysql_store_result() should store everything to a
local file and and mysql_fetch... should read from this file?
This should not be that hard to do.

>> Which version of MyODBC do you use?

Marcello> myodbc-2.50.22

>> If you have an very old MyODBC versions which includes an old
>> mysqlclient lib this may explain your problems; Older
>> mysql_free_result() versions didn't read the old result from the
>> connections and because of this one would get the error message you
>> got if one didn't read all rows from the result before calling
>> mysql_query() again.

Unfortunately the above wasn't the problem in this case.

Regards,
Monty

---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to