~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to storage/blackhole/ha_blackhole.cc

  • Committer: Brian Aker
  • Date: 2009-03-25 22:03:13 UTC
  • mfrom: (960.2.47 mordred)
  • Revision ID: brian@tangent.org-20090325220313-fffae098oufxiaqg
Merge of Monty

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 handlerton */
21
 
 
22
 
static handler *blackhole_create_handler(handlerton *hton,
23
 
                                         TABLE_SHARE *table,
24
 
                                         MEM_ROOT *mem_root)
 
20
#include <string>
 
21
 
 
22
using namespace std;
 
23
 
 
24
static const string engine_name("BLACKHOLE");
 
25
 
 
26
class BlackholeEngine : public StorageEngine
25
27
{
26
 
  return new (mem_root) ha_blackhole(hton, table);
27
 
}
28
 
 
 
28
public:
 
29
  BlackholeEngine(const string &name_arg) : StorageEngine(name_arg) {}
 
30
  virtual handler *create(TABLE_SHARE *table,
 
31
                          MEM_ROOT *mem_root)
 
32
  {
 
33
    return new (mem_root) ha_blackhole(this, table);
 
34
  }
 
35
};
29
36
 
30
37
/* Static declarations for shared structures */
31
38
 
39
46
** BLACKHOLE tables
40
47
*****************************************************************************/
41
48
 
42
 
ha_blackhole::ha_blackhole(handlerton *hton,
 
49
ha_blackhole::ha_blackhole(StorageEngine *engine_arg,
43
50
                           TABLE_SHARE *table_arg)
44
 
  :handler(hton, table_arg)
 
51
  :handler(engine_arg, table_arg)
45
52
{}
46
53
 
47
54
 
269
276
 
270
277
static int blackhole_init(void *p)
271
278
{
272
 
  handlerton *blackhole_hton;
273
 
  blackhole_hton= (handlerton *)p;
274
 
  blackhole_hton->state= SHOW_OPTION_YES;
275
 
  blackhole_hton->create= blackhole_create_handler;
276
 
  blackhole_hton->flags= HTON_CAN_RECREATE;
 
279
  StorageEngine **engine= static_cast<StorageEngine **>(p);
 
280
 
 
281
  BlackholeEngine *blackhole_engine= new BlackholeEngine(engine_name);
 
282
 
 
283
  blackhole_engine->state= SHOW_OPTION_YES;
 
284
  blackhole_engine->flags= HTON_CAN_RECREATE;
 
285
 
 
286
  *engine= blackhole_engine; 
277
287
 
278
288
  pthread_mutex_init(&blackhole_mutex, MY_MUTEX_INIT_FAST);
279
289
  (void) hash_init(&blackhole_open_tables, system_charset_info,32,0,0,
283
293
  return 0;
284
294
}
285
295
 
286
 
static int blackhole_fini(void *)
 
296
static int blackhole_fini(void *p)
287
297
{
 
298
  BlackholeEngine *blackhole_engine= static_cast<BlackholeEngine *>(p);
 
299
  delete blackhole_engine;
 
300
 
288
301
  hash_free(&blackhole_open_tables);
289
302
  pthread_mutex_destroy(&blackhole_mutex);
290
303