summaryrefslogtreecommitdiff
path: root/storage/connect/javaconn.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'storage/connect/javaconn.cpp')
-rw-r--r--storage/connect/javaconn.cpp45
1 files changed, 20 insertions, 25 deletions
diff --git a/storage/connect/javaconn.cpp b/storage/connect/javaconn.cpp
index af5986dad81..364d49f8e7c 100644
--- a/storage/connect/javaconn.cpp
+++ b/storage/connect/javaconn.cpp
@@ -6,24 +6,24 @@
/* This file contains the JAVA connection classes functions. */
/***********************************************************************/
-#if defined(__WIN__)
+#if defined(_WIN32)
// This is needed for RegGetValue
#define _WINVER 0x0601
#undef _WIN32_WINNT
#define _WIN32_WINNT 0x0601
-#endif // __WIN__
+#endif // _WIN32
/***********************************************************************/
/* Include relevant MariaDB header file. */
/***********************************************************************/
#include <my_global.h>
//#include <m_string.h>
-#if defined(__WIN__)
+#if defined(_WIN32)
#include <direct.h> // for getcwd
#if defined(__BORLANDC__)
#define __MFC_COMPAT__ // To define min/max as macro
#endif // __BORLANDC__
-#else // !__WIN__
+#else // !_WIN32
#if defined(UNIX)
#include <errno.h>
#else // !UNIX
@@ -31,7 +31,7 @@
#include <stdio.h>
#include <stdlib.h> // for getenv
#define NODW
-#endif // !__WIN__
+#endif // !_WIN32
/***********************************************************************/
/* Required objects includes. */
@@ -47,9 +47,9 @@
#include "valblk.h"
#include "osutil.h"
-#if defined(__WIN__)
+#if defined(_WIN32)
extern "C" HINSTANCE s_hModule; // Saved module handle
-#endif // __WIN__
+#endif // _WIN32
#define nullptr 0
//TYPCONV GetTypeConv();
@@ -57,6 +57,8 @@ extern "C" HINSTANCE s_hModule; // Saved module handle
extern char *JvmPath; // The connect_jvm_path global variable value
extern char *ClassPath; // The connect_class_path global variable value
+char *GetPluginDir(void);
+char *GetMessageDir(void);
char *GetJavaWrapper(void); // The connect_java_wrapper variable value
extern MYSQL_PLUGIN_IMPORT char lc_messages_dir[FN_REFLEN];
@@ -199,11 +201,11 @@ int JAVAConn::GetMaxValue(int n)
void JAVAConn::ResetJVM(void)
{
if (LibJvm) {
-#if defined(__WIN__)
+#if defined(_WIN32)
FreeLibrary((HMODULE)LibJvm);
-#else // !__WIN__
+#else // !_WIN32
dlclose(LibJvm);
-#endif // !__WIN__
+#endif // !_WIN32
LibJvm = NULL;
CreateJavaVM = NULL;
GetCreatedJavaVMs = NULL;
@@ -226,7 +228,7 @@ bool JAVAConn::GetJVM(PGLOBAL g)
if (!LibJvm) {
char soname[512];
-#if defined(__WIN__)
+#if defined(_WIN32)
for (ntry = 0; !LibJvm && ntry < 3; ntry++) {
if (!ntry && JvmPath) {
strcat(strcpy(soname, JvmPath), "\\jvm.dll");
@@ -294,7 +296,7 @@ bool JAVAConn::GetJVM(PGLOBAL g)
LibJvm = NULL;
#endif // _DEBUG
} // endif LibJvm
-#else // !__WIN__
+#else // !_WIN32
const char *error = NULL;
for (ntry = 0; !LibJvm && ntry < 2; ntry++) {
@@ -335,7 +337,7 @@ bool JAVAConn::GetJVM(PGLOBAL g)
LibJvm = NULL;
#endif // _DEBUG
} // endif LibJvm
-#endif // !__WIN__
+#endif // !_WIN32
} // endif LibJvm
@@ -377,7 +379,7 @@ bool JAVAConn::Open(PGLOBAL g)
char *cp = NULL;
char sep;
-#if defined(__WIN__)
+#if defined(_WIN32)
sep = ';';
#define N 1
//#define N 2
@@ -400,24 +402,17 @@ bool JAVAConn::Open(PGLOBAL g)
jpop->Append(ClassPath);
} // endif ClassPath
-#if 0
- // Java source will be compiled as a jar file installed in the mysql share dir
- jpop->Append(sep);
- jpop->Append(lc_messages_dir);
- jpop->Append("JdbcInterface.jar");
-#endif // 0
-
- // All wrappers are pre-compiled in JavaWrappers.jar in the mysql share dir
+ // All wrappers are pre-compiled in JavaWrappers.jar in the share dir
jpop->Append(sep);
- jpop->Append(lc_messages_dir);
+ jpop->Append(GetMessageDir());
jpop->Append("JavaWrappers.jar");
#if defined(MONGO_SUPPORT)
jpop->Append(sep);
- jpop->Append(lc_messages_dir);
+ jpop->Append(GetMessageDir());
jpop->Append("Mongo3.jar");
jpop->Append(sep);
- jpop->Append(lc_messages_dir);
+ jpop->Append(GetMessageDir());
jpop->Append("Mongo2.jar");
#endif // MONGO_SUPPORT