Subject | Re: [firebird-support] named parameter always replaced by '?' |
---|---|
Author | Helen Borrie |
Post date | 2004-11-26T05:53:41Z |
At 05:25 PM 25/11/2004 +0000, you wrote:
It should be exactly as follows:
CREATE PROCEDURE TEST (
FIELD1 INTEGER)
RETURNS (
FIELD2 INTEGER)
AS
Begin
FOR SELECT FIELD2 FROM TABLE1
WHERE FIELD1 = :FIELD1
INTO :FIELD2
DO
BEGIN
SUSPEND;
END
End
how params are passed across the API. Your driver layer allows you the
convenience of naming your params but this naming is confined to the client
layer. The API gets and returns params unnamed, in a fixed order. The
client interface sorts out which is which for you.
./heLen
>Hi All,Change the stored procedure so that it is correct.
>
>
>The environment D7, Embedded Firebird 1.5.1, UIB dbExpress driver.
>
>I tried to use a TSQLQuery component (ParamCheck = False) to run the
>following code:
>
>-----
>CREATE PROCEDURE TEST (
> FIELD1 INTEGER)
>RETURNS (
> FIELD2 INTEGER)
>AS
>Begin
> FOR SELECT FIELD2 FROM TABLE1
> WHERE FIELD1 = :FIELD1
> INTO "FIELD2" <----- this is wrong syntax
> DO
> BEGIN
> SUSPEND;
> END
>End
>
>-----------
>
>When I check the stored procedure in the database, it appears that
>named parameter has been replaced by '?' as follows:
>
>---------
>
>CREATE PROCEDURE TEST (
>
>.........
>
> WHERE FIELD1 = ?
> INTO "FIELD2"
>
>........
>
>End
>
>-----------
>Besides that, I am not able to use :FIELD2 as the output parameter, so
>I use "FIELD2" instead, if the ':FIELD2' is used there is a 'Invalid
>token error, error code 249' at the ':' position.
It should be exactly as follows:
CREATE PROCEDURE TEST (
FIELD1 INTEGER)
RETURNS (
FIELD2 INTEGER)
AS
Begin
FOR SELECT FIELD2 FROM TABLE1
WHERE FIELD1 = :FIELD1
INTO :FIELD2
DO
BEGIN
SUSPEND;
END
End
>But the real problem is the '?' replacement, I can't run the storedNo, that's not the problem. The SQL output that you are seeing is exactly
>procedure whatever value I pass into the input parameter, a null
>result set is returned.
how params are passed across the API. Your driver layer allows you the
convenience of naming your params but this naming is confined to the client
layer. The API gets and returns params unnamed, in a fixed order. The
client interface sorts out which is which for you.
>I have tried modify the VCL source in SqlExpr.pas source by commentingSo silly of you.
>a line of function FixParams as follows:
>
>//++++ SQL := stringReplace(SQL, Param, ' ? ', []);
>Yet, the '?' replacement persists. If I use the IBExpert program toYou can't. It's the way it works.
>create or modify the stored procedure, the ':' named parameter was
>never replaced by the '?'. I use the same fbClient.dll and dbexpress
>driver, so the replacement must be done by the delphi VCL codes, How
>can I stop the Replacement of named parameter by '?' ?
./heLen