[Devel] one more (possible) improovments of mysql module
vit at lipetsk.ru
Wed Jun 13 19:20:41 CEST 2007
Henning Westerholt wrote:
> On Mittwoch, 13. Juni 2007, Victor Gamov wrote:
>> Looking into mysql module I found two very similar (at first glance)
>> functions db_mysql_store_result() and db_mysql_fetch_result().
>> I change db_mysql_store_result() with db_mysql_fetch_result() (with
>> slightly changed interface) and everything work fine.
>> Is it really needed both of this functions ?
> Hello Victor,
> store_result is a helper function for query and raw_query, fetch_result
> fetches only the specified number of rows. This function is only needed from
> the usrloc module.
I see, Thanks
> So i don't think that we could get rid of this function at the moment.
> But how do you changed the interface of the store_result function?
No. I remove store_result and use only fetch_result.
But it was mistake about interface changes, sorry.
I change all store_result calls (two times only in dbase.c) to
fetch_result with third parameter nrows=0.
As I found in fetch_result code it counts number of rows returned by DB
and fetch only nrows. If nrows=0
it will return all rows fetched from DB
at line 368-369 (mysql/dbase.c):
if(nrows>0 && nrows<n)
n = nrows;
More information about the Devel