mariadb/storage/connect/jmgoconn.h
Olivier Bertrand 94e5d7de85 - Add Support of the MongoDB Java Driver.
modified:   storage/connect/CMakeLists.txt
  modified:   storage/connect/JavaWrappers.jar
  modified:   storage/connect/colblk.h
  modified:   storage/connect/filter.cpp
  modified:   storage/connect/filter.h
  modified:   storage/connect/ha_connect.cc
  modified:   storage/connect/ha_connect.h
  modified:   storage/connect/jdbccat.h
  modified:   storage/connect/jdbconn.cpp
  modified:   storage/connect/jdbconn.h
  modified:   storage/connect/mongofam.cpp
  modified:   storage/connect/mongofam.h
  modified:   storage/connect/mycat.cc
  modified:   storage/connect/mycat.h
  modified:   storage/connect/tabext.h
  modified:   storage/connect/tabjdbc.cpp
  modified:   storage/connect/tabjdbc.h
  modified:   storage/connect/tabjson.cpp
  modified:   storage/connect/tabjson.h
  modified:   storage/connect/tabmgo.cpp
  modified:   storage/connect/tabmgo.h
  created:    storage/connect/Mongo2Interface.java
  created:    storage/connect/Mongo3Interface.java
  created:    storage/connect/cmgoconn.cpp
  created:    storage/connect/cmgoconn.h
  created:    storage/connect/javaconn.cpp
  created:    storage/connect/javaconn.h
  created:    storage/connect/jmgfam.cpp
  created:    storage/connect/jmgfam.h
  created:    storage/connect/jmgoconn.cpp
  created:    storage/connect/jmgoconn.h
  created:    storage/connect/mongo.cpp
  created:    storage/connect/mongo.h
  created:    storage/connect/tabjmg.cpp
  created:    storage/connect/tabjmg.h

- tdbp not initialized when catched exception
in CntGetTDB (connect.cc line 188)
  modified:   storage/connect/connect.h

- CheckCleanup should sometimes doing cleanup on pure info
Sometimes MariaDB loops on info to get the size of all tables in a database.
This can sometimes fail by exhausted memory.
CheckCleanup now have a force boolean parameter (defaulting to false)
  modified:   storage/connect/ha_connect.cc
  modified:   storage/connect/user_connect.cc
  modified:   storage/connect/user_connect.h

Change the copyright of some source files
  modified:   storage/connect/connect.cc
  modified:   storage/connect/connect.h
  modified:   storage/connect/engmsg.h
  modified:   storage/connect/global.h
  modified:   storage/connect/ha_connect.cc
  modified:   storage/connect/ha_connect.h
  modified:   storage/connect/msgid.h
  modified:   storage/connect/mycat.cc
  modified:   storage/connect/mycat.h
  modified:   storage/connect/os.h
  modified:   storage/connect/osutil.c
  modified:   storage/connect/osutil.h
  modified:   storage/connect/user_connect.cc
  modified:   storage/connect/user_connect.h
2017-07-02 22:41:11 +02:00

136 lines
4.5 KiB
C++

/***********************************************************************/
/* JMgoConn.h : header file for the MongoDB connection classes. */
/***********************************************************************/
/***********************************************************************/
/* Java interface. */
/***********************************************************************/
#include "javaconn.h"
// Java connection to a MongoDB data source
class TDBJMG;
class JMGCOL;
/***********************************************************************/
/* Include MongoDB library header files. */
/***********************************************************************/
typedef class JNCOL *PJNCOL;
typedef class MGODEF *PMGODEF;
typedef class TDBJMG *PTDBJMG;
typedef class JMGCOL *PJMGCOL;
#if 0
/***********************************************************************/
/* Class used to get the columns of a mongo collection. */
/***********************************************************************/
class MGODISC : public BLOCK {
public:
// Constructor
MGODISC(PGLOBAL g, int *lg);
// Functions
int GetColumns(PGLOBAL g, char *db, PTOS topt);
bool FindInDoc(PGLOBAL g, bson_iter_t *iter, const bson_t *doc,
char *pcn, char *pfmt, int i, int k, bool b);
// Members
BCOL bcol;
PBCOL bcp, fbcp, pbcp;
PMGODEF tdp;
TDBJMG *tmgp;
int *length;
int n, k, lvl;
bool all;
}; // end of MGODISC
#endif // 0
typedef struct JKCOL {
JKCOL *Next;
PJNCOL Jncolp;
PCOL Colp;
char *Key;
int N;
} *PJKC;
/***********************************************************************/
/* Used when inserting values in a MongoDB collection. */
/***********************************************************************/
class JNCOL : public BLOCK {
public:
// Constructor
JNCOL(bool ar) { Klist = NULL; Array = ar; }
// Methods
void AddCol(PGLOBAL g, PCOL colp, PSZ jp);
//Members
PJKC Klist;
bool Array;
}; // end of JNCOL;
/***********************************************************************/
/* JMgoConn class. */
/***********************************************************************/
class JMgoConn : public JAVAConn {
friend class TDBJMG;
//friend class TDBXJDC;
//friend PQRYRES GetColumnInfo(PGLOBAL, char*&, char *, int, PVBLK&);
private:
JMgoConn(); // Standard (unused) constructor
public:
// Constructor
JMgoConn(PGLOBAL g, PCSZ collname, PCSZ wrapper);
// Implementation
public:
virtual void AddJars(PSTRG jpop, char sep);
virtual bool Connect(PJPARM sop);
virtual bool MakeCursor(PGLOBAL g, PTDB tdbp, PCSZ options, PCSZ filter, bool pipe);
// PQRYRES AllocateResult(PGLOBAL g, TDBEXT *tdbp, int n);
// Attributes
public:
// virtual int GetMaxValue(int infotype);
public:
// Operations
virtual int Fetch(int pos = 0);
virtual PSZ GetColumnValue(PSZ name);
int CollSize(PGLOBAL g);
bool FindCollection(PCSZ query, PCSZ proj);
bool AggregateCollection(PCSZ pipeline);
void MakeColumnGroups(PGLOBAL g, PTDB tdbp);
bool GetMethodId(PGLOBAL g, MODE mode);
jobject MakeObject(PGLOBAL g, PCOL colp, bool& error);
jobject MakeDoc(PGLOBAL g, PJNCOL jcp);
int DocWrite(PGLOBAL g);
int DocUpdate(PGLOBAL g, PTDB tdbp);
int DocDelete(PGLOBAL g, bool all);
bool Rewind(void);
PSZ GetDocument(void);
protected:
// Members
PCSZ CollName; // The collation name
jmethodID gcollid; // The GetCollection method ID
jmethodID countid; // The GetCollSize method ID
jmethodID fcollid; // The FindColl method ID
jmethodID acollid; // The AggregateColl method ID
jmethodID readid; // The ReadNext method ID
jmethodID fetchid; // The Fetch method ID
jmethodID rewindid; // The Rewind method ID
jmethodID getdocid; // The GetDoc method ID
jmethodID objfldid; // The ObjectField method ID
jmethodID mkdocid; // The MakeDocument method ID
jmethodID docaddid; // The DocAdd method ID
jmethodID mkarid; // The MakeArray method ID
jmethodID araddid; // The ArrayAdd method ID
jmethodID insertid; // The CollInsert method ID
jmethodID updateid; // The CollUpdate method ID
jmethodID deleteid; // The CollDelete method ID
PJNCOL Fpc; // To JNCOL classes
int m_Fetch;
int m_Version; // Java driver version (2 or 3)
}; // end of JMgoConn class definition