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
CONC-395: Dashes and underscores are not interchangeable in options in my.cnf
This commit is contained in:
@@ -698,6 +698,11 @@ my_bool _mariadb_set_conf_option(MYSQL *mysql, const char *config_option, const
|
|||||||
if (config_option)
|
if (config_option)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
char *c;
|
||||||
|
|
||||||
|
/* CONC-395: replace underscore "_" by dash "-" */
|
||||||
|
while ((c= strchr(config_option, '_')))
|
||||||
|
*c= '-';
|
||||||
|
|
||||||
for (i=0; mariadb_defaults[i].conf_key; i++)
|
for (i=0; mariadb_defaults[i].conf_key; i++)
|
||||||
{
|
{
|
||||||
|
@@ -1345,10 +1345,51 @@ static int test_conc384(MYSQL *my __attribute__((unused)))
|
|||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifndef _WIN32
|
||||||
|
static int test_conc395(MYSQL *unused __attribute__((unused)))
|
||||||
|
{
|
||||||
|
MYSQL *mysql;
|
||||||
|
FILE *fp= NULL;
|
||||||
|
const char *env= getenv("MYSQL_TMP_DIR");
|
||||||
|
char cnf_file1[FN_REFLEN + 1];
|
||||||
|
|
||||||
|
if (travis_test)
|
||||||
|
return SKIP;
|
||||||
|
|
||||||
|
if (!env)
|
||||||
|
env= "/tmp";
|
||||||
|
|
||||||
|
setenv("HOME", env, 1);
|
||||||
|
|
||||||
|
snprintf(cnf_file1, FN_REFLEN, "%s%c.my.cnf", env, FN_LIBCHAR);
|
||||||
|
|
||||||
|
FAIL_IF(!access(cnf_file1, R_OK), "access");
|
||||||
|
|
||||||
|
mysql= mysql_init(NULL);
|
||||||
|
fp= fopen(cnf_file1, "w");
|
||||||
|
FAIL_IF(!fp, "fopen");
|
||||||
|
|
||||||
|
/* Mix dash and underscore */
|
||||||
|
fprintf(fp, "[client]\ndefault_character-set=latin2\n");
|
||||||
|
fclose(fp);
|
||||||
|
|
||||||
|
mysql_options(mysql, MYSQL_READ_DEFAULT_GROUP, "");
|
||||||
|
my_test_connect(mysql, hostname, username, password,
|
||||||
|
schema, 0, socketname, 0);
|
||||||
|
|
||||||
|
remove(cnf_file1);
|
||||||
|
|
||||||
|
FAIL_IF(strcmp(mysql_character_set_name(mysql), "latin2"), "expected charset latin2");
|
||||||
|
mysql_close(mysql);
|
||||||
|
return OK;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
struct my_tests_st my_tests[] = {
|
struct my_tests_st my_tests[] = {
|
||||||
{"test_conc384", test_conc384, TEST_CONNECTION_NONE, 0, NULL, NULL},
|
{"test_conc384", test_conc384, TEST_CONNECTION_NONE, 0, NULL, NULL},
|
||||||
#ifndef _WIN32
|
#ifndef _WIN32
|
||||||
{"test_mdev12965", test_mdev12965, TEST_CONNECTION_DEFAULT, 0, NULL, NULL},
|
{"test_mdev12965", test_mdev12965, TEST_CONNECTION_DEFAULT, 0, NULL, NULL},
|
||||||
|
{"test_conc395", test_conc395, TEST_CONNECTION_DEFAULT, 0, NULL, NULL},
|
||||||
#endif
|
#endif
|
||||||
{"test_wl6797", test_wl6797, TEST_CONNECTION_DEFAULT, 0, NULL, NULL},
|
{"test_wl6797", test_wl6797, TEST_CONNECTION_DEFAULT, 0, NULL, NULL},
|
||||||
{"test_server_status", test_server_status, TEST_CONNECTION_DEFAULT, 0, NULL, NULL},
|
{"test_server_status", test_server_status, TEST_CONNECTION_DEFAULT, 0, NULL, NULL},
|
||||||
|
Reference in New Issue
Block a user