05.07.2018, 21:11
You should delete the cache before executing another query to avoid memory leaks. The code in #2 will result in error as "result" is already defined symbol.
Example:
But.. store cache and delete only if you want to call cache function in between.
I notice many users hesitate to use threaded queries and prefer non-threaded queries as it was easier to convert from older version and what not. It is preferable to use threaded queries in most cases.
Example:
pawn Код:
new Cache: result, retrieved_int, retrieved_string[17];
result = mysql_query(Sql_T, "SELECT 1"); //query 1
if (cache_num_rows())
{
cache_get_value_int(0, 0, retrieved_int);
}
cache_delete(result);
result = mysql_query(Sql_T, "SELECT 'some random text'"); //query 2
if (cache_num_rows())
{
cache_get_value(0, 0, retrieved_string, sizeof retrieved_string);
}
cache_delete(result);
I notice many users hesitate to use threaded queries and prefer non-threaded queries as it was easier to convert from older version and what not. It is preferable to use threaded queries in most cases.