free result function on database scripting

A

Anonymous

Guest
I couldn't find the PostgreSQL channel. So I choose the nearest one, mySQL. I'm sorry if my post is OOT. Don't focus at the dirty codes, but I need to know the answer in database perspective.

if I have a script like this :
$db = pg_connect("host=localhost dbname=temp user=user")
$result = pg_query($db,"SELECT * from MyTable");
list($a, $b, $c) = pg_fetch_row($result);
pg_free_result($result);
pg_close($db);

// end of code

My question is, does the free result function need to be called after using?
MySQL has this kind of function, hasn't it?

Actually I've done so many database script without calling the free result function, and nothing matters. I'm just curious what is the effect of this function.

Thanks.

Jenny.
 
It will free the memory allocated for a result set.
I recommend its use after a result set.

Cheers
 
thanks gesf :D

but if the script is done, all the memories used by results will be freed right?

rgrds,
jenny
 
Jenny -- yes... its always like that that when a script it done all the memory allocated for that script is freed..

Otherwise there would be a problem on the servers that run 1000's of scripts :)
 
Back
Top