~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to storage/csv/ha_tina.cc

Merged in plugin-registration.  handlerton now == StorageEngine.

Show diffs side-by-side

added added

removed removed

Lines of Context:
75
75
/* Stuff for shares */
76
76
pthread_mutex_t tina_mutex;
77
77
static HASH tina_open_tables;
78
 
static handler *tina_create_handler(handlerton *hton,
79
 
                                    TABLE_SHARE *table,
80
 
                                    MEM_ROOT *mem_root);
81
 
 
82
78
 
83
79
/*****************************************************************************
84
80
 ** TINA tables
102
98
  return (unsigned char*) share->table_name;
103
99
}
104
100
 
 
101
class Tina : public StorageEngine
 
102
{
 
103
  virtual handler *create(TABLE_SHARE *table,
 
104
                          MEM_ROOT *mem_root)
 
105
  {
 
106
    return new (mem_root) ha_tina(this, table);
 
107
  }
 
108
};
 
109
 
105
110
static int tina_init_func(void *p)
106
111
{
107
 
  handlerton *tina_hton;
108
 
 
109
 
  tina_hton= (handlerton *)p;
 
112
  StorageEngine **engine= static_cast<StorageEngine **>(p);
 
113
 
 
114
  Tina *tina_engine= new Tina();
 
115
 
110
116
  pthread_mutex_init(&tina_mutex,MY_MUTEX_INIT_FAST);
111
117
  (void) hash_init(&tina_open_tables,system_charset_info,32,0,0,
112
118
                   (hash_get_key) tina_get_key,0,0);
113
 
  tina_hton->state= SHOW_OPTION_YES;
114
 
  tina_hton->create= tina_create_handler;
115
 
  tina_hton->flags= (HTON_CAN_RECREATE | HTON_SUPPORT_LOG_TABLES |
 
119
  tina_engine->state= SHOW_OPTION_YES;
 
120
  tina_engine->flags= (HTON_CAN_RECREATE | HTON_SUPPORT_LOG_TABLES |
116
121
                     HTON_NO_PARTITION);
 
122
  *engine= tina_engine;
117
123
  return 0;
118
124
}
119
125
 
120
 
static int tina_done_func(void *)
 
126
static int tina_done_func(void *p)
121
127
{
 
128
  Tina *tina_engine= static_cast<Tina *>(p);
 
129
  delete tina_engine;
 
130
 
122
131
  hash_free(&tina_open_tables);
123
132
  pthread_mutex_destroy(&tina_mutex);
124
133
 
416
425
}
417
426
 
418
427
 
419
 
static handler *tina_create_handler(handlerton *hton,
420
 
                                    TABLE_SHARE *table,
421
 
                                    MEM_ROOT *mem_root)
422
 
{
423
 
  return new (mem_root) ha_tina(hton, table);
424
 
}
425
 
 
426
 
 
427
 
ha_tina::ha_tina(handlerton *hton, TABLE_SHARE *table_arg)
428
 
  :handler(hton, table_arg),
 
428
 
 
429
ha_tina::ha_tina(StorageEngine *engine_arg, TABLE_SHARE *table_arg)
 
430
  :handler(engine_arg, table_arg),
429
431
  /*
430
432
    These definitions are found in handler.h
431
433
    They are not probably completely right.