diff options
author | Sergei Golubchik <sergii@pisem.net> | 2013-06-15 19:09:47 +0200 |
---|---|---|
committer | Sergei Golubchik <sergii@pisem.net> | 2013-06-15 19:09:47 +0200 |
commit | 8bc6aed49186b1f6020ecea29a9b0def5803d370 (patch) | |
tree | c92e63f753d62d928184a84455c480a6fa96c07f /sql | |
parent | 935817e985d15ce0d4f339ee7006ee891df11489 (diff) | |
download | mariadb-git-8bc6aed49186b1f6020ecea29a9b0def5803d370.tar.gz |
plugin_hton helper
Diffstat (limited to 'sql')
-rw-r--r-- | sql/handler.cc | 40 | ||||
-rw-r--r-- | sql/handler.h | 5 | ||||
-rw-r--r-- | sql/mysqld.cc | 2 | ||||
-rw-r--r-- | sql/sql_show.cc | 4 | ||||
-rw-r--r-- | sql/sql_table.cc | 2 | ||||
-rw-r--r-- | sql/sql_yacc.yy | 4 | ||||
-rw-r--r-- | sql/table.cc | 4 | ||||
-rw-r--r-- | sql/table.h | 3 |
8 files changed, 34 insertions, 30 deletions
diff --git a/sql/handler.cc b/sql/handler.cc index 7a6edc967ba..069e1369df3 100644 --- a/sql/handler.cc +++ b/sql/handler.cc @@ -124,7 +124,7 @@ handlerton *ha_default_handlerton(THD *thd) { plugin_ref plugin= ha_default_plugin(thd); DBUG_ASSERT(plugin); - handlerton *hton= plugin_data(plugin, handlerton*); + handlerton *hton= plugin_hton(plugin); DBUG_ASSERT(hton); return hton; } @@ -155,7 +155,7 @@ redo: if ((plugin= my_plugin_lock_by_name(thd, name, MYSQL_STORAGE_ENGINE_PLUGIN))) { - handlerton *hton= plugin_data(plugin, handlerton *); + handlerton *hton= plugin_hton(plugin); if (hton && !(hton->flags & HTON_NOT_USER_SELECTABLE)) return plugin; @@ -203,7 +203,7 @@ handlerton *ha_resolve_by_legacy_type(THD *thd, enum legacy_db_type db_type) default: if (db_type > DB_TYPE_UNKNOWN && db_type < DB_TYPE_DEFAULT && (plugin= ha_lock_engine(thd, installed_htons[db_type]))) - return plugin_data(plugin, handlerton*); + return plugin_hton(plugin); /* fall through */ case DB_TYPE_UNKNOWN: return NULL; @@ -662,7 +662,7 @@ int ha_end() static my_bool dropdb_handlerton(THD *unused1, plugin_ref plugin, void *path) { - handlerton *hton= plugin_data(plugin, handlerton *); + handlerton *hton= plugin_hton(plugin); if (hton->state == SHOW_OPTION_YES && hton->drop_database) hton->drop_database(hton, (char *)path); return FALSE; @@ -678,7 +678,7 @@ void ha_drop_database(char* path) static my_bool checkpoint_state_handlerton(THD *unused1, plugin_ref plugin, void *disable) { - handlerton *hton= plugin_data(plugin, handlerton *); + handlerton *hton= plugin_hton(plugin); if (hton->state == SHOW_OPTION_YES && hton->checkpoint_state) hton->checkpoint_state(hton, (int) *(bool*) disable); return FALSE; @@ -700,7 +700,7 @@ static my_bool commit_checkpoint_request_handlerton(THD *unused1, plugin_ref plu void *data) { st_commit_checkpoint_request *st= (st_commit_checkpoint_request *)data; - handlerton *hton= plugin_data(plugin, handlerton *); + handlerton *hton= plugin_hton(plugin); if (hton->state == SHOW_OPTION_YES && hton->commit_checkpoint_request) { void *cookie= st->cookie; @@ -732,7 +732,7 @@ ha_commit_checkpoint_request(void *cookie, void (*pre_hook)(void *)) static my_bool closecon_handlerton(THD *thd, plugin_ref plugin, void *unused) { - handlerton *hton= plugin_data(plugin, handlerton *); + handlerton *hton= plugin_hton(plugin); /* there's no need to rollback here as all transactions must be rolled back already @@ -759,7 +759,7 @@ void ha_close_connection(THD* thd) static my_bool kill_handlerton(THD *thd, plugin_ref plugin, void *level) { - handlerton *hton= plugin_data(plugin, handlerton *); + handlerton *hton= plugin_hton(plugin); if (hton->state == SHOW_OPTION_YES && hton->kill_query && thd_get_ha_data(thd, hton)) @@ -1604,7 +1604,7 @@ struct xahton_st { static my_bool xacommit_handlerton(THD *unused1, plugin_ref plugin, void *arg) { - handlerton *hton= plugin_data(plugin, handlerton *); + handlerton *hton= plugin_hton(plugin); if (hton->state == SHOW_OPTION_YES && hton->recover) { hton->commit_by_xid(hton, ((struct xahton_st *)arg)->xid); @@ -1616,7 +1616,7 @@ static my_bool xacommit_handlerton(THD *unused1, plugin_ref plugin, static my_bool xarollback_handlerton(THD *unused1, plugin_ref plugin, void *arg) { - handlerton *hton= plugin_data(plugin, handlerton *); + handlerton *hton= plugin_hton(plugin); if (hton->state == SHOW_OPTION_YES && hton->recover) { hton->rollback_by_xid(hton, ((struct xahton_st *)arg)->xid); @@ -1722,7 +1722,7 @@ struct xarecover_st static my_bool xarecover_handlerton(THD *unused, plugin_ref plugin, void *arg) { - handlerton *hton= plugin_data(plugin, handlerton *); + handlerton *hton= plugin_hton(plugin); struct xarecover_st *info= (struct xarecover_st *) arg; int got; @@ -2051,7 +2051,7 @@ int ha_release_savepoint(THD *thd, SAVEPOINT *sv) static my_bool snapshot_handlerton(THD *thd, plugin_ref plugin, void *arg) { - handlerton *hton= plugin_data(plugin, handlerton *); + handlerton *hton= plugin_hton(plugin); if (hton->state == SHOW_OPTION_YES && hton->start_consistent_snapshot) { @@ -2091,7 +2091,7 @@ int ha_start_consistent_snapshot(THD *thd) static my_bool flush_handlerton(THD *thd, plugin_ref plugin, void *arg) { - handlerton *hton= plugin_data(plugin, handlerton *); + handlerton *hton= plugin_hton(plugin); if (hton->state == SHOW_OPTION_YES && hton->flush_logs && hton->flush_logs(hton)) return TRUE; @@ -4327,7 +4327,7 @@ static my_bool discover_handlerton(THD *thd, plugin_ref plugin, void *arg) { TABLE_SHARE *share= (TABLE_SHARE *)arg; - handlerton *hton= plugin_data(plugin, handlerton *); + handlerton *hton= plugin_hton(plugin); if (hton->state == SHOW_OPTION_YES && hton->discover_table) { share->db_plugin= plugin; @@ -4390,7 +4390,7 @@ static my_bool discover_existence(THD *thd, plugin_ref plugin, void *arg) { st_discover_existence_args *args= (st_discover_existence_args*)arg; - handlerton *ht= plugin_data(plugin, handlerton *); + handlerton *ht= plugin_hton(plugin); if (ht->state != SHOW_OPTION_YES || !ht->discover_table_existence) return FALSE; @@ -4614,7 +4614,7 @@ static my_bool discover_names(THD *thd, plugin_ref plugin, void *arg) { st_discover_names_args *args= (st_discover_names_args *)arg; - handlerton *ht= plugin_data(plugin, handlerton *); + handlerton *ht= plugin_hton(plugin); if (ht->state == SHOW_OPTION_YES && ht->discover_table_names) { @@ -4691,7 +4691,7 @@ struct binlog_func_st static my_bool binlog_func_list(THD *thd, plugin_ref plugin, void *arg) { hton_list_st *hton_list= (hton_list_st *)arg; - handlerton *hton= plugin_data(plugin, handlerton *); + handlerton *hton= plugin_hton(plugin); if (hton->state == SHOW_OPTION_YES && hton->binlog_func) { uint sz= hton_list->sz; @@ -4781,7 +4781,7 @@ static my_bool binlog_log_query_handlerton(THD *thd, plugin_ref plugin, void *args) { - return binlog_log_query_handlerton2(thd, plugin_data(plugin, handlerton *), args); + return binlog_log_query_handlerton2(thd, plugin_hton(plugin), args); } void ha_binlog_log_query(THD *thd, handlerton *hton, @@ -5012,7 +5012,7 @@ static my_bool exts_handlerton(THD *unused, plugin_ref plugin, void *arg) { List<char> *found_exts= (List<char> *) arg; - handlerton *hton= plugin_data(plugin, handlerton *); + handlerton *hton= plugin_hton(plugin); List_iterator_fast<char> it(*found_exts); const char **ext, *old_ext; @@ -5081,7 +5081,7 @@ static my_bool showstat_handlerton(THD *thd, plugin_ref plugin, void *arg) { enum ha_stat_type stat= *(enum ha_stat_type *) arg; - handlerton *hton= plugin_data(plugin, handlerton *); + handlerton *hton= plugin_hton(plugin); if (hton->state == SHOW_OPTION_YES && hton->show_status && hton->show_status(hton, thd, stat_print, stat)) return TRUE; diff --git a/sql/handler.h b/sql/handler.h index bfc83a52582..5232900a293 100644 --- a/sql/handler.h +++ b/sql/handler.h @@ -1210,6 +1210,11 @@ static inline LEX_STRING *hton_name(const handlerton *hton) return &(hton2plugin[hton->slot]->name); } +static inline handlerton *plugin_hton(plugin_ref plugin) +{ + return plugin_data(plugin, handlerton *); +} + static inline sys_var *find_hton_sysvar(handlerton *hton, st_mysql_sys_var *var) { return find_plugin_sysvar(hton2plugin[hton->slot], var); diff --git a/sql/mysqld.cc b/sql/mysqld.cc index d5af1634a8a..2302a67b838 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -4582,7 +4582,7 @@ a file name for --log-bin-index option", opt_binlog_index_name); plugin_ref plugin; handlerton *hton; if ((plugin= ha_resolve_by_name(0, &name))) - hton= plugin_data(plugin, handlerton*); + hton= plugin_hton(plugin); else { sql_print_error("Unknown/unsupported storage engine: %s", diff --git a/sql/sql_show.cc b/sql/sql_show.cc index b7b2574c31d..e0b3de07305 100644 --- a/sql/sql_show.cc +++ b/sql/sql_show.cc @@ -5395,7 +5395,7 @@ static my_bool iter_schema_engines(THD *thd, plugin_ref plugin, void *ptable) { TABLE *table= (TABLE *) ptable; - handlerton *hton= plugin_data(plugin, handlerton *); + handlerton *hton= plugin_hton(plugin); const char *wild= thd->lex->wild ? thd->lex->wild->ptr() : NullS; CHARSET_INFO *scs= system_charset_info; handlerton *default_type= ha_default_handlerton(thd); @@ -8052,7 +8052,7 @@ static my_bool run_hton_fill_schema_table(THD *thd, plugin_ref plugin, { struct run_hton_fill_schema_table_args *args= (run_hton_fill_schema_table_args *) arg; - handlerton *hton= plugin_data(plugin, handlerton *); + handlerton *hton= plugin_hton(plugin); if (hton->fill_is_table && hton->state == SHOW_OPTION_YES) hton->fill_is_table(hton, thd, args->tables, args->cond, get_schema_table_idx(args->tables->schema_table)); diff --git a/sql/sql_table.cc b/sql/sql_table.cc index b16264d1145..67bc7d0cb12 100644 --- a/sql/sql_table.cc +++ b/sql/sql_table.cc @@ -950,7 +950,7 @@ static int execute_ddl_log_action(THD *thd, DDL_LOG_ENTRY *ddl_log_entry) my_error(ER_UNKNOWN_STORAGE_ENGINE, MYF(0), ddl_log_entry->handler_name); goto error; } - hton= plugin_data(plugin, handlerton*); + hton= plugin_hton(plugin); file= get_new_handler((TABLE_SHARE*)0, &mem_root, hton); if (!file) { diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy index 2634470d916..8e22950aa72 100644 --- a/sql/sql_yacc.yy +++ b/sql/sql_yacc.yy @@ -5376,7 +5376,7 @@ storage_engines: plugin_ref plugin= ha_resolve_by_name(YYTHD, &$1); if (plugin) - $$= plugin_data(plugin, handlerton*); + $$= plugin_hton(plugin); else { if (YYTHD->variables.sql_mode & MODE_NO_ENGINE_SUBSTITUTION) @@ -5398,7 +5398,7 @@ known_storage_engines: { plugin_ref plugin; if ((plugin= ha_resolve_by_name(YYTHD, &$1))) - $$= plugin_data(plugin, handlerton*); + $$= plugin_hton(plugin); else { my_error(ER_UNKNOWN_STORAGE_ENGINE, MYF(0), $1.str); diff --git a/sql/table.cc b/sql/table.cc index 08903db93e1..01b7ae3445e 100644 --- a/sql/table.cc +++ b/sql/table.cc @@ -1333,7 +1333,7 @@ int TABLE_SHARE::init_from_binary_frm_image(THD *thd, bool write, /* Allocate handler */ if (!(handler_file= get_new_handler(share, thd->mem_root, - plugin_data(se_plugin, handlerton *)))) + plugin_hton(se_plugin)))) goto err; record= share->default_values-1; /* Fieldstart = 1 */ @@ -2081,7 +2081,7 @@ int TABLE_SHARE::init_from_sql_statement_string(THD *thd, bool write, goto ret; } - thd->lex->create_info.db_type= plugin_data(db_plugin, handlerton *); + thd->lex->create_info.db_type= plugin_hton(db_plugin); if (tabledef_version.str) thd->lex->create_info.tabledef_version= tabledef_version; diff --git a/sql/table.h b/sql/table.h index 78d1cd01db9..e376ee2ad2f 100644 --- a/sql/table.h +++ b/sql/table.h @@ -672,8 +672,7 @@ struct TABLE_SHARE inline handlerton *db_type() const /* table_type for handler */ { return is_view ? view_pseudo_hton : - db_plugin ? plugin_data(db_plugin, handlerton*) - : NULL; + db_plugin ? plugin_hton(db_plugin) : NULL; } enum row_type row_type; /* How rows are stored */ enum tmp_table_type tmp_table; |