diff options
author | unknown <tomas@whalegate.ndb.mysql.com> | 2007-06-14 12:35:35 +0200 |
---|---|---|
committer | unknown <tomas@whalegate.ndb.mysql.com> | 2007-06-14 12:35:35 +0200 |
commit | ef3ed50bc0be1170cf22bcdc914374b3a1a67407 (patch) | |
tree | 39358d0a9f2a51413d607ec01b69d026dccbd47e /extra | |
parent | 0d5c6b702a516c8cff37b9020d918bc4be50f184 (diff) | |
download | mariadb-git-ef3ed50bc0be1170cf22bcdc914374b3a1a67407.tar.gz |
get mgmapi error codes into perror
storage/ndb/include/mgmapi/mgmapi_error.h:
New BitKeeper file ``storage/ndb/include/mgmapi/mgmapi_error.h''
Diffstat (limited to 'extra')
-rw-r--r-- | extra/perror.c | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/extra/perror.c b/extra/perror.c index c49869be681..6ab2afe0b71 100644 --- a/extra/perror.c +++ b/extra/perror.c @@ -25,6 +25,7 @@ #ifdef WITH_NDBCLUSTER_STORAGE_ENGINE #include "../storage/ndb/src/ndbapi/ndberror.c" #include "../storage/ndb/src/kernel/error/ndbd_exit_codes.c" +#include "../storage/ndb/include/mgmapi/mgmapi_error.h" #endif static my_bool verbose, print_all_codes; @@ -32,6 +33,20 @@ static my_bool verbose, print_all_codes; #ifdef WITH_NDBCLUSTER_STORAGE_ENGINE static my_bool ndb_code; static char ndb_string[1024]; +int mgmapi_error_string(int err_no, char *str, int size) +{ + int i; + for (i= 0; i < ndb_mgm_noOfErrorMsgs; i++) + { + if (ndb_mgm_error_msgs[i].code == err_no) + { + my_snprintf(str, size-1, "%s", ndb_mgm_error_msgs[i].msg); + str[size-1]= '\0'; + return 0; + } + } + return -1; +} #endif static struct my_option my_long_options[] = @@ -238,8 +253,9 @@ int main(int argc,char *argv[]) #ifdef WITH_NDBCLUSTER_STORAGE_ENGINE if (ndb_code) { - if ((ndb_error_string(code, ndb_string, sizeof(ndb_string)) < 0) && - (ndbd_exit_string(code, ndb_string, sizeof(ndb_string)) < 0)) + if ((ndb_error_string(code, ndb_string, sizeof(ndb_string)) < 0) && + (ndbd_exit_string(code, ndb_string, sizeof(ndb_string)) < 0) && + (mgmapi_error_string(code, ndb_string, sizeof(ndb_string)) < 0)) { msg= 0; } |