diff options
author | Sergey Glukhov <Sergey.Glukhov@sun.com> | 2009-10-15 17:23:43 +0500 |
---|---|---|
committer | Sergey Glukhov <Sergey.Glukhov@sun.com> | 2009-10-15 17:23:43 +0500 |
commit | d8c3f2263f3deaadff957a0047460e8058cffccf (patch) | |
tree | e38788d80d85437efb1819550af226f7b2e2c195 /sql/sql_error.h | |
parent | 3929dddcd76130529cabfbd68cfff024e6b5c80d (diff) | |
download | mariadb-git-d8c3f2263f3deaadff957a0047460e8058cffccf.tar.gz |
WL#751 Error message construction, backport
Diffstat (limited to 'sql/sql_error.h')
-rw-r--r-- | sql/sql_error.h | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/sql/sql_error.h b/sql/sql_error.h index f7b0ff56efa..ac86ca4770c 100644 --- a/sql/sql_error.h +++ b/sql/sql_error.h @@ -516,11 +516,45 @@ private: friend class Resignal_statement; }; +extern char *err_conv(char *buff, uint to_length, const char *from, + uint from_length, CHARSET_INFO *from_cs); + +class ErrConvString +{ + char err_buffer[MYSQL_ERRMSG_SIZE]; +public: + + ErrConvString(String *str) + { + (void) err_conv(err_buffer, sizeof(err_buffer), str->ptr(), + str->length(), str->charset()); + } + + ErrConvString(const char *str, CHARSET_INFO* cs) + { + (void) err_conv(err_buffer, sizeof(err_buffer), + str, strlen(str), cs); + } + + ErrConvString(const char *str, uint length, CHARSET_INFO* cs) + { + (void) err_conv(err_buffer, sizeof(err_buffer), + str, length, cs); + } + + ~ErrConvString() { }; + char *ptr() { return err_buffer; } +}; + + void push_warning(THD *thd, MYSQL_ERROR::enum_warning_level level, uint code, const char *msg); void push_warning_printf(THD *thd, MYSQL_ERROR::enum_warning_level level, uint code, const char *format, ...); bool mysqld_show_warnings(THD *thd, ulong levels_to_show); +uint32 convert_error_message(char *to, uint32 to_length, CHARSET_INFO *to_cs, + const char *from, uint32 from_length, + CHARSET_INFO *from_cs, uint *errors); extern const LEX_STRING warning_level_names[]; |