Subject | Re: [IBO] TIB_StoredProc management question |
---|---|
Author | Joe Martinez |
Post date | 2003-05-10T07:26:19Z |
>IMHO, none of them is efficient. I don't touch TIB_StoredProc, ever.Why is that? Why does TIB_StoredProc exist at all if you can get the same
functionality with the objects you mention below?
>For executable SP's I use TIB_DSQL. For selectables, I use TIB_Query whenOk. These are SP's that both update data and return values (just one row
>I want a scrolling dataset, TIB_Cursor when I don't.
with output values, not a scrolling dataset). So, in that case, would I
use TIB_Cursor?
What would I set the SQL to?
Would it be "execute procedure MyProc ('12345", 234, 'Hello')"
Or, would it be "select retval1,retval2,retval3 from MyProc where MyParam1
= '12345' and MyParam2 = 234 and MyParam3 = 'Hello'"
or something else?
In either of the above SQL statements, do I use paramaters (:MyParam1,
:MyParam2, etc.) instead of the literal strings, just like in a
parameterized select?
Then, do I call Open() or Execute()? Which is correct in this case?
Then, do I just use the TIB_Cursor's FieldByName() method to get the return
values?
>If the same SP is going to be called again and again with differentThe call to my SP is going to be done in a loop, with different parameters
>parameters, at random, it makes sense to create it at create-time, prepare
>it once the first time it's called and then select or execute it as
>required. I don't want to waste resources on continually creating,
>preparing and destroying instances of the same object if the only variable
>factor is the input parameters.
each time.
So, in my case above, I would set the SQL parameter to the correct
statement, prepare, and execute/select.
Then, what do I do for each iteration of the loop? Do I use ParamByName to
set the params for each iteration?
Thanks,
Joe