1
0
mirror of https://github.com/MariaDB/server.git synced 2026-01-06 05:22:24 +03:00

bug #14573 (Error on adding auto_increment on to a column with '0' values)

This commit is contained in:
holyfoot@deer.(none)
2006-05-12 18:02:42 +05:00
parent e672bdc824
commit 034508f6ca
6 changed files with 54 additions and 12 deletions

View File

@@ -1818,6 +1818,24 @@ ulonglong handler::get_auto_increment()
}
void handler::print_keydupp_error(uint key_nr, const char *msg)
{
/* Write the duplicated key in the error message */
char key[MAX_KEY_LENGTH];
String str(key,sizeof(key),system_charset_info);
/* Table is opened and defined at this point */
key_unpack(&str,table,(uint) key_nr);
uint max_length=MYSQL_ERRMSG_SIZE-(uint) strlen(msg);
if (str.length() >= max_length)
{
str.length(max_length-4);
str.append(STRING_WITH_LEN("..."));
}
my_printf_error(ER_DUP_ENTRY, msg,
MYF(0), str.c_ptr(), table->key_info[key_nr].name);
}
/*
Print error that we got from handler function
@@ -1857,18 +1875,7 @@ void handler::print_error(int error, myf errflag)
uint key_nr=get_dup_key(error);
if ((int) key_nr >= 0)
{
/* Write the duplicated key in the error message */
char key[MAX_KEY_LENGTH];
String str(key,sizeof(key),system_charset_info);
/* Table is opened and defined at this point */
key_unpack(&str,table,(uint) key_nr);
uint max_length=MYSQL_ERRMSG_SIZE-(uint) strlen(ER(ER_DUP_ENTRY));
if (str.length() >= max_length)
{
str.length(max_length-4);
str.append(STRING_WITH_LEN("..."));
}
my_error(ER_DUP_ENTRY, MYF(0), str.c_ptr(), table->key_info[key_nr].name);
print_keydupp_error(key_nr, ER(ER_DUP_ENTRY));
DBUG_VOID_RETURN;
}
textno=ER_DUP_KEY;