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

Fix for CONC-351:

If an ok packet doesn't contain session state tracking information, we need to
clear session state information from previous ok packet.
This commit is contained in:
Georg Richter
2018-08-06 18:45:30 +02:00
parent 6d15291899
commit 072fa008b8
2 changed files with 27 additions and 0 deletions

View File

@@ -2100,6 +2100,9 @@ int ma_read_ok_packet(MYSQL *mysql, uchar *pos, ulong length)
} }
} }
} }
/* CONC-351: clear session state information */
else if (mysql->server_capabilities & CLIENT_SESSION_TRACKING)
ma_clear_session_state(mysql);
return(0); return(0);
} }

View File

@@ -1528,7 +1528,31 @@ static int test_conc332(MYSQL *unused __attribute__((unused)))
return OK; return OK;
} }
static int test_conc351(MYSQL *unused __attribute__((unused)))
{
int rc;
const char *data;
size_t len;
MYSQL *mysql= mysql_init(NULL);
my_test_connect(mysql, hostname, username, password, schema,
port, socketname, 0);
FAIL_IF(mysql_errno(mysql), "Error during connect");
FAIL_IF(mysql_session_track_get_first(mysql, SESSION_TRACK_SCHEMA, &data, &len), "expected session track schema");
rc= mysql_query(mysql, "SET @a:=1");
check_mysql_rc(rc, mysql);
FAIL_IF(!mysql_session_track_get_first(mysql, SESSION_TRACK_SCHEMA, &data, &len), "expected no schema tracking information");
mysql_close(mysql);
return OK;
}
struct my_tests_st my_tests[] = { struct my_tests_st my_tests[] = {
{"test_conc351", test_conc351, TEST_CONNECTION_NONE, 0, NULL, NULL},
{"test_conc332", test_conc332, TEST_CONNECTION_NONE, 0, NULL, NULL}, {"test_conc332", test_conc332, TEST_CONNECTION_NONE, 0, NULL, NULL},
#ifndef WIN32 #ifndef WIN32
{"test_conc327", test_conc327, TEST_CONNECTION_DEFAULT, 0, NULL, NULL}, {"test_conc327", test_conc327, TEST_CONNECTION_DEFAULT, 0, NULL, NULL},