Subject Re: [IBO] execute stored procedure
Author Helen Borrie
At 05:42 PM 26-12-01 -0800, Daniel Bertin wrote:
>Hi all,
>I know this will sound stupid but, how should I execute a stored procedure.
>using the sql of a IBOquery? seems to me I don't need a component I should
>be able to do it in code?

You always need a component to pass a statement through from the client to the server...but you don't really want the overhead of a bi-directional dataset to execute something...


>all I want to do is clean up some records as part of a weekly procedure.
>I created a stored procedure CLEAN_UP
>
>DELETE FROM READINGS
> WHERE RDATE < CURRENT_DATE - 30
>
>so now How should I execute this CLEAN_UP procedure? I'm using Delphi 5,
>IBO, and Firebird RC2.

If that's all there is to it, you surely don't need a stored procedure. Just drop a TIB_DSQL and a TIBOTransaction onto your application. Set the IB_Transaction property of the ib_dsql to this transaction. Set the IB_Connection property of both to your iboDatabase. Place your statement above into the SQL property. Handle the transaction explicitly - start it, execute the DSQL (call its Execute method), handle any errors and commit or rollback as required.

If there is more to it than the statement above and you really do need a SP, you can just replace the SQL with
execute myproc(someinput)


>Best wishes to all for the New Year

Same to you and everyone.

Cheers,
Helen