Subject | Re: [IBO] 4.9.14b32 - Problem with executable SP and output parameters |
---|---|
Author | Thomas Steinmaurer |
Post date | 2012-01-10T09:41:34Z |
Hello Jason,
/*---
EXECUTE2 DSQL
TR_HANDLE = 6
STMT_HANDLE = 3
PARAMS = [ ]
FIELDS = [ Version 1 SQLd 1 SQLn 1
P1.RINT = 1 ]
SECONDS = 0,016
----*/
/*---
COMMIT RETAINING
TR_HANDLE = 6
----*/
According to the trace, P1.RINT = 1, so the correct output parameter
value should be available, but I do get 0 when accessing the field with:
IB_StoredProc1.FieldByName('RINT').AsInteger
After the ExecProc call.
The SP is very simple:
SET TERM ^^ ;
CREATE PROCEDURE P1 returns (
RINT Integer)
AS
begin
RINT = 1;
end ^^
SET TERM ; ^^
Regards,
Thomas
> Would you provide the SQL trace that the IBO trace monitor outputs so I canWhen using the TIB_StoredProc component.
> decipher exactly what API calls are being used?
/*---
EXECUTE2 DSQL
TR_HANDLE = 6
STMT_HANDLE = 3
PARAMS = [ ]
FIELDS = [ Version 1 SQLd 1 SQLn 1
P1.RINT = 1 ]
SECONDS = 0,016
----*/
/*---
COMMIT RETAINING
TR_HANDLE = 6
----*/
According to the trace, P1.RINT = 1, so the correct output parameter
value should be available, but I do get 0 when accessing the field with:
IB_StoredProc1.FieldByName('RINT').AsInteger
After the ExecProc call.
The SP is very simple:
SET TERM ^^ ;
CREATE PROCEDURE P1 returns (
RINT Integer)
AS
begin
RINT = 1;
end ^^
SET TERM ; ^^
Regards,
Thomas
> Thanks,
> Jason
>
>
> -----Original Message-----
> From: IBObjects@yahoogroups.com [mailto:IBObjects@yahoogroups.com] On Behalf
> Of Thomas Steinmaurer
> Sent: 09 January 2012 02:33 PM
> To: IBObjects@yahoogroups.com
> Subject: Re: [IBO] 4.9.14b32 - Problem with executable SP and output
> parameters
>
> Jason,
>
>> You said:
>> I'm not talking about executing the procedure as SELECT * FROM<SP> at
>> the client side but rather some kind of EXECUTE PROCEDURE ...
>> RETURNING_VALUES ... equivalent? I don't know the IBO internals, e.g.
>> what client API call TIB_StoredProc.ExecProc is issuing.
>>
>> Adding SUSPEND to a SP which is then used as EXECUTE PROCEDURE ... has
>> been treated as devil already in the old InterBase days. I'm just
>> seeking for the reason why the most recent IBO version behaves
>> differently in that area with the same Firebird engine version.
>>
>> Or possibly I simply don't understand the problem in its full potential.
> ;-)
>>
>> My reply:
>> You are correct that I did not discuss using the statement EXECUTE
> PROCEDURE
>> ... RETURNING_VALUES ... at all in those issues. I understand why you
> would
>> not be satisfied and agree you shouldn't be.
>>
>> I don't have an answer at this time but I will look into this tomorrow
> when
>> my mind is more fresh. You should be able to simply drop an EXECUTE
>> PROCEDURE ... statement into an IB_DSQL component and call ExecSQL and
> then
>> grab your output values in its Fields column list. If this doesn't work
> then
>> it is possible I could have done something to break it that I need to look
>> into. Perhaps between now and then you can test some things out and report
>> back to me your findings.
>
> Tried the following:
>
> procedure TForm1.Button1Click(Sender: TObject);
> begin
> if not IB_Connection1.Connected then
> IB_Connection1.Connect;
> IB_StoredProc1.ExecProc;
> ShowMessage(IntToStr(IB_StoredProc1.FieldByName('RINT').AsInteger));
> end;
>
> procedure TForm1.Button2Click(Sender: TObject);
> begin
> if not IB_Connection1.Connected then
> IB_Connection1.Connect;
> IB_DSQL1.Execute;
> ShowMessage(IntToStr(IB_DSQL1.FieldByName('RINT').AsInteger));
> end;
>
>
> The same SP, simply returning 1 in an output parameter RINT.
>
> While I don't get the expected result in the Button1Click event using a
> TIB_StoredProc, it works in the second example using an EXECUTE
> PROCEDURE P1 statement in in TIB_DSQL.
>
>
> Regards,
> Thomas
>
>
>
> ------------------------------------
>
> ___________________________________________________________________________
> IB Objects - direct, complete, custom connectivity to Firebird or InterBase
> without the need for BDE, ODBC or any other layer.
> ___________________________________________________________________________
> http://www.ibobjects.com - your IBO community resource for Tech Info papers,
> keyword-searchable FAQ, community code contributions and more ! Yahoo! Groups Links
>
>
>