Subject RE: [IBO] TIB_SToredProc problems
Author Helen Borrie
At 02:15 PM 22/10/2004 +1000, you wrote:

> > Forget about TIB_StoredProc. Use TIB_DSQL. Use EXECUTE
> > PROCEDURE in your SQL property, use Execute to execute it,
> > read Fields[] after execution to read the return values. Use
> > parameters for re-executions of the same proc and keep it
> > prepared beween re-executions.
> >
> > There's not much point in recycling a SP or DSQL object; but
> > if you want to do so with a tib_dsql, you can.
> >
> > Helen
> >
>Hi Helen,
>I am not sure I have explained myself clearly from your solution.
>The question is: Is it possible to use a single TIB_StoredPorc or TIB_DSQL
>to execute different Proc's on the same DB, taking into account that the
>different proc's have different Params.
>ie, I have six different stored/select proc's where one of them is selected
>for execution at runtime based on certain application states. As the
>application state changes a different execute procedure is used. I'm trying
>to avoid using a different TIB_StoredProc per execute procedure defined in
>the DB.
>I hope this is clearer. Thanks again for your time.

Yes: That is what I understood you wanted.

It is dead easy. Either write a procedure to create the DSQL at run-time,
passing the parametrised EXECUTE PROCEDURE statement as a string; or
merely plonk one ib_dsql in your datamodule, set it up with everything
except the SQL, and access it at run-time.:

procedure MyDM.SetupDSQL (sSQL:string);
with my_dsql do

Clearing the SQL completely invalidates, unprepares and clears the
object. It will reassemble itself in your launch code when you call Prepare:

Launch code, just this:

s:= 'EXECUTE PROCEDURE WHATEVER(:param1, :param2)';
with MyDM.my_dsql do
if not Prepared then Prepare;
Params[0].AsWhatever := whatever;
Params[1].AsSomething := something;