FB 4 UDR question

22 views
Skip to first unread message

zora...@gmail.com

unread,
Jun 4, 2021, 1:24:43 PMJun 4
to firebird...@googlegroups.com

Hello

 

FB 4, Delphi 10.4.2

 

In FB3 I have a udf with 3 small functions:

 

1. return current_timestamp in UTC time (no parameters)

2. return current_timestamp in double precision format (no parameters)

3. return md5 value of varchar(50) column (parameter is varchar column)

 

I've looked at FB4 docs how to create udr dll, but couldn't find (clear enough) instructions on how to create new udr or add new function to the existing udr.

 

Can someone point me in the right direction? Or are these functions already available in FB4?

 

Thank you.

 

Regards

Zoran

Mark Rotteveel

unread,
Jun 4, 2021, 2:41:33 PMJun 4
to firebird...@googlegroups.com
For point 1 and 2, see examples in examples\udr, but to be honest UDRs
are badly documented IMHO.

For point 1, you could also use the udf_compat UDR included in Firebird 4:

create or alter function getExactTimestampUTC
returns timestamp
external name 'udf_compat!UC_getExactTimestampUTC'
engine udr

For point 3 you can use CRYPT_HASH(<value> USING MD5), see
https://www.firebirdsql.org/file/documentation/html/en/refdocs/fblangref40/firebird-40-language-reference.html#fblangref40-scalarfuncs-crypthash
The return type of CRYPT_HASH is VARBINARY (a.k.a. VARCHAR CHARACTER SET
OCTETS), but you can use HEX_ENCODE or BASE64_ENCODE to produce a string
value.

Mark
--
Mark Rotteveel

Karol Bieniaszewski

unread,
Jun 4, 2021, 5:29:34 PMJun 4
to firebird...@googlegroups.com

>> but to be honest UDRs are badly documented IMHO.

 

Shouldn't this be a sufficient premise that the UDF is not depricated in FB4?

 

regards,

Karol Bieniaszewski

Mark Rotteveel

unread,
Jun 5, 2021, 7:21:02 AMJun 5
to firebird...@googlegroups.com
On 04-06-2021 23:29, Karol Bieniaszewski wrote:
> >> but to be honest UDRs are badly documented IMHO.
>
> Shouldn't this be a sufficient premise that the UDF is not depricated in
> FB4?

The primary reason that UDFs are deprecated is that they are a gigantic
security risk.

Mark
--
Mark Rotteveel

liviuslivius

unread,
Jun 5, 2021, 3:48:59 PMJun 5
to firebird...@googlegroups.com
I know :)

But api without documentation is like computer without software. If somethink is depricated then users must know how to migrate to new feature. 

P.s. It is already big progress with Firebird documentation, especially finally release notes up to date with FB4 release and thank you very much for that :)

Regards,
Karol Bieniaszewski


Reply all
Reply to author
Forward
0 new messages