diff options
author | unknown <monty@nosik.monty.fi> | 2008-02-11 21:01:36 +0200 |
---|---|---|
committer | unknown <monty@nosik.monty.fi> | 2008-02-11 21:01:36 +0200 |
commit | 3056d07a86d86dc35925c1de12b9d432816517c8 (patch) | |
tree | 26921d9b8bba141f795716cb583d6ee1e681e7f4 /sql | |
parent | 17b9038942ecb17b83f4c61796705a6923c92b25 (diff) | |
parent | d3996f2f908294d47cd69e9e55096958d3759322 (diff) | |
download | mariadb-git-3056d07a86d86dc35925c1de12b9d432816517c8.tar.gz |
Merge bk-internal.mysql.com:/home/bk/mysql-maria
into mysql.com:/home/my/mysql-maria
Diffstat (limited to 'sql')
-rw-r--r-- | sql/handler.cc | 9 | ||||
-rw-r--r-- | sql/handler.h | 11 | ||||
-rw-r--r-- | sql/set_var.cc | 2 | ||||
-rw-r--r-- | sql/sql_table.cc | 28 | ||||
-rw-r--r-- | sql/sql_tablespace.cc | 13 | ||||
-rw-r--r-- | sql/sql_yacc.yy | 2 | ||||
-rw-r--r-- | sql/unireg.cc | 3 |
7 files changed, 44 insertions, 24 deletions
diff --git a/sql/handler.cc b/sql/handler.cc index e514a079cd4..0685069f6e0 100644 --- a/sql/handler.cc +++ b/sql/handler.cc @@ -373,8 +373,7 @@ int ha_finalize_handlerton(st_plugin_int *plugin) handlerton *hton= (handlerton *)plugin->data; DBUG_ENTER("ha_finalize_handlerton"); - switch (hton->state) - { + switch (hton->state) { case SHOW_OPTION_NO: case SHOW_OPTION_DISABLED: break; @@ -647,7 +646,7 @@ int ha_prepare(THD *thd) { push_warning_printf(thd, MYSQL_ERROR::WARN_LEVEL_WARN, ER_ILLEGAL_HA, ER(ER_ILLEGAL_HA), - ha_resolve_storage_engine_name(*ht)); + hton_name(*ht)->str); } } } @@ -1041,7 +1040,7 @@ static my_bool xarecover_handlerton(THD *unused, plugin_ref plugin, while ((got= hton->recover(hton, info->list, info->len)) > 0 ) { sql_print_information("Found %d prepared transaction(s) in %s", - got, ha_resolve_storage_engine_name(hton)); + got, hton_name(hton)->str); for (int i=0; i < got; i ++) { my_xid x=info->list[i].get_my_xid(); @@ -3814,7 +3813,7 @@ bool ha_show_status(THD *thd, handlerton *db_type, enum ha_stat_type stat) { if (db_type->state != SHOW_OPTION_YES) { - const LEX_STRING *name=&hton2plugin[db_type->slot]->name; + const LEX_STRING *name= hton_name(db_type); result= stat_print(thd, name->str, name->length, "", 0, "DISABLED", 8) ? 1 : 0; } diff --git a/sql/handler.h b/sql/handler.h index 8e3073eb6ba..a4ef34d5f2d 100644 --- a/sql/handler.h +++ b/sql/handler.h @@ -709,6 +709,12 @@ struct handlerton }; +inline LEX_STRING *hton_name(const handlerton *hton) +{ + return &(hton2plugin[hton->slot]->name); +} + + /* Possible flags of a handlerton (there can be 32 of them) */ #define HTON_NO_FLAGS 0 #define HTON_CLOSE_CURSORS_AT_COMMIT (1 << 0) @@ -1629,6 +1635,8 @@ public: */ virtual void use_hidden_primary_key(); + LEX_STRING *engine_name() { return hton_name(ht); } + protected: /* Service methods for use by storage engines. */ void ha_statistic_increment(ulong SSV::*offset) const; @@ -1644,6 +1652,7 @@ protected: */ virtual int rename_table(const char *from, const char *to); virtual int delete_table(const char *name); + private: /* Low-level primitives for storage engines. These should be @@ -1848,7 +1857,7 @@ static inline enum legacy_db_type ha_legacy_type(const handlerton *db_type) static inline const char *ha_resolve_storage_engine_name(const handlerton *db_type) { - return db_type == NULL ? "UNKNOWN" : hton2plugin[db_type->slot]->name.str; + return db_type == NULL ? "UNKNOWN" : hton_name(db_type)->str; } static inline bool ha_check_storage_engine_flag(const handlerton *db_type, uint32 flag) diff --git a/sql/set_var.cc b/sql/set_var.cc index 2b11b81f79d..8e52519f1a8 100644 --- a/sql/set_var.cc +++ b/sql/set_var.cc @@ -3529,7 +3529,7 @@ uchar *sys_var_thd_storage_engine::value_ptr(THD *thd, enum_var_type type, if (type == OPT_GLOBAL) plugin= my_plugin_lock(thd, &(global_system_variables.*offset)); hton= plugin_data(plugin, handlerton*); - engine_name= &hton2plugin[hton->slot]->name; + engine_name= hton_name(hton); result= (uchar *) thd->strmake(engine_name->str, engine_name->length); if (type == OPT_GLOBAL) plugin_unlock(thd, plugin); diff --git a/sql/sql_table.cc b/sql/sql_table.cc index 2438d8fc2ea..0b4d8e14efc 100644 --- a/sql/sql_table.cc +++ b/sql/sql_table.cc @@ -3418,6 +3418,14 @@ bool mysql_create_table_no_lock(THD *thd, goto err; } + /* Give warnings for not supported table options */ + if (create_info->transactional && !file->ht->commit) + push_warning_printf(thd, MYSQL_ERROR::WARN_LEVEL_ERROR, + ER_ILLEGAL_HA_CREATE_OPTION, + ER(ER_ILLEGAL_HA_CREATE_OPTION), + file->engine_name()->str, + "TRANSACTIONAL=1"); + VOID(pthread_mutex_lock(&LOCK_open)); if (!internal_tmp_table && !(create_info->options & HA_LEX_CREATE_TMP_TABLE)) { @@ -5414,6 +5422,7 @@ bool alter_table_manage_keys(TABLE *table, int indexes_were_disabled, Sets create_info->varchar if the table has a VARCHAR column. Prepares alter_info->create_list and alter_info->key_list with columns and keys of the new table. + @retval TRUE error, out of memory or a semantical error in ALTER TABLE instructions @retval FALSE success @@ -5440,7 +5449,8 @@ mysql_prepare_alter_table(THD *thd, TABLE *table, uint used_fields= create_info->used_fields; KEY *key_info=table->key_info; bool rc= TRUE; - + Create_field *def; + Field **f_ptr,*field; DBUG_ENTER("mysql_prepare_alter_table"); create_info->varchar= FALSE; @@ -5476,18 +5486,16 @@ mysql_prepare_alter_table(THD *thd, TABLE *table, create_info->tablespace= tablespace; } restore_record(table, s->default_values); // Empty record for DEFAULT - Create_field *def; /* First collect all fields from table which isn't in drop_list */ - Field **f_ptr,*field; for (f_ptr=table->field ; (field= *f_ptr) ; f_ptr++) { + Alter_drop *drop; if (field->type() == MYSQL_TYPE_STRING) create_info->varchar= TRUE; /* Check if field should be dropped */ - Alter_drop *drop; drop_it.rewind(); while ((drop=drop_it++)) { @@ -5561,7 +5569,8 @@ mysql_prepare_alter_table(THD *thd, TABLE *table, { if (def->change && ! def->field) { - my_error(ER_BAD_FIELD_ERROR, MYF(0), def->change, table->s->table_name.str); + my_error(ER_BAD_FIELD_ERROR, MYF(0), def->change, + table->s->table_name.str); goto err; } /* @@ -5596,7 +5605,8 @@ mysql_prepare_alter_table(THD *thd, TABLE *table, } if (!find) { - my_error(ER_BAD_FIELD_ERROR, MYF(0), def->after, table->s->table_name.str); + my_error(ER_BAD_FIELD_ERROR, MYF(0), def->after, + table->s->table_name.str); goto err; } find_it.after(def); // Put element after this @@ -5646,6 +5656,8 @@ mysql_prepare_alter_table(THD *thd, TABLE *table, continue; // Wrong field (from UNIREG) const char *key_part_name=key_part->field->field_name; Create_field *cfield; + uint key_part_length; + field_it.rewind(); while ((cfield=field_it++)) { @@ -5661,7 +5673,7 @@ mysql_prepare_alter_table(THD *thd, TABLE *table, } if (!cfield) continue; // Field is removed - uint key_part_length=key_part->length; + key_part_length= key_part->length; if (cfield->field) // Not new field { /* @@ -7312,7 +7324,7 @@ static bool check_engine(THD *thd, const char *table_name, if (create_info->used_fields & HA_CREATE_USED_ENGINE) { my_error(ER_ILLEGAL_HA_CREATE_OPTION, MYF(0), - ha_resolve_storage_engine_name(*new_engine), "TEMPORARY"); + hton_name(*new_engine)->str, "TEMPORARY"); *new_engine= 0; return TRUE; } diff --git a/sql/sql_tablespace.cc b/sql/sql_tablespace.cc index 9fec0e3bc63..14b29452750 100644 --- a/sql/sql_tablespace.cc +++ b/sql/sql_tablespace.cc @@ -34,7 +34,7 @@ int mysql_alter_tablespace(THD *thd, st_alter_tablespace *ts_info) push_warning_printf(thd, MYSQL_ERROR::WARN_LEVEL_ERROR, ER_WARN_USING_OTHER_HANDLER, ER(ER_WARN_USING_OTHER_HANDLER), - ha_resolve_storage_engine_name(hton), + hton_name(hton)->str, ts_info->tablespace_name ? ts_info->tablespace_name : ts_info->logfile_group_name); } @@ -43,13 +43,14 @@ int mysql_alter_tablespace(THD *thd, st_alter_tablespace *ts_info) { if ((error= hton->alter_tablespace(hton, thd, ts_info))) { - if (error == HA_ADMIN_NOT_IMPLEMENTED) + if (error == 1) { - my_error(ER_CHECK_NOT_IMPLEMENTED, MYF(0), ""); + DBUG_RETURN(1); } - else if (error == 1) + + if (error == HA_ADMIN_NOT_IMPLEMENTED) { - DBUG_RETURN(1); + my_error(ER_CHECK_NOT_IMPLEMENTED, MYF(0), ""); } else { @@ -63,7 +64,7 @@ int mysql_alter_tablespace(THD *thd, st_alter_tablespace *ts_info) push_warning_printf(thd, MYSQL_ERROR::WARN_LEVEL_ERROR, ER_ILLEGAL_HA_CREATE_OPTION, ER(ER_ILLEGAL_HA_CREATE_OPTION), - ha_resolve_storage_engine_name(hton), + hton_name(hton)->str, "TABLESPACE or LOGFILE GROUP"); } write_bin_log(thd, FALSE, thd->query, thd->query_length); diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy index c00394d96cf..0d5908ccc1e 100644 --- a/sql/sql_yacc.yy +++ b/sql/sql_yacc.yy @@ -1650,7 +1650,7 @@ create: push_warning_printf(YYTHD, MYSQL_ERROR::WARN_LEVEL_WARN, ER_WARN_USING_OTHER_HANDLER, ER(ER_WARN_USING_OTHER_HANDLER), - ha_resolve_storage_engine_name(lex->create_info.db_type), + hton_name(lex->create_info.db_type)->str, $5->table.str); } } diff --git a/sql/unireg.cc b/sql/unireg.cc index 64a5b7d8910..c4d656e6e9c 100644 --- a/sql/unireg.cc +++ b/sql/unireg.cc @@ -159,8 +159,7 @@ bool mysql_create_frm(THD *thd, const char *file_name, reclength=uint2korr(forminfo+266); /* Calculate extra data segment length */ - str_db_type.str= (char *) ha_resolve_storage_engine_name(create_info->db_type); - str_db_type.length= strlen(str_db_type.str); + str_db_type= *hton_name(create_info->db_type); /* str_db_type */ create_info->extra_size= (2 + str_db_type.length + 2 + create_info->connect_string.length); |