Load the shared-object file for debugging
To load the shared-object file, you must execute one of the UDRs within the file.
One technique is to execute the UDR itself within . For example,
if a user-defined function named my_udf() is within the shared-object
file, you can use the following SQL statement to execute my_udf(),
which causes the database server to load the shared-object file that
contains my_udf():
EXECUTE FUNCTION my_udf();
Another technique for loading the shared-object file is to define
a dummy UDR in the shared-object file that you use to load the shared-object
file, as follows:
- Create the dummy UDR in the shared-object file.
The routine can be as simple as the following example:
mi_integer load_so() { return 0; }
To prevent name conflicts with other shared-object files (or DataBlade modules), you can put a prefix in the routine name.
- Compile the shared-object file.
- Register the dummy UDR with the CREATE FUNCTION statement.
CREATE FUNCTION load_so() RETURNS INTEGER WITH (NOT VARIANT) EXTERNAL NAME '/usr/lib/udrs/myudrs.so(load_so)' LANGUAGE C;
To load the shared-object file, execute the dummy UDR. The following
SELECT statement in your client application (or DB-Access) loads the myudrs shared-object
file, which contains load_so():
SELECT load_so() FROM informix.systables WHERE tabid=1;
For more information about loading a shared-object file, see Load a shared-object file.