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:
@ -1396,11 +1396,11 @@ void SchemaRouterSession::query_databases()
|
|||||||
m_state &= ~INIT_UNINT;
|
m_state &= ~INIT_UNINT;
|
||||||
|
|
||||||
GWBUF *buffer = modutil_create_query
|
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 "
|
"LEFT JOIN information_schema.tables AS t ON s.schema_name = t.table_schema "
|
||||||
"WHERE t.table_name IS NULL "
|
"WHERE t.table_name IS NULL "
|
||||||
"UNION "
|
"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');");
|
"WHERE table_schema NOT IN ('information_schema', 'performance_schema', 'mysql');");
|
||||||
gwbuf_set_type(buffer, GWBUF_TYPE_COLLECT_RESULT);
|
gwbuf_set_type(buffer, GWBUF_TYPE_COLLECT_RESULT);
|
||||||
|
|
||||||
|
|||||||
@ -28,21 +28,17 @@ Shard::~Shard()
|
|||||||
|
|
||||||
bool Shard::add_location(std::string db, SERVER* target)
|
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;
|
return m_map.insert(std::make_pair(db, target)).second;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Shard::replace_location(std::string db, SERVER* target)
|
void Shard::replace_location(std::string db, SERVER* target)
|
||||||
{
|
{
|
||||||
std::transform(db.begin(), db.end(), db.begin(), ::tolower);
|
|
||||||
m_map[db] = target;
|
m_map[db] = target;
|
||||||
}
|
}
|
||||||
|
|
||||||
SERVER* Shard::get_location(std::string table)
|
SERVER* Shard::get_location(std::string table)
|
||||||
{
|
{
|
||||||
SERVER* rval = NULL;
|
SERVER* rval = NULL;
|
||||||
std::transform(table.begin(), table.end(), table.begin(), ::tolower);
|
|
||||||
|
|
||||||
if (table.find(".") == std::string::npos)
|
if (table.find(".") == std::string::npos)
|
||||||
{
|
{
|
||||||
for (ServerMap::iterator it = m_map.begin(); it != m_map.end(); it++)
|
for (ServerMap::iterator it = m_map.begin(); it != m_map.end(); it++)
|
||||||
|
|||||||
Reference in New Issue
Block a user