Subject Re: [firebird-support] "arithmetic exception, numeric overflow, or string truncation" - string is compared differently if it is passed as parameter.
Author Virgo Pärna
Helen Borrie wrote:
>
> Wow, that's a strange guess! A "named parameter" is a purely Delphi thing.

I do knwo that. But for more complex queries I find it easier to read
and understand (although it was not case here).

>
> A parameter is not a variable: it is a placeholder for a data element of a known type. The statement
>
> SELECT * FROM ZZZ WHERE XXX LIKE :XXX
> is passed across the API as
> SELECT * FROM ZZZ WHERE XXX LIKE ?
>
> The XSQLVAR structure has been primed to expect a string of no more
> than 6 characters (that's what VARCHAR(6) prescribes) but you are
> passing 7.
>

Ok. So it is intended behavior. I discovered it with specific use with
LIKE query, but affects all string comparisons (FIELDNAME = ? - prameter
cannot be longer then field). Because it was not an issue in Paradox,
the application, that I'm converting does not check string length before
passing it as parameter. I know, that I need to add such checks everywhere.

--
Virgo Pärna
virgo.parna@...