cciGetLastExceptionData

获取有关生成的最后一个异常的诊断信息。有关当前线程上生成的最后一个异常的信息在 CCI_EXCEPTION_ST 输出结构中返回。用户定义的扩展可以使用此函数来确定当实用程序函数返回错误代码时是否需要任何恢复。

当通过将 returnCode 设置为 CCI_EXCEPTION,向实用程序函数表明发生了异常时,可能调用此函数。

如果 char* 是 US-ASCII,则与异常关联的 traceText 将转换为 char*。如果 traceText 使用另一种语言,则使用 cciGetLastExceptionDataW 及与其关联的 CCI_EXCEPTION_WIDE_ST 结构(它以 UTF-16 的格式存储 traceText)。

如果代理或 cciThrowExceptionW 已引发异常,则 CCI_EXCEPTION_ST 结构的 traceText 元素将为空字符串。

语法

void* cciGetLastExceptionData(
  int*                returnCode,
  CCI_EXCEPTION_ST*  exception_st);

参数

returnCode
接收来自函数(输出)的返回码。可能的返回码是:
  • CCI_FATAL_EXCEPTION
  • CCI_RECOVERABLE_EXCEPTION
  • CCI_CONFIGURATION_EXCEPTION
  • CCI_PARSER_EXCEPTION
  • CCI_CONVERSION_EXCEPTION
  • CCI_DATABASE_EXCEPTION
  • CCI_USER_EXCEPTION
  • CCI_UNKNOWN_EXCEPTION
  • CCI_NO_EXCEPTION_EXISTS
  • CCI_INV_DATA_POINTER
exception_st
指定用于接收有关最近一个异常的数据的 CCI_EXCEPTION_ST 结构的地址(输出)。

返回值

无。 如果发生错误,则 returnCode 参数表明错误原因。

示例

typedef struct exception_st {
int               versionId;     /* Structure version identification */
int               type;          /* Type of exception */
int               messageNumber; /* Message number */
int               insertCount;   /* Number of message inserts */
CCI_STRING_ST     inserts[CCI_MAX_EXCEPTION_INSERTS];  
/* Array of message insert areas */
const char*       fileName;      /* Source: file name */
int               lineNumber;    /* Source: line number in file */
const char*       functionName;  /* Source: function name */
const char*       traceText;     /* Trace text associated with exception */
CCI_STRING_ST     objectName;    /* Object name */
CCI_STRING_ST     objectType;    /* Object type */
} CCI_EXCEPTION_ST;
CCI_EXCEPTION_ST exception_st = malloc(sizeof(CCI_EXCEPTION_ST));
  int                rc = 0;
memset(&exception_st,0,sizeof(exception_st));
          cciGetLastExceptionData(&rc, &exception_st);
相关概念
用户定义的扩展
声明 | 商标 | 下载 | | 支持 | 反馈
Copyright IBM Corporation 1999, 2006 最后更新:2006/05/19
as08551_