~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to storage/blackhole/ha_blackhole.cc

  • Committer: Monty Taylor
  • Date: 2009-03-24 21:26:44 UTC
  • mto: (960.5.2 mordred)
  • mto: This revision was merged to the branch mainline in revision 964.
  • Revision ID: mordred@inaugust.com-20090324212644-zw63siqoj6hxd8ur
Updated blackhole.

Show diffs side-by-side

added added

removed removed

Lines of Context:
17
17
#include <drizzled/table.h>
18
18
#include "ha_blackhole.h"
19
19
 
20
 
/* Static declarations for StorageEngine */
21
 
 
22
 
static handler *blackhole_create_handler(StorageEngine *engine,
23
 
                                         TABLE_SHARE *table,
24
 
                                         MEM_ROOT *mem_root)
 
20
class BlackholeEngine : public StorageEngine
25
21
{
26
 
  return new (mem_root) ha_blackhole(engine, table);
27
 
}
28
 
 
 
22
  virtual handler *create(StorageEngine *engine,
 
23
                          TABLE_SHARE *table,
 
24
                          MEM_ROOT *mem_root)
 
25
  {
 
26
    return new (mem_root) ha_blackhole(engine, table);
 
27
  }
 
28
};
29
29
 
30
30
/* Static declarations for shared structures */
31
31
 
269
269
 
270
270
static int blackhole_init(void *p)
271
271
{
272
 
  StorageEngine *blackhole_engine;
273
 
  blackhole_engine= (StorageEngine *)p;
 
272
  StorageEngine **engine= static_cast<StorageEngine **>(p);
 
273
 
 
274
  BlackholeEngine *blackhole_engine= new BlackholeEngine();
 
275
 
274
276
  blackhole_engine->state= SHOW_OPTION_YES;
275
 
  blackhole_engine->create= blackhole_create_handler;
276
277
  blackhole_engine->flags= HTON_CAN_RECREATE;
277
278
 
 
279
  *engine= blackhole_engine; 
 
280
 
278
281
  pthread_mutex_init(&blackhole_mutex, MY_MUTEX_INIT_FAST);
279
282
  (void) hash_init(&blackhole_open_tables, system_charset_info,32,0,0,
280
283
                   (hash_get_key) blackhole_get_key,
283
286
  return 0;
284
287
}
285
288
 
286
 
static int blackhole_fini(void *)
 
289
static int blackhole_fini(void *p)
287
290
{
 
291
  BlackholeEngine *blackhole_engine= static_cast<BlackholeEngine *>(p);
 
292
  delete blackhole_engine;
 
293
 
288
294
  hash_free(&blackhole_open_tables);
289
295
  pthread_mutex_destroy(&blackhole_mutex);
290
296