PDA

View Full Version : Proper db_free_result() usage?


DrakeX
14/05/2014, 07:44 PM
I have a simple question, which relates to the db_free_result(); (http://wiki.sa-mp.com/wiki/Db_free_result) function. Is db_free_result(); used only after retrieving a result? Such as:

new string[128], DBResult:result;
format(string, sizeof(string), "SELECT * FROM `TABLE` WHERE `VALUE` = '%s'", EscapeString("example"));
result = db_query(Database, string);
db_free_result(result); // <---


Or is it to be used during the use of db_query as well (as shown as an example on the Wiki page (http://wiki.sa-mp.com/wiki/Db_free_result))?
I've seen numerous examples and different usages, so I really don't understand where and when to use this function. Thanks.

Vince
14/05/2014, 08:11 PM
You only need to free the result if there was a result in the first place. That means: select, show, describe and explain queries.

Goldenfox
16/05/2014, 08:42 PM
https://i.imgflip.com/8ukjb.jpg