Commit 6b4c37d6 authored by marko's avatar marko

branches/zip: Decode table names when displaying error messages in

fast index creation.

innobase_convert_tablename(): New function, to remove the filename
encoding of a database and table name.

ha_innobase::add_index(): Invoke innobase_convert_tablename() before
calling my_error().

innodb-index.result: Update the error messages.
parent 0a2e8d97
......@@ -813,6 +813,40 @@ innobase_convert_from_filename(
system_charset_info, s, strlen(s), &errors);
}
/**********************************************************************
Removes the filename encoding of a database and table name. */
static
void
innobase_convert_tablename(
/*=======================*/
char* s) /* in: identifier; out: decoded identifier */
{
uint errors;
char* slash = strchr(s, '/');
if (slash) {
char* t;
/* Temporarily replace the '/' with NUL. */
*slash = 0;
/* Convert the database name. */
strconvert(&my_charset_filename, s, system_charset_info,
s, slash - s + 1, &errors);
t = s + strlen(s);
ut_ad(slash >= t);
/* Append a '.' after the database name. */
*t++ = '.';
slash++;
/* Convert the table name. */
strconvert(&my_charset_filename, slash, system_charset_info,
t, slash - t + strlen(slash), &errors);
} else {
strconvert(&my_charset_filename, s,
system_charset_info, s, strlen(s), &errors);
}
}
/**********************************************************************
Compares NUL-terminated UTF-8 strings case insensitively.
......@@ -8333,6 +8367,7 @@ ha_innobase::add_index(
switch (trx->error_state) {
case DB_TABLESPACE_ALREADY_EXISTS:
case DB_DUPLICATE_KEY:
innobase_convert_tablename(new_table_name);
my_error(HA_ERR_TABLE_EXIST, MYF(0),
new_table_name);
error = HA_ERR_TABLE_EXIST;
......@@ -8421,8 +8456,8 @@ ha_innobase::add_index(
dictionary which were defined. */
switch (error) {
const char* old_name;
const char* tmp_name;
const char* old_name;
char* tmp_name;
case DB_SUCCESS:
ut_ad(!dict_locked);
......@@ -8460,6 +8495,7 @@ ha_innobase::add_index(
switch (error) {
case DB_TABLESPACE_ALREADY_EXISTS:
case DB_DUPLICATE_KEY:
innobase_convert_tablename(tmp_name);
my_error(HA_ERR_TABLE_EXIST, MYF(0), tmp_name);
error = HA_ERR_TABLE_EXIST;
break;
......
......@@ -48,10 +48,10 @@ t1 CREATE TABLE `t1` (
) ENGINE=InnoDB DEFAULT CHARSET=latin1
CREATE TABLE `t1#1`(a INT PRIMARY KEY) ENGINE=InnoDB;
alter table t1 add unique index (c), add index (d);
ERROR HY000: Table 'test/t1@00231' already exists
ERROR HY000: Table 'test.t1#1' already exists
rename table `t1#1` to `t1#2`;
alter table t1 add unique index (c), add index (d);
ERROR HY000: Table 'test/t1@00232' already exists
ERROR HY000: Table 'test.t1#2' already exists
drop table `t1#2`;
alter table t1 add unique index (c), add index (d);
show create table t1;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment