~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/sql_base.cc

  • Committer: Mark Atwood
  • Date: 2011-08-04 16:21:21 UTC
  • mfrom: (2318.9.14 refactor3)
  • Revision ID: me@mark.atwood.name-20110804162121-6b9ay1b1de3yfgvl
mergeĀ lp:~olafvdspek/drizzle/refactor3

Show diffs side-by-side

added added

removed removed

Lines of Context:
107
107
    the table defintion cache as soon as the last instance is removed
108
108
  */
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(),
112
 
                                    identifier,
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()));
114
111
 
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)
1675
1672
{
1676
1673
  assert(identifier.isTmp());
1677
 
 
1678
 
 
1679
 
  table::Temporary *new_tmp_table= new table::Temporary(identifier.getType(),
1680
 
                                                        identifier,
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)
1684
 
    return NULL;
1685
 
 
 
1674
  table::Temporary *new_tmp_table= new table::Temporary(identifier.getType(), identifier, 
 
1675
    identifier.getPath().c_str(), static_cast<uint32_t>(identifier.getPath().length()));
1686
1676
  /*
1687
1677
    First open the share, and then open the table from the share we just opened.
1688
1678
  */
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 |
1692
 
                                                                          HA_GET_INDEX),
1693
 
                                                              ha_open_options,
1694
 
                                                              *new_tmp_table))
 
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))
1695
1682
  {
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;
1699
 
 
1700
 
    return 0;
 
1686
    return NULL;
1701
1687
  }
1702
1688
 
1703
1689
  new_tmp_table->reginfo.lock_type= TL_WRITE;    // Simulate locked