Subject | Re: [IBO] Re: Correct Way to Use TIB_StoredProc |
---|---|
Author | Helen Borrie |
Post date | 2003-04-19T22:06:42Z |
At 09:32 PM 19/04/2003 +0000, you wrote:
necessary (and should not be allowed by your code, if you care about
performance!)
if not Prepared then Prepare; <-- only needs to be done once
ParamByName('parm1').Value:=SameValue1;
ParamByName('parm2').Value:=SameValue2;
ExecSQL;
For batches, you will also make it faster if you place batches of up to
2000 calls to the procedure inside a single, explicit transaction.
Helen
> >it's actually more efficient to use TIB_DSQL and TIB_Query forNo, this does not change the structure of the SQL and so a prepare is not
>executable and selectable stored procedures, respectively
>
>I am playing with a remote Linux server accessed via a slow TCP/IP
>connection.
>
>The first thing I noted was how slow is the Prepare method of a
>TIB_StoredProc.
>
>Now I understand that I should use a TIB_DSQL.
>
>Ok.
>
> > With any of the components, the Params[] array gets cleared
>whenever the component is unprepared. Unprepare occurs whenever you
>change the SQL property or, in the case of TIB_StoredProc, the
>StoredProcName.
>
>What if I want to use the same SP with new parameters ?
necessary (and should not be allowed by your code, if you care about
performance!)
>The following code works:Yes. Keep it prepared. Your code should be:
>
>Prepare;
>ParamByName('parm1').Value:=SameValue1;
>ParamByName('parm2').Value:=SameValue2;
>ExecSQL;
>
>But it is rather slow.
>
>Is there any faster way to feed new parameters to a SP ?
if not Prepared then Prepare; <-- only needs to be done once
ParamByName('parm1').Value:=SameValue1;
ParamByName('parm2').Value:=SameValue2;
ExecSQL;
For batches, you will also make it faster if you place batches of up to
2000 calls to the procedure inside a single, explicit transaction.
Helen