05.09.2010, 01:40
(
Последний раз редактировалось yezizhu; 06.09.2010 в 10:28.
)
I've found some scripters use this code below
Does func"db_free_result" has any effect here?
I think it does no effect, cuz it frees the result which stores in heap(TEMPORARY memory area), but not stack.
Neither it does below.
Does variable in heap will be cleared when it may not be use(code survival time?)
Or, should we just use db_free_result in this case?
It might be a code optimisation.
Thanks in advanced.
Код:
db_free_result(db_query(db_example,"SELECT * FROM example_table"));
I think it does no effect, cuz it frees the result which stores in heap(TEMPORARY memory area), but not stack.
Neither it does below.
Код:
new DBReuslt:dbr; //stores in heap dbr = db_query(db_example,"SELECT * FROM example_table"); db_free_result(dbr);
Or, should we just use db_free_result in this case?
Код:
new DBResult:g_dbr; //stores in stack func dbexe1(){ g_dbr = db_query(db_example,"example query1"); //use g_dbr do something here db_free_result(g_dbr); } func dbexe2(){ g_dbr = db_query(db_example,"example query2"); //use g_dbr do something here db_free_result(g_dbr); }
Thanks in advanced.