Details
-
New Feature
-
Status: Open (View Workflow)
-
Minor
-
Resolution: Unresolved
-
3.4
-
None
-
None
Description
Suggestion: add a new option to mysql_optionsv() which allows an error-handling callback function to be passed. The callback would be automatically executed whenever a subsequent C/C function call (limited to appropriate functions) returns a nonzero error code.
This would be roughly equivalent to placing every subsequent C/C function call inside an if statement as follows, without the added clutter:
if (/* C/C function here */) {
|
my_error_handler();
|
}
|
The primary use case for this would be in logging errors and/or debugging without making major modifications to existing code.
This feature could be implemented as a single option MYSQL_ERROR_CALLBACK which applies to all C/C functions, leaving any further filtering to be done by the implementing programmer in their callback function, as a small family of options with some granularity, i.e. MYSQL_{CLIENT|SERVER|READ|WRITE|etc...}_ERROR_CALLBACK, or on a per-function basis as MYSQL_FUNCTION_ERROR_CALLBACK which also takes a C/C function list passed as an additional string parameter to mysql_optionsv(). I'll leave any further details up to discussion.