MXS-1820 Show original case in schemarouter SHOW DATABASES queries

Original case is now used in schemarouter this means that database and
table names are now case sensitive as well.
This commit is contained in:
Marko
2018-07-05 09:50:19 +03:00
parent 5b9da16518
commit 0fe5eb2743
2 changed files with 2 additions and 6 deletions

View File

@ -1396,11 +1396,11 @@ void SchemaRouterSession::query_databases()
m_state &= ~INIT_UNINT;
GWBUF *buffer = modutil_create_query
("SELECT LOWER(schema_name) FROM information_schema.schemata AS s "
("SELECT schema_name FROM information_schema.schemata AS s "
"LEFT JOIN information_schema.tables AS t ON s.schema_name = t.table_schema "
"WHERE t.table_name IS NULL "
"UNION "
"SELECT LOWER(CONCAT(table_schema, '.', table_name)) FROM information_schema.tables "
"SELECT CONCAT (table_schema, '.', table_name) FROM information_schema.tables "
"WHERE table_schema NOT IN ('information_schema', 'performance_schema', 'mysql');");
gwbuf_set_type(buffer, GWBUF_TYPE_COLLECT_RESULT);

View File

@ -28,21 +28,17 @@ Shard::~Shard()
bool Shard::add_location(std::string db, SERVER* target)
{
std::transform(db.begin(), db.end(), db.begin(), ::tolower);
return m_map.insert(std::make_pair(db, target)).second;
}
void Shard::replace_location(std::string db, SERVER* target)
{
std::transform(db.begin(), db.end(), db.begin(), ::tolower);
m_map[db] = target;
}
SERVER* Shard::get_location(std::string table)
{
SERVER* rval = NULL;
std::transform(table.begin(), table.end(), table.begin(), ::tolower);
if (table.find(".") == std::string::npos)
{
for (ServerMap::iterator it = m_map.begin(); it != m_map.end(); it++)