1
0
mirror of https://github.com/mariadb-corporation/mariadb-connector-c.git synced 2025-08-05 15:55:58 +03:00

status and session_tracik callback function:

This feature allows client applications to register a callback function,
which is called as soon as the server status changes or session_track
information was sent by the server.

Registration is handled via mysql_optionsv() API function:

mysql_optionsv(mysql, MARIADB_OPT_STATUS_CALLBACK, function, data)

The callback function must be defined as follws:

void status_callback(void *data, enum enum_mariadb_status_info type, ..)

  Parameters:
    - data  Pointer passed with registration of callback function
            (usually a connection handle)
    - type  Information type  STATUS_TYPE or SESSION_TRACK_TYPE

  Variadic Parameters:

  if (type == STATUS_TYPE):
    - server status (unsigned int)

  if (type == SESSION_TRACK_TYPE)
    - enum enum_session_state_type track_type - session track type

    if (track_type == SESSION_TRACK_SYSTEM_VARIABLES)
      - MARIADB_CONST_STRING *key
      - MARIADB_CONST_STRING *value

    else
      - MARIADB_CONST_STRING *value

An example can be found in connection.c (test_status_callback)
This commit is contained in:
Georg Richter
2022-08-02 10:10:50 +02:00
parent 8eff2a866e
commit a8832afa2a
5 changed files with 236 additions and 34 deletions

View File

@@ -249,7 +249,8 @@ extern const char *SQLSTATE_UNKNOWN;
MARIADB_OPT_IO_WAIT,
MARIADB_OPT_SKIP_READ_RESPONSE,
MARIADB_OPT_RESTRICTED_AUTH,
MARIADB_OPT_RPL_REGISTER_REPLICA
MARIADB_OPT_RPL_REGISTER_REPLICA,
MARIADB_OPT_STATUS_CALLBACK
};
enum mariadb_value {