mariadb/storage/connect/javaconn.h
Olivier Bertrand 70e567f576 Squashed commit of connect/10.0:
commit 02d8c21380f
Author: Olivier Bertrand <bertrandop@gmail.com>
Date:   Sat Oct 6 16:27:13 2018 +0200

    - Fix truncating error messages on first unrecognized latin1 character
      modified:   storage/connect/ha_connect.cc

    - Fix MDEV-17343
      Reject multi-table UPDATE/DELETE commands that crash on some systems
      modified:   storage/connect/ha_connect.cc
      modified:   storage/connect/tabext.cpp

    - Try to fix failing tests (MariaDB version 10.0 only)
      modified:   storage/connect/mysql-test/connect/disabled.def

    - Typo
      modified:   storage/connect/global.h

commit f83caed8569
Author: Olivier Bertrand <bertrandop@gmail.com>
Date:   Tue Sep 25 15:49:26 2018 +0200

    - Try to fix failing tests (MariaDB version 10.0 only)
      modified:   storage/connect/mysql-test/connect/disabled.def
      modified:   storage/connect/mysql-test/connect/r/grant2.result
      modified:   storage/connect/mysql-test/connect/r/infoschema2-9739.result
      modified:   storage/connect/mysql-test/connect/r/mysql_exec.result

commit 9fd6f178846
Author: Olivier Bertrand <bertrandop@gmail.com>
Date:   Sun Sep 23 19:45:59 2018 +0200

    - Implement the CHECK TABLE statement and accept REPAIR and ANALYZE
      modified:   storage/connect/connect.cc
      modified:   storage/connect/ha_connect.cc
      modified:   storage/connect/ha_connect.h
      modified:   storage/connect/tabjdbc.cpp
      modified:   storage/connect/tabmysql.cpp
      modified:   storage/connect/tabodbc.cpp

    - MDEV-17212: Test if NumResultCols is implemented by the data source
      modified:   storage/connect/odbconn.cpp

    - Change error type in Optimize
      modified:   storage/connect/ha_connect.cc

    - Update version date
      modified:   storage/connect/ha_connect.cc

    - Record new result from odbc_postgresql.test
      modified:   storage/connect/mysql-test/connect/r/odbc_postgresql.result

commit d8cf51319e1
Author: Olivier Bertrand <bertrandop@gmail.com>
Date:   Wed Aug 8 12:18:52 2018 +0200

    - Comment out failing Cyrillic test in xml2.test
      modified:   storage/connect/mysql-test/connect/r/xml2.result
      modified:   storage/connect/mysql-test/connect/t/xml2.test

commit 9df49e21f9e
Author: Olivier Bertrand <bertrandop@gmail.com>
Date:   Tue Aug 7 15:01:06 2018 +0200

    - Fix MDEV-16672 Connect: Warnings with 10.0
      filamtxt.cpp: DOSFAM::RenameTempFile: Change sprintf to snprintf.
      filamvct.cpp: VECFAM::RenameTempFile: Change sprintf to snprintf.
      javaconn.cpp:
        Add JAVAConn::GetUTFString function.
        Use it instead of env->GetStringUTFChars.
        Fix wrong identation.
      javaconn.h: Add GetUTFString declaration.
      jdbconn.cpp:
        Use GetUTFString function instead of env->GetStringUTFChars.
      jmgoconn.cpp:
        Use GetUTFString function instead of env->GetStringUTFChars.
        Fix wrong identation.
      jsonudf.cpp: change 139 to BMX line 4631.
      tabjmg.cpp:
        Add ReleaseStringUTF.
        Fix wrong identation.
      tabpivot.cpp: Fix wrong identation.
      tabutil.cpp: TDBPRX::GetSubTable: Change sprintf to snprintf.
      modified:   storage/connect/filamtxt.cpp
      modified:   storage/connect/filamvct.cpp
      modified:   storage/connect/javaconn.cpp
      modified:   storage/connect/javaconn.h
      modified:   storage/connect/jdbconn.cpp
      modified:   storage/connect/jmgoconn.cpp
      modified:   storage/connect/jsonudf.cpp
      modified:   storage/connect/tabjmg.cpp
      modified:   storage/connect/tabpivot.cpp
      modified:   storage/connect/tabutil.cpp

    - Fix MDEV-16895 CONNECT engine's get_error_message can cause buffer
                     overflow and server crash with long queries
      ha_connect_cc: Update version.
        get_error_message: Remove charset conversion.
      modified:   storage/connect/ha_connect.cc

    - Fix a server crash on inserting bigint to a JDBC table
      JDBConn::SetUUID:
        Suppress check on ctyp that causes a server crash because ctyp
        can be negative and this triggers an DEBUG_ASSERT on return.
      modified:   storage/connect/jdbconn.cpp

    - Delete an assert(qrp) from JCATPARM *AllocCatInfo that is called with
      qrp=NULL from JDBConn::SetUUID. Also delete a clone of this function
      that was duplicated in javaconn.cpp.
      modified:   storage/connect/javaconn.cpp
      modified:   storage/connect/jdbconn.cpp

    - Update some disabled tests and results to avoid failure
      modified:   storage/connect/mysql-test/connect/r/jdbc.result
      modified:   storage/connect/mysql-test/connect/r/json_java_2.result
      modified:   storage/connect/mysql-test/connect/r/json_java_3.result
      modified:   storage/connect/mysql-test/connect/r/mongo_java_2.result
      modified:   storage/connect/mysql-test/connect/r/mongo_java_3.result
      modified:   storage/connect/mysql-test/connect/t/json_java_2.test
      modified:   storage/connect/mysql-test/connect/t/json_java_3.test
      modified:   storage/connect/mysql-test/connect/t/mongo_java_2.test
      modified:   storage/connect/mysql-test/connect/t/mongo_java_3.test

commit 415273eb193
Author: Olivier Bertrand <bertrandop@gmail.com>
Date:   Thu Jun 28 19:37:49 2018 +0200

    - Fix MDEV-16167 Cannot insert unsigned values into a VEC table
      modified:   storage/connect/filamvct.cpp
      modified:   storage/connect/tabvct.cpp

commit 9ffcb68a9f2
Author: Olivier Bertrand <bertrandop@gmail.com>
Date:   Mon May 7 22:43:43 2018 +0200

    - Fix MDEV-15735 CONNECT [filamtxt.cpp:429]: Suspicious condition
      modified:   storage/connect/filamtxt.cpp

    - Fix compiler warnings
      modified:   storage/connect/domdoc.cpp
      modified:   storage/connect/ha_connect.cc
      modified:   storage/connect/json.h
      modified:   storage/connect/jsonudf.cpp
      modified:   storage/connect/tabext.cpp
      modified:   storage/connect/tabjson.cpp
      modified:   storage/connect/tabjson.h

    - Miscelleanous from 10.3
      modified:   storage/connect/ha_connect.cc
      modified:   storage/connect/mycat.cc
      modified:   storage/connect/user_connect.cc
2018-10-28 10:41:31 +01:00

130 lines
4.6 KiB
C++

/***********************************************************************/
/* JavaConn.h : header file for the Java connection classes. */
/***********************************************************************/
/***********************************************************************/
/* Included C-definition files required by the interface. */
/***********************************************************************/
#include "block.h"
#include "jdbccat.h"
/***********************************************************************/
/* Java native interface. */
/***********************************************************************/
#include <jni.h>
/***********************************************************************/
/* Constants and defines. */
/***********************************************************************/
// Miscellaneous sizing info
#define MAX_NUM_OF_MSG 10 // Max number of error messages
//efine MAX_CURRENCY 30 // Max size of Currency($) string
#define MAX_TNAME_LEN 32 // Max size of table names
//efine MAX_FNAME_LEN 256 // Max size of field names
//efine MAX_STRING_INFO 256 // Max size of string from SQLGetInfo
//efine MAX_DNAME_LEN 256 // Max size of Recordset names
//efine MAX_CONNECT_LEN 512 // Max size of Connect string
//efine MAX_CURSOR_NAME 18 // Max size of a cursor name
//efine DEFAULT_FIELD_TYPE 0 // TYPE_NULL
#if !defined(__WIN__)
typedef unsigned char *PUCHAR;
#endif // !__WIN__
enum JCATINFO {
JCAT_TAB = 1, // JDBC Tables
JCAT_COL = 2, // JDBC Columns
JCAT_KEY = 3, // JDBC PrimaryKeys
};
/***********************************************************************/
/* This structure is used to control the catalog functions. */
/***********************************************************************/
typedef struct tagJCATPARM {
JCATINFO Id; // Id to indicate function
PQRYRES Qrp; // Result set pointer
PCSZ DB; // Database (Schema)
PCSZ Tab; // Table name or pattern
PCSZ Pat; // Table type or column pattern
} JCATPARM;
typedef jint(JNICALL *CRTJVM) (JavaVM **, void **, void *);
typedef jint(JNICALL *GETJVM) (JavaVM **, jsize, jsize *);
#if defined(_DEBUG)
typedef jint(JNICALL *GETDEF) (void *);
#endif // _DEBUG
//class JAVAConn;
/***********************************************************************/
/* JAVAConn class. */
/***********************************************************************/
class DllExport JAVAConn : public BLOCK {
friend class TDBJMG;
friend class JMGDISC;
private:
JAVAConn(); // Standard (unused) constructor
public:
// Constructor
JAVAConn(PGLOBAL g, PCSZ wrapper);
// Set static variables
static void SetJVM(void) {
LibJvm = NULL;
CreateJavaVM = NULL;
GetCreatedJavaVMs = NULL;
#if defined(_DEBUG)
GetDefaultJavaVMInitArgs = NULL;
#endif // _DEBUG
} // end of SetJVM
static void ResetJVM(void);
static bool GetJVM(PGLOBAL g);
// Implementation
public:
//virtual ~JAVAConn();
bool IsOpen(void) { return m_Opened; }
bool IsConnected(void) { return m_Connected; }
// Java operations
protected:
char *GetUTFString(jstring s);
bool gmID(PGLOBAL g, jmethodID& mid, const char *name, const char *sig);
bool Check(jint rc = 0);
public:
virtual void AddJars(PSTRG jpop, char sep) = 0;
virtual bool Connect(PJPARM sop) = 0;
virtual bool Open(PGLOBAL g);
virtual bool MakeCursor(PGLOBAL g, PTDB tdbp, PCSZ options,
PCSZ filter, bool pipe) = 0;
virtual void Close(void);
protected:
// Members
#if defined(__WIN__)
static HANDLE LibJvm; // Handle to the jvm DLL
#else // !__WIN__
static void *LibJvm; // Handle for the jvm shared library
#endif // !__WIN__
static CRTJVM CreateJavaVM;
static GETJVM GetCreatedJavaVMs;
#if defined(_DEBUG)
static GETDEF GetDefaultJavaVMInitArgs;
#endif // _DEBUG
PGLOBAL m_G;
JavaVM *jvm; // Pointer to the JVM (Java Virtual Machine)
JNIEnv *env; // Pointer to native interface
jclass jdi; // Pointer to the java wrapper class
jobject job; // The java wrapper class object
jmethodID errid; // The GetErrmsg method ID
PFBLOCK fp;
bool m_Opened;
bool m_Connected;
PCSZ DiscFunc;
PCSZ Msg;
PCSZ m_Wrap;
int m_Rows;
}; // end of JAVAConn class definition