MySQL Internals Manual  /  ...  /  Adding Error Messages to Old (< MySQL 5.0) Versions

27.1.3 Adding Error Messages to Old (< MySQL 5.0) Versions

Note: This section is included for historical purposes. In practice, no new error messages should be added to error message files for versions of MySQL prior to 5.0.3. Doing so and merging the messages upward would cause error numbers to change in more recent versions.

Before MySQL 5.0.3, error messages are stored in errmsg.txt files in the language directories under sql/share. The files have names like czech/errmsg.txt, danish/errmsg.txt, and so forth, and each one is language-specific. Each of these language-specific files must contain a line for each error message, so adding a new message involves adding a line to the errmsg.txt file for every language. The procedure involves adding the English message to the english/errmsg.txt file and running a script that adds the message to the other language-specific files. Translators may translate the message in other errmsg.txt files later.

  1. Open the file sql/share/english/errmsg.txt in an editor.

  2. Add new error messages at the end of this file. Each message should be on a separate line, and it must be quoted within double quote ('"') characters. By convention, every message line except the last should end with a comma (',') following the second double quote.

  3. For each new error message, add a #define line to the include/mysqld_error.h file before the last line (#define ER_ERROR_MESSAGES).

  4. Adjust the value of ER_ERROR_MESSAGES to the new number of error messages.

  5. Add the defined error symbols to include/sql_state.h. This file contains the SQL states for the error messages. If the new errors don't have SQL states, add a comment instead. Note that this file must be kept sorted according to the value of the error number. That is, although the sql_state.h file might not contain an entry for every symbol in mysqld_error.h, those entries that are present in sql_state.h must appear in the same order as those for the corresponding entries in mysqld_error.h.

  6. Go to the sql directory in a terminal window and type ./add_errmsg N. This will copy the last N error messages from share/english.txt to all the other language files in share/.

  7. Translate the error message for those languages that you know by editing the files share/language/errmsg.txt.

  8. Make a full build (configure + make). A make all is insufficient to build the sql/share/*/errmsg.sys files.


User Comments
Sign Up Login You must be logged in to post a comment.