21.10.2013 Views

Firebird 2.1 Language Reference Update

Firebird 2.1 Language Reference Update

Firebird 2.1 Language Reference Update

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

DDL statements<br />

Description: This statement makes an external function (UDF) available in the database.<br />

Syntax:<br />

DECLARE EXTERNAL FUNCTION localname<br />

[ [, ...]]<br />

RETURNS { | PARAMETER 1-based_pos} [FREE_IT]<br />

ENTRY_POINT 'function_name' MODULE_NAME 'library_name'<br />

::= sqltype [BY DESCRIPTOR] | CSTRING(length)<br />

::= sqltype [BY {DESCRIPTOR|VALUE}] | CSTRING(length)<br />

Restrictions<br />

• The BY DESCRIPTOR passing method is not supported in ESQL.<br />

You may choose localname freely; this is the name by which the function will be known to your database.<br />

You may also vary the length argument of CSTRING parameters (more about CSTRINGs in the note near the<br />

end of the book).<br />

BY DESCRIPTOR parameter passing<br />

Available in: DSQL<br />

Added in: 1.0<br />

Description: <strong>Firebird</strong> introduces the possibility to pass parameters BY DESCRIPTOR; this mechanism facilitates<br />

the processing of NULLs in a meaningful way. Notice that this only works if the person who wrote the function<br />

has implemented it. Simply adding “BY DESCRIPTOR” to an existing declaration does not make it work – on<br />

the contrary! Always use the declaration block provided by the function designer.<br />

RETURNS PARAMETER n<br />

Available in: DSQL, ESQL<br />

Added in: IB 6<br />

Description: In order to return a BLOB, an extra input parameter must be declared and a “RETURNS PARAMETER<br />

n” clause added – n being the position of said parameter. This clause dates back to InterBase 6 beta, but somehow<br />

didn't make it into the <strong>Language</strong> <strong>Reference</strong> (it is documented in the Developer's Guide though).<br />

ALTER EXTERNAL FUNCTION<br />

Available in: DSQL<br />

Added in: 2.0<br />

Description: Alters an external function's module name and/or entry point. Existing dependencies are preserved.<br />

24

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!