Bug #21839 Error message UDF init not shown
Submitted: 25 Aug 2006 17:26 Modified: 20 Nov 2013 11:06
Reporter: Arnold Daniels Email Updates:
Status: Not a Bug Impact on me:
None 
Category:MySQL Server: User-defined functions ( UDF ) Severity:S4 (Feature request)
Version:5.0 OS:Linux (linux)
Assigned to: CPU Architecture:Any

[25 Aug 2006 17:26] Arnold Daniels
Description:
I've noticed that the error messages set by an UDF, are not shown in phpmyadmin nor in the query browser. They are displayed in the commandline client though.

This raises confusion when using UDF's. So could this please be changed that an actual error is raised, which is returned by mysql_errno() and mysql_error() in the client API.

How to repeat:
SELECT myudf_err(1);

/***************************************************************************
** Test error message
****************************************************************************/

my_bool myudf_err_init(UDF_INIT *initid, UDF_ARGS *args, char *message)
{
  if (args->arg_count > 0)
  {
    strcpy(message,"Init error because I have an argument");
    return 1;
  }
  return 0;
}

longlong myudf_err(UDF_INIT *initid, UDF_ARGS *args, char *is_null, char *error)
{
  *error = 1;
  return 0;
}
[20 Nov 2013 11:06] Sveta Smirnova
Thank you for taking the time to write to us, but this is not a bug. Please double-check the documentation available at http://dev.mysql.com/doc/ and the instructions on
how to report a bug at http://bugs.mysql.com/how-to-report.php

> I've noticed that the error messages set by an UDF, are not shown in phpmyadmin nor in the query browser. They are displayed in the commandline client though.

You have to use special functions to receive error and warning information from your PHP programs. See http://sql-error.microbecal.com/en/chap4.html for examples.