mirror of
https://github.com/MariaDB/server.git
synced 2025-08-08 11:22:35 +03:00
- 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
This commit is contained in:
99
storage/connect/mongo.cpp
Normal file
99
storage/connect/mongo.cpp
Normal file
@@ -0,0 +1,99 @@
|
||||
/************** mongo C++ Program Source Code File (.CPP) **************/
|
||||
/* PROGRAM NAME: mongo Version 1.0 */
|
||||
/* (C) Copyright to the author Olivier BERTRAND 2017 */
|
||||
/* These programs are the MGODEF class execution routines. */
|
||||
/***********************************************************************/
|
||||
|
||||
/***********************************************************************/
|
||||
/* Include relevant sections of the MariaDB header file. */
|
||||
/***********************************************************************/
|
||||
#include <my_global.h>
|
||||
|
||||
/***********************************************************************/
|
||||
/* Include application header files: */
|
||||
/* global.h is header containing all global declarations. */
|
||||
/* plgdbsem.h is header containing the DB application declarations. */
|
||||
/***********************************************************************/
|
||||
#include "global.h"
|
||||
#include "plgdbsem.h"
|
||||
#include "xtable.h"
|
||||
#include "tabext.h"
|
||||
#if defined(MONGO_SUPPORT)
|
||||
#include "tabmgo.h"
|
||||
#endif // MONGO_SUPPORT
|
||||
#if defined(JDBC_SUPPORT)
|
||||
#include "tabjmg.h"
|
||||
#endif // JDBC_SUPPORT
|
||||
|
||||
/* -------------------------- Class MGODEF --------------------------- */
|
||||
|
||||
MGODEF::MGODEF(void)
|
||||
{
|
||||
Driver = NULL;
|
||||
Uri = NULL;
|
||||
Colist = NULL;
|
||||
Filter = NULL;
|
||||
Level = 0;
|
||||
Base = 0;
|
||||
Version = 0;
|
||||
Pipe = false;
|
||||
} // end of MGODEF constructor
|
||||
|
||||
/***********************************************************************/
|
||||
/* DefineAM: define specific AM block values. */
|
||||
/***********************************************************************/
|
||||
bool MGODEF::DefineAM(PGLOBAL g, LPCSTR, int poff)
|
||||
{
|
||||
if (EXTDEF::DefineAM(g, "MGO", poff))
|
||||
return true;
|
||||
else if (!Tabschema)
|
||||
Tabschema = GetStringCatInfo(g, "Dbname", "*");
|
||||
|
||||
# if !defined(JDBC_SUPPORT)
|
||||
Driver = "C";
|
||||
#elif !defined(MONGO_SUPPORT)
|
||||
Driver = "JAVA";
|
||||
#else
|
||||
Driver = GetStringCatInfo(g, "Driver", "C");
|
||||
#endif
|
||||
Uri = GetStringCatInfo(g, "Connect", "mongodb://localhost:27017");
|
||||
Colist = GetStringCatInfo(g, "Colist", NULL);
|
||||
Filter = GetStringCatInfo(g, "Filter", NULL);
|
||||
Base = GetIntCatInfo("Base", 0) ? 1 : 0;
|
||||
Version = GetIntCatInfo("Version", 3);
|
||||
|
||||
if (Version == 2)
|
||||
Wrapname = GetStringCatInfo(g, "Wrapper", "Mongo2Interface");
|
||||
else
|
||||
Wrapname = GetStringCatInfo(g, "Wrapper", "Mongo3Interface");
|
||||
|
||||
Pipe = GetBoolCatInfo("Pipeline", false);
|
||||
return false;
|
||||
} // end of DefineAM
|
||||
|
||||
/***********************************************************************/
|
||||
/* GetTable: makes a new Table Description Block. */
|
||||
/***********************************************************************/
|
||||
PTDB MGODEF::GetTable(PGLOBAL g, MODE m)
|
||||
{
|
||||
if (Catfunc == FNC_COL) {
|
||||
#if defined(MONGO_SUPPORT)
|
||||
if (Driver && toupper(*Driver) == 'C')
|
||||
return new(g)TDBGOL(this);
|
||||
#endif // MONGO_SUPPORT
|
||||
strcpy(g->Message, "No column find for Java Mongo yet");
|
||||
return NULL;
|
||||
} // endif Catfunc
|
||||
|
||||
#if defined(MONGO_SUPPORT)
|
||||
if (Driver && toupper(*Driver) == 'C')
|
||||
return new(g) TDBMGO(this);
|
||||
#endif // MONGO_SUPPORT
|
||||
#if defined(JDBC_SUPPORT)
|
||||
return new(g) TDBJMG(this);
|
||||
#else // !JDBC_SUPPORT
|
||||
strcpy(g->Message, "No MONGO nor Java support");
|
||||
return NULL;
|
||||
#endif // !JDBC_SUPPORT
|
||||
} // end of GetTable
|
||||
|
Reference in New Issue
Block a user