You've already forked mariadb-connector-c
mirror of
https://github.com/mariadb-corporation/mariadb-connector-c.git
synced 2025-08-08 14:02:17 +03:00
Fix for asynchronous (reconnect)
Fixed memory leak after reconnect/change user
This commit is contained in:
@@ -39,8 +39,7 @@ static int test_conc75(MYSQL *my)
|
||||
mysql= mysql_init(NULL);
|
||||
|
||||
|
||||
mysql_options(mysql, MYSQL_OPT_RECONNECT,(const char *)"true");
|
||||
|
||||
mysql->reconnect= 1;
|
||||
mysql_real_connect(mysql, hostname, username, password, schema, port, socketname, 0| CLIENT_MULTI_RESULTS | CLIENT_REMEMBER_OPTIONS);
|
||||
|
||||
rc= mysql_query(mysql, "DROP TABLE IF EXISTS a");
|
||||
|
@@ -487,6 +487,7 @@ static int bug30472_retrieve_charset_info(MYSQL *con,
|
||||
row= mysql_fetch_row(rs);
|
||||
FAIL_IF(!row, "Couldn't fetch row");
|
||||
strcpy(character_set_client, row[1]);
|
||||
diag("cs: %s", row[1]);
|
||||
mysql_free_result(rs);
|
||||
|
||||
rc= mysql_query(con, "SHOW VARIABLES LIKE 'character_set_results'");
|
||||
|
@@ -964,7 +964,6 @@ static int test_conc117(MYSQL *mysql)
|
||||
mysql_kill(my, mysql_thread_id(my));
|
||||
sleep(5);
|
||||
|
||||
strcpy(my->host, "A");
|
||||
my->reconnect= 1;
|
||||
|
||||
mysql_query(my, "SET @a:=1");
|
||||
|
@@ -374,7 +374,7 @@ MYSQL *test_connect(struct my_tests_st *test) {
|
||||
return(NULL);
|
||||
}
|
||||
|
||||
mysql_options(mysql, MYSQL_REPORT_DATA_TRUNCATION, "1");
|
||||
mysql_options(mysql, MYSQL_REPORT_DATA_TRUNCATION, &i);
|
||||
mysql_options(mysql, MYSQL_OPT_CONNECT_TIMEOUT, (const char *)&i);
|
||||
|
||||
/* option handling */
|
||||
|
@@ -523,10 +523,12 @@ static int test_bug12744(MYSQL *mysql)
|
||||
check_stmt_rc(rc, stmt);
|
||||
|
||||
/* set reconnect, kill and ping to reconnect */
|
||||
rc= mysql_query(mysql, "SET @a:=1");
|
||||
check_mysql_rc(rc, mysql);
|
||||
rc= mysql_options(mysql, MYSQL_OPT_RECONNECT, "1");
|
||||
check_mysql_rc(rc, mysql);
|
||||
rc= mysql_kill(mysql, mysql_thread_id(mysql));
|
||||
//check_mysql_rc(rc, mysql);
|
||||
check_mysql_rc(rc, mysql);
|
||||
|
||||
sleep(2);
|
||||
rc= mysql_ping(mysql);
|
||||
@@ -542,10 +544,10 @@ static int test_bug1500(MYSQL *mysql)
|
||||
{
|
||||
MYSQL_STMT *stmt;
|
||||
MYSQL_BIND my_bind[3];
|
||||
int rc;
|
||||
int rc= 0;
|
||||
int32 int_data[3]= {2, 3, 4};
|
||||
const char *data;
|
||||
const char *query;
|
||||
char *data;
|
||||
char *query;
|
||||
|
||||
|
||||
rc= mysql_query(mysql, "DROP TABLE IF EXISTS test_bg1500");
|
||||
@@ -1084,6 +1086,8 @@ static int test_bug20152(MYSQL *mysql)
|
||||
my_bind[0].buffer_type= MYSQL_TYPE_DATE;
|
||||
my_bind[0].buffer= (void*)&tm;
|
||||
|
||||
memset(&tm, 0, sizeof(MYSQL_TIME));
|
||||
|
||||
tm.year = 2006;
|
||||
tm.month = 6;
|
||||
tm.day = 18;
|
||||
@@ -2180,11 +2184,11 @@ static int test_bug4026(MYSQL *mysql)
|
||||
rc= mysql_stmt_prepare(stmt, stmt_text, strlen(stmt_text));
|
||||
check_stmt_rc(rc, stmt);
|
||||
/* Bind input buffers */
|
||||
memset(my_bind, '\0', sizeof(my_bind));
|
||||
memset(&time_in, '\0', sizeof(time_in));
|
||||
memset(&time_out, '\0', sizeof(time_out));
|
||||
memset(&datetime_in, '\0', sizeof(datetime_in));
|
||||
memset(&datetime_out, '\0', sizeof(datetime_out));
|
||||
memset(my_bind, '\0', sizeof(MYSQL_BIND) * 2);
|
||||
memset(&time_in, '\0', sizeof(MYSQL_TIME));
|
||||
memset(&time_out, '\0', sizeof(MYSQL_TIME));
|
||||
memset(&datetime_in, '\0', sizeof(MYSQL_TIME));
|
||||
memset(&datetime_out, '\0', sizeof(MYSQL_TIME));
|
||||
my_bind[0].buffer_type= MYSQL_TYPE_TIME;
|
||||
my_bind[0].buffer= (void *) &time_in;
|
||||
my_bind[1].buffer_type= MYSQL_TYPE_DATETIME;
|
||||
|
@@ -680,6 +680,9 @@ const char *ssl_cert_finger_print= "@SSL_CERT_FINGER_PRINT@";
|
||||
static int test_ssl_fp(MYSQL *unused)
|
||||
{
|
||||
MYSQL *my;
|
||||
MYSQL_RES *res;
|
||||
MYSQL_ROW row;
|
||||
int rc;
|
||||
|
||||
if (check_skip_ssl())
|
||||
return SKIP;
|
||||
@@ -693,8 +696,22 @@ static int test_ssl_fp(MYSQL *unused)
|
||||
|
||||
FAIL_IF(!mysql_real_connect(my, hostname, ssluser, sslpw, schema,
|
||||
port, socketname, 0), mysql_error(my));
|
||||
|
||||
|
||||
FAIL_IF(check_cipher(my) != 0, "Invalid cipher");
|
||||
|
||||
mysql_query(my, "SET @a:=1");
|
||||
check_mysql_rc(rc, my);
|
||||
|
||||
mysql_query(my, "SELECT @a");
|
||||
check_mysql_rc(rc, my);
|
||||
|
||||
if ((res= mysql_store_result(my)))
|
||||
{
|
||||
row= mysql_fetch_row(res);
|
||||
diag("@a:=%s", row[0]);
|
||||
mysql_free_result(res);
|
||||
}
|
||||
|
||||
mysql_close(my);
|
||||
return OK;
|
||||
}
|
||||
@@ -741,7 +758,7 @@ struct my_tests_st my_tests[] = {
|
||||
{"test_multi_ssl_connections", test_multi_ssl_connections, TEST_CONNECTION_NONE, 0, NULL, NULL},
|
||||
{"test_conc_102", test_conc_102, TEST_CONNECTION_NEW, 0, NULL, NULL},
|
||||
{"test_ssl_threads", test_ssl_threads, TEST_CONNECTION_NEW, 0, NULL, NULL},
|
||||
{"test_password_protected", test_password_protected, TEST_CONNECTION_NEW, 0, NULL, NULL},
|
||||
{"test_password_protected", test_password_protected, TEST_CONNECTION_NEW, 0, NULL, NULL},
|
||||
|
||||
{NULL, NULL, 0, 0, NULL, NULL}
|
||||
};
|
||||
|
Reference in New Issue
Block a user