MXS-1113 Add support for prepared statements in schemarouter

Implement handling of the text protocol part of the prepared statements
in schemarouter.
This commit is contained in:
Marko
2018-07-29 14:21:55 +03:00
parent bfe5bcd7a7
commit adbc3a6749
4 changed files with 80 additions and 3 deletions

View File

@ -31,6 +31,11 @@ bool Shard::add_location(std::string db, SERVER* target)
return m_map.insert(std::make_pair(db, target)).second;
}
void Shard::add_statement(std::string stmt, SERVER* target)
{
stmt_map[stmt] = target;
}
void Shard::replace_location(std::string db, SERVER* target)
{
m_map[db] = target;
@ -78,6 +83,22 @@ SERVER* Shard::get_location(std::string table)
return rval;
}
SERVER* Shard::get_statement(std::string stmt)
{
SERVER* rval = NULL;
ServerMap::iterator iter = stmt_map.find(stmt);
if(iter != stmt_map.end())
{
rval = iter->second;
}
return rval;
}
bool Shard::remove_statement(std::string stmt)
{
return stmt_map.erase(stmt);
}
bool Shard::stale(double max_interval) const
{
time_t now = time(NULL);