Skip to content

Commit

Permalink
Add test for sql_mode with spaces
Browse files Browse the repository at this point in the history
  • Loading branch information
javsanpar committed Feb 21, 2023
1 parent 8e9f297 commit c33b980
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions test/tap/tests/generate_set_session_csv.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
#include <unordered_map>
#include <stdlib.h>
#include <string.h>
#include <algorithm>

std::vector<std::string> bool_values = {
"0", "1",
Expand Down Expand Up @@ -263,6 +264,7 @@ int main() {
vars["sql_mode"]->add(std::vector<std::string> {"NO_ENGINE_SUBSTITUTION", "'NO_ENGINE_SUBSTITUTION'", "\"NO_ENGINE_SUBSTITUTION\""});
vars["sql_mode"]->add(std::vector<std::string> {"concat(@@sql_mode,',STRICT_TRANS_TABLES')"});
vars["sql_mode"]->add(std::vector<std::string> {"CONCAT(CONCAT(@@sql_mode, ',STRICT_ALL_TABLES'), ',NO_AUTO_VALUE_ON_ZERO')"});
vars["sql_mode"]->add(std::vector<std::string> {"''", "\"\"", "' '", "\" \"", "' '", "\" \"",});


vars["default_storage_engine"] = new variable("default_storage_engine", true, false, false);
Expand Down Expand Up @@ -326,6 +328,10 @@ int main() {
query += s;
}
j += "\"" + v->name + "\":\"";
if (v->name == "sql_mode")
// Remove all whitespaces
// see https://github.com/sysown/proxysql/issues/3863
s.erase(std::remove(s.begin(), s.end(), ' '), s.end());
add_value_j(j,s,v);
if (v->name == "max_join_size") {
// see https://dev.mysql.com/doc/refman/5.7/en/server-system-variables.html#sysvar_max_join_size
Expand Down

0 comments on commit c33b980

Please sign in to comment.