From ff704368c050e61e0fe1cdc08bccc3aec09dddd5 Mon Sep 17 00:00:00 2001 From: Olivier Bertrand Date: Thu, 13 Apr 2017 23:52:39 +0200 Subject: [PATCH] Add mongoDB access to json tables. Finalize replacement of longjmp by throw. modified: storage/connect/CMakeLists.txt modified: storage/connect/array.cpp modified: storage/connect/blkfil.cpp modified: storage/connect/colblk.cpp modified: storage/connect/connect.cc modified: storage/connect/filamtxt.cpp modified: storage/connect/filamvct.cpp modified: storage/connect/filter.cpp modified: storage/connect/ha_connect.cc modified: storage/connect/jdbconn.cpp modified: storage/connect/json.cpp modified: storage/connect/jsonudf.cpp modified: storage/connect/odbconn.cpp modified: storage/connect/plgdbsem.h modified: storage/connect/plgdbutl.cpp modified: storage/connect/plugutil.cpp modified: storage/connect/tabdos.cpp modified: storage/connect/tabfix.cpp modified: storage/connect/tabfmt.cpp modified: storage/connect/tabjson.cpp modified: storage/connect/tabjson.h modified: storage/connect/tabmul.cpp modified: storage/connect/tabmysql.cpp modified: storage/connect/tabpivot.cpp modified: storage/connect/tabsys.cpp modified: storage/connect/tabvct.cpp modified: storage/connect/tabvir.cpp modified: storage/connect/tabxml.cpp modified: storage/connect/valblk.cpp modified: storage/connect/value.cpp modified: storage/connect/xindex.cpp modified: storage/connect/xobject.cpp --- storage/connect/ha_connect.cc | 2 +- storage/connect/tabjson.cpp | 18 ++++++++++++++---- storage/connect/tabjson.h | 2 +- 3 files changed, 16 insertions(+), 6 deletions(-) diff --git a/storage/connect/ha_connect.cc b/storage/connect/ha_connect.cc index 681869755bf..6da4188388e 100644 --- a/storage/connect/ha_connect.cc +++ b/storage/connect/ha_connect.cc @@ -3104,7 +3104,7 @@ const COND *ha_connect::cond_push(const COND *cond) } else if (x && cond) tdbp->SetCondFil(filp); // Wrong filter - } else // if (tty != TYPE_AM_JSN && tty != TYPE_AM_JSON) + } else if (tty != TYPE_AM_JSN && tty != TYPE_AM_JSON) tdbp->SetFilter(CondFilter(g, (Item *)cond)); } catch (int n) { diff --git a/storage/connect/tabjson.cpp b/storage/connect/tabjson.cpp index a6e78ca3fd1..be61f9da9d3 100644 --- a/storage/connect/tabjson.cpp +++ b/storage/connect/tabjson.cpp @@ -172,9 +172,14 @@ PQRYRES JSONColumns(PGLOBAL g, char *db, char *dsn, PTOS topt, bool info) sprintf(g->Message, MSG(NO_FEAT_SUPPORT), "ZIP"); return NULL; #endif // !ZIP_SUPPORT - } else if (tdp->Uri) + } else if (tdp->Uri) { +#if defined(MONGO_SUPPORT) tjnp = new(g) TDBJSN(tdp, new(g) MGOFAM(tdp)); - else +#else // !MONGO_SUPPORT + sprintf(g->Message, MSG(NO_FEAT_SUPPORT), "MONGO"); + return NULL; +#endif // !MONGO_SUPPORT + } else tjnp = new(g) TDBJSN(tdp, new(g) DOSFAM(tdp)); tjnp->SetMode(MODE_READ); @@ -500,9 +505,14 @@ PTDB JSONDEF::GetTable(PGLOBAL g, MODE m) sprintf(g->Message, MSG(NO_FEAT_SUPPORT), "GZ"); return NULL; #endif // !GZ_SUPPORT - } else if (Uri) + } else if (Uri) { +#if defined(MONGO_SUPPORT) txfp = new(g) MGOFAM(this); - else if (map) +#else // !MONGO_SUPPORT + sprintf(g->Message, MSG(NO_FEAT_SUPPORT), "MONGO"); + return NULL; +#endif // !MONGO_SUPPORT + } else if (map) txfp = new(g) MAPFAM(this); else txfp = new(g) DOSFAM(this); diff --git a/storage/connect/tabjson.h b/storage/connect/tabjson.h index c98d32a804e..49a6664d7f1 100644 --- a/storage/connect/tabjson.h +++ b/storage/connect/tabjson.h @@ -61,8 +61,8 @@ public: int Level; /* Used for catalog table */ int Base; /* Tne array index base */ bool Strict; /* Strict syntax checking */ -#if defined(MONGO_SUPPORT) const char *Uri; /* MongoDB connection URI */ +#if defined(MONGO_SUPPORT) PSZ Collname; /* External collection name */ PSZ Schema; /* External schema (DB) name */ PSZ Options; /* Colist ; filter */