Refactor TABLE_CREATE allocation

Using std::string for names removes the need to handle memory
allocation. Moving the column attributes into a class of its own greatly
simplifies the creation of the TABLE_CREATE as well as modifications that
are done to it.
This commit is contained in:
Markus Mäkelä
2018-05-23 00:30:39 +03:00
parent d5760f4301
commit f8ceb875a0
4 changed files with 123 additions and 289 deletions

View File

@ -933,7 +933,7 @@ bool is_alter_table_statement(Avro *router, char* ptr, size_t len)
bool save_and_replace_table_create(Avro *router, TABLE_CREATE *created)
{
char table_ident[MYSQL_TABLE_MAXLEN + MYSQL_DATABASE_MAXLEN + 2];
snprintf(table_ident, sizeof(table_ident), "%s.%s", created->database, created->table);
snprintf(table_ident, sizeof(table_ident), "%s.%s", created->database.c_str(), created->table.c_str());
auto it = router->created_tables.find(table_ident);
@ -951,7 +951,7 @@ bool save_and_replace_table_create(Avro *router, TABLE_CREATE *created)
}
router->created_tables[table_ident] = STableCreate(created);
ss_dassert(created->columns > 0);
ss_dassert(created->columns.size() > 0);
return true;
}