MXS-1319: Set SQL_MODE for all internal connections
When an internal connection is created, the SQL_MODE of the connection should be set to a known default. The empty SQL_MODE allows consistent functionality for all backend server versions.
This commit is contained in:
parent
9752068444
commit
07a5cba2de
@ -476,6 +476,10 @@ add_test_executable(mxs1045.cpp mxs1045 mxs1045 LABELS maxscale REPL_BACKEND)
|
||||
# https://jira.mariadb.org/browse/MXS-1123
|
||||
add_test_executable(mxs1123.cpp mxs1123 mxs1123 LABELS maxscale REPL_BACKEND)
|
||||
|
||||
# MXS-1319: Maxscale selecting extra whitespace while loading users
|
||||
# https://jira.mariadb.org/browse/MXS-1319
|
||||
add_test_executable(mxs1319.cpp mxs1319 replication LABELS MySQLAuth REPL_BACKEND)
|
||||
|
||||
# 'namedserverfilter' test
|
||||
add_test_executable(namedserverfilter.cpp namedserverfilter namedserverfilter LABELS namedserverfilter LIGHT REPL_BACKEND)
|
||||
|
||||
|
23
maxscale-system-test/mxs1319.cpp
Normal file
23
maxscale-system-test/mxs1319.cpp
Normal file
@ -0,0 +1,23 @@
|
||||
/**
|
||||
* Check that SQL_MODE='PAD_CHAR_TO_FULL_LENGTH' doesn't break authentication
|
||||
*/
|
||||
|
||||
#include "testconnections.h"
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
TestConnections test(argc, argv);
|
||||
|
||||
test.tprintf("Changing SQL_MODE to PAD_CHAR_TO_FULL_LENGTH and restarting MaxScale");
|
||||
test.repl->connect();
|
||||
test.repl->execute_query_all_nodes("SET GLOBAL SQL_MODE='PAD_CHAR_TO_FULL_LENGTH'");
|
||||
test.restart_maxscale();
|
||||
|
||||
test.tprintf("Connecting to MaxScale and executing a query");
|
||||
test.connect_maxscale();
|
||||
test.try_query(test.conn_rwsplit, "SELECT 1");
|
||||
test.close_maxscale_connections();
|
||||
|
||||
test.repl->execute_query_all_nodes("SET GLOBAL SQL_MODE=DEFAULT");
|
||||
return test.global_result;
|
||||
}
|
@ -174,6 +174,11 @@ MYSQL *mxs_mysql_real_connect(MYSQL *con, SERVER *server, const char *user, cons
|
||||
MY_CHARSET_INFO cs_info;
|
||||
mysql_get_character_set_info(mysql, &cs_info);
|
||||
server->charset = cs_info.number;
|
||||
|
||||
if (mysql_query(mysql, "SET SQL_MODE=''"))
|
||||
{
|
||||
MXS_ERROR("Failed to change SQL_MODE: %s", mysql_error(mysql));
|
||||
}
|
||||
}
|
||||
|
||||
return mysql;
|
||||
|
Loading…
x
Reference in New Issue
Block a user