mi_lvarchar_to_string
Posted in 2000
Can someone tell me what's wrong with my code. I can't seem to get any
string data. The UDR has no problem with the integer, but the three
strings are all null when I call mi_lvarchar_to_string. Also, when I
call mi_get_varlen it returns -1. I'm running all this on the Informix
Dynamic Server version 9.14. with Universal Data for Intel.
Here is a snip of the code and the sql statement to create the function:
mi_integer xp_test(mi_lvarchar *mi_pszVal1,
mi_integer nNumber,
mi_lvarchar *mi_pszVal2,
mi_lvarchar *mi_pszVal3,
MI_FPARAM *fparam)
{
mi_string *pszVal1 = NULL;
mi_string *pszVal2 = NULL;
mi_string *pszVal3 = NULL;
long nReturn = 0;
long nLen = 0;
// First check to see if there are any nulls */
if( mi_fp_argisnull( fparam, 0 ) == MI_TRUE ||
mi_fp_argisnull( fparam, 2 ) == MI_TRUE ||
mi_fp_argisnull( fparam, 3 ) == MI_TRUE)
{
return ERROR_NULLS;
}
pszVal1 = mi_lvarchar_to_string(mi_pszVal1);
pszVal2 = mi_lvarchar_to_string(mi_pszVal2);
pszVal3 = mi_lvarchar_to_string(mi_pszVal3);
if(pszVal1 == NULL || pszVal2 == NULL || pszVal3 == NULL )
{
return -1; // something went wrong in the conversion
}
CREATE FUNCTION xp_Test (lvarchar, integer, lvarchar, lvarchar )
RETURNS integer WITH (NOT VARIANT)
EXTERNAL NAME 'F:\\Informix\\Test.dll(xp_test)'
LANGUAGE C;GRANT EXECUTE ON FUNCTION xp_test ( lvarchar, integer, lvarchar,
lvarchar ) TO PUBLIC;
EXECUTE FUNCTION xp_test ( 'value1', 1234, 'value2', 'value3' );
Any ideas what why this is happening would be greatly appreciated.
Sent via Deja.com http://www.deja.com/
Before you buy.