Mimer SQL Documentation TOC PREV NEXT INDEX

Mimer SQL Developer Site


Error Handling


Upon return, all routines return an integer value. In most cases the value zero (MIMER_SUCCESS) is used to indicates success. In some cases a positive value is used to indicate success with additional information. Negative values always indicate an error condition. The negative values are standard Mimer SQL error codes, which are listed in Return Codes.

Errors between -24000 and -24299 are specific to Micro API (and Mimer Real-Time), where errors in the -24100 to -24199 range occur because of programming mistakes. Errors in the -24200 to -24299 range are of internal nature caused by system problems.

The Micro API specific return codes are listed in Mimer Real-Time and Micro API Return Codes. The acronyms for the Micro API specific return codes can be found in the mimerrors.h header file.

The macro MIMER_SUCCEEDED may be used to detect a call which has either succeeded, or succeeded with additional information (a positive value). Negating this macro may be used to detect an error.

The error condition MIMER_SEQUENCE_ERROR has a special meaning. It will be returned when an illegal call has been made. The Micro API will enforce a strict sequence of allowed calls. For example, MimerGetString may not be called before MimerFetch has been called. MIMER_SEQUENCE_ERROR is returned when illegal sequences of calls are detected.

Error Handling Example

The below example function shows how a function uses the return value from a MicroAPI function call to determine success or failure.

 /**
  * Function which executes the statement OUR_STATEMENT
  *
  * On failure, the error code is written to stdout.
  */
 #include "mimmicroapi.h"
 int example1(MimerSession session) 
 {
   int32_t err,end_err=MIMER_SUCCESS;
   MimerStatement statement;
   
   err = MimerBeginStatement(session,L"OUR_STATEMENT",0,&statement);
   if (MIMER_SUCCEEDED(err)) {
     err = MimerExecute(statement);
     end_err = MimerEndStatement(&statement);
   }            
   if (!MIMER_SUCCEEDED(err) || !MIMER_SUCCEEDED(end_err)) {
     printf("Error %d, end error %d.\n",err,end_err);
   }    
 }

Mimer
Mimer Information Technology AB
Voice: +46 18 780 92 00
Fax: +46 18 780 92 40
info@mimer.se
Mimer SQL Documentation TOC PREV NEXT INDEX