Uploaded image for project: 'MariaDB Connector/C'
  1. MariaDB Connector/C
  2. CONC-765

Suggestion: MYSQL_ERROR_CALLBACK option

    XMLWordPrintable

Details

    • New Feature
    • Status: Open (View Workflow)
    • Minor
    • Resolution: Unresolved
    • 3.4
    • None
    • Error handling
    • 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.

      Attachments

        Activity

          People

            georg Georg Richter
            NextDoorTech Connor Gibson
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:

              Git Integration

                Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.