SA-MP Forums Archive
Proper db_free_result() usage? - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Proper db_free_result() usage? (/showthread.php?tid=513163)



Proper db_free_result() usage? - DrakeX - 14.05.2014

I have a simple question, which relates to the db_free_result(); function. Is db_free_result(); used only after retrieving a result? Such as:

pawn Код:
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)?
I've seen numerous examples and different usages, so I really don't understand where and when to use this function. Thanks.


Re: Proper db_free_result() usage? - Vince - 14.05.2014

You only need to free the result if there was a result in the first place. That means: select, show, describe and explain queries.


Re: Proper db_free_result() usage? - Goldenfox - 16.05.2014