CLASS

Use the CLASS modifier to specify the name of a virtual-processor (VP) class in which to run an external routine. A user-defined VP class must be defined before the UDR can be invoked.

You can execute C UDRs in the following types of VP classes:
  • The CPU virtual-processor class (CPU VP)
  • A user-defined virtual-processor class.
If you omit the CLASS modifier to specify a VP class for a UDR written in C, the UDR runs in the CPU VP. User-defined VP classes protect the database server from ill-behaved C UDRs. An ill-behaved C UDR has at least one of the following characteristics:
  • It runs in the CPU VP for a long time without yielding.
  • It is not thread safe.
  • It calls an unsafe operating-system routine.
A well-behaved C UDR has none of these characteristics. Execute only well-behaved C UDRs in the CPU VP.
Warning: Execution of an ill-behaved C UDR in the CPU VP can cause serious interference with the operation of the database server, and the UDR might not produce correct results. For a discussion of ill-behaved UDRs, see the HCL OneDB™ DataBlade® API Programmer's Guide.

By default, a UDR written in Java™ runs in a Java virtual processor class (JVP). Therefore, the CLASS modifier is optional for a UDR written in Java. However, use the CLASS modifier when you register a UDR written in Java to improve readability of your SQL statements.