I have a mysql function, i want to debug it, set breakboints, see variables values on that time period etc. How to do it ?
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
回答1:
You cannot debug UDF function when it is called by MySQL. But I think you can try these variants:
- debug your functions without MySQL, just pass test parameter values into function.
- try to output values into the file when UDF is called, this will help you to view internal variables and understand what is happen.
回答2:
From my current search so far (though I might have missed something) I have to agree with Devart that you cannot debug UDF functions.
One extra advice to give you is to use the stderr for debugging. I've crafted something rather simple to work with:
void udf_debug( char *msg, ... ) {
#ifdef DEBUG
va_list ap;
va_start(ap, msg);
vfprintf(stderr, msg, ap);
va_end(ap);
fflush(stderr);
#endif
}