/* ** Title: UDTExporter ** SCCSid: %W% %E% %U% ** CCid: %W% %E% %U% ** Author: Informix Software, Inc. ** Created: 06/11/1998 14:47 ** Description: This is the generated 'C' file for the UDTExporter DataBlade. ** Comments: Generated for project UDTExporter.3.6 */ /* ** The following is placed here to insure ** that name "mangling" does not occur. */ #ifdef __cplusplus extern "C" { #endif /* Standard library includes. */ #include #include #include #include /* Used by Informix GLS routines. */ #include /* Include when accessing the Informix API. */ #include /* This is the project include file. */ #include "UDTExporter.h" /* {{FUNCTION(882cb705-17e0-11d1-b89a-0800095a3b28) (MergeSection) */ /**************************************************************** ** ** Function name: ** ** ComplexNumberSend ** ** Description: ** ** The binary send function is used to convert an instance of a ** data type between its internal representation on the server and ** on the client. ** ** Special Comments: ** ** Support routine for opaque type ComplexNumber returns mi_sendrecv. ** ** Parameters: ** ** ComplexNumber * Gen_param1; Pointer to the input text. ** MI_FPARAM * Gen_fparam; Standard info - see DBDK docs. ** ** Return value: ** ** mi_sendrecv * The constructed UDT value. ** ** History: ** ** 06/11/1998 - Generated by BladeSmith Version 3.60.TC1B1. ** ** Identification: ** ** Warning: Do not remove or modify this comment: ** ComplexNumberSend FunctionId: 882cb705-17e0-11d1-b89a-0800095a3b28 ** ***************************************************************** */ mi_sendrecv * ComplexNumberSend ( ComplexNumber * Gen_param1, /* The UDT value */ MI_FPARAM * Gen_fparam /* Standard info - see DBDK docs. */ ) { MI_CONNECTION * Gen_Con; /* The current connection. */ ComplexNumber * Gen_InData; /* Pointer to the UDT value. */ ComplexNumber * Gen_OutData; /* Pointer to the packet data. */ mi_sendrecv * Gen_RetVal; /* The return value. */ mi_integer Gen_Index10; /* Array iterator */ /* Get the current connection handle. */ Gen_Con = mi_open( NULL, NULL, NULL ); /* Verify that the connection has been established. */ if( Gen_Con == 0 ) { /* ** Opening the current connection has failed ** so issue the following message and quit. ** ** "Connection has failed in ComplexNumberSend." */ DBDK_TRACE_ERROR( "ComplexNumberSend", ERRORMESG1, 10 ); /* not reached */ } /* Point to the input data. */ Gen_InData = Gen_param1; /* Allocate a new return value. */ Gen_RetVal = (mi_sendrecv *)mi_new_var( sizeof( ComplexNumber ) ); if( Gen_RetVal == 0 ) { /* ** Memory allocation has failed so issue ** the following message and quit. ** ** "Memory allocation has failed in ComplexNumberSend." */ DBDK_TRACE_ERROR( "ComplexNumberSend", ERRORMESG2, 10 ); /* not reached */ } /* Point to the output data. */ Gen_OutData = (ComplexNumber *)mi_get_vardata( (mi_lvarchar *)Gen_RetVal ); /* Perform the operation on each of the array elements. */ for( Gen_Index10 = -1; ++Gen_Index10 < 2; ) { /* Prepare the value for Gen_OutData->complexNum[Gen_Index10]. */ mi_put_integer( (mi_unsigned_char1 *)&Gen_OutData->complexNum[Gen_Index10], Gen_InData->complexNum[Gen_Index10] ); } /* Close the connection. */ mi_close( Gen_Con ); /* Return the UDT for transmission. */ return Gen_RetVal; } /* }}FUNCTION (#6GLP) */ /* {{FUNCTION(882cb706-17e0-11d1-b89a-0800095a3b28) (MergeSection) */ /**************************************************************** ** ** Function name: ** ** ComplexNumberReceive ** ** Description: ** ** The binary receive function is used to convert an instance of a ** data type between its internal representation on the server and ** on the client. ** ** Special Comments: ** ** Support routine for opaque type ComplexNumber returns ComplexNumber. ** ** Parameters: ** ** mi_lvarchar * Gen_param1; Pointer to the input text. ** MI_FPARAM * Gen_fparam; Standard info - see DBDK docs. ** ** Return value: ** ** ComplexNumber * The constructed UDT value. ** ** History: ** ** 06/11/1998 - Generated by BladeSmith Version 3.60.TC1B1. ** ** Identification: ** ** Warning: Do not remove or modify this comment: ** ComplexNumberReceive FunctionId: 882cb706-17e0-11d1-b89a-0800095a3b28 ** ***************************************************************** */ ComplexNumber * ComplexNumberReceive ( mi_sendrecv * Gen_param1, /* The UDT value. */ MI_FPARAM * Gen_fparam /* Standard info - see DBDK docs. */ ) { MI_CONNECTION * Gen_Con; /* The current connection. */ ComplexNumber * Gen_RetVal; /* The return value. */ ComplexNumber * Gen_InData; /* Packet data. */ ComplexNumber * Gen_OutData; /* Output UDT value. */ mi_integer Gen_Index10; /* Array iterator */ /* Get the current connection handle. */ Gen_Con = mi_open( NULL, NULL, NULL ); /* Verify that the connection has been established. */ if( Gen_Con == 0 ) { /* ** Opening the current connection has failed ** so issue the following message and quit. ** ** "Connection has failed in ComplexNumberReceive." */ DBDK_TRACE_ERROR( "ComplexNumberReceive", ERRORMESG1, 10 ); /* not reached */ } /* Point to the input data. */ Gen_InData = (ComplexNumber *)mi_get_vardata( (mi_lvarchar *)Gen_param1 ); /* Allocate room for the UDT. */ Gen_RetVal = (ComplexNumber *)mi_alloc( sizeof( ComplexNumber ) ); if( Gen_RetVal == 0 ) { /* ** Memory allocation has failed so issue ** the following message and quit. ** ** "Memory allocation has failed in ComplexNumberReceive." */ DBDK_TRACE_ERROR( "ComplexNumberReceive", ERRORMESG2, 10 ); /* not reached */ } /* Point to the output data. */ Gen_OutData = (ComplexNumber *)Gen_RetVal; /* Copy the attribute value(s) from the transmission parcel. */ /* Perform the operation on each of the array elements. */ for( Gen_Index10 = -1; ++Gen_Index10 < 2; ) { /* Prepare the value for Gen_OutData->complexNum[Gen_Index10]. */ mi_get_integer( (mi_unsigned_char1 *)&Gen_InData->complexNum[Gen_Index10], &Gen_OutData->complexNum[Gen_Index10] ); } /* Return the transmitted UDT value. */ return Gen_RetVal; } /* }}FUNCTION (#2E4E) */ /* {{FUNCTION(882cb707-17e0-11d1-b89a-0800095a3b28) (MergeSection) */ /**************************************************************** ** ** Function name: ** ** ComplexNumberInput ** ** Description: ** ** This function converts from the external representation of the ** UDT type ComplexNumber to its internal representation. The external ** representation is a blank-separated list of values and the ** internal representation is a 'C' structure of type ComplexNumber as ** defined in the header file. ** ** ** Data can be inserted into a table using an SQL insert statement: ** ** insert into tablename values ( 'value-list' ); ** ** value-list is a space-delimited list of values. ** ** Data for the mi_integer type is in the range [-32767, +32767]. ** Special Comments: ** ** Support routine for opaque type ComplexNumber returns ComplexNumber. ** ** Parameters: ** ** mi_lvarchar * Gen_param1; Pointer to the input text. ** MI_FPARAM * Gen_fparam; Standard info - see DBDK docs. ** ** Return value: ** ** ComplexNumber * The constructed UDT value. ** ** History: ** ** 06/11/1998 - Generated by BladeSmith Version 3.60.TC1B1. ** ** Identification: ** ** Warning: Do not remove or modify this comment: ** ComplexNumberInput FunctionId: 882cb707-17e0-11d1-b89a-0800095a3b28 ** ***************************************************************** */ ComplexNumber * ComplexNumberInput ( mi_lvarchar * Gen_param1, /* Pointer to the input text. */ MI_FPARAM * Gen_fparam /* Standard info - see DBDK docs. */ ) { MI_CONNECTION * Gen_Con; /* The current connection. */ gl_mchar_t * Gen_InData; /* Pointer to the input data. */ gl_mchar_t * Gen_StartInData; /* First value of Gen_InData. */ ComplexNumber * Gen_OutData; /* Pointer to the output data. */ mi_integer Gen_DataLen; /* Length of the data in bytes. */ ComplexNumber * Gen_RetVal; /* The return value. */ mi_integer Gen_Index10; /* Array iterator */ /* Get the current connection handle. */ Gen_Con = mi_open( NULL, NULL, NULL ); /* Verify that the connection has been established. */ if( Gen_Con == 0 ) { /* ** Opening the current connection has failed ** so issue the following message and quit. ** ** "Connection has failed in ComplexNumberInput." */ DBDK_TRACE_ERROR( "ComplexNumberInput", ERRORMESG1, 10 ); /* not reached */ } /* Point to the input data. */ Gen_InData = (gl_mchar_t *)mi_get_vardata( (mi_lvarchar *) Gen_param1 ); Gen_StartInData = Gen_InData; /* Get the length of the input string. */ Gen_DataLen = mi_get_varlen( Gen_param1 ); /* Allocate a new UDT for the return result. */ Gen_RetVal = (ComplexNumber *)mi_alloc( sizeof( ComplexNumber ) ); if( Gen_RetVal == 0 ) { /* ** Memory allocation has failed so issue ** the following message and quit. ** ** "Memory allocation has failed in ComplexNumberInput." */ DBDK_TRACE_ERROR( "ComplexNumberInput", ERRORMESG2, 10 ); /* not reached */ } /* Point to the output data. */ Gen_OutData = (ComplexNumber *)Gen_RetVal; /* Perform the operation on each of the array elements. */ for( Gen_Index10 = -1; ++Gen_Index10 < 2; ) { /* Get the mi_integer value for complexNum[Gen_Index10]. */ Gen_InData = Gen_sscanf( Gen_Con, "ComplexNumberInput", Gen_InData, Gen_DataLen - (Gen_InData - Gen_StartInData), 0, "%d %n", (char *)&Gen_OutData->complexNum[Gen_Index10] ); } /* Close the connection. */ mi_close( Gen_Con ); /* Return the UDT value. */ return Gen_RetVal; } /* }}FUNCTION (#H6EP) */ /* {{FUNCTION(882cb708-17e0-11d1-b89a-0800095a3b28) (MergeSection) */ /**************************************************************** ** ** Function name: ** ** ComplexNumberOutput ** ** Description: ** ** This function converts from the internal representation of the ** UDT type ComplexNumber to its external representation. The external ** representation is a blank-separated list of values and the ** internal representation is a 'C' structure of type ComplexNumber as ** defined in the header file. ** ** Data can be retrieved from a table using an SQL select statement: ** ** select * from tablename; ** ** Data for the mi_integer type is in the range [-32767, +32767]. ** Special Comments: ** ** Support routine for opaque type ComplexNumber returns mi_lvarchar. ** ** Parameters: ** ** ComplexNumber * Gen_param1; Pointer to the input text. ** MI_FPARAM * Gen_fparam; Standard info - see DBDK docs. ** ** Return value: ** ** mi_lvarchar * The constructed UDT value. ** ** History: ** ** 06/11/1998 - Generated by BladeSmith Version 3.60.TC1B1. ** ** Identification: ** ** Warning: Do not remove or modify this comment: ** ComplexNumberOutput FunctionId: 882cb708-17e0-11d1-b89a-0800095a3b28 ** ***************************************************************** */ mi_lvarchar * ComplexNumberOutput ( ComplexNumber * Gen_param1, /* The UDT value. */ MI_FPARAM * Gen_fparam /* Standard info - see DBDK docs. */ ) { MI_CONNECTION * Gen_Con; /* The current connection. */ mi_integer Gen_CharLen; /* Estimate maximum length. */ ComplexNumber * Gen_InData; /* Pointer to the input data. */ char * Gen_OutData; /* Pointer to the output data. */ mi_lvarchar * Gen_RetVal; /* The return result. */ mi_integer Gen_DataLen; /* The data length. */ mi_integer Gen_Index10; /* Array iterator */ /* Get the current connection handle. */ Gen_Con = mi_open( NULL, NULL, NULL ); /* Verify that the connection has been established. */ if( Gen_Con == 0 ) { /* ** Opening the current connection has failed ** so issue the following message and quit. ** ** "Connection has failed in ComplexNumberOutput." */ DBDK_TRACE_ERROR( "ComplexNumberOutput", ERRORMESG1, 10 ); /* not reached */ } /* Point to the input data. */ Gen_InData = Gen_param1; /* Compute the maximum length of the text representation. */ Gen_CharLen = 1 /* Leave room for the NULL terminator. */ + 2 *12 /* Add the length for complexNum. */ ; /* Allocate room for the output string. */ Gen_RetVal = mi_new_var( Gen_CharLen ); if( Gen_RetVal == 0 ) { /* ** Memory allocation has failed so issue ** the following message and quit. ** ** "Memory allocation has failed in ComplexNumberOutput." */ DBDK_TRACE_ERROR( "ComplexNumberOutput", ERRORMESG2, 10 ); /* not reached */ } /* Point to the output data. */ Gen_OutData = mi_get_vardata( Gen_RetVal ); /* Format the attribute value into the output string. */ /* Perform the operation on each of the array elements. */ for( Gen_Index10 = -1; ++Gen_Index10 < 2; ) { /* Format the mi_integer value for Gen_InData->complexNum[Gen_Index10]. */ sprintf( Gen_OutData, "%d ", Gen_InData->complexNum[Gen_Index10] ); Gen_OutData += strlen( Gen_OutData ); } /* ** Compute the length of the data and ** place it in the return structure. */ Gen_DataLen = (mi_integer)(Gen_OutData - mi_get_vardata( Gen_RetVal )); mi_set_varlen ( Gen_RetVal, Gen_DataLen ); /* Close the connection. */ mi_close( Gen_Con ); /* Return the UDT value. */ return Gen_RetVal; } /* }}FUNCTION (#6IOK) */ #ifdef __cplusplus } #endif