#ifndef FBCErrorMetaData__H
#define FBCErrorMetaData__H

#ifndef FBVersion
#define FBVersion 7
#elif FBVersion != 7
#error "The headers for FBCAccess version have been mixed"
#endif

typedef struct FBCErrorMetaData FBCErrorMetaData;
/*!
@header FBCErrorMetaData
 @discussion FBCErrorMetaData objects provide error information about a failed database operation.

 FBCErrorMetaData objects are allocated by the fbcdcErrorMetaData() function in the FBCDatabaseConnection suite.  Once they're not longer necessary, the caller should release them using fbcemdRelease().
*/

#ifdef __cplusplus
extern "C" {
#endif

/*!
@function fbcemdAllErrorMessages
 @discussion Return all of the error messages associated with the previous operation.
 @result The returned string should be freed by the caller.
 */
char* fbcemdAllErrorMessages(FBCErrorMetaData* self);
void  fbcemdReleaseMessage (char* message );

/*!
@function fbcemdErrorCount
 @discussion Return the error count.
 */
unsigned fbcemdErrorCount(FBCErrorMetaData* self);

/*!
@function fbcemdErrorCodeAtIndex
 @discussion Returns the error code at the given index.  The codes are defined in <install root>/FrontBase/Library/FBSQLErrors.array
 */
unsigned fbcemdErrorCodeAtIndex(FBCErrorMetaData* self, unsigned errorIndex);

/*!
@function fbcemdErrorMessageAtIndex
 @discussion Returns the error message at the given index.
 @result The returned string should be freed by the caller.
 */
char* fbcemdErrorMessageAtIndex(FBCErrorMetaData* self, unsigned errorIndex);

char* fbcemdErrorInfoAtIndex(FBCErrorMetaData* self, unsigned errorIndex);
/*!
@function fbcemdErrorKindAtIndex
 @discussion Returns the kind of error at the given index.  Error kinds are, "Syntax Error", "Semantic Error", "Completion condition", "Exception", "Connection error", and "License error".
 */
const char* fbcemdErrorKindAtIndex(FBCErrorMetaData* self, unsigned errorIndex);

/*!
 @function fbcemdReleaseMessage
 @discussion  Release the memory used for the error messages
*/

void  fbcemdReleaseMessage (char* message );

/*!
@function fbcemdRelease
 @discussion Releases the resources associated with an FBCErrorMetaData.
 */
void fbcemdRelease(FBCErrorMetaData* self);
   
#ifdef __cplusplus
}
#endif

#endif /* FBCErrorMetaData__H */
