Commit 025decfc authored by Olivier Bertrand's avatar Olivier Bertrand

- Remove gcc compiling errors and warnings

  modified:   storage/connect/jdbconn.cpp
  modified:   storage/connect/tabjdbc.h
parent 80a204f2
...@@ -47,7 +47,9 @@ ...@@ -47,7 +47,9 @@
#if defined(__WIN__) #if defined(__WIN__)
extern "C" HINSTANCE s_hModule; // Saved module handle extern "C" HINSTANCE s_hModule; // Saved module handle
#endif // __WIN__ #else // !__WIN__
#define nullptr 0
#endif // !__WIN__
int GetConvSize(); int GetConvSize();
...@@ -62,6 +64,9 @@ int GetConvSize(); ...@@ -62,6 +64,9 @@ int GetConvSize();
#define DEBUG_ONLY(f) ((void)0) #define DEBUG_ONLY(f) ((void)0)
#endif // !_DEBUG #endif // !_DEBUG
// To avoid gcc warning
int TranslateJDBCType(int stp, int prec, int& len, char& v);
/***********************************************************************/ /***********************************************************************/
/* GetJDBCType: returns the SQL_TYPE corresponding to a PLG type. */ /* GetJDBCType: returns the SQL_TYPE corresponding to a PLG type. */
/***********************************************************************/ /***********************************************************************/
...@@ -155,7 +160,7 @@ int TranslateJDBCType(int stp, int prec, int& len, char& v) ...@@ -155,7 +160,7 @@ int TranslateJDBCType(int stp, int prec, int& len, char& v)
static JCATPARM *AllocCatInfo(PGLOBAL g, JCATINFO fid, char *db, static JCATPARM *AllocCatInfo(PGLOBAL g, JCATINFO fid, char *db,
char *tab, PQRYRES qrp) char *tab, PQRYRES qrp)
{ {
size_t m, n; //size_t m, n;
JCATPARM *cap; JCATPARM *cap;
#if defined(_DEBUG) #if defined(_DEBUG)
...@@ -174,8 +179,8 @@ static JCATPARM *AllocCatInfo(PGLOBAL g, JCATINFO fid, char *db, ...@@ -174,8 +179,8 @@ static JCATPARM *AllocCatInfo(PGLOBAL g, JCATINFO fid, char *db,
goto fin; goto fin;
} // endif rc } // endif rc
m = (size_t)qrp->Maxres; //m = (size_t)qrp->Maxres;
n = (size_t)qrp->Nbcol; //n = (size_t)qrp->Nbcol;
cap = (JCATPARM *)PlugSubAlloc(g, NULL, sizeof(JCATPARM)); cap = (JCATPARM *)PlugSubAlloc(g, NULL, sizeof(JCATPARM));
memset(cap, 0, sizeof(JCATPARM)); memset(cap, 0, sizeof(JCATPARM));
cap->Id = fid; cap->Id = fid;
...@@ -1157,10 +1162,12 @@ void JDBConn::Close() ...@@ -1157,10 +1162,12 @@ void JDBConn::Close()
if (did == nullptr) if (did == nullptr)
printf("ERROR: method JdbcDisconnect() not found !"); printf("ERROR: method JdbcDisconnect() not found !");
else else if ((rc = env->CallIntMethod(job, did)))
rc = env->CallIntMethod(job, did); printf("jdbcDisconnect: rc=%d", (int)rc);
if ((rc = jvm->DetachCurrentThread()))
printf("DetachCurrentThread: rc = %d", (int)rc);
rc = jvm->DetachCurrentThread();
//rc = jvm->DestroyJavaVM(); //rc = jvm->DestroyJavaVM();
m_Opened = false; m_Opened = false;
} // endif m_Opened } // endif m_Opened
...@@ -1687,8 +1694,8 @@ bool JDBConn::SetParam(JDBCCOL *colp) ...@@ -1687,8 +1694,8 @@ bool JDBConn::SetParam(JDBCCOL *colp)
int len, qcol = 5; int len, qcol = 5;
PQRYRES qrp = NULL; PQRYRES qrp = NULL;
PCOLRES crp; PCOLRES crp;
USHORT i; ushort i;
jint *n; jint *n = nullptr;
jstring label; jstring label;
jmethodID colid; jmethodID colid;
int rc = ExecSQLcommand(src); int rc = ExecSQLcommand(src);
...@@ -1872,7 +1879,7 @@ bool JDBConn::SetParam(JDBCCOL *colp) ...@@ -1872,7 +1879,7 @@ bool JDBConn::SetParam(JDBCCOL *colp)
int JDBConn::GetCatInfo(JCATPARM *cap) int JDBConn::GetCatInfo(JCATPARM *cap)
{ {
PGLOBAL& g = m_G; PGLOBAL& g = m_G;
void *buffer; // void *buffer;
int i; int i;
PSZ fnc = "Unknown"; PSZ fnc = "Unknown";
uint n, ncol; uint n, ncol;
...@@ -1946,7 +1953,7 @@ bool JDBConn::SetParam(JDBCCOL *colp) ...@@ -1946,7 +1953,7 @@ bool JDBConn::SetParam(JDBCCOL *colp)
env->DeleteLocalRef(parms); env->DeleteLocalRef(parms);
// n because we no more ignore the first column // n because we no more ignore the first column
if ((n = qrp->Nbcol) > (int)ncol) { if ((n = qrp->Nbcol) > (uint)ncol) {
strcpy(g->Message, MSG(COL_NUM_MISM)); strcpy(g->Message, MSG(COL_NUM_MISM));
return -1; return -1;
} // endif n } // endif n
...@@ -1972,9 +1979,10 @@ bool JDBConn::SetParam(JDBCCOL *colp) ...@@ -1972,9 +1979,10 @@ bool JDBConn::SetParam(JDBCCOL *colp)
if (crp->Type == TYPE_STRING) { if (crp->Type == TYPE_STRING) {
pbuf[n] = (char*)PlugSubAlloc(g, NULL, len); pbuf[n] = (char*)PlugSubAlloc(g, NULL, len);
buffer = pbuf[n]; // buffer = pbuf[n];
} else } // endif Type
buffer = pval[n]->GetTo_Val(); // } else
// buffer = pval[n]->GetTo_Val();
n++; n++;
} // endfor n } // endfor n
......
...@@ -73,7 +73,7 @@ class DllExport JDBCDEF : public TABDEF { /* Logical table description */ ...@@ -73,7 +73,7 @@ class DllExport JDBCDEF : public TABDEF { /* Logical table description */
}; // end of JDBCDEF }; // end of JDBCDEF
#if !defined(NJDBC) #if !defined(NJDBC)
#include "JDBConn.h" #include "jdbconn.h"
/***********************************************************************/ /***********************************************************************/
/* This is the JDBC Access Method class declaration for files from */ /* This is the JDBC Access Method class declaration for files from */
......
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