On Monday 22 February 2010, Henning Westerholt wrote:
Old results are freed when the module is destroyed as a cleanup, during an error of query execution and before a new query is started. But as every single invocation of sql_query could fail, i'd not recommend it to optimize the free operation away.
Just to complete this, there are error conditions in the sql_query function that do not free the previous query, like "bad parameter", otherwise it would be probably work.
Cheers,
Henning