Skip to content

Commit

Permalink
Code fix for issue #468
Browse files Browse the repository at this point in the history
Signed-off-by: Arnab Mukherjee <[email protected]>
  • Loading branch information
Arnab Mukherjee authored and amukherjee28 committed May 19, 2022
1 parent 8739480 commit 1d8af42
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions IBM_DB/ibm_db/ibm_db.c
Original file line number Diff line number Diff line change
Expand Up @@ -506,6 +506,7 @@ static void _python_ibm_db_check_sql_errors( SQLHANDLE handle, SQLSMALLINT hType
SQLSMALLINT length = 0;
char *p= NULL;
SQLINTEGER rc1 = SQL_SUCCESS;
int i = 0;

memset(errMsg, '\0', DB2_MAX_ERR_MSG_LEN);
memset(msg, '\0', SQL_MAX_MESSAGE_LENGTH + 1);
Expand All @@ -517,6 +518,15 @@ static void _python_ibm_db_check_sql_errors( SQLHANDLE handle, SQLSMALLINT hType
*p = '\0';
}
sprintf((char*)errMsg, "%s SQLCODE=%d", (char*)msg, (int)sqlcode);
#ifdef _WIN32
for(i = 0; i < strlen(errMsg); i++)
{
if(errMsg[i] == '\r')
{
errMsg[i] = ' ';
}
}
#endif
if (cpy_to_global != 0 && rc != 1 ) {
PyErr_SetString(PyExc_Exception, (char *) errMsg);
}
Expand Down

0 comments on commit 1d8af42

Please sign in to comment.