Subject | Re: [IBO]Parameter values in DeleteSQL |
---|---|
Author | Helen Borrie |
Post date | 2006-06-13T00:42:09Z |
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
>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