diff options
author | Sergei Golubchik <serg@mariadb.org> | 2018-10-30 13:02:59 +0100 |
---|---|---|
committer | Sergei Golubchik <serg@mariadb.org> | 2018-10-30 15:10:01 +0100 |
commit | 44f6f445933e12cbc4cce63e2b7d983b9938d3b9 (patch) | |
tree | f5230fb24510bb201eb33122a62939ce74588b83 /storage/connect/javaconn.cpp | |
parent | 8772824ce72a811ea92dd5cfb73602eb93237891 (diff) | |
parent | f4b8b6b9a3ad4ce5e5218e2ec2dfe6dd34112e45 (diff) | |
download | mariadb-git-44f6f445933e12cbc4cce63e2b7d983b9938d3b9.tar.gz |
Merge branch '10.0' into 10.1
Diffstat (limited to 'storage/connect/javaconn.cpp')
-rw-r--r-- | storage/connect/javaconn.cpp | 41 |
1 files changed, 13 insertions, 28 deletions
diff --git a/storage/connect/javaconn.cpp b/storage/connect/javaconn.cpp index ec10b125737..f919344f20b 100644 --- a/storage/connect/javaconn.cpp +++ b/storage/connect/javaconn.cpp @@ -82,29 +82,6 @@ GETDEF JAVAConn::GetDefaultJavaVMInitArgs = NULL; #endif // !_DEBUG /***********************************************************************/ -/* Allocate the structure used to refer to the result set. */ -/***********************************************************************/ -static JCATPARM *AllocCatInfo(PGLOBAL g, JCATINFO fid, PCSZ db, - PCSZ tab, PQRYRES qrp) -{ - JCATPARM *cap; - -#if defined(_DEBUG) - assert(qrp); -#endif - - if ((cap = (JCATPARM *)PlgDBSubAlloc(g, NULL, sizeof(JCATPARM)))) { - memset(cap, 0, sizeof(JCATPARM)); - cap->Id = fid; - cap->Qrp = qrp; - cap->DB = db; - cap->Tab = tab; - } // endif cap - - return cap; -} // end of AllocCatInfo - -/***********************************************************************/ /* JAVAConn construction/destruction. */ /***********************************************************************/ JAVAConn::JAVAConn(PGLOBAL g, PCSZ wrapper) @@ -138,6 +115,16 @@ JAVAConn::JAVAConn(PGLOBAL g, PCSZ wrapper) // EndCom(); // } // end of ~JAVAConn +char *JAVAConn::GetUTFString(jstring s) +{ + char *str; + const char *utf = env->GetStringUTFChars(s, nullptr); + + str = PlugDup(m_G, utf); + env->ReleaseStringUTFChars(s, utf); + env->DeleteLocalRef(s); + return str; +} // end of GetUTFString /***********************************************************************/ /* Screen for errors. */ @@ -152,17 +139,15 @@ bool JAVAConn::Check(jint rc) "toString", "()Ljava/lang/String;"); if (exc != nullptr && tid != nullptr) { - jstring s = (jstring)env->CallObjectMethod(exc, tid); - const char *utf = env->GetStringUTFChars(s, NULL); - env->DeleteLocalRef(s); - Msg = PlugDup(m_G, utf); + s = (jstring)env->CallObjectMethod(exc, tid); + Msg = GetUTFString(s); } else Msg = "Exception occured"; env->ExceptionClear(); } else if (rc < 0) { s = (jstring)env->CallObjectMethod(job, errid); - Msg = (char*)env->GetStringUTFChars(s, NULL); + Msg = GetUTFString(s); } else Msg = NULL; |