Commit b2956b2a authored by Olivier Bertrand's avatar Olivier Bertrand

Update version number and date

  modified:   storage/connect/ha_connect.cc

Add conditional SE exception support
  modified:   storage/connect/json.cpp
  modified:   storage/connect/plgdbutl.cpp

Change %p in %x in some sprintf functions.
This to avoid some compiler warnings.
  modified:   storage/connect/tabwmi.cpp
  modified:   storage/connect/tabxml.cpp
  modified:   storage/connect/value.h

Add JavaWrappers.jar to the class path
  modified:   storage/connect/jdbconn.cpp

Fix wrong declare (char *buf[256]; --> char  buf[256];)
  modified:   storage/connect/xindex.cpp
parent d75e5e6e
...@@ -172,9 +172,9 @@ ...@@ -172,9 +172,9 @@
#define JSONMAX 10 // JSON Default max grp size #define JSONMAX 10 // JSON Default max grp size
extern "C" { extern "C" {
char version[]= "Version 1.05.0002 January 08, 2017"; char version[]= "Version 1.05.0003 February 27, 2017";
#if defined(__WIN__) #if defined(__WIN__)
char compver[]= "Version 1.05.0002 " __DATE__ " " __TIME__; char compver[]= "Version 1.05.0003 " __DATE__ " " __TIME__;
char slash= '\\'; char slash= '\\';
#else // !__WIN__ #else // !__WIN__
char slash= '/'; char slash= '/';
...@@ -7045,10 +7045,10 @@ maria_declare_plugin(connect) ...@@ -7045,10 +7045,10 @@ maria_declare_plugin(connect)
PLUGIN_LICENSE_GPL, PLUGIN_LICENSE_GPL,
connect_init_func, /* Plugin Init */ connect_init_func, /* Plugin Init */
connect_done_func, /* Plugin Deinit */ connect_done_func, /* Plugin Deinit */
0x0104, /* version number (1.04) */ 0x0105, /* version number (1.05) */
NULL, /* status variables */ NULL, /* status variables */
connect_system_variables, /* system variables */ connect_system_variables, /* system variables */
"1.05.0001", /* string version */ "1.05.0003", /* string version */
MariaDB_PLUGIN_MATURITY_GAMMA /* maturity */ MariaDB_PLUGIN_MATURITY_GAMMA /* maturity */
} }
maria_declare_plugin_end; maria_declare_plugin_end;
...@@ -826,6 +826,11 @@ int JDBConn::Open(PJPARM sop) ...@@ -826,6 +826,11 @@ int JDBConn::Open(PJPARM sop)
jpop->Append(GetPluginDir()); jpop->Append(GetPluginDir());
jpop->Append("JdbcInterface.jar"); jpop->Append("JdbcInterface.jar");
// All wrappers are pre-compiled in JavaWrappers.jar in the plugin dir
jpop->Append(sep);
jpop->Append(GetPluginDir());
jpop->Append("JavaWrappers.jar");
//================== prepare loading of Java VM ============================ //================== prepare loading of Java VM ============================
JavaVMInitArgs vm_args; // Initialization arguments JavaVMInitArgs vm_args; // Initialization arguments
JavaVMOption* options = new JavaVMOption[N]; // JVM invocation options JavaVMOption* options = new JavaVMOption[N]; // JVM invocation options
......
/*************** json CPP Declares Source Code File (.H) ***************/ /*************** json CPP Declares Source Code File (.H) ***************/
/* Name: json.cpp Version 1.2 */ /* Name: json.cpp Version 1.3 */
/* */ /* */
/* (C) Copyright to the author Olivier BERTRAND 2014 - 2015 */ /* (C) Copyright to the author Olivier BERTRAND 2014 - 2017 */
/* */ /* */
/* This file contains the JSON classes functions. */ /* This file contains the JSON classes functions. */
/***********************************************************************/ /***********************************************************************/
...@@ -27,8 +27,33 @@ ...@@ -27,8 +27,33 @@
#define EL "\r\n" #define EL "\r\n"
#else #else
#define EL "\n" #define EL "\n"
#undef SE_CATCH // Does not work for Linux
#endif #endif
#if defined(SE_CATCH)
/**************************************************************************/
/* This is the support of catching C interrupts to prevent crashes. */
/**************************************************************************/
#include <eh.h>
class SE_Exception {
public:
SE_Exception(unsigned int n, PEXCEPTION_RECORD p) : nSE(n), eRec(p) {}
~SE_Exception() {}
unsigned int nSE;
PEXCEPTION_RECORD eRec;
}; // end of class SE_Exception
void trans_func(unsigned int u, _EXCEPTION_POINTERS* pExp)
{
throw SE_Exception(u, pExp->ExceptionRecord);
} // end of trans_func
char *GetExceptionDesc(PGLOBAL g, unsigned int e);
#endif // SE_CATCH
/***********************************************************************/ /***********************************************************************/
/* Parse a json string. */ /* Parse a json string. */
/* Note: when pretty is not known, the caller set pretty to 3. */ /* Note: when pretty is not known, the caller set pretty to 3. */
...@@ -40,6 +65,9 @@ PJSON ParseJson(PGLOBAL g, char *s, int len, int *ptyp, bool *comma) ...@@ -40,6 +65,9 @@ PJSON ParseJson(PGLOBAL g, char *s, int len, int *ptyp, bool *comma)
PJSON jsp = NULL; PJSON jsp = NULL;
STRG src; STRG src;
if (trace)
htrc("ParseJson: s=%.10s len=%d\n", s, len);
if (!s || !len) { if (!s || !len) {
strcpy(g->Message, "Void JSON object"); strcpy(g->Message, "Void JSON object");
return NULL; return NULL;
...@@ -53,16 +81,38 @@ PJSON ParseJson(PGLOBAL g, char *s, int len, int *ptyp, bool *comma) ...@@ -53,16 +81,38 @@ PJSON ParseJson(PGLOBAL g, char *s, int len, int *ptyp, bool *comma)
if (s[0] == '[' && (s[1] == '\n' || (s[1] == '\r' && s[2] == '\n'))) if (s[0] == '[' && (s[1] == '\n' || (s[1] == '\r' && s[2] == '\n')))
pty[0] = false; pty[0] = false;
// Save stack and allocation environment and prepare error return // Save stack and allocation environment and prepare error return
if (g->jump_level == MAX_JUMP) { if (g->jump_level == MAX_JUMP) {
strcpy(g->Message, MSG(TOO_MANY_JUMPS)); strcpy(g->Message, MSG(TOO_MANY_JUMPS));
return NULL; return NULL;
} // endif jump_level } // endif jump_level
if ((rc= setjmp(g->jumper[++g->jump_level])) != 0) { #if defined(SE_CATCH)
// Let's try to recover from any kind of interrupt
_se_translator_function f = _set_se_translator(trans_func);
try {
#endif // SE_CATCH --------------------- try section --------------------
if ((rc = setjmp(g->jumper[++g->jump_level])) != 0) {
goto err; goto err;
} // endif rc } // endif rc
#if defined(SE_CATCH) // ------------- end of try section -----------------
} catch (SE_Exception e) {
sprintf(g->Message, "ParseJson: exception doing setjmp: %s (rc=%hd)",
GetExceptionDesc(g, e.nSE), e.nSE);
_set_se_translator(f);
goto err;
} catch (...) {
strcpy(g->Message, "Exception doing setjmp");
_set_se_translator(f);
goto err;
} // end of try-catches
_set_se_translator(f);
#endif // SE_CATCH
for (i = 0; i < len; i++) for (i = 0; i < len; i++)
switch (s[i]) { switch (s[i]) {
case '[': case '[':
......
/********** PlgDBUtl Fpe C++ Program Source Code File (.CPP) ***********/ /********** PlgDBUtl Fpe C++ Program Source Code File (.CPP) ***********/
/* PROGRAM NAME: PLGDBUTL */ /* PROGRAM NAME: PLGDBUTL */
/* ------------- */ /* ------------- */
/* Version 3.9 */ /* Version 4.0 */
/* */ /* */
/* COPYRIGHT: */ /* COPYRIGHT: */
/* ---------- */ /* ---------- */
/* (C) Copyright to the author Olivier BERTRAND 1998-2016 */ /* (C) Copyright to the author Olivier BERTRAND 1998-2017 */
/* */ /* */
/* WHAT THIS PROGRAM DOES: */ /* WHAT THIS PROGRAM DOES: */
/* ----------------------- */ /* ----------------------- */
...@@ -1123,7 +1123,7 @@ char *GetAmName(PGLOBAL g, AMT am, void *memp) ...@@ -1123,7 +1123,7 @@ char *GetAmName(PGLOBAL g, AMT am, void *memp)
return amn; return amn;
} // end of GetAmName } // end of GetAmName
#if defined(__WIN__) && !defined(NOCATCH) #if defined(SE_CATCH)
/***********************************************************************/ /***********************************************************************/
/* GetExceptionDesc: return the description of an exception code. */ /* GetExceptionDesc: return the description of an exception code. */
/***********************************************************************/ /***********************************************************************/
...@@ -1211,7 +1211,7 @@ char *GetExceptionDesc(PGLOBAL g, unsigned int e) ...@@ -1211,7 +1211,7 @@ char *GetExceptionDesc(PGLOBAL g, unsigned int e)
return p; return p;
} // end of GetExceptionDesc } // end of GetExceptionDesc
#endif // __WIN__ && !NOCATCH #endif // SE_CATCH
/***********************************************************************/ /***********************************************************************/
/* PlgDBalloc: allocates or suballocates memory conditionally. */ /* PlgDBalloc: allocates or suballocates memory conditionally. */
......
...@@ -134,7 +134,7 @@ class TDBDIR : public TDBASE { ...@@ -134,7 +134,7 @@ class TDBDIR : public TDBASE {
int iFile; // Index of currently retrieved file int iFile; // Index of currently retrieved file
#if defined(__WIN__) #if defined(__WIN__)
_finddata_t FileData; // Find data structure _finddata_t FileData; // Find data structure
int Hsearch; // Search handle intptr_t Hsearch; // Search handle
char Drive[_MAX_DRIVE]; // Drive name char Drive[_MAX_DRIVE]; // Drive name
#else // !__WIN__ #else // !__WIN__
struct stat Fileinfo; // File info structure struct stat Fileinfo; // File info structure
...@@ -184,7 +184,7 @@ class TDBSDR : public TDBDIR { ...@@ -184,7 +184,7 @@ class TDBSDR : public TDBDIR {
struct _Sub_Dir *Next; struct _Sub_Dir *Next;
struct _Sub_Dir *Prev; struct _Sub_Dir *Prev;
#if defined(__WIN__) #if defined(__WIN__)
int H; // Search handle intptr_t H; // Search handle
#else // !__WIN__ #else // !__WIN__
DIR *D; DIR *D;
#endif // !__WIN__ #endif // !__WIN__
......
...@@ -63,7 +63,7 @@ PWMIUT InitWMI(PGLOBAL g, char *nsp, char *classname) ...@@ -63,7 +63,7 @@ PWMIUT InitWMI(PGLOBAL g, char *nsp, char *classname)
if (FAILED(res)) { if (FAILED(res)) {
sprintf(g->Message, "Failed to initialize COM library. " sprintf(g->Message, "Failed to initialize COM library. "
"Error code = %p", res); "Error code = %x", res);
return NULL; return NULL;
} // endif res } // endif res
...@@ -86,7 +86,7 @@ PWMIUT InitWMI(PGLOBAL g, char *nsp, char *classname) ...@@ -86,7 +86,7 @@ PWMIUT InitWMI(PGLOBAL g, char *nsp, char *classname)
(void**) &loc); (void**) &loc);
if (FAILED(res)) { if (FAILED(res)) {
sprintf(g->Message, "Failed to create Locator. " sprintf(g->Message, "Failed to create Locator. "
"Error code = %p", res); "Error code = %x", res);
CoUninitialize(); CoUninitialize();
return NULL; return NULL;
} // endif res } // endif res
...@@ -95,7 +95,7 @@ PWMIUT InitWMI(PGLOBAL g, char *nsp, char *classname) ...@@ -95,7 +95,7 @@ PWMIUT InitWMI(PGLOBAL g, char *nsp, char *classname)
NULL, NULL, NULL, 0, NULL, NULL, &wp->Svc); NULL, NULL, NULL, 0, NULL, NULL, &wp->Svc);
if (FAILED(res)) { if (FAILED(res)) {
sprintf(g->Message, "Could not connect. Error code = %p", res); sprintf(g->Message, "Could not connect. Error code = %x", res);
loc->Release(); loc->Release();
CoUninitialize(); CoUninitialize();
return NULL; return NULL;
...@@ -424,7 +424,7 @@ bool TDBWMI::Initialize(PGLOBAL g) ...@@ -424,7 +424,7 @@ bool TDBWMI::Initialize(PGLOBAL g)
if (FAILED(Res)) { if (FAILED(Res)) {
sprintf(g->Message, "Failed to initialize COM library. " sprintf(g->Message, "Failed to initialize COM library. "
"Error code = %p", Res); "Error code = %x", Res);
return true; // Program has failed. return true; // Program has failed.
} // endif Res } // endif Res
...@@ -437,7 +437,7 @@ bool TDBWMI::Initialize(PGLOBAL g) ...@@ -437,7 +437,7 @@ bool TDBWMI::Initialize(PGLOBAL g)
if (FAILED(Res)) { if (FAILED(Res)) {
sprintf(g->Message, "Failed to create Locator. " sprintf(g->Message, "Failed to create Locator. "
"Error code = %p", Res); "Error code = %x", Res);
CoUninitialize(); CoUninitialize();
return true; // Program has failed. return true; // Program has failed.
} // endif Res } // endif Res
...@@ -449,7 +449,7 @@ bool TDBWMI::Initialize(PGLOBAL g) ...@@ -449,7 +449,7 @@ bool TDBWMI::Initialize(PGLOBAL g)
NULL, NULL,0, NULL, 0, 0, &Svc); NULL, NULL,0, NULL, 0, 0, &Svc);
if (FAILED(Res)) { if (FAILED(Res)) {
sprintf(g->Message, "Could not connect. Error code = %p", Res); sprintf(g->Message, "Could not connect. Error code = %x", Res);
loc->Release(); loc->Release();
CoUninitialize(); CoUninitialize();
return true; // Program has failed. return true; // Program has failed.
...@@ -464,7 +464,7 @@ bool TDBWMI::Initialize(PGLOBAL g) ...@@ -464,7 +464,7 @@ bool TDBWMI::Initialize(PGLOBAL g)
RPC_C_IMP_LEVEL_IMPERSONATE, NULL, EOAC_NONE); RPC_C_IMP_LEVEL_IMPERSONATE, NULL, EOAC_NONE);
if (FAILED(Res)) { if (FAILED(Res)) {
sprintf(g->Message, "Could not set proxy. Error code = 0x", Res); sprintf(g->Message, "Could not set proxy. Error code = %x", Res);
Svc->Release(); Svc->Release();
CoUninitialize(); CoUninitialize();
return true; // Program has failed. return true; // Program has failed.
...@@ -574,7 +574,7 @@ bool TDBWMI::GetWMIInfo(PGLOBAL g) ...@@ -574,7 +574,7 @@ bool TDBWMI::GetWMIInfo(PGLOBAL g)
NULL, &Enumerator); NULL, &Enumerator);
if (FAILED(Rc)) { if (FAILED(Rc)) {
sprintf(g->Message, "Query %s failed. Error code = %p", cmd, Rc); sprintf(g->Message, "Query %s failed. Error code = %x", cmd, Rc);
Svc->Release(); Svc->Release();
CoUninitialize(); CoUninitialize();
return true; // Program has failed. return true; // Program has failed.
......
...@@ -931,7 +931,7 @@ bool TDBXML::Initialize(PGLOBAL g) ...@@ -931,7 +931,7 @@ bool TDBXML::Initialize(PGLOBAL g)
if (rc) if (rc)
sprintf(g->Message, "%s: %s", MSG(COM_ERROR), buf); sprintf(g->Message, "%s: %s", MSG(COM_ERROR), buf);
else else
sprintf(g->Message, "%s hr=%p", MSG(COM_ERROR), e.Error()); sprintf(g->Message, "%s hr=%x", MSG(COM_ERROR), e.Error());
goto error; goto error;
#endif // __WIN__ #endif // __WIN__
......
...@@ -271,7 +271,7 @@ class DllExport TYPVAL<PSZ>: public VALUE { ...@@ -271,7 +271,7 @@ class DllExport TYPVAL<PSZ>: public VALUE {
virtual void Reset(void) {*Strp = 0;} virtual void Reset(void) {*Strp = 0;}
virtual int GetValLen(void) {return Len;}; virtual int GetValLen(void) {return Len;};
virtual int GetValPrec() {return (Ci) ? 1 : 0;} virtual int GetValPrec() {return (Ci) ? 1 : 0;}
virtual int GetSize(void) {return (Strp) ? strlen(Strp) : 0;} virtual int GetSize(void) {return (Strp) ? (int)strlen(Strp) : 0;}
virtual PSZ GetCharValue(void) {return Strp;} virtual PSZ GetCharValue(void) {return Strp;}
virtual char GetTinyValue(void); virtual char GetTinyValue(void);
virtual uchar GetUTinyValue(void); virtual uchar GetUTinyValue(void);
......
...@@ -2738,7 +2738,7 @@ bool XHUGE::Read(PGLOBAL g, void *buf, int n, int size) ...@@ -2738,7 +2738,7 @@ bool XHUGE::Read(PGLOBAL g, void *buf, int n, int size)
} // endif nbr } // endif nbr
} else { } else {
char *buf[256]; char buf[256];
DWORD drc = GetLastError(); DWORD drc = GetLastError();
FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM | FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM |
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment