Firebird Documentation Index → Firebird 1.5 Language Ref. Update → DDL statements → DECLARE EXTERNAL FUNCTION |
Available in: DSQL, ESQL
Description: This statement makes an external function (UDF) known to the database.
Syntax:
DECLARE EXTERNAL FUNCTIONlocalname
[<type_decl>
[,<type_decl>
...]] RETURNS {<return_type_decl>
| PARAMETER1-based_pos
} [FREE_IT] ENTRY_POINT 'function_name
' MODULE_NAME 'library_name
'<type_decl>
::=sqltype
[BY DESCRIPTOR] | CSTRING(length
)<return_type_decl>
::=sqltype
[BY {DESCRIPTOR|VALUE}] | CSTRING(length
)
You may choose localname
freely; this is the name by which the function will be known to your database. You may also vary the length
argument of CSTRING parameters (more about CSTRINGs in the note near the end of the book).
Added in: 1.0
Description: Firebird introduces the possibility to pass parameters BY DESCRIPTOR; this mechanism facilitates the processing of NULL
s in a meaningful way. Notice that this only works if the person who wrote the function has implemented it. Simply adding
“BY DESCRIPTOR” to an existing declaration does not make it work – on the contrary! Always use the declaration block provided by the function
designer.
Added in: IB 6
Description: In order to return a BLOB, an extra input parameter must be declared and a “RETURNS PARAMETER n
” subclause added – n
being the position of said parameter. This subclause dates back to InterBase 6 beta, but somehow didn't make it into the
Language Reference (it is documented in the Developer's Guide though).
Firebird Documentation Index → Firebird 1.5 Language Ref. Update → DDL statements → DECLARE EXTERNAL FUNCTION |