Subject RE: [IBO]Parameter values in DeleteSQL
Author Paul Hope
> -----Original Message-----
> From: IBObjects@yahoogroups.com
> [mailto:IBObjects@yahoogroups.com] On Behalf Of Helen Borrie
> Sent: 13 June 2006 15:10
> To: IBObjects@yahoogroups.com
> Subject: RE: [IBO]Parameter values in DeleteSQL
>
> At 09:25 PM 13/06/2006, you wrote:
> >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.
>
> IMO, not. You are trying to use parameters as
> application-local variables. They are not application-local
> variables and things would come unstuck if they were, given
> that the host language and SQL do not have the same data types.
>
> If you want (in your application) to test whether a parameter's
> (intended) value against a constant, test it in your application.
>
> This is a misuse of parameters:
>
> and((:WHS='')or(WHS=:WHS))

Why? - it works perfectly well in stored procedure code

>
> If it means this:
>
> and (WHS = '' OR WHS = :WHS)
>
> then write it that way.
>

No - it doesn't mean that. It means if the user doesn't fill in the WHS box
it doesn't filter.

> If you want your empty string constant to represent null in
> the database, then write it this way:
>
> amd (WHS is null or WHS = :WHS)
>
I'm not interested in null, only an empty string or a character.


Regards
Paul