Skip to content

Commit

Permalink
Move proxysqlTap_find_charset_collate out of utils.cpp
Browse files Browse the repository at this point in the history
proxysqlTap_find_charset_collate() has been moved out of utils.cpp to allow
statically linking
  • Loading branch information
renecannao committed Aug 18, 2023
1 parent fbdb1c6 commit c2d6324
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 11 deletions.
11 changes: 0 additions & 11 deletions test/tap/tap/utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -595,17 +595,6 @@ int wait_for_replication(
return result;
}

MARIADB_CHARSET_INFO * proxysqlTap_find_charset_collate(const char *collatename) {
MARIADB_CHARSET_INFO *c = (MARIADB_CHARSET_INFO *)mariadb_compiled_charsets;
do {
if (!strcasecmp(c->name, collatename)) {
return c;
}
++c;
} while (c[0].nr != 0);
return NULL;
}

int create_proxysql_user(
MYSQL* proxysql_admin,
const string& user,
Expand Down
2 changes: 2 additions & 0 deletions test/tap/tap/utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -179,11 +179,13 @@ int wait_for_replication(
* NOTE: This is a duplicate of 'proxysql_find_charset_collate' in 'MySQL_Variables.h'. Including
* 'MySQL_Variables' is not a easy task due to its interdependeces with other ProxySQL modules.
*/
/*
#ifdef LIBMYSQL_HELPER
MY_CHARSET_INFO * proxysqlTap_find_charset_collate(const char *collatename);
#else
MARIADB_CHARSET_INFO * proxysqlTap_find_charset_collate(const char *collatename);
#endif
*/
/**
* @brief Creates the new supplied user in ProxySQL with the provided
* attributes.
Expand Down
11 changes: 11 additions & 0 deletions test/tap/tests/test_com_reset_connection_com_change_user-t.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,17 @@ const std::vector<std::string> tracked_variables {
"wsrep_sync_wait"
};

MARIADB_CHARSET_INFO * proxysqlTap_find_charset_collate(const char *collatename) {
MARIADB_CHARSET_INFO *c = (MARIADB_CHARSET_INFO *)mariadb_compiled_charsets;
do {
if (!strcasecmp(c->name, collatename)) {
return c;
}
++c;
} while (c[0].nr != 0);
return NULL;
}

void variable_rows_to_json(MYSQL_RES *result, json& j) {
if(!result) return;
MYSQL_ROW row;
Expand Down
11 changes: 11 additions & 0 deletions test/tap/tests/test_set_collation-t.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,17 @@
#define N_ITERATION_2 2
#define N_ITERATION_3 3

MARIADB_CHARSET_INFO * proxysqlTap_find_charset_collate(const char *collatename) {
MARIADB_CHARSET_INFO *c = (MARIADB_CHARSET_INFO *)mariadb_compiled_charsets;
do {
if (!strcasecmp(c->name, collatename)) {
return c;
}
++c;
} while (c[0].nr != 0);
return NULL;
}

/**
* @brief Creates a different MYSQL connection for each supplied collation. Logs in case of a
* failure creating a connection.
Expand Down

0 comments on commit c2d6324

Please sign in to comment.