Skip to content

Commit 49daa9a

Browse files
authored
Fix to get the sqlcode from ibm_db.get_sqlcode api for warnings (ibmdb#1020)
* Fix to get the sqlcode from ibm_db.get_sqlcode api for warning message Signed-off-by: ek <ek@rocketsoftware.com> * Update README.md Signed-off-by: ek <ek@rocketsoftware.com> * Resolve merge conflicts for warnings Signed-off-by: ek <ek@rocketsoftware.com> * Update ibm_db.c --------- Signed-off-by: ek <ek@rocketsoftware.com>
1 parent e84428c commit 49daa9a

2 files changed

Lines changed: 10 additions & 2 deletions

File tree

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ If you face problems due to missing python header files while installing the dri
4949

5050
### Windows:
5151

52-
- If a db2 client or server or dsdriver or clidriver is already installed in the system and user has already set installed path to `PATH` environment variable, then user need to set [environment variable](#envvar) `IBM_DB_HOME` manaully to the installed path before installing `ibm_db`.
52+
- If a db2 client or server or dsdriver or clidriver is already installed in the system and user has already set installed path to `PATH` environment variable, then user needs to set [environment variable](#envvar) `IBM_DB_HOME` manually to the installed path before installing `ibm_db`.
5353

5454
- To verify it, just execute `db2level` command before installation of `ibm_db`. If it works, note down the install directory path and set system level environment variable `IBM_DB_HOME` as install path shown in output of `db2level` command.
5555

ibm_db.c

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -815,7 +815,11 @@ static void _python_ibm_db_check_sql_errors(SQLHANDLE handle, SQLSMALLINT hType,
815815

816816
strncpy(IBM_DB_G(__python_conn_warn_msg), (char *)errMsg, DB2_MAX_ERR_MSG_LEN - 1);
817817
IBM_DB_G(__python_conn_warn_msg)[DB2_MAX_ERR_MSG_LEN - 1] = '\0';
818-
break;
818+
819+
strncpy(IBM_DB_G(__python_err_code), (char *)errcode, SQL_SQLCODE_SIZE);
820+
IBM_DB_G(__python_err_code)[SQL_SQLCODE_SIZE] = '\0';
821+
822+
break;
819823

820824
case SQL_HANDLE_STMT:
821825
snprintf(messageStr, sizeof(messageStr),
@@ -827,6 +831,10 @@ static void _python_ibm_db_check_sql_errors(SQLHANDLE handle, SQLSMALLINT hType,
827831

828832
strncpy(IBM_DB_G(__python_stmt_warn_msg), (char *)errMsg, DB2_MAX_ERR_MSG_LEN - 1);
829833
IBM_DB_G(__python_stmt_warn_msg)[DB2_MAX_ERR_MSG_LEN - 1] = '\0';
834+
835+
strncpy(IBM_DB_G(__python_err_code), (char *)errcode, SQL_SQLCODE_SIZE);
836+
IBM_DB_G(__python_err_code)[SQL_SQLCODE_SIZE] = '\0';
837+
830838
break;
831839
}
832840
}

0 commit comments

Comments
 (0)