Skip to content

Commit

Permalink
- Suppress warning when creating mongo JSON tables
Browse files Browse the repository at this point in the history
  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
  • Loading branch information
Buggynours committed Jul 3, 2017
1 parent 94e5d7d commit b63f847
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 17 deletions.
6 changes: 4 additions & 2 deletions storage/connect/ha_connect.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion storage/connect/jdbconn.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
6 changes: 5 additions & 1 deletion storage/connect/mongo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
1 change: 1 addition & 0 deletions storage/connect/mongo.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
17 changes: 10 additions & 7 deletions storage/connect/tabjmg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 -------------------------- */

/***********************************************************************/
Expand Down Expand Up @@ -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 --------------------------- */
11 changes: 5 additions & 6 deletions storage/connect/tabjmg.h
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit b63f847

Please sign in to comment.