Subject | Re: Prepare and SPs |
---|---|
Author | Svein Erling Tysvær |
Post date | 2005-06-10T11:04:03Z |
The stored procedure is compiled into BLR at the time of creation (or
rather, when you commit that transaction, I think). It is prepared
(plan chosen to use upon calling open) when you do myQuery.Prepare;
After that, you just change parameters, and no further prepare is
done. Logically, it would make little sense to do prepare at the time
of creation, since the contents of your tables may change between
creating and using the procedure.
Of course, if you use EXECUTE STATEMENT within your procedure, then
that part is prepared on the fly when you execute it.
HTH,
Set
rather, when you commit that transaction, I think). It is prepared
(plan chosen to use upon calling open) when you do myQuery.Prepare;
After that, you just change parameters, and no further prepare is
done. Logically, it would make little sense to do prepare at the time
of creation, since the contents of your tables may change between
creating and using the procedure.
Of course, if you use EXECUTE STATEMENT within your procedure, then
that part is prepared on the fly when you execute it.
HTH,
Set
--- In firebird-support@yahoogroups.com, "colinriley666" wrote:
> Can't find the answer to this in the excellent "The Firebird Book".
> I have a query myQuery : select a,b,c from stored_proc1(:myParam).
>
> I issue (using Delphi as an example):
> myQueryPrepare;
> myQuery.Params[0] := 1;
> myQuery.Open;
> ... bla bla bla...
> myQuery.Close;
>
> myQuery.Params[0] := 2;
> myQuery.Open;
> ... bla bla bla...
> myQuery.Close;
>
> Question : at what point are the SQL statements embedded within
> stored_proc1 actually prepared?
>
> regards, Colin