#include <ndb_global.h>#include <my_base.h>#include <ndberror.h>#include <m_string.h>Include dependency graph for ndberror.c:

Go to the source code of this file.
Classes | |
| struct | ErrorBundle |
| struct | ErrorStatusMessage |
| struct | ErrorStatusClassification |
Defines | |
| #define | ST_S ndberror_st_success |
| #define | ST_P ndberror_st_permanent |
| #define | ST_T ndberror_st_temporary |
| #define | ST_U ndberror_st_unknown |
| #define | NE ndberror_cl_none |
| #define | AE ndberror_cl_application |
| #define | CE ndberror_cl_configuration |
| #define | ND ndberror_cl_no_data_found |
| #define | CV ndberror_cl_constraint_violation |
| #define | SE ndberror_cl_schema_error |
| #define | UD ndberror_cl_user_defined |
| #define | IS ndberror_cl_insufficient_space |
| #define | TR ndberror_cl_temporary_resource |
| #define | NR ndberror_cl_node_recovery |
| #define | OL ndberror_cl_overload |
| #define | TO ndberror_cl_timeout_expired |
| #define | NS ndberror_cl_node_shutdown |
| #define | UR ndberror_cl_unknown_result |
| #define | IE ndberror_cl_internal_error |
| #define | NI ndberror_cl_function_not_implemented |
| #define | UE ndberror_cl_unknown_error_code |
| #define | OE ndberror_cl_schema_object_already_exists |
| #define | IT ndberror_cl_internal_temporary |
| #define | DMEC -1 |
Functions | |
| void | ndberror_update (ndberror_struct *error) |
| const char * | ndberror_status_message (ndberror_status status) |
| const char * | ndberror_classification_message (ndberror_classification classification) |
| int | ndb_error_string (int err_no, char *str, unsigned int size) |
Variables | |
| static const char * | empty_string = "" |
| static const ErrorBundle | ErrorCodes [] |
| static const int | NbErrorCodes = sizeof(ErrorCodes)/sizeof(ErrorBundle) |
| static const ErrorStatusMessage | StatusMessageMapping [] |
| static const int | NbStatus = sizeof(StatusMessageMapping)/sizeof(ErrorStatusMessage) |
| static const ErrorStatusClassification | StatusClassificationMapping [] |
| static const int | NbClassification = sizeof(StatusClassificationMapping)/sizeof(ErrorStatusClassification) |
| #define AE ndberror_cl_application |
Definition at line 40 of file ndberror.c.
| #define CE ndberror_cl_configuration |
Definition at line 41 of file ndberror.c.
| #define CV ndberror_cl_constraint_violation |
Definition at line 43 of file ndberror.c.
| #define DMEC -1 |
Definition at line 65 of file ndberror.c.
| #define IE ndberror_cl_internal_error |
Definition at line 56 of file ndberror.c.
| #define IS ndberror_cl_insufficient_space |
Definition at line 47 of file ndberror.c.
| #define IT ndberror_cl_internal_temporary |
Definition at line 62 of file ndberror.c.
| #define ND ndberror_cl_no_data_found |
Definition at line 42 of file ndberror.c.
| #define NE ndberror_cl_none |
Definition at line 39 of file ndberror.c.
| #define NI ndberror_cl_function_not_implemented |
Definition at line 57 of file ndberror.c.
| #define NR ndberror_cl_node_recovery |
Definition at line 49 of file ndberror.c.
| #define NS ndberror_cl_node_shutdown |
Definition at line 52 of file ndberror.c.
| #define OE ndberror_cl_schema_object_already_exists |
Definition at line 60 of file ndberror.c.
| #define OL ndberror_cl_overload |
Definition at line 50 of file ndberror.c.
| #define SE ndberror_cl_schema_error |
Definition at line 44 of file ndberror.c.
Referenced by NDB_CPC::telnetclient::telnetClient::ArrangeReply(), and NDB_CPC::telnetclient::telnetClient::ProcessOptions().
| #define ST_P ndberror_st_permanent |
Definition at line 35 of file ndberror.c.
| #define ST_S ndberror_st_success |
Shorter names in table below
Definition at line 34 of file ndberror.c.
| #define ST_T ndberror_st_temporary |
Definition at line 36 of file ndberror.c.
| #define ST_U ndberror_st_unknown |
Definition at line 37 of file ndberror.c.
| #define TO ndberror_cl_timeout_expired |
Definition at line 51 of file ndberror.c.
| #define TR ndberror_cl_temporary_resource |
Definition at line 48 of file ndberror.c.
| #define UD ndberror_cl_user_defined |
Definition at line 45 of file ndberror.c.
| #define UE ndberror_cl_unknown_error_code |
| #define UR ndberror_cl_unknown_result |
Definition at line 54 of file ndberror.c.
| int ndb_error_string | ( | int | err_no, | |
| char * | str, | |||
| unsigned int | size | |||
| ) |
Definition at line 774 of file ndberror.c.
References error, my_snprintf(), ndberror_classification_message(), ndberror_status_message(), ndberror_update(), and UE.
Referenced by MgmtSrvr::alloc_node_id(), MgmtSrvr::getErrorText(), and main().
00775 { 00776 ndberror_struct error; 00777 unsigned int len; 00778 00779 error.code = err_no; 00780 ndberror_update(&error); 00781 00782 len = 00783 my_snprintf(str, size-1, "%s: %s: %s", error.message, 00784 ndberror_status_message(error.status), 00785 ndberror_classification_message(error.classification)); 00786 str[size-1]= '\0'; 00787 00788 if (error.classification != UE) 00789 return len; 00790 return -len; 00791 }
Here is the call graph for this function:

Here is the caller graph for this function:

| const char* ndberror_classification_message | ( | ndberror_classification | classification | ) |
Definition at line 765 of file ndberror.c.
References empty_string, and StatusClassificationMapping.
Referenced by ndb_error_string(), and operator<<().
00766 { 00767 int i; 00768 for (i= 0; i < NbClassification; i++) 00769 if (StatusClassificationMapping[i].classification == classification) 00770 return StatusClassificationMapping[i].message; 00771 return empty_string; 00772 }
Here is the caller graph for this function:

| const char* ndberror_status_message | ( | ndberror_status | status | ) |
Definition at line 756 of file ndberror.c.
References empty_string, and StatusMessageMapping.
Referenced by ndb_error_string(), and operator<<().
00757 { 00758 int i; 00759 for (i= 0; i < NbStatus; i++) 00760 if (StatusMessageMapping[i].status == status) 00761 return StatusMessageMapping[i].message; 00762 return empty_string; 00763 }
Here is the caller graph for this function:

| void ndberror_update | ( | ndberror_struct * | error | ) |
Definition at line 697 of file ndberror.c.
References ErrorBundle::classification, error, ErrorCodes, ErrorBundle::message, ErrorBundle::mysql_code, and NbErrorCodes.
Referenced by ndb_error_string(), and update().
00697 { 00698 00699 int found = 0; 00700 int i; 00701 00702 for(i = 0; i<NbErrorCodes; i++){ 00703 if(ErrorCodes[i].code == error->code){ 00704 error->classification = ErrorCodes[i].classification; 00705 error->message = ErrorCodes[i].message; 00706 error->mysql_code = ErrorCodes[i].mysql_code; 00707 found = 1; 00708 break; 00709 } 00710 } 00711 00712 if(!found){ 00713 error->classification = UE; 00714 error->message = "Unknown error code"; 00715 error->mysql_code = DMEC; 00716 } 00717 00718 found = 0; 00719 for(i = 0; i<NbClassification; i++){ 00720 if(StatusClassificationMapping[i].classification == error->classification){ 00721 error->status = StatusClassificationMapping[i].status; 00722 found = 1; 00723 break; 00724 } 00725 } 00726 if(!found){ 00727 error->status = ST_U; 00728 } 00729 00730 error->details = 0; 00731 }
Here is the caller graph for this function:

const char* empty_string = "" [static] |
Definition at line 67 of file ndberror.c.
const ErrorBundle ErrorCodes[] [static] |
const int NbClassification = sizeof(StatusClassificationMapping)/sizeof(ErrorStatusClassification) [static] |
Definition at line 676 of file ndberror.c.
const int NbErrorCodes = sizeof(ErrorCodes)/sizeof(ErrorBundle) [static] |
const int NbStatus = sizeof(StatusMessageMapping)/sizeof(ErrorStatusMessage) [static] |
Definition at line 646 of file ndberror.c.
const ErrorStatusClassification StatusClassificationMapping[] [static] |
Initial value:
{
{ ST_S, NE, "No error"},
{ ST_P, AE, "Application error"},
{ ST_P, CE, "Configuration or application error"},
{ ST_P, ND, "No data found"},
{ ST_P, CV, "Constraint violation"},
{ ST_P, SE, "Schema error"},
{ ST_P, UD, "User defined error"},
{ ST_P, IS, "Insufficient space"},
{ ST_T, TR, "Temporary Resource error"},
{ ST_T, NR, "Node Recovery error"},
{ ST_T, OL, "Overload error"},
{ ST_T, TO, "Timeout expired"},
{ ST_T, NS, "Node shutdown"},
{ ST_T, IT, "Internal temporary"},
{ ST_U , UR, "Unknown result error"},
{ ST_U , UE, "Unknown error code"},
{ ST_P, IE, "Internal error"},
{ ST_P, NI, "Function not implemented"}
}
Definition at line 650 of file ndberror.c.
Referenced by ndberror_classification_message().
const ErrorStatusMessage StatusMessageMapping[] [static] |
Initial value:
{
{ ST_S, "Success"},
{ ST_P, "Permanent error"},
{ ST_T, "Temporary error"},
{ ST_U ,"Unknown result"}
}
Definition at line 637 of file ndberror.c.
Referenced by ndberror_status_message().
1.4.7

