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

Reply via email to