Subject | RE: [IBO]Parameter values in DeleteSQL |
---|---|
Author | Paul Hope |
Post date | 2006-06-13T11:25:54Z |
Hi Helen
I changed one of them to :REC and it worked. However it seems to me to be a
poor Delphi interface when IBO cant interpret a valid Delphi statement.
I have just had another parameter problem with a straight forward TIB_Cursor
with 'and((:WHS='')or(WHS=:WHS))'. When the value of Parameter WHS is set
to '', IBO chooses to convert that to ' ' (WHS is char(1)), this then causes
a string truncation error.
IMO parameter handling could be improved.
Regards
Paul
_____
From: IBObjects@yahoogroups.com [mailto:IBObjects@yahoogroups.com] On Behalf
Of Helen Borrie
Sent: 13 June 2006 01:42
To: IBObjects@yahoogroups.com
Subject: Re: [IBO]Parameter values in DeleteSQL
At 02:32 AM 9/06/2006, you wrote:
If you look at the statement that you copy/pasted from the monitor
you will see that the two parameters are represented by
questionmarks. Parameters actually don't have names at all, only positions.
For convenience in referring to them in Delphi, our interface
provides the means to name the parameters and refer to them in our
code by this strictly client-side-only name. Under the hood, IBO
passes to the API a structure it has predefined (the XSQLDA) along
with the metadata details of each parameter defined in that XSQLDA
(XSQLVAR). IBO takes the necessary care to ensure that the values
pass through in the right order.
So, from the API's point of view, you have two parameters here, not
one. They happen to be of the same type and value, but only you know that.
Replace the original statement with one that has different names for
each use of the value and apply the value to each. Stick with the
column name for the expression that refers directly to the table and
use some other valid string for the name of the parameter in the
EXISTS argument.
Helen
[Non-text portions of this message have been removed]
I changed one of them to :REC and it worked. However it seems to me to be a
poor Delphi interface when IBO cant interpret a valid Delphi statement.
I have just had another parameter problem with a straight forward TIB_Cursor
with 'and((:WHS='')or(WHS=:WHS))'. When the value of Parameter WHS is set
to '', IBO chooses to convert that to ' ' (WHS is char(1)), this then causes
a string truncation error.
IMO parameter handling could be improved.
Regards
Paul
_____
From: IBObjects@yahoogroups.com [mailto:IBObjects@yahoogroups.com] On Behalf
Of Helen Borrie
Sent: 13 June 2006 01:42
To: IBObjects@yahoogroups.com
Subject: Re: [IBO]Parameter values in DeleteSQL
At 02:32 AM 9/06/2006, you wrote:
>HIParameters are not variables, they are placeholders for argument values.
>
>I have DeleteSQL of
>
>DELETE FROM SHIPMENTS WHERE
> REC = ? /* OLD_REC */ and
>not exists(select * from shipping_line where shipment=? /* OLD_REC */ )
>
>but only the first occurrence of old_rec gets set
>
>EXECUTE STATEMENT
>TR_HANDLE = 24342488
>STMT_HANDLE = 37637208
>PARAMS = [ Version 1 SQLd 2 SQLn 2
> [OLD_REC] = 4176429
> [OLD_REC] = <NULL> ]
>
>Any reason why both shouldn't get set?
If you look at the statement that you copy/pasted from the monitor
you will see that the two parameters are represented by
questionmarks. Parameters actually don't have names at all, only positions.
For convenience in referring to them in Delphi, our interface
provides the means to name the parameters and refer to them in our
code by this strictly client-side-only name. Under the hood, IBO
passes to the API a structure it has predefined (the XSQLDA) along
with the metadata details of each parameter defined in that XSQLDA
(XSQLVAR). IBO takes the necessary care to ensure that the values
pass through in the right order.
So, from the API's point of view, you have two parameters here, not
one. They happen to be of the same type and value, but only you know that.
Replace the original statement with one that has different names for
each use of the value and apply the value to each. Stick with the
column name for the expression that refers directly to the table and
use some other valid string for the name of the parameter in the
EXISTS argument.
Helen
[Non-text portions of this message have been removed]