Adding Storage Engine Error Messages MySQL

To add error messages for table handlers, the following example may be helpful.

Purpose: Implement the handler :: get_ error_ message function as ha_ federated :: get_ error_ message to return the handler- specific error message.


  1. When an error occurs you return an error code. (It should not be in the range of those that HA_ERR uses, which currently is 120-159.)
  2. When handler::print_error is called to convert the handler error code to a MySQL error code, it will enter the default label of the switch(error) statement:

Adding Storage Engine Error Messages

Thus the handler::get_error_message is called and you can return the handler-specific error message, which is either a static error message that you retrieve from an error/string array, or a a dynamic one that you format when the error occurs.

When you have returned the error message it will be passed to MySQL and formatted as Got error %d '%-.100s' from %s. For example:

Got error 788 'Could not connect to remote server' from FEDERATED

The Got error %d part will be returned in the user's selected language, but the handler-specific one will use English (unless the handler supports returning the handler error message in the user's selected language).

Face Book Twitter Google Plus Instagram Youtube Linkedin Myspace Pinterest Soundcloud Wikipedia

All rights reserved © 2018 Wisdom IT Services India Pvt. Ltd Protection Status

MySQL Topics