开发者

mysql_store_result() @ MySQL C API - does it really allocate memory in each call?

开发者 https://www.devze.com 2022-12-22 03:44 出处:网络
I\'ve read that mysql_store_result() in the MySQL C API will allocate memory for each and every call to it;

I've read that mysql_store_result() in the MySQL C API will allocate memory for each and every call to it;

mysql_store_result() reads the entire result of a query to the client, allocates a MYSQL_RES structure, and places the result into this structure.

It is really so? I'm asking because I'm about to call it many times in a server application. Allocating/Freeing is horrible for my purpose.

Is there a way to provide a custom buffer to 开发者_如何学运维it? Maybe some "undocumented" API?


See this link about using mysql_use_result: http://dev.mysql.com/doc/refman/5.0/en/mysql-use-result.html

i use "use_result" instead of "store_result" on all select queries.


Yes, it's really so. Why wouldn't it be?

Perhaps you mean to edit your question to be, "What can I do instead?" rather than "Is it really so?" Based on your comments, that seems to be more what you're actually wanting to know.

0

精彩评论

暂无评论...
验证码 换一张
取 消