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

Callback support for session tracking

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed (View Workflow)
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 3.3.1
    • Fix Version/s: 3.3.2
    • Component/s: Protocol
    • Labels:
      None

      Description

      Currently the API functions mysql_session_track_get_first/get_next() provide access to session tracking data sent by server in it's OK packet.

      It would be more convenient to offer the possibility to register a callback function, which will be called if the server sends session track information to the client.

      Callback function:

      void session_track_cb(void *userdata, enum enum_session_state_type type,
                                 char *val1, size_t len1, char *val2, size_t len2)
      {
        switch (type) {
          case SESSION_TRACK_SCHEMA:
            printf("New schema: %.*s\n", len1, val1);
            break;
          case SESSION_TRACK_SYSTEM_VARIABLES:
            printf("Variable: "%.*s  Value: %.*s\n", len1, val1, len2, val2);
            break;
        }
      }
      

      Registering the callback function:

      if (mysql_optionsv(handle, MARIADB_OPT_SESSION_TRACK_CALLBACK, session_track_cb, data))
      {
        printf("Error: %s\n", mysql_error(handle));
      }
      

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              georg Georg Richter
              Reporter:
              georg Georg Richter
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:

                  Git Integration

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