1
0
mirror of https://github.com/mariadb-corporation/mariadb-connector-c.git synced 2025-08-07 02:42:49 +03:00

Follow up for status/session_track callback:

- changed data type to MARIADB_CONST_STRING
- allow setting callback function and/or data ptr
This commit is contained in:
Georg Richter
2022-08-02 15:19:39 +02:00
parent 28df8a73b6
commit 64ebd5818a

View File

@@ -2594,7 +2594,7 @@ int ma_read_ok_packet(MYSQL *mysql, uchar *pos, ulong length)
while (pos < end)
{
size_t plen;
MYSQL_LEX_STRING data1, data2;
MARIADB_CONST_STRING data1, data2;
si_type= (enum enum_session_state_type)net_field_length(&pos);
switch(si_type) {
@@ -3774,10 +3774,14 @@ mysql_optionsv(MYSQL *mysql,enum mysql_option option, ...)
case MARIADB_OPT_STATUS_CALLBACK:
{
void *arg2= va_arg(ap, void *);
if (arg1)
if (arg1 || arg2)
{
OPT_SET_EXTENDED_VALUE(&mysql->options, status_callback, arg1);
OPT_SET_EXTENDED_VALUE(&mysql->options, status_data, arg2);
if (arg1) {
OPT_SET_EXTENDED_VALUE(&mysql->options, status_callback, arg1);
}
if (arg2) {
OPT_SET_EXTENDED_VALUE(&mysql->options, status_data, arg2);
}
} else {
OPT_SET_EXTENDED_VALUE(&mysql->options, status_callback, ma_save_session_track_info);
OPT_SET_EXTENDED_VALUE(&mysql->options, status_data, mysql);