1434
1433
/* Fix alias if table name changes */
1435
1434
if (strcmp(table->getAlias(), alias))
1437
uint32_t length=(uint32_t) strlen(alias)+1;
1438
table->alias= (char*) realloc((char*) table->alias, length);
1439
memcpy((void*) table->alias, alias, length);
1436
table->setAlias(alias);
1442
1439
/* These variables are also set in reopen_table() */
2230
2227
Table *Session::open_temporary_table(TableIdentifier &identifier,
2231
2228
bool link_in_list)
2235
2230
assert(identifier.isTmp());
2236
share= new TableShare(identifier.getType(),
2238
const_cast<char *>(identifier.getPath().c_str()), static_cast<uint32_t>(identifier.getPath().length()));
2241
table::Temporary *new_tmp_table= new table::Temporary;
2233
table::Temporary *new_tmp_table= new table::Temporary(identifier.getType(),
2235
const_cast<char *>(identifier.getPath().c_str()),
2236
static_cast<uint32_t>(identifier.getPath().length()));
2242
2237
if (not new_tmp_table)
2246
2241
First open the share, and then open the table from the share we just opened.
2248
if (share->open_table_def(*this, identifier) ||
2249
share->open_table_from_share(this, identifier, identifier.getTableName().c_str(),
2250
(uint32_t) (HA_OPEN_KEYFILE | HA_OPEN_RNDFILE |
2243
if (new_tmp_table->getMutableShare()->open_table_def(*this, identifier) ||
2244
new_tmp_table->getMutableShare()->open_table_from_share(this, identifier, identifier.getTableName().c_str(),
2245
(uint32_t) (HA_OPEN_KEYFILE | HA_OPEN_RNDFILE |
2255
2250
/* No need to lock share->mutex as this is not needed for tmp tables */
2251
delete new_tmp_table->getMutableShare();
2257
2252
delete new_tmp_table;