~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/sql_base.cc

  • Committer: Brian Aker
  • Date: 2010-10-22 00:26:57 UTC
  • mfrom: (1864.4.6 refactor)
  • Revision ID: brian@tangent.org-20101022002657-f5d3isth30d0urop
Merge of refactor2 tree

Show diffs side-by-side

added added

removed removed

Lines of Context:
266
266
  table->db_stat= 0;                            // Mark cursor closed
267
267
  TableShare::release(table->getMutableShare());
268
268
  table->setShare(share);
269
 
  table->cursor->change_table_ptr(table, table->getMutableShare());
270
269
}
271
270
 
272
271
 
1434
1433
  /* Fix alias if table name changes */
1435
1434
  if (strcmp(table->getAlias(), alias))
1436
1435
  {
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);
1440
1437
  }
1441
1438
 
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)
2232
2229
{
2233
 
  TableShare *share;
2234
 
 
2235
2230
  assert(identifier.isTmp());
2236
 
  share= new TableShare(identifier.getType(),
2237
 
                        identifier,
2238
 
                        const_cast<char *>(identifier.getPath().c_str()), static_cast<uint32_t>(identifier.getPath().length()));
2239
 
 
2240
 
 
2241
 
  table::Temporary *new_tmp_table= new table::Temporary;
 
2231
 
 
2232
 
 
2233
  table::Temporary *new_tmp_table= new table::Temporary(identifier.getType(),
 
2234
                                                        identifier,
 
2235
                                                        const_cast<char *>(identifier.getPath().c_str()),
 
2236
                                                        static_cast<uint32_t>(identifier.getPath().length()));
2242
2237
  if (not new_tmp_table)
2243
2238
    return NULL;
2244
2239
 
2245
2240
  /*
2246
2241
    First open the share, and then open the table from the share we just opened.
2247
2242
  */
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 |
2251
 
                                        HA_GET_INDEX),
2252
 
                            ha_open_options,
2253
 
                            *new_tmp_table))
 
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 |
 
2246
                                                                          HA_GET_INDEX),
 
2247
                                                              ha_open_options,
 
2248
                                                              *new_tmp_table))
2254
2249
  {
2255
2250
    /* No need to lock share->mutex as this is not needed for tmp tables */
2256
 
    delete share;
 
2251
    delete new_tmp_table->getMutableShare();
2257
2252
    delete new_tmp_table;
2258
2253
 
2259
2254
    return 0;