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

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Library: ib_udf<br />

Added in: IB<br />

Changed in: 2.0<br />

Better alternative: Internal function LOWER()<br />

External functions (UDFs)<br />

lower<br />

Description: Returns the lower-case version of the input string. Please notice that only ASCII characters are<br />

handled correctly. If possible, use the superior internal function LOWER instead. Just dropping the declaration<br />

of the lower UDF should do the trick, unless you gave it an alternative name.<br />

Result type: VARCHAR(n)<br />

Syntax:<br />

"LOWER" (str)<br />

Declaration:<br />

Notes:<br />

DECLARE EXTERNAL FUNCTION "LOWER"<br />

CSTRING(255) NULL<br />

RETURNS CSTRING(255) FREE_IT<br />

ENTRY_POINT 'IB_UDF_lower' MODULE_NAME 'ib_udf'<br />

The above declaration is from the file ib_udf2.sql. “LOWER” has been surrounded by double-quotes<br />

to avoid confusion with the internal function LOWER.<br />

The NULL after CSTRING(255) is an optional addition that became available in <strong>Firebird</strong> 2. When<br />

declared with the NULL keyword, the engine will pass a NULL argument unchanged to the function.<br />

This leads to a NULL result, which is correct. Without the NULL keyword (your only option in pre-2.0<br />

versions), NULL is passed to the function as an empty string and the result is an empty string as well.<br />

For more information about passing NULLs to UDFs, see the note at the end of this book.<br />

• Depending on how you declare it (see CSTRING note), this function can accept and return strings of up to<br />

32767 characters.<br />

• Before <strong>Firebird</strong> 2.0, the result type was CHAR(n).<br />

• In <strong>Firebird</strong> 1.5.1 and below, the default declaration used CSTRING(80) instead of CSTRING(255).<br />

Library: ib_udf<br />

lpad<br />

179

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

Saved successfully!

Ooh no, something went wrong!