Subject Re: [firebird-support] LTRIM, RTRIM declaration in IB_UDF
Author Helen Borrie
At 10:06 AM 3/10/2005 -0400, you wrote:
>The Firebird book states that LTRIM and RTRIM take a 32,765 byte input
>string.
>My copy of Firebird 1.5 has a CString input and output of 80 characters.
>Which is correct?

You can declare it any length you need (up to a 32,765 byte maximum). 80
is just an arbitrary number (actually, the number of bytes on one line of a
90's style text terminal!) Declare the length of the longest varchar you
will want to trim.

You can make multiple declarations with different sizes, too. Use the same
ENTRY_POINT and MODULE_NAME, just give each "version" a distinct name in
the database:

DECLARE EXTERNAL FUNCTION rtrim_80
CSTRING(80)
RETURNS CSTRING(80) FREE_IT
ENTRY_POINT 'IB_UDF_rtrim' MODULE_NAME 'ib_udf';


DECLARE EXTERNAL FUNCTION rtrim_255
CSTRING(255)
RETURNS CSTRING(255) FREE_IT
ENTRY_POINT 'IB_UDF_rtrim' MODULE_NAME 'ib_udf';

Incidentally, my copy of Firebird 1.5 has the "arbitrary" declaration at
255, not 80. If you are using an outdated version of ib_udf.sql, maybe you
have an outdated ib_udf.dll too. Since ib_udf gets bugfixed from time to
time, it would be a good idea to get set up with the latest.

./hb