Subject RE: [IBO]Parameter values in DeleteSQL
Author Helen Borrie
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))

If it means this:

and (WHS = '' OR WHS = :WHS)

then write it that way.

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)

Helen