[TRAFODION-3329] Code cleanup in Type 2 driver
Added code back that was inadvertently deleted in commit 6b6d8800fe141986ef73b3af480d32d775b3ada7
diff --git a/core/conn/jdbc_type2/native/SQLMXCommonFunctions.cpp b/core/conn/jdbc_type2/native/SQLMXCommonFunctions.cpp
index 555eb83..9da7e44 100644
--- a/core/conn/jdbc_type2/native/SQLMXCommonFunctions.cpp
+++ b/core/conn/jdbc_type2/native/SQLMXCommonFunctions.cpp
@@ -2316,6 +2316,34 @@
}
}
+ void throwTransactionException(JNIEnv *jenv, jint err_code)
+ {
+ FUNCTION_ENTRY("throwTransactionException",("jenv=0x%08x, err_code=%ld",
+ jenv, err_code));
+
+ char msg[100];
+
+ if (err_code > 0)
+ {
+ sprintf(msg,"error %d",err_code);
+ throwSQLException(jenv, TMF_ERROR, msg, "HY000", 0);
+ }
+ else
+ {
+ switch (err_code)
+ {
+ case INVALID_TRANSACTION_STATE:
+ throwSQLException(jenv, INCONSISTENT_TRANSACTION_ERROR, NULL, "25000", 0);
+ break;
+ // This exception should never be thrown
+ default:
+ throwSQLException(jenv, PROGRAMMING_ERROR, NULL, "HY000", 0);
+ break;
+ }
+ }
+ FUNCTION_RETURN_VOID((NULL));
+ }
+
BOOL cacheJNIObjects(JNIEnv *jenv)
{
FUNCTION_ENTRY("cacheJNIObjects",("jenv=0x%08x",
diff --git a/core/conn/jdbc_type2/native/SQLMXStatement.cpp b/core/conn/jdbc_type2/native/SQLMXStatement.cpp
index 6e16a2c..7fb2b41 100644
--- a/core/conn/jdbc_type2/native/SQLMXStatement.cpp
+++ b/core/conn/jdbc_type2/native/SQLMXStatement.cpp
@@ -224,6 +224,26 @@
FUNCTION_RETURN_VOID(("RSstmtLabel is NULL"));
}
+ jdbc_SQLSvc_ExecSPJRS_sme_(NULL, NULL,
+ &exception_,
+ dialogueId,
+ nStmtLabel,
+ nRSStmtLabel,
+ EXTERNAL_STMT,
+ (isSelect ? TYPE_SELECT : TYPE_UNKNOWN),
+ (long) resultSet,
+ ResultSetIndex,
+ &outputDesc,
+ &sqlWarning,
+ &RSstmtId,
+ stmtId);
+
+ if (stmtLabel)
+ JNI_ReleaseStringUTFChars(jenv, stmtLabel, nStmtLabel);
+
+ if (RSstmtLabel)
+ JNI_ReleaseStringUTFChars(jenv, RSstmtLabel, nRSStmtLabel);
+
switch (exception_.exception_nr)
{
case CEE_SUCCESS: