Top

Name

udt_implements_method — provides a handle to the first method with specific name in a user defined type.

Synopsis

any udt_implements_method ( in udt any ,
  in method_name varchar );
 

Description

This returns a non-zero value (true) if the udt has an instance method with a name equal to the value of method_name. For methods with the same name, but with different signatures this function will return the handle of the first method in order of definition. If a method is not found, 0 will be returned. The return value can be used to call the method using the indirect call statement. In which case an instance should be passed as a first argument to the indirect call statement.

Parameters

udt

Type name as varchar or a type instance.

method_name

The requested method name as a varchar.

Return Types

An integer will be returned. If the named method is not contained within the user defined type 0 (false) will be returned. Otherwise an integer representing the handle to first definition of a contained method with that name will be returned.

Examples

Example 24.427. Finding methods within a UDT

This example demonstrates how one might go about utilizing the handle of a method if found within a user defined type.

....
declare mtd any;
declare inst SER_UDT;

inst := new SER_UDT ();
mtd := udt_implements_method (inst, 'NEGATE');

if (mtd <> 0)
  return call (mtd) (inst);
else
  signal ('42000', 'No method NEGATE');
....