Firebird Maestro online Help
Prev | Return to chapter overview | Next |
Create UDF Wizard
Create UDF Wizard guides you through the process of creating a new UDF. See How To create UDF for instructions on running this wizard.
The basic principles of Create Object Wizards in Firebird Maestro are explained in a separate topic. Below you will find a description of wizard steps that are unique for the current object.
Specify the properties for the new UDF according to your needs. The detailed description is given below.
Specifying UDF properties
Name
Specify a name for the function.
Comment
Supply a comment to the UDF if necessary.
Defines the data type of the function result.
Language
The field stores the name of the language the function is implemented in. Select either of the available languages: SQL, C, internal, or the name of a u ser-defined procedural language. For backward compatibility, the name may be enclosed by single quotes.
Check the Strict option to indicate that the function always returns NULL whenever any of its arguments are null. If this option is specified, the function is not executed when there are null arguments; a null result is assumed automatically instead. Uncheck the Strict option to indicate that the function will be called normally when some of its arguments are null. It is then the function author's responsibility to check for null values if necessary and to respond in the appropriate way.
Execution Privileges
Select Invoker to indicate that the function is to be executed with the privileges of the user that calls it (the default value).
Select Definer to specify that the function is to be executed with the privileges of the user that created it.
Stability
Set the attribute to inform the system whether it is safe to replace multiple evaluations of the function with a single evaluation, for run-time optimization. If none of these appear, Volatile is the default assumption.
Immutable indicates that the function always returns the same result when given the same argument values; that is, it does not do database lookups or otherwise use information not directly present in its argument list. If this option is given, any call of the function with all-constant arguments can be immediately replaced with the function value.
Stable indicates that within a single table scan the function will consistently return the same result for the same argument values, but that its result could change across SQL statements. This is the appropriate selection for the functions in which the results depend on database lookups, parameter variables (such as the current time zone), etc. Also note that the current_timestamp family of functions qualify as stable, since their values do not change within a transaction.
Volatile indicates that the function value can change even within a single table scan, so no optimizations can be made. Relatively few database functions are volatile in this sense; some examples are random(), currval(), timeofday(). Note that any function that has side-effects must be classified volatile (even if its result is quite predictable) to prevent calls from being optimized away; an example is setval().
Note: You can also add the function definition within the Properties tab of Function Editor.
Lib name
Define the file name identifying the library that contains the UDF.
Entry point
Define the string specifying the name of the UDF in the source code as stored in the UDF library.
Managing parameters of a new UDF
Use popup menu Add New Parameter... item to add a new parameter and set its properties in Parameter Editor. Use the Edit and Delete items to manage UDF parameters. If a UDF has either no parameters or no return parameters then the UDF returns integer type by default.
Prev | Return to chapter overview | Next |