Firebird Documentation IndexFirebird 1.5.6 Release NotesMiscellaneous Enhancements → External Functions (UDFs)
Firebird Home Firebird Home Prev: New ISQL FeaturesFirebird Documentation IndexUp: Miscellaneous EnhancementsNext: New Configuration Files

External Functions (UDFs)

In the ib_udf Library
In the fbudf library

User-defined functions.-

In the ib_udf Library

rpad()

Juan Guerrero

rpad (instring, length, padcharacter)

Right-pads the supplied string instring by appending padcharacters until the result string has the given length.

The input string can be any length less than 32766 bytes. Length must not exceed 32765 bytes.

Declaration

  DECLARE EXTERNAL FUNCTION rpad
      CSTRING(80), INTEGER, CSTRING(1)
      RETURNS CSTRING(80) FREE_IT
      ENTRY_POINT 'IB_UDF_rpad' MODULE_NAME 'ib_udf';
      

lpad()

Juan Guerrero

lpad (instring, length, padcharacter)

Left-pads the supplied string instring by prepending padcharacters until the result string has the given length.

The input string can be any length less than 32766 bytes. Length must not exceed 32765 bytes.

Declaration

  DECLARE EXTERNAL FUNCTION lpad
      CSTRING(80), INTEGER, CSTRING(1)
      RETURNS CSTRING(80) FREE_IT
      ENTRY_POINT 'IB_UDF_lpad' MODULE_NAME 'ib_udf';
      

log()

Paul Vinkenoog

log (x, y)

This function had an old bug, whereby the arguments x and y were erroneously reversed. It should return the logarithm base x of y but in fact it returned the log base y of x. It has been corrected.

Warning

If it was used in your applications previously, PLEASE CHECK YOUR APPLICATION CODE! it either returned the wrong results; or someone, at some point, did a workaround and reversed the arguments deliberately in order to get the right calculation.

In the fbudf library

Changes in Firebird 1.5 affect functions in the fbudf external function library, as follows.-

  1. The *NVL and *NULLIF functions remain for backward compatibility, but are deprecated by the introduction of the new internal functions CASE, COALESCE and NULLIF.

     

  2. If you are porting a database that was created in Firebird 1.0.x and you declared the fbudf functions truncate and round, those declarations will no longer work with Firebird 1.5 because the entry_point names were changed. You will need to drop the functions and redeclare them, using the declarations from the fbudf.sql script in the 1.5 /UDF directory.

Caution

Note that fbudf cannot handle string fields bigger than (32Kb - 1) bytes in length. This limit may have ill effects where strings are concatenated before being passed to UDFs taking string arguments. If the sum of field is beyond the limit, the behavior is undefined. The function may return a nonsense result or the fbudf code may perform an illegal operation.

Prev: New ISQL FeaturesFirebird Documentation IndexUp: Miscellaneous EnhancementsNext: New Configuration Files
Firebird Documentation IndexFirebird 1.5.6 Release NotesMiscellaneous Enhancements → External Functions (UDFs)