lookup and reverse_lookup UDF problem
I, like others, am having trouble getting the two UDF's mentioned above to work correctly. I successfully compiled MySQL 4.0.14 dynamically with the -rdynamic flag on Linux 8. I have also compiled the udf_example.cc file using the -shared option. Everything seems to go OK when I'm using the CREATE FUNCTION command to add the avaiable UDF's until I get to lookup and reverse_lookup. On these two, I get the following error message: ERROR 1127: Can't find function 'reverse_lookup' in library ERROR 1127: Can't find function 'lookup' in library I checked the func table in the mysql database, and I see where it created the entries for the other functions, so I know it's not a permissions problem. Has anyone out there run into this one and found an answer?
Re: UDF Problem
Thomas Kaester(global) writes: Hello everybody, I have a big UDF problem and I hope that anybody can help me! In details: I have developed an UDF which returns a string which is longer than 256 characters! But the function only returns the first 256 characters and not the whole string. I checked the UDF_INIT struct but the necessary parameter initid-max_length has the value 65535. This should be enough. Does anyone know if I have to set special buffer parameters? What goes wrong? And what can I do? Greetings Tom Hi! You will have to allocate that string in _init function and deallocate it in _deinit function. Regards, Sinisa __ _ _ ___ == MySQL AB /*/\*\/\*\ /*/ \*\ /*/ \*\ |*| Sinisa Milivojevic /*/ /*/ /*/ \*\_ |*| |*||*| mailto:[EMAIL PROTECTED] /*/ /*/ /*/\*\/*/ \*\|*| |*||*| Larnaca, Cyprus /*/ /*/ /*/\*\_/*/ \*\_/*/ |*| /*/^^^\*\^^^ /*/ \*\Developers Team - 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
Urgent-UDF problem
Hello Sinisa and everybody else, sorry that I contact you directly! But I tried all suggestions and it still doesn't work! The UDF return string has always 256 characters! I've used my_malloc and my_free! Also I allocated the necessary memory in xxx_init()! But it doesn't work! What can I do? Who is the mysql developer who is specialized in UDF programming! It's very important! To change the initid-max_length has no effect. If I set this value on 12 or so, I will furthermore get 256 characters, why? Is it a bug? Thank you for your help and support! Greetings Tom Some code: // init function my_bool IHistogram_init(UDF_INIT *initid, UDF_ARGS *args, char *message){ // Parameter: ID, filepointer, data if (args-arg_count != 3) { strcpy(message,"Usage: ID, filepointer and data field."); return 1; } initid-ptr = (char*) my_malloc (65535 * sizeof(char), MY_ZEROFILL); // Set types args-arg_type[0] = STRING_RESULT; args-arg_type[1] = STRING_RESULT; args-arg_type[2] = STRING_RESULT; return 0; } void IHistogram_deinit(UDF_INIT *initid) { my_free(initid-ptr, MY_ZEROFILL); } char* IHistogram(UDF_INIT *initid, UDF_ARGS *args, char *result, unsigned long length, char *is_null, char *error){ char* res; // Calc histogram, result: histogram-string res = checkIHist(args-args[0], args-args[1], args-args[2], args-lengths[1], args-lengths[2]); // Error occured if (strcmp(res, "ERROR") == 0){ *error = 1; return 0; } else{ initid-ptr = res; return initid-ptr; } } - 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