Commit b63f8477 authored by Olivier Bertrand's avatar Olivier Bertrand

- Suppress warning when creating mongo JSON tables

  modified:   storage/connect/ha_connect.cc

- Add catalog table for Mongo java driver tables
  modified:   storage/connect/mongo.cpp
  modified:   storage/connect/mongo.h
  modified:   storage/connect/tabjmg.cpp
  modified:   storage/connect/tabjmg.h
parent 94e5d7de
......@@ -6079,6 +6079,7 @@ int ha_connect::create(const char *name, TABLE *table_arg,
TABTYPE type;
TABLE *st= table; // Probably unuseful
THD *thd= ha_thd();
LEX_STRING cnc = table_arg->s->connect_string;
#if defined(WITH_PARTITION_STORAGE_ENGINE)
partition_info *part_info= table_arg->part_info;
#endif // WITH_PARTITION_STORAGE_ENGINE
......@@ -6126,7 +6127,8 @@ int ha_connect::create(const char *name, TABLE *table_arg,
if (check_privileges(thd, options, GetDBfromName(name)))
DBUG_RETURN(HA_ERR_INTERNAL_ERROR);
inward= IsFileType(type) && !options->filename;
inward= IsFileType(type) && !options->filename &&
(type != TAB_JSON || !cnc.length);
if (options->data_charset) {
const CHARSET_INFO *data_charset;
......@@ -6223,7 +6225,7 @@ int ha_connect::create(const char *name, TABLE *table_arg,
DBUG_RETURN(HA_ERR_INTERNAL_ERROR);
} // endif CheckSelf
}break;
} break;
default: /* do nothing */;
break;
} // endswitch ttp
......
......@@ -56,7 +56,7 @@
//#if defined(__WIN__)
//extern "C" HINSTANCE s_hModule; // Saved module handle
//#endif // __WIN__
//#define nullptr 0
#define nullptr 0
TYPCONV GetTypeConv();
int GetConvSize();
......
......@@ -81,8 +81,12 @@ PTDB MGODEF::GetTable(PGLOBAL g, MODE m)
if (Driver && toupper(*Driver) == 'C')
return new(g)TDBGOL(this);
#endif // MONGO_SUPPORT
strcpy(g->Message, "No column find for Java Mongo yet");
#if defined(JDBC_SUPPORT)
return new(g)TDBJGL(this);
#else // !JDBC_SUPPORT
strcpy(g->Message, "No column find, no MONGO nor Java support");
return NULL;
#endif // !JDBC_SUPPORT
} // endif Catfunc
#if defined(MONGO_SUPPORT)
......
......@@ -32,6 +32,7 @@ class DllExport MGODEF : public EXTDEF { /* Table description */
friend class TDBMGO;
friend class TDBJMG;
friend class TDBGOL;
friend class TDBJGL;
friend class MGOFAM;
friend class MGODISC;
friend PQRYRES MGOColumns(PGLOBAL, PCSZ, PCSZ, PTOS, bool);
......
......@@ -33,6 +33,8 @@
#define MAXCOL 200 /* Default max column nb in result */
#define TYPE_UNKNOWN 12 /* Must be greater than other types */
PQRYRES JSONColumns(PGLOBAL g, PCSZ db, PCSZ dsn, PTOS topt, bool info);
/* --------------------------- Class TDBJMG -------------------------- */
/***********************************************************************/
......@@ -481,25 +483,26 @@ bool JMGCOL::AddValue(PGLOBAL g, bson_t *doc, char *key, bool upd)
return false;
} // end of AddValue
#endif // 0
/* ---------------------------TDBGOL class --------------------------- */
/* -------------------------- TDBJGL class --------------------------- */
/***********************************************************************/
/* TDBGOL class constructor. */
/* TDBJGL class constructor. */
/***********************************************************************/
TDBGOL::TDBGOL(PMGODEF tdp) : TDBCAT(tdp)
TDBJGL::TDBJGL(PMGODEF tdp) : TDBCAT(tdp)
{
Topt = tdp->GetTopt();
Db = (char*)tdp->GetTabschema();
Uri = tdp->Uri;
Db = tdp->GetTabschema();
} // end of TDBJCL constructor
/***********************************************************************/
/* GetResult: Get the list the JSON file columns. */
/***********************************************************************/
PQRYRES TDBGOL::GetResult(PGLOBAL g)
PQRYRES TDBJGL::GetResult(PGLOBAL g)
{
return MGOColumns(g, Db, Topt, false);
return JSONColumns(g, Db, Uri, Topt, false);
} // end of GetResult
#endif // 0
/* -------------------------- End of mongo --------------------------- */
......@@ -102,21 +102,20 @@ class DllExport JMGCOL : public EXTCOL {
//char *Mbuf; // The Mini buffer
}; // end of class JMGCOL
#if 0
/***********************************************************************/
/* This is the class declaration for the MONGO catalog table. */
/***********************************************************************/
class DllExport TDBGOL : public TDBCAT {
class DllExport TDBJGL : public TDBCAT {
public:
// Constructor
TDBGOL(PMGODEF tdp);
TDBJGL(PMGODEF tdp);
protected:
// Specific routines
virtual PQRYRES GetResult(PGLOBAL g);
// Members
PTOS Topt;
char *Db;
PTOS Topt;
PCSZ Uri;
PCSZ Db;
}; // end of class TDBGOL
#endif 0
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