SQLException类

SQLException类提供了有关生成的错误、它们的代码和相关消息的信息。

SQLException()

SQLException的构造函数。

参数 描述
SQLException(); 默认构造函数

SQLException(

const SQLException &e);
拷贝构造函数
参数 描述
e 要拷贝的SQLException

getErrorCode()

获取数据库错误代码。

语法

int getErrorCode() const;

getMessage()

如果该SQLException是用错误消息字符串创建的,则返回该SQLException的错误消息字符串。如果创建的SQLException没有错误消息,则返回NULL。

语法

string getMessage() const;

setErrorCtx()

相关消息的信息。设置指向错误上下文的指针。

语法

void setErrorCtx(

   void *ctx);
参数 描述
ctx 指向错误上下文的指针。

what()

返回与SQLException关联的错误消息。

语法

const char *what() const throw();

setACCIErrorLanguage()

设置ACI、ACCI错误信息的中英文。

语法

void setACCIErrorLanguage(
    bool lan = false);
参数 描述
lan ACI、ACCI错误信息中英文flag,true:中文 false:英文