Subject Re: [IBO]Parameter values in DeleteSQL
Author Dany M
Paul Hope 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.
>

No! That would break lots of applications. (Strange though that you get
a string truncation error, should be just an empty result).

I use a similar construct a lot. It caters for a generic application and
lots of reporting queries. Try to write;

and ((:WHS = ' ') or (WHS = :WHS))

and that should work. If WHS is Char(1) then the parameter should be
too. Maybe you could redefine WHS to be VARCHAR(1) but that is awkward.
Another solution is this;

and ((:WHS = 'F') or (WHS = :WHS_VAL))

which to be honest I use more often. That would force you to fill two
different parameters with the same value.

---

This is from a live application;

(:MEDIA_EASYREAD_$ = ' ' OR ((P.MEDIA_EASYREAD = 'N' AND
:MEDIA_EASYREAD_$ = 'F') or (P.MEDIA_EASYREAD = 'Y' AND
:MEDIA_EASYREAD_$ = 'T'))) AND

the parameter value is set from a three-state checkbox where ' '
coresponds to "grey".

/Dany