Find bottlenecks in Firebird database

Does Firebird have functions like ABS, SIN, COS, FLOOR, LOG, TRIM, MOD, STRLEN?


Update: Firebird 2.1 has many of these functions integrated into the main engine, so you don't need to declare UDFs any more. Please read the release notes document for more information. The following FAQ still applies for older versions of Firebird and for functions which are not yet part of the core engine:

Firebird engine has a limited number of functions that are always available. However, it supports the User Defined Functions (UDF) which can be written in any programming language that can be compiled into DLL library (.so on Linux). Default installation of Firebird features few such libraries containing common functions like ABS, SIN, COS, LOG, TRIM, etc. To use them, you need to register them in your database. Registering into one database makes them only available there, you need to register UDFs in each database where you want to use them. Registration SQL looks like this:

DECLARE EXTERNAL FUNCTION abs
DOUBLE PRECISION
RETURNS DOUBLE PRECISION BY VALUE
ENTRY_POINT 'IB_UDF_abs' MODULE_NAME 'ib_udf';

Take a look in your Firebird installation directory, in UDF subdirectory. The library .so or .dll files are there, together with .sql scripts which you can use to register UDFs in your databases.

If you wish to write your own functions, take a look at FAQ #83 for Delphi example.


Do you find this FAQ incorrect or incomplete? Please e-mail us what needs to be changed. To ensure quality, each change is checked by our editors (and often tested on live Firebird databases), before it enters the main FAQ database. If you desire so, the changes will be credited to your name. To learn more, visit our add content page.

If you are a commercial tool maker and your tool features a great way to handle the issue written about in this FAQ, please check out our advertisement page.



All contents are copyright © 2007-2017 FirebirdFAQ.org unless otherwise stated in the text.


Links   Firebird   News   FlameRobin   Home Inventory powered by FB  
Add content   Advertise   About  

Categories
 Newbies
 SQL
 Installation and setup
 Backup and restore
 Performance
 Security
 Connectivity and API
 HOWTOs
 Errors and error codes
 Miscellaneous