[OpenSIPS-Devel] Db interface
Bogdan-Andrei Iancu
bogdan at voice-system.ro
Wed Aug 4 22:17:34 CEST 2010
Hi Stan,
there are 2 way you can get the results from a DB query:
1) directly, by passing the db_res struct to the query function - it
will return the whole result right away
2) piece by piece, after the query is done - you do not pass any db_res
to the query function; after the query is done, you use fetch_result()
to get a number of rows from the DB underlaying driver. You can call
fetch_result() several time (to fetch consecutive chunks) for the same
result in a loop (until entire result is fetched).
The second mechanism was added to be able to fetch large results via
small pkg mem pool.
Regards,
Bogdan
Stanisław Pitucha wrote:
> Hi,
> I have some questions about the DB interface. In general - what is
> fetch_result() useful for?
> As far as I can see, every query function returns the needed results
> directly into `*_r`. In that case, why is fetch_result() needed?
>
> If it's needed, are there any guarantees about calling fetch_result? Is
> it always called directly after the query? Are there any other DB
> operations in between?
>
> Taking db_mysql as an example - how does it return any results, if every
> other query function uses mysql_store_result() directly?
>
> Thanks,
> Stan
>
> _______________________________________________
> Devel mailing list
> Devel at lists.opensips.org
> http://lists.opensips.org/cgi-bin/mailman/listinfo/devel
>
>
--
Bogdan-Andrei Iancu
OpenSIPS Bootcamp
20 - 24 September 2010, Frankfurt, Germany
www.voice-system.ro
More information about the Devel
mailing list