Subject | Does unpreparing affect server/client memory? |
---|---|
Author | Dennis McFall |
Post date | 2006-04-26T22:15:22Z |
Let's say I am using a single TIB_Cursor component on the main form
to handle 100 different SELECT statements, by CLEARing and ADDing to
the SQL property as needed. For example:
Button1Click:
with curData do try
SQL.Clear;
SQL.Add('SELECT THIS, THAT, OTHER FROM SOMETABLE WHERE ITEMID=?');
Prepare;
Params[0].AsInteger := iSomeInteger;
First;
if not eof then begin
// do something
end;
finally
Close;
end;
Button2Click:
with curData do try
SQL.Clear;
SQL.Add('SELECT ALPHA, BETA, GAMMA FROM TABLE2 WHERE FOO_ID=?');
Prepare;
Params[0].AsInteger := iOtherInteger;
First;
if not eof then begin
// do something
end;
finally
Close;
end;
Does it make any difference, as far as memory or other resources are
concered -- on either the client workstation or on the Firebird
server -- whether there is an "Unprepare" in the try...
finally block? Does the query in some way ever get unprepared on the
server without my calling "unprepare". I assume (?) that "Prepare"
takes up some RAM on the server as the data structures are created to
receive the param values and to return the results. When/how is that
memory released if I don't explicitly call Unprepare?
Thanks,
Dennis McFall
to handle 100 different SELECT statements, by CLEARing and ADDing to
the SQL property as needed. For example:
Button1Click:
with curData do try
SQL.Clear;
SQL.Add('SELECT THIS, THAT, OTHER FROM SOMETABLE WHERE ITEMID=?');
Prepare;
Params[0].AsInteger := iSomeInteger;
First;
if not eof then begin
// do something
end;
finally
Close;
end;
Button2Click:
with curData do try
SQL.Clear;
SQL.Add('SELECT ALPHA, BETA, GAMMA FROM TABLE2 WHERE FOO_ID=?');
Prepare;
Params[0].AsInteger := iOtherInteger;
First;
if not eof then begin
// do something
end;
finally
Close;
end;
Does it make any difference, as far as memory or other resources are
concered -- on either the client workstation or on the Firebird
server -- whether there is an "Unprepare" in the try...
finally block? Does the query in some way ever get unprepared on the
server without my calling "unprepare". I assume (?) that "Prepare"
takes up some RAM on the server as the data structures are created to
receive the param values and to return the results. When/how is that
memory released if I don't explicitly call Unprepare?
Thanks,
Dennis McFall