diff options
author | Jan Lindström <jan.lindstrom@mariadb.com> | 2015-07-29 05:58:45 +0300 |
---|---|---|
committer | Jan Lindström <jan.lindstrom@mariadb.com> | 2015-07-31 08:59:13 +0300 |
commit | e05cd97b8af6ebda0080eec40018207d0c78acbd (patch) | |
tree | 9f8eba23241f2d18afa9114f7c1a703e0d4bbb78 /storage/xtradb/handler | |
parent | 392df76bc3a40a5dd1956b12628dd6489a37be36 (diff) | |
download | mariadb-git-e05cd97b8af6ebda0080eec40018207d0c78acbd.tar.gz |
MDEV-8524: Improve error messaging when there is duplicate key or foreign key names
Added better error message that will be printed when foreign key
constraint name in create table is not unique in database.
Diffstat (limited to 'storage/xtradb/handler')
-rw-r--r-- | storage/xtradb/handler/ha_innodb.cc | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/storage/xtradb/handler/ha_innodb.cc b/storage/xtradb/handler/ha_innodb.cc index fa0081da436..6c4e9eedd7d 100644 --- a/storage/xtradb/handler/ha_innodb.cc +++ b/storage/xtradb/handler/ha_innodb.cc @@ -14107,3 +14107,28 @@ ha_innobase::idx_cond_push( DBUG_RETURN(NULL); } +/********************************************************************//** +Helper function to push warnings from InnoDB internals to SQL-layer. */ +extern "C" UNIV_INTERN +void +ib_push_warning( + trx_t* trx, /*!< in: trx */ + ulint error, /*!< in: error code to push as warning */ + const char *format,/*!< in: warning message */ + ...) +{ + va_list args; + THD *thd = (THD *)trx->mysql_thd; + char *buf; +#define MAX_BUF_SIZE 4*1024 + + va_start(args, format); + buf = (char *)my_malloc(MAX_BUF_SIZE, MYF(MY_WME)); + vsprintf(buf,format, args); + + push_warning_printf(thd, MYSQL_ERROR::WARN_LEVEL_WARN, + convert_error_code_to_mysql(error, 0, thd), + buf); + my_free(buf); + va_end(args); +} |