Subject Re: Unicode and STRLEN function
Author Adam
--- In firebird-support@yahoogroups.com, "elite705" <kuchinke@i...> wrote:
> Hi,
>
> I have a database with Default Charset Unicode_Fss.
> When I try to install the function strlen in ib_udf with:
>
> DECLARE EXTERNAL FUNCTION strlen
> CSTRING(32767)
> RETURNS INTEGER BY VALUE
> ENTRY_POINT 'IB_UDF_strlen' MODULE_NAME 'ib_udf';
>
> I get an error because of the 32767.

That number looks suspiciously close to 2^15. Whether it is possible
or not really depends on how ib_udf internally works. You would have
to check the source to find its real limit. My guess is that at some
stage a varchar field was limited to that size, so declaring it with
that limit made sense.

Of course writing your own BigStrLen UDF function is a pretty trivial
operation, and may be a safer road to travel. It is not "corruption"
as such. The implementation may or may not be able to handle longer
strings, which may cause problems.

Adam