The InterBase UDF Library
Go Up to Working with UDFs and Blob Filters
InterBase provides a number of frequently needed functions in the form of a UDF library, named ib_udf.dll
on Windows platforms and ib_udf
on UNIX platforms. This UDF library is located in <<InterBase_home>>/UDF
and its functions are all implemented using the standard C library. This section describes each UDF and provides its declaration.
Important notes:
- Do not move the UDF library file from its installed location unless you also move the utility file that is located in the same directory (
ib_util.dll
on Windows,ib_util.so
on Solaris and Linux). The UDF library file requires the utility file to function correctly. - There is a script,
ib_udf.sql
, in the <<InterBase_home>>/examples/udf
directory that declares all of the functions listed below. If you want to declare only a subset of these, copy and edit the script file. - Several of these UDFs must be called using the new
FREE_IT
keyword if, and only if, they are written in thread-safe form, usingmalloc
to allocate dynamic memory. - When trigonometric functions are passed inputs that are out of bounds, they return zero rather than NaN.
Below is a list of the functions supplied in the InterBase UDF library. The description and code for each function follow the table.
Function name |
Description | Inputs | Outputs |
---|---|---|---|
Absolute value |
Double precision |
Double precision | |
Arc cosine |
Double precision |
Double precision | |
Return character based on ASCII code. |
Integer |
Char(1) | |
Returns the ASCII value of the character passed in. |
Char(1) |
Integer | |
io |
Return ASCII code for given character. |
Char(1) |
Integer |
Arc sine |
Double precision |
Double precision | |
Arc tangent |
Double precision |
Double precision | |
Arc tangent divided by second argument |
Double precision, |
Double precision | |
Bitwise AND operation |
Integer, Integer |
Integer | |
Bitwise OR operation |
Integer, Integer |
Integer | |
Bitwise XOR operation |
Integer, Integer |
Integer | |
Round up to nearest whole value. |
Double precision |
Double precision | |
Cosine |
Double precision |
Double precision | |
Hyperbolic cosine |
Double precision |
Double precision | |
Cotangent |
Double precision |
Double precision | |
Integer division |
Integer |
Integer | |
Round down to nearest whole value. |
Double precision |
Double precision | |
Natural logarithm |
Double precision |
Double precision | |
Logarithm of the first argument, by the base of the second argument. |
Double precision, |
Double precision | |
Logarithm base 10 |
Double precision |
Double precision | |
Reduce all upper-case characters to lower-case. |
Cstring(80) |
Cstring(80) | |
Strip preceding blanks. |
Cstring(80) |
Cstring(80) | |
Modulus operation between the two arguments. |
Integer, Integer |
Integer | |
Return the value of p. |
— |
Double precision | |
Return a random value. |
— |
Double precision | |
Strip trailing blanks. |
Cstring(80) |
Cstring(80) | |
Return -1, 0, or 1. |
Double precision |
Integer | |
Sine |
Double precision |
Double precision | |
Hyperbolic sine |
Double precision |
Double precision | |
Square root |
Double precision |
Double precision | |
Length of string |
Cstring(80) |
Integer | |
The substring of <s> starting at position <m> and ending at position <n>. |
Cstring(80), Smallint, |
Cstring(80) | |
Tangent |
Double precision |
Double precision | |
Hyperbolic tangent |
Double precision |
Double precision |