/*
** Title: Circ.c
** SCCSid: dbdktxa.ide, dbdk_tut, v11.10.UC1 07/07/05 10:31:18
** CCid: dbdktxa.ide, dbdk_tut, v11.10.UC1 07/07/05 10:31:18
** Author: danielh
** Created: 05/18/1999 18:52
** Description: This is a generated source file for the Circle DataBlade module.
** Comments: Generated for project Circle.1.0
*/
/*
** The following is placed here to insure
** that name "mangling" does not occur.
*/
#ifdef __cplusplus
extern "C"
{
#endif
/* Standard library includes. */
#include <ctype.h
#include <stdio.h>
#include <string.h>
#include <Stddef.h>
/* Used by Informix GLS routines. */
#include <ifxgls.h>
/* Include when accessing the Informix API. */
#include <mi.h>
/* This is the project include file. */
#include "Circle.h"
/* {{FUNCTION(92e2627a-0d7a-11d3-98b2-000000000000) (MergeSection) */
/*******************************************************************************
**
** Function name:
**
** CircSend
**
** 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 Circ returns mi_sendrecv.
**
** Parameters:
**
** Circ * 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:
**
** 05/18/1999 - Generated by BladeSmith Version 4.00.517.
**
** Identification:
**
** Warning: Do not remove or modify this comment:
** CircSend FunctionId: 92e2627a-0d7a-11d3-98b2-000000000000
**
********************************************************************************
*/
UDREXPORT
mi_sendrecv *
CircSend
(
Circ * Gen_param1, /* The UDT value */
MI_FPARAM * Gen_fparam /* Standard info - see DBDK docs. */
)
{
MI_CONNECTION * Gen_Con; /* The current connection. */
Circ * Gen_InData; /* Pointer to the UDT value. */
Circ * Gen_OutData; /* Pointer to the packet data. */
mi_sendrecv * Gen_RetVal; /* The return value. */
/* 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 CircSend."
*/
DBDK_TRACE_ERROR( "CircSend", 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( Circ ) );
if( Gen_RetVal == 0 )
{
/*
** Memory allocation has failed so issue
** the following message and quit.
**
** "Memory allocation has failed in CircSend."
*/
DBDK_TRACE_ERROR( "CircSend", ERRORMESG2, 10 );
/* not reached */
}
/* Point to the output data. */
Gen_OutData = (Circ *)mi_get_vardata( (mi_lvarchar *)Gen_RetVal );
/* Prepare the value for Gen_OutData->center.x. */
mi_put_double_precision( (mi_unsigned_char1 *)&Gen_OutData->center.x,
&Gen_InData->center.x );
/* Prepare the value for Gen_OutData->center.y. */
mi_put_double_precision( (mi_unsigned_char1 *)&Gen_OutData->center.y,
&Gen_InData->center.y );
/* Prepare the value for Gen_OutData->radius. */
mi_put_double_precision( (mi_unsigned_char1 *)&Gen_OutData->radius,
&Gen_InData->radius );
/* Close the connection. */
mi_close( Gen_Con );
/* Return the UDT for transmission. */
return Gen_RetVal;
}
/* }}FUNCTION (#HV9J) */
/* {{FUNCTION(92e2627b-0d7a-11d3-98b2-000000000000) (MergeSection) */
/*******************************************************************************
**
** Function name:
**
** CircReceive
**
** 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 Circ returns Circ.
**
** Parameters:
**
** mi_lvarchar * Gen_param1; Pointer to the input text.
** MI_FPARAM * Gen_fparam; Standard info - see DBDK docs.
**
** Return value:
**
** Circ * The constructed UDT value.
**
** History:
**
** 05/18/1999 - Generated by BladeSmith Version 4.00.517.
**
** Identification:
**
** Warning: Do not remove or modify this comment:
** CircReceive FunctionId: 92e2627b-0d7a-11d3-98b2-000000000000
**
********************************************************************************
*/
UDREXPORT
Circ *
CircReceive
(
mi_sendrecv * Gen_param1, * The UDT value. */
MI_FPARAM * Gen_fparam /* Standard info - see DBDK docs. */
)
{
MI_CONNECTION * Gen_Con; /* The current connection. */
Circ * Gen_RetVal; /* The return value. */
Circ * Gen_InData; /* Packet data. */
Circ * Gen_OutData; /* Output UDT value. */
/* 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 CircReceive."
*/
DBDK_TRACE_ERROR( "CircReceive", ERRORMESG1, 10 );
/* not reached */
}
/* Point to the input data. */
Gen_InData = (Circ *)mi_get_vardata( (mi_lvarchar *)Gen_param1 );
/* Allocate room for the UDT. */
Gen_RetVal = (Circ *)mi_alloc( sizeof( Circ ) );
if( Gen_RetVal == 0 )
{
/*
** Memory allocation has failed so issue
** the following message and quit.
**
** "Memory allocation has failed in CircReceive."
*/
DBDK_TRACE_ERROR( "CircReceive", ERRORMESG2, 10 );
/* not reached */
}
/* Point to the output data. */
Gen_OutData = (Circ *)Gen_RetVal;
/* Copy the attribute value(s) from the transmission parcel. */
/* Prepare the value for Gen_OutData->center.x. */
mi_get_double_precision( (mi_unsigned_char1 *)&Gen_InData->center.x,
&Gen_OutData->center.x );
/* Prepare the value for Gen_OutData->center.y. */
mi_get_double_precision( (mi_unsigned_char1 *)&Gen_InData->center.y,
&Gen_OutData->center.y );
/* Prepare the value for Gen_OutData->radius. */
mi_get_double_precision( (mi_unsigned_char1 *)&Gen_InData->radius,
&Gen_OutData->radius );
/* Close the connection. */
mi_close( Gen_Con );
/* Return the transmitted UDT value. */
return Gen_RetVal;
}
/* }}FUNCTION (#OVRF) */
/* {{FUNCTION(92e2627c-0d7a-11d3-98b2-000000000000) (MergeSection) */
/*******************************************************************************
**
** Function name:
**
** CircCompare
**
** Description:
**
** Perform the comparison operations required to compare two
** UDT values.
**
** This function returns zero if the two UDT values are equal and
** a non-zero value otherwise.
**
** Special Comments:
**
** Compares two fixed-sized opaque types
**
** Parameters:
**
** Circ * Gen_param1; The first UDT value to compare.
** Circ * Gen_param2; The second UDT value to compare.
** MI_FPARAM * Gen_fparam; Standard info - see DBDK docs.
**
** Return value:
**
** mi_integer The comparison result.
**
** History:
**
** 05/18/1999 - Generated by BladeSmith Version 4.00.517.
**
** Identification:
**
** Warning: Do not remove or modify this comment:
** CircCompare FunctionId: 92e2627c-0d7a-11d3-98b2-000000000000
**
********************************************************************************
*/
UDREXPORT
mi_integer
CircCompare
(
Circ * Gen_param1, /* The first UDT value to compare. */
Circ * Gen_param2, /* The second UDT value to compare. */
MI_FPARAM * Gen_fparam /* Standard info - see DBDK docs. */
)
{
MI_CONNECTION * Gen_Con; /* The current connection. */
mi_integer Gen_cc; /* Numeric attribute difference. */
Circ * Gen_Value1; /* Pointer to the first value. */
Circ * Gen_Value2; /* Pointer to the second value. */
/* 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 CircCompare."
*/
DBDK_TRACE_ERROR( "CircCompare", ERRORMESG1, 10 );
/* not reached */
}
/* Point to the data values that are to be compared. */
Gen_Value1 = Gen_param1;
Gen_Value2 = Gen_param2;
/* Compare the two values. */
Gen_cc = Gen_Value1->center.x > Gen_Value2->center.x ? +1 :
Gen_Value1->center.x < Gen_Value2->center.x ? -1 :
0 ;
if( Gen_cc )
{
return Gen_cc < 0 ? -1 : 1;
}
/* Compare the two values. */
Gen_cc = Gen_Value1->center.y > Gen_Value2->center.y ? +1 :
Gen_Value1->center.y < Gen_Value2->center.y ? -1 :
0 ;
if( Gen_cc )
{
return Gen_cc < 0 ? -1 : 1;
}
/* Compare the two values. */
Gen_cc = Gen_Value1->radius > Gen_Value2->radius ? +1 :
Gen_Value1->radius < Gen_Value2->radius ? -1 :
0 ;
if( Gen_cc )
{
return Gen_cc < 0 ? -1 : 1;
}
/* Close the connection. */
mi_close( Gen_Con );
return 0;
}
/* }}FUNCTION (#2RKB) */
/* {{FUNCTION(92e2627d-0d7a-11d3-98b2-000000000000) (MergeSection) */
/*******************************************************************************
**
** Function name:
**
** CircEqual
**
** Description:
**
** Determine if one UDT value is equal to another.
**
** Special Comments:
**
** Compares two fixed-sized opaque types for equality
**
** Parameters:
**
** Circ * Gen_param1; The first UDT value to compare.
** Circ * Gen_param2; The second UDT value to compare.
** MI_FPARAM * Gen_fparam; Standard info - see DBDK docs.
**
** Return value:
**
** mi_boolean The comparison result.
**
** History:
**
** 05/18/1999 - Generated by BladeSmith Version 4.00.517.
**
** Identification:
**
** Warning: Do not remove or modify this comment:
** CircEqual FunctionId: 92e2627d-0d7a-11d3-98b2-000000000000
**
********************************************************************************
*/
UDREXPORT
mi_boolean
CircEqual
(
Circ * Gen_param1, /* The first UDT value to compare. */
Circ * Gen_param2, /* The second UDT value to compare. */
MI_FPARAM * Gen_fparam /* Standard info - see DBDK docs. */
)
{
/* Call Compare to perform the comparison. */
return (mi_boolean)(0 == CircCompare( Gen_param1,
Gen_param2, Gen_fparam ));
}
/* }}FUNCTION (#LKNH) */
/* {{FUNCTION(92e2627e-0d7a-11d3-98b2-000000000000) (MergeSection) */
/*******************************************************************************
**
** Function name:
**
** CircNotEqual
**
** Description:
**
** Determine if one UDT value is not equal to another.
**
** Special Comments:
**
** Compares two fixed-sized opaque types for non-equality
**
** Parameters:
**
** Circ * Gen_param1; The first UDT value to compare.
** Circ * Gen_param2; The second UDT value to compare.
** MI_FPARAM * Gen_fparam; Standard info - see DBDK docs.
**
** Return value:
**
** mi_boolean The comparison result.
**
** History:
**
** 05/18/1999 - Generated by BladeSmith Version 4.00.517.
**
** Identification:
**
** Warning: Do not remove or modify this comment:
** CircNotEqual FunctionId: 92e2627e-0d7a-11d3-98b2-000000000000
**
********************************************************************************
*/
UDREXPORT
mi_boolean
CircNotEqual
(
Circ * Gen_param1, /* The first UDT value to compare. */
Circ * Gen_param2, /* The second UDT value to compare. */
MI_FPARAM * Gen_fparam /* Standard info - see DBDK docs. */
)
{
/* Call Compare to perform the comparison. */
return (mi_boolean)(0 != CircCompare( Gen_param1,
Gen_param2, Gen_fparam ));
}
/* }}FUNCTION (#J1IH) */
/* {{FUNCTION(92e26278-0d7a-11d3-98b2-000000000000) (MergeSection) */
/*******************************************************************************
**
** Function name:
**
** CircInput
**
** Description:
**
** This function converts from the external representation of the
** UDT type Circ to its internal representation. The external
** representation is a blank-separated list of values and the
** internal representation is a 'C' structure of type Circ 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.
**
** Special Comments:
**
** Support routine for opaque type Circ returns Circ.
**
** Parameters:
**
** mi_lvarchar * Gen_param1; Pointer to the input text.
** MI_FPARAM * Gen_fparam; Standard info - see DBDK docs.
**
** Return value:
**
** Circ * The constructed UDT value.
**
** History:
**
** 05/18/1999 - Generated by BladeSmith Version 4.00.517.
**
** Identification:
**
** Warning: Do not remove or modify this comment:
** CircInput FunctionId: 92e26278-0d7a-11d3-98b2-000000000000
**
********************************************************************************
*/
UDREXPORT
Circ *
CircInput
(
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. */
Circ * Gen_OutData; /* Pointer to the output data. */
mi_integer Gen_DataLen; /* Length of the data in bytes. */
Circ * Gen_RetVal; /* The return value. */
/* 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 CircInput."
*/
DBDK_TRACE_ERROR( "CircInput", 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 = (Circ *)mi_alloc( sizeof( Circ ) );
if( Gen_RetVal == 0 )
{
/*
** Memory allocation has failed so issue
** the following message and quit.
**
** "Memory allocation has failed in CircInput."
*/
DBDK_TRACE_ERROR( "CircInput", ERRORMESG2, 10 );
/* not reached */
}
/* Point to the output data. */
Gen_OutData = (Circ *)Gen_RetVal;
/* Get the mi_double_precision value for center.x. */
Gen_InData = Gen_sscanf( Gen_Con, "CircInput", Gen_InData,
Gen_DataLen - (Gen_InData - Gen_StartInData),
0, "%lf %n", (char *)&Gen_OutData->center.x );
/* Get the mi_double_precision value for center.y. */
Gen_InData = Gen_sscanf( Gen_Con, "CircInput", Gen_InData,
Gen_DataLen - (Gen_InData - Gen_StartInData),
0, "%lf %n", (char *)&Gen_OutData->center.y );
/* Get the mi_double_precision value for radius. */
Gen_InData = Gen_sscanf( Gen_Con, "CircInput", Gen_InData,
Gen_DataLen - (Gen_InData - Gen_StartInData),
0, "%lf %n", (char *)&Gen_OutData->radius );
/* Close the connection. */
mi_close( Gen_Con );
/* Return the UDT value. */
return Gen_RetVal;
}
/* }}FUNCTION (#RHCJ) */
/* {{FUNCTION(92e26279-0d7a-11d3-98b2-000000000000) (MergeSection) */
/*******************************************************************************
**
** Function name:
**
** CircOutput
**
** Description:
**
** This function converts from the internal representation of the
** UDT type Circ to its external representation. The external
** representation is a blank-separated list of values and the
** internal representation is a 'C' structure of type Circ as
** defined in the header file.
**
** Data can be retrieved from a table using an SQL select statement:
**
** select * from tablename;
**
** Special Comments:
**
** Support routine for opaque type Circ returns mi_lvarchar.
**
** Parameters:
**
** Circ * 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:
**
** 05/18/1999 - Generated by BladeSmith Version 4.00.517.
**
** Identification:
**
** Warning: Do not remove or modify this comment:
** CircOutput FunctionId: 92e26279-0d7a-11d3-98b2-000000000000
**
********************************************************************************
*/
UDREXPORT
mi_lvarchar *
CircOutput
(
Circ * 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. */
Circ * 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. */
/* 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 CircOutput."
*/
DBDK_TRACE_ERROR( "CircOutput", 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. */
+ (
+ 61 /* Add the length for x. */
+ 61 /* Add the length for y. */
)
+ 61 /* Add the length for radius. */
;
/* 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 CircOutput."
*/
DBDK_TRACE_ERROR( "CircOutput", ERRORMESG2, 10 );
/* not reached */
}
/* Point to the output data. */
Gen_OutData = mi_get_vardata( Gen_RetVal );
/* Format the attribute value into the output string. */
/* Format the mi_double_precision value for center.x. */
sprintf( Gen_OutData, "%lg ", Gen_InData->center.x );
Gen_OutData += strlen( Gen_OutData );
/* Format the mi_double_precision value for center.y. */
sprintf( Gen_OutData, "%lg ", Gen_InData->center.y );
Gen_OutData += strlen( Gen_OutData );
/* Format the mi_double_precision value for radius. */
sprintf( Gen_OutData, "%lg ", Gen_InData->radius );
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 (#CONH) */
#ifdef __cplusplus
}
#endif