Hi,
i am trying to define user define function which has argument integer bat and returning integer.
step 1:
i have added function defination in udf_80.sql as follow
create function xtest(one integer)
returns integer external name udf.xtest;
step 2:
i have added function defination in udf.mal
module udf;
command xtest(b:bat[:oid,:int]):int
address UDFBATxtest
comment "function xtest";
module batudf;
command xtest(b:bat[:oid,:int]):int
address UDFBATxtest
comment "function xtest";
step 3:
then i have define this function in udf.c file
UDFBATxtest_(int *ret, BAT *src)
{
return MAL_SUCCEED;
}
str
UDFBATxtest(int *ires, bat *ione)
{
BAT *bone = NULL;
str msg = NULL;
/* assert calling sanity */
assert(ione != NULL);
/* bat-id -> BAT-descriptor */
if ((bone = BATdescriptor(*ione)) == NULL)
throw(MAL, "batudf.xtest", RUNTIME_OBJECT_MISSING);
/* do the work */
msg = UDFBATxtest_ ( ires, bone);
return msg;
}
step 4:
then i have compiled source code and installed it:
step 5:
i am try to execute xtest function on mclient but i got following error
sql>select xtest(id) from student;
TypeException:user.s23_1[16]:'udf.xtest' undefined in: _53:any := udf.xtest(_51:int)
TypeException:user.s23_1[17]:'bat.insert' undefined in: _54:any := bat.insert(_45:bat[:oid,:int], _50:oid, _53:any)
program contains errors
step 6:
write a mail and sent to you for getting help i hope you will give me.
--
Regards,
Swapnil K. Joshi