diff options
Diffstat (limited to 'sql/table.cc')
-rw-r--r-- | sql/table.cc | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/sql/table.cc b/sql/table.cc index 220aba27d5b..0324e29abf3 100644 --- a/sql/table.cc +++ b/sql/table.cc @@ -702,10 +702,9 @@ int openfrm(THD *thd, const char *name, const char *alias, uint db_stat, key_part->key_part_flag|= HA_BIT_PART; if (i == 0 && key != primary_key) - field->flags |= - ((keyinfo->flags & HA_NOSAME) && - field->key_length() == - keyinfo->key_length ? UNIQUE_KEY_FLAG : MULTIPLE_KEY_FLAG); + field->flags |= ((keyinfo->flags & HA_NOSAME) && + (keyinfo->key_parts == 1)) ? + UNIQUE_KEY_FLAG : MULTIPLE_KEY_FLAG; if (i == 0) field->key_start.set_bit(key); if (field->key_length() == key_part->length && @@ -1343,8 +1342,9 @@ void append_unescaped(String *res, const char *pos, uint length) /* Create a .frm file */ -File create_frm(THD *thd, register my_string name, uint reclength, - uchar *fileinfo, HA_CREATE_INFO *create_info, uint keys) +File create_frm(THD *thd, my_string name, const char *db, + const char *table, uint reclength, uchar *fileinfo, + HA_CREATE_INFO *create_info, uint keys) { register File file; ulong length; @@ -1367,7 +1367,7 @@ File create_frm(THD *thd, register my_string name, uint reclength, */ set_if_smaller(create_info->raid_chunks, 255); - if ((file= my_create(name, CREATE_MODE, create_flags, MYF(MY_WME))) >= 0) + if ((file= my_create(name, CREATE_MODE, create_flags, MYF(0))) >= 0) { uint key_length, tmp_key_length; uint tmp; @@ -1414,6 +1414,13 @@ File create_frm(THD *thd, register my_string name, uint reclength, } } } + else + { + if (my_errno == ENOENT) + my_error(ER_BAD_DB_ERROR,MYF(0),db); + else + my_error(ER_CANT_CREATE_TABLE,MYF(0),table,my_errno); + } return (file); } /* create_frm */ |