Implementing client transforms for binding in from a client using external UDFs
This section provides information about implementing client transforms for binding in from a client using external UDFs.
About this task
The following DDL registers a function that takes the VARCHAR-encoded object from the client, decomposes it into its various base type attributes, and passes it to the TO SQL function transform.
CREATE FUNCTION to_sql_from_client (VARCHAR (150))
RETURNS Address_t
LANGUAGE C
TRANSFORM GROUP func_group
EXTERNAL NAME 'addressudf!address_to_sql_from_client'
DETERMINISTIC
NO EXTERNAL ACTION
NOT FENCED
NO SQL
PARAMETER STYLE SQL;
Although it appears as if the to_sql_from_client
returns the address directly,
what really happens is that to_sql_from_client
converts the VARCHAR (150) to a set
of base type attributes. Then
implicitly invokes the TO
SQL transform functoaddress
to construct the address object that is returned to the
database.
Notice that the DDL in to_sql_from_client
includes a clause called TRANSFORM
GROUP. This clause tells
which set of transforms to use in processing the address type in those functions.