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

CONC-26: CLIENT_REMEMBER_OPTIONS is not supported

This commit is contained in:
Georg Richter
2013-05-10 10:27:42 +02:00
parent f6d4749279
commit a1c12629e4
3 changed files with 28 additions and 1 deletions

View File

@@ -151,6 +151,7 @@ enum enum_server_command
#define CLIENT_PLUGIN_AUTH (1UL << 19) #define CLIENT_PLUGIN_AUTH (1UL << 19)
#define CLIENT_PROGRESS (1UL << 29) /* client supports progress indicator */ #define CLIENT_PROGRESS (1UL << 29) /* client supports progress indicator */
#define CLIENT_SSL_VERIFY_SERVER_CERT (1UL << 30) #define CLIENT_SSL_VERIFY_SERVER_CERT (1UL << 30)
#define CLIENT_REMEMBER_OPTIONS (1UL << 31)
#define CLIENT_SUPPORTED_FLAGS (CLIENT_LONG_PASSWORD | \ #define CLIENT_SUPPORTED_FLAGS (CLIENT_LONG_PASSWORD | \
CLIENT_FOUND_ROWS |\ CLIENT_FOUND_ROWS |\
@@ -171,7 +172,8 @@ enum enum_server_command
CLIENT_MULTI_STATEMENTS |\ CLIENT_MULTI_STATEMENTS |\
CLIENT_MULTI_RESULTS |\ CLIENT_MULTI_RESULTS |\
CLIENT_PROGRESS |\ CLIENT_PROGRESS |\
CLIENT_SSL_VERIFY_SERVER_CERT) CLIENT_SSL_VERIFY_SERVER_CERT |\
CLIENT_REMEMBER_OPTIONS)
#define CLIENT_CAPABILITIES (CLIENT_LONG_PASSWORD |\ #define CLIENT_CAPABILITIES (CLIENT_LONG_PASSWORD |\
CLIENT_LONG_FLAG |\ CLIENT_LONG_FLAG |\

View File

@@ -65,6 +65,7 @@
#endif #endif
static my_bool mysql_client_init=0; static my_bool mysql_client_init=0;
static void mysql_close_options(MYSQL *mysql);
extern my_bool my_init_done; extern my_bool my_init_done;
extern my_bool mysql_ps_subsystem_initialized; extern my_bool mysql_ps_subsystem_initialized;
extern my_bool mysql_handle_local_infile(MYSQL *mysql, const char *filename); extern my_bool mysql_handle_local_infile(MYSQL *mysql, const char *filename);
@@ -1858,6 +1859,8 @@ error:
end_server(mysql); end_server(mysql);
/* only free the allocated memory, user needs to call mysql_close */ /* only free the allocated memory, user needs to call mysql_close */
mysql_close_memory(mysql); mysql_close_memory(mysql);
if (!(((ulong) client_flag) & CLIENT_REMEMBER_OPTIONS))
mysql_close_options(mysql);
} }
DBUG_RETURN(0); DBUG_RETURN(0);
} }

View File

@@ -560,6 +560,27 @@ int test_conc21(MYSQL *mysql)
return OK; return OK;
} }
int test_conc26(MYSQL *my)
{
MYSQL *mysql= mysql_init(NULL);
mysql_options(mysql, MYSQL_SET_CHARSET_NAME, "utf8");
FAIL_IF(mysql_real_connect(mysql, hostname, "notexistinguser", "password", schema, port, NULL, CLIENT_REMEMBER_OPTIONS),
"Error expected");
FAIL_IF(!mysql->options.charset_name || strcmp(mysql->options.charset_name, "utf8") != 0,
"expected charsetname=utf8");
mysql_close(mysql);
mysql= mysql_init(NULL);
FAIL_IF(mysql_real_connect(mysql, hostname, "notexistinguser", "password", schema, port, NULL, 0),
"Error expected");
FAIL_IF(mysql->options.charset_name, "Error: options not freed");
mysql_close(mysql);
return OK;
}
struct my_tests_st my_tests[] = { struct my_tests_st my_tests[] = {
{"test_bug20023", test_bug20023, TEST_CONNECTION_NEW, 0, NULL, NULL}, {"test_bug20023", test_bug20023, TEST_CONNECTION_NEW, 0, NULL, NULL},
{"test_bug31669", test_bug31669, TEST_CONNECTION_NEW, 0, NULL, NULL}, {"test_bug31669", test_bug31669, TEST_CONNECTION_NEW, 0, NULL, NULL},
@@ -569,6 +590,7 @@ struct my_tests_st my_tests[] = {
{"test_compress", test_compress, TEST_CONNECTION_NONE, 0, NULL, NULL}, {"test_compress", test_compress, TEST_CONNECTION_NONE, 0, NULL, NULL},
{"test_reconnect", test_reconnect, TEST_CONNECTION_DEFAULT, 0, NULL, NULL}, {"test_reconnect", test_reconnect, TEST_CONNECTION_DEFAULT, 0, NULL, NULL},
{"test_conc21", test_conc21, TEST_CONNECTION_DEFAULT, 0, NULL, NULL}, {"test_conc21", test_conc21, TEST_CONNECTION_DEFAULT, 0, NULL, NULL},
{"test_conc26", test_conc26, TEST_CONNECTION_NONE, 0, NULL, NULL},
{NULL, NULL, 0, 0, NULL, NULL} {NULL, NULL, 0, 0, NULL, NULL}
}; };