107
107
the table defintion cache as soon as the last instance is removed
109
109
identifier::Table identifier(table->getShare()->getSchemaName(), table->getShare()->getTableName(), message::Table::INTERNAL);
110
const identifier::Table::Key &key(identifier.getKey());
111
TableShare *share= new TableShare(identifier.getType(),
113
const_cast<char *>(key.vector()), static_cast<uint32_t>(table->getShare()->getCacheKeySize()));
110
TableShare *share= new TableShare(identifier.getType(), identifier, identifier.getKey().vector(), static_cast<uint32_t>(table->getShare()->getCacheKeySize()));
115
112
table->cursor->close();
116
113
table->db_stat= 0; // Mark cursor closed
1674
1671
Table* Session::open_temporary_table(const identifier::Table &identifier, bool link_in_list)
1676
1673
assert(identifier.isTmp());
1679
table::Temporary *new_tmp_table= new table::Temporary(identifier.getType(),
1681
const_cast<char *>(const_cast<identifier::Table&>(identifier).getPath().c_str()),
1682
static_cast<uint32_t>(identifier.getPath().length()));
1683
if (not new_tmp_table)
1674
table::Temporary *new_tmp_table= new table::Temporary(identifier.getType(), identifier,
1675
identifier.getPath().c_str(), static_cast<uint32_t>(identifier.getPath().length()));
1687
1677
First open the share, and then open the table from the share we just opened.
1689
if (new_tmp_table->getMutableShare()->open_table_def(*static_cast<Session *>(this), identifier) ||
1690
new_tmp_table->getMutableShare()->open_table_from_share(static_cast<Session *>(this), identifier, identifier.getTableName().c_str(),
1691
(uint32_t) (HA_OPEN_KEYFILE | HA_OPEN_RNDFILE |
1679
if (new_tmp_table->getMutableShare()->open_table_def(*this, identifier) ||
1680
new_tmp_table->getMutableShare()->open_table_from_share(this, identifier, identifier.getTableName().c_str(),
1681
(uint32_t) (HA_OPEN_KEYFILE | HA_OPEN_RNDFILE | HA_GET_INDEX), ha_open_options, *new_tmp_table))
1696
1683
/* No need to lock share->mutex as this is not needed for tmp tables */
1697
1684
delete new_tmp_table->getMutableShare();
1698
1685
delete new_tmp_table;
1703
1689
new_tmp_table->reginfo.lock_type= TL_WRITE; // Simulate locked