~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to plugin/blackhole/ha_blackhole.cc

  • Committer: Brian Aker
  • Date: 2010-10-22 23:33:58 UTC
  • mfrom: (1869.1.7 refactor)
  • Revision ID: brian@tangent.org-20101022233358-kmtrpm1yvmmyaame
Merge in overhaul to how cursor and table are handled. Cursor now only knows
about table, and will always have a table and engine reference.

This cleans up a number of ownership issues, the biggest being that it now
creates the space needed for the next big refactor in locks.

Show diffs side-by-side

added added

removed removed

Lines of Context:
68
68
    pthread_mutex_destroy(&blackhole_mutex);
69
69
  }
70
70
 
71
 
  virtual Cursor *create(TableShare &table)
 
71
  virtual Cursor *create(Table &table)
72
72
  {
73
73
    return new ha_blackhole(*this, table);
74
74
  }
191
191
*****************************************************************************/
192
192
 
193
193
ha_blackhole::ha_blackhole(drizzled::plugin::StorageEngine &engine_arg,
194
 
                           TableShare &table_arg)
 
194
                           Table &table_arg)
195
195
  :Cursor(engine_arg, table_arg), share(NULL)
196
196
{ }
197
197
 
318
318
 
319
319
int ha_blackhole::doInsertRecord(unsigned char *)
320
320
{
321
 
  return(table->next_number_field ? update_auto_increment() : 0);
 
321
  return(getTable()->next_number_field ? update_auto_increment() : 0);
322
322
}
323
323
 
324
324
int ha_blackhole::doStartTableScan(bool)
404
404
{
405
405
  pthread_mutex_lock(&blackhole_mutex);
406
406
 
407
 
  BlackholeEngine *a_engine= static_cast<BlackholeEngine *>(engine);
 
407
  BlackholeEngine *a_engine= static_cast<BlackholeEngine *>(getEngine());
408
408
  share= a_engine->findOpenTable(table_name);
409
409
 
410
410
  if (share == NULL)
429
429
  pthread_mutex_lock(&blackhole_mutex);
430
430
  if (!--share->use_count)
431
431
  {
432
 
    BlackholeEngine *a_engine= static_cast<BlackholeEngine *>(engine);
 
432
    BlackholeEngine *a_engine= static_cast<BlackholeEngine *>(getEngine());
433
433
    a_engine->deleteOpenTable(share->table_name);
434
434
    delete share;
435
435
  }