On Thursday, 11. April 2002 10:26, Fei Chen wrote: > Dear Georg, > > > * notation. Just as normally I can say > select * from myTable; > can I write a UDF to handle > select my_udf(*) from myTable; ? > There is the builtin function > select count(*) from myTable; > But the manual does not say how this is to be accomplished using UDFs.
No, the udf is outside from mysql in a shared library. So the udf doesn't know anything about the used table(s) and his fields. When you want functionallity like count, you have to write an aggregate udf. The diffrence between a normal udf and a aggregate udf is that _reset and _add functions will be called for first row/each row. > Indeed UDFs can return (char *), but my question is, is there a way to > return an array of intergers (int *)? or some more complicated structure, > say, (myStruct *)? If UDFs are limited to returning (char*), (long) or > (double), does that mean the only way out is to turn (myStruct*) into > some kind of string and return it as (char*)? > An user defined function (udf) is not a api-function. It would make no sense to return other values, or a structure. What output should be displayed, when udf would return a structure? SELECT UDF("foo"); Regards Georg mysql, query --------------------------------------------------------------------- Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail <[EMAIL PROTECTED]> To unsubscribe, e-mail <[EMAIL PROTECTED]> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php