skip to main content
OpenAccess SDK SQL Engine Core Functions API : Function Reference : dam_addError/dam_addErrorW
 

dam_addError/dam_addErrorW

This function adds an error to the error list maintained by the OpenAccess SDK SQL engine. An error is added at the environment, connection or statement level. This error string is returned to the client. This is the only way to pass specific error information to the client. An IP function returns an error by adding an error using this function and then returning DAM_FAILURE.
Error messages added using this function are reported as SQL state HY000. Use dam_addErrorEx/dam_addErrorExW if you want to specify the SQL state. Using dam_addError is the recommended approach to report back errors to the client.
void dam_addError(
DAM_HDBC hdbc,
DAM_HSTMT hstmt,
int iErrorIndex,
int iNativeError,
char * szErrorText)

void dam_addErrorW(
DAM_HDBC hdbc,
DAM_HSTMT hstmt,
int iErrorIndex,
int iNativeError,
OAWCHAR * szErrorText)
Table 54. Parameters for dam_addError/dam_addErrorW
Parameter
Type
Description
IN
hdbc
DAM_HDBC
The connection handle. Set to NULL if the error is related to a statement and not to the connection.
hstmt
DAM_HSTMT
The statement handle. Set to NULL if the error is related to a connection.
iErrorIndex
int
This parameter must be set to DAM_IP_ERROR to indicate an IP-generated error message.
iNativeError
int
Native error as defined by the IP.
szErrorText
char *
OAWCHAR *
Text to use in place of the standard text. Data from this buffer is copied into the error queue. Set to NULL to use the default error string.
RETURN
NONE