~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/handler.cc

  • Committer: Monty Taylor
  • Date: 2009-03-24 18:13:47 UTC
  • mto: (960.5.2 mordred)
  • mto: This revision was merged to the branch mainline in revision 964.
  • Revision ID: mordred@inaugust.com-20090324181347-phblgoj913uph2hs
Rename hton to engine.

Show diffs side-by-side

added added

removed removed

Lines of Context:
188
188
                              plugin_ref plugin,
189
189
                              void *path)
190
190
{
191
 
  StorageEngine *hton= plugin_data(plugin, StorageEngine *);
192
 
  if (hton->state == SHOW_OPTION_YES && hton->drop_database)
193
 
    hton->drop_database(hton, (char *)path);
 
191
  StorageEngine *engine= plugin_data(plugin, StorageEngine *);
 
192
  if (engine->state == SHOW_OPTION_YES && engine->drop_database)
 
193
    engine->drop_database(engine, (char *)path);
194
194
  return false;
195
195
}
196
196
 
204
204
static bool closecon_handlerton(Session *session, plugin_ref plugin,
205
205
                                void *)
206
206
{
207
 
  StorageEngine *hton= plugin_data(plugin, StorageEngine *);
 
207
  StorageEngine *engine= plugin_data(plugin, StorageEngine *);
208
208
  /*
209
209
    there's no need to rollback here as all transactions must
210
210
    be rolled back already
211
211
  */
212
 
  if (hton->state == SHOW_OPTION_YES && hton->close_connection &&
213
 
      session_get_ha_data(session, hton))
214
 
    hton->close_connection(hton, session);
 
212
  if (engine->state == SHOW_OPTION_YES && engine->close_connection &&
 
213
      session_get_ha_data(session, engine))
 
214
    engine->close_connection(engine, session);
215
215
  return false;
216
216
}
217
217
 
877
877
                                plugin_ref plugin,
878
878
                                void *arg)
879
879
{
880
 
  StorageEngine *hton= plugin_data(plugin, StorageEngine *);
881
 
  if (hton->state == SHOW_OPTION_YES && hton->recover)
 
880
  StorageEngine *engine= plugin_data(plugin, StorageEngine *);
 
881
  if (engine->state == SHOW_OPTION_YES && engine->recover)
882
882
  {
883
 
    hton->commit_by_xid(hton, ((struct xahton_st *)arg)->xid);
 
883
    engine->commit_by_xid(engine, ((struct xahton_st *)arg)->xid);
884
884
    ((struct xahton_st *)arg)->result= 0;
885
885
  }
886
886
  return false;
890
890
                                  plugin_ref plugin,
891
891
                                  void *arg)
892
892
{
893
 
  StorageEngine *hton= plugin_data(plugin, StorageEngine *);
894
 
  if (hton->state == SHOW_OPTION_YES && hton->recover)
 
893
  StorageEngine *engine= plugin_data(plugin, StorageEngine *);
 
894
  if (engine->state == SHOW_OPTION_YES && engine->recover)
895
895
  {
896
 
    hton->rollback_by_xid(hton, ((struct xahton_st *)arg)->xid);
 
896
    engine->rollback_by_xid(engine, ((struct xahton_st *)arg)->xid);
897
897
    ((struct xahton_st *)arg)->result= 0;
898
898
  }
899
899
  return false;
940
940
                                 plugin_ref plugin,
941
941
                                 void *arg)
942
942
{
943
 
  StorageEngine *hton= plugin_data(plugin, StorageEngine *);
 
943
  StorageEngine *engine= plugin_data(plugin, StorageEngine *);
944
944
  struct xarecover_st *info= (struct xarecover_st *) arg;
945
945
  int got;
946
946
 
947
 
  if (hton->state == SHOW_OPTION_YES && hton->recover)
 
947
  if (engine->state == SHOW_OPTION_YES && engine->recover)
948
948
  {
949
 
    while ((got= hton->recover(hton, info->list, info->len)) > 0 )
 
949
    while ((got= engine->recover(engine, info->list, info->len)) > 0 )
950
950
    {
951
951
      errmsg_printf(ERRMSG_LVL_INFO, _("Found %d prepared transaction(s) in %s"),
952
 
                            got, ha_resolve_storage_engine_name(hton));
 
952
                            got, ha_resolve_storage_engine_name(engine));
953
953
      for (int i=0; i < got; i ++)
954
954
      {
955
955
        my_xid x=info->list[i].get_my_xid();
969
969
            hash_search(info->commit_list, (unsigned char *)&x, sizeof(x)) != 0 :
970
970
            tc_heuristic_recover == TC_HEURISTIC_RECOVER_COMMIT)
971
971
        {
972
 
          hton->commit_by_xid(hton, info->list+i);
 
972
          engine->commit_by_xid(engine, info->list+i);
973
973
        }
974
974
        else
975
975
        {
976
 
          hton->rollback_by_xid(hton, info->list+i);
 
976
          engine->rollback_by_xid(engine, info->list+i);
977
977
        }
978
978
      }
979
979
      if (got < info->len)
1120
1120
static bool release_temporary_latches(Session *session, plugin_ref plugin,
1121
1121
                                      void *)
1122
1122
{
1123
 
  StorageEngine *hton= plugin_data(plugin, StorageEngine *);
 
1123
  StorageEngine *engine= plugin_data(plugin, StorageEngine *);
1124
1124
 
1125
 
  if (hton->state == SHOW_OPTION_YES && hton->release_temporary_latches)
1126
 
    hton->release_temporary_latches(hton, session);
 
1125
  if (engine->state == SHOW_OPTION_YES && engine->release_temporary_latches)
 
1126
    engine->release_temporary_latches(engine, session);
1127
1127
 
1128
1128
  return false;
1129
1129
}
1248
1248
 
1249
1249
static bool snapshot_handlerton(Session *session, plugin_ref plugin, void *arg)
1250
1250
{
1251
 
  StorageEngine *hton= plugin_data(plugin, StorageEngine *);
1252
 
  if (hton->state == SHOW_OPTION_YES &&
1253
 
      hton->start_consistent_snapshot)
 
1251
  StorageEngine *engine= plugin_data(plugin, StorageEngine *);
 
1252
  if (engine->state == SHOW_OPTION_YES &&
 
1253
      engine->start_consistent_snapshot)
1254
1254
  {
1255
 
    hton->start_consistent_snapshot(hton, session);
 
1255
    engine->start_consistent_snapshot(engine, session);
1256
1256
    *((bool *)arg)= false;
1257
1257
  }
1258
1258
  return false;
1280
1280
                             plugin_ref plugin,
1281
1281
                             void *)
1282
1282
{
1283
 
  StorageEngine *hton= plugin_data(plugin, StorageEngine *);
1284
 
  if (hton->state == SHOW_OPTION_YES && hton->flush_logs &&
1285
 
      hton->flush_logs(hton))
 
1283
  StorageEngine *engine= plugin_data(plugin, StorageEngine *);
 
1284
  if (engine->state == SHOW_OPTION_YES && engine->flush_logs &&
 
1285
      engine->flush_logs(engine))
1286
1286
    return true;
1287
1287
  return false;
1288
1288
}
2995
2995
  const char *db;
2996
2996
  const char *name;
2997
2997
  int err;
2998
 
  StorageEngine* hton;
 
2998
  StorageEngine* engine;
2999
2999
};
3000
3000
 
3001
3001
static bool table_exists_in_engine_handlerton(Session *session, plugin_ref plugin,
3002
3002
                                              void *arg)
3003
3003
{
3004
3004
  st_table_exists_in_engine_args *vargs= (st_table_exists_in_engine_args *)arg;
3005
 
  StorageEngine *hton= plugin_data(plugin, StorageEngine *);
 
3005
  StorageEngine *engine= plugin_data(plugin, StorageEngine *);
3006
3006
 
3007
3007
  int err= HA_ERR_NO_SUCH_TABLE;
3008
3008
 
3009
 
  if (hton->state == SHOW_OPTION_YES && hton->table_exists_in_engine)
3010
 
    err = hton->table_exists_in_engine(hton, session, vargs->db, vargs->name);
 
3009
  if (engine->state == SHOW_OPTION_YES && engine->table_exists_in_engine)
 
3010
    err = engine->table_exists_in_engine(engine, session, vargs->db, vargs->name);
3011
3011
 
3012
3012
  vargs->err = err;
3013
3013
  if (vargs->err == HA_ERR_TABLE_EXIST)
3014
3014
  {
3015
 
    vargs->hton= hton;
 
3015
    vargs->engine= engine;
3016
3016
    return true;
3017
3017
  }
3018
3018
 
3021
3021
 
3022
3022
int ha_table_exists_in_engine(Session* session,
3023
3023
                              const char* db, const char* name,
3024
 
                              StorageEngine **hton)
 
3024
                              StorageEngine **engine)
3025
3025
{
3026
3026
  st_table_exists_in_engine_args args= {db, name, HA_ERR_NO_SUCH_TABLE, NULL};
3027
3027
  plugin_foreach(session, table_exists_in_engine_handlerton,
3050
3050
                                 strlen(table.engine().name().c_str()) };
3051
3051
        plugin_ref plugin= ha_resolve_by_name(session, &engine_name);
3052
3052
        if(plugin)
3053
 
          args.hton= plugin_data(plugin,StorageEngine *);
 
3053
          args.engine= plugin_data(plugin,StorageEngine *);
3054
3054
      }
3055
3055
    }
3056
3056
  }
3057
3057
 
3058
 
  if(hton)
3059
 
    *hton= args.hton;
 
3058
  if(engine)
 
3059
    *engine= args.engine;
3060
3060
 
3061
3061
  return(args.err);
3062
3062
}
4089
4089
                            void *arg)
4090
4090
{
4091
4091
  List<char> *found_exts= (List<char> *) arg;
4092
 
  StorageEngine *hton= plugin_data(plugin, StorageEngine *);
 
4092
  StorageEngine *engine= plugin_data(plugin, StorageEngine *);
4093
4093
  handler *file;
4094
 
  if (hton->state == SHOW_OPTION_YES && hton->create &&
4095
 
      (file= hton->create(hton, (TABLE_SHARE*) 0, current_session->mem_root)))
 
4094
  if (engine->state == SHOW_OPTION_YES && engine->create &&
 
4095
      (file= engine->create(engine, (TABLE_SHARE*) 0, current_session->mem_root)))
4096
4096
  {
4097
4097
    List_iterator_fast<char> it(*found_exts);
4098
4098
    const char **ext, *old_ext;