Interstage Shunsaku Data Manager Application Development Guide - Microsoft(R) Windows(R) 2000/ Microsoft(R) Windows Server(TM) 2003 - - UNIX - |
Contents
Index
![]() ![]() |
Part 2 Developing Applications by APIs | > Chapter 11 Developing C Applications | > 11.2 How to Use C APIs |
If a warning or error occurs while a C API is being used, a value other than that indicating normal completion will be returned when a function is executed. In such cases, the ShunGetErrorMessage function can be used to obtain the following information:
if(ret != SHUN_SUCCESS) { /* Obtain error information */ ShunGetErrorMessage(StmtH, &Err_Level, &Err_Msg); (1) (2) switch ( Err_Level ) { case SHUN_ERROR_CONNECTION: printf("Error level = SHUN_ERROR_CONNECTION\n"); break; case SHUN_ERROR_TRANSACTION: printf("Error level = SHUN_ERROR_TRANSACTION\n"); break; case SHUN_ERROR_DATA: printf("Error level = SHUN_ERROR_DATA\n"); break; } printf("Error message = %s\n", Err_Msg); } |
Use the values returned when each function is executed to determine if an error has occurred. If an error has occurred, obtain the error information.
By examining the error level, the user can ascertain the status of an application after an error has occurred.
The following four error levels are returned:
Constant |
Meaning |
---|---|
SHUN_INFORMATION |
Indicates normal completion. |
SHUN_ERROR_DATA |
Indicates that a warning level error (such as a parameter error) has occurred. Retry from the point where the error occurred. |
SHUN_ERROR_TRANSACTION |
An error has caused a transaction to be canceled. Re-execute the process from the start of the transaction. |
SHUN_ERROR_CONNECTION |
An error has occurred, causing the connection to Shunsaku to be forcibly closed. Discard and then recreate the connection handle where the error occurred, and then re-execute the process starting from establishing the connection. |
Refer to Messages Output when APIs are Executed in the Messages for more information on error messages.
Contents
Index
![]() ![]() |