ESQL/C client for accessing User Defined Types ----------------------------------------------- 1. Introduction This example illustrates the use of user defined types (UDT) in an esql/c client. The example consists of a datablade, UDTExporter which contains all the types which can be created using Datablade Developers Kit (DBDK). The esql/c program, 'udtexpo.ec' contains code which illustrates the use of various user defined types through esql/c. 2. Example blade overview This example creates a datablade called UDTExporter which contains row types, collection types, opaque types, qualified types, and distinct types. The user can open the file, UDTExporter.ibs in Blade Smith to find out the exact definition of the different types. This datablade can be installed on the server just like any other datablade. Please refer to the DBDK user guide for more details about installation and registration. The UDTExporter datablade defines the following functions: Input: The input routine is used for inserting data into a table. It converts the data from external to internal representation. Output: The output routine is used for extracting data from a table. It converts the data from internal to external representation. Send: The server calls the send routine to convert values to the client format before sending them to the client. Receive:The receive funtion converts a value arriving from the client to the server format. 3. Example esql/c program overview The esql/c program demonstrates the use of the UDTs in an esql/c client program. The program illustrates the following things: a) Creating tables with different kinds of user defined types like distinct types, row types, opaque types, etc. b) Inserting values into the tables. c) Retrieving values from the tables. 4. How to run the example Prerequisites: a) C compiler. b) Informix Universal Server, version 9.12 or later. c) Informix DBDK, version 3.60 d) esqlc compiler. This product can be installed using clientsdk installation. In order to build the datablade on the server machine(if the server machine is different from the machine on which DBDK is installed), the user should copy the "server" directory from DBDK examples directory to the server machine and invoke the appropriate makefile depending on the platform (UNIX.mak or WinNT.mak). Once the datablade is built successfully, use Blademanager to register the datablade. Compile the esql/c program, udtexpo.ec using esqlc compiler and run the executable generated by esqlc to create tables, insert values into tables, and finally to retrieve values from the tables. The source code is well commented and it illustrates the use of the UDTs. Users are recommended to walk through the source code to find out how to use UDTs through esql/c program. The example, also contains a file called drop.ec which drops the tables that are created. Its always a good idea to drop all the tables, if they exist before running the executatble created by compiling 'udtexpo.ec'. 4. How to compile and run the example: To compile and run on NT: -preprocess udtexpo.ec and drop.ec by: esql udtexpo.ec esql drop.ec -run drop by : ./drop @ -run udtexpo by: ./udtexpo @ -check your results with the result file (results.out) provided.