Here is a synopsis of the steps you take to develop, compile, install, and use a UDM:
- Write, test, and debug the C or C++ code for the UDM.
You can use the Teradata C/C++ UDF Debugger, which is a version of GDB (the gnu Source-Level Debugger) that contains extensions for the database. For more information, see C/C++ Command-line Debugging for UDFs.
- Use CREATE TYPE to create the UDT and specify constructor methods and instance methods.
IF the method is … THEN use this METHOD specification in the CREATE TYPE statement … an instance method INSTANCE METHOD or METHOD a constructor method for a structured type CONSTRUCTOR METHOD
- Use CREATE METHOD or REPLACE METHOD to identify the location of the source code or object, and install it on the server. In general, you should not create UDMs in Teradata system databases such as SYSLIB or SYSUDTLIB. For more information, see Installing the UDM.
The method is compiled, if the source code is submitted, linked to the dynamic linked library (DLL or SO) associated with the database in which the method resides, and distributed to all database nodes in the system.
- If the UDM is an instance method that provides transform, ordering, or cast functionality for a structured UDT, register the UDM as a transform, ordering, or cast routine. Otherwise, skip to the next step.
IF the UDM implements this functionality for a UDT … THEN use this statement to register the UDM … cast CREATE CAST or REPLACE CAST ordering CREATE ORDERING or REPLACE ORDERING transform CREATE TRANSFORM or REPLACE TRANSFORM
- Test the UDM in protected execution mode until you are satisfied it works correctly.
Protected mode is the default execution mode for a UDM. In protected mode, the database isolates all of the data the UDM might access as a separate process in its own local workspace. This makes the method run slower. If any memory violation or other system error occurs, the error is localized to the method and the transaction executing the method.
- Use ALTER METHOD to change the UDM to run in nonprotected execution mode.
- Rerun the tests from Step 5 to test the UDM in nonprotected execution mode until you are satisfied it works correctly.
- Use GRANT to grant privileges to users who are authorized to use the UDT.
|FOR more information on …||SEE …|
|developing a UDM||related topics in this document.|
|debugging a UDM||Debugging a UDM.|
|code examples for UDMs||UDM Code Examples.|