Skip to content

Commit

Permalink
Last 3 commits of 10.2
Browse files Browse the repository at this point in the history
  • Loading branch information
Buggynours committed Jun 10, 2017
1 parent 96f2294 commit bae30c9
Show file tree
Hide file tree
Showing 7 changed files with 27 additions and 59 deletions.
14 changes: 10 additions & 4 deletions storage/connect/ha_connect.cc
Original file line number Diff line number Diff line change
Expand Up @@ -508,7 +508,8 @@ ha_create_table_option connect_table_option_list[]=
HA_TOPTION_STRING("CATFUNC", catfunc),
HA_TOPTION_STRING("SRCDEF", srcdef),
HA_TOPTION_STRING("COLIST", colist),
HA_TOPTION_STRING("OPTION_LIST", oplist),
HA_TOPTION_STRING("FILTER", filter),
HA_TOPTION_STRING("OPTION_LIST", oplist),
HA_TOPTION_STRING("DATA_CHARSET", data_charset),
HA_TOPTION_NUMBER("LRECL", lrecl, 0, 0, INT_MAX32, 1),
HA_TOPTION_NUMBER("BLOCK_SIZE", elements, 0, 0, INT_MAX32, 1),
Expand Down Expand Up @@ -1106,7 +1107,9 @@ PCSZ GetStringTableOption(PGLOBAL g, PTOS options, PCSZ opname, PCSZ sdef)
opval= options->srcdef;
else if (!stricmp(opname, "Colist"))
opval= options->colist;
else if (!stricmp(opname, "Data_charset"))
else if (!stricmp(opname, "Filter"))
opval = options->filter;
else if (!stricmp(opname, "Data_charset"))
opval= options->data_charset;

if (!opval && options->oplist)
Expand Down Expand Up @@ -4447,7 +4450,7 @@ MODE ha_connect::CheckMode(PGLOBAL g, THD *thd,

case SQLCOM_CHECK: // TODO implement it
case SQLCOM_END: // Met in procedures: IF(EXISTS(SELECT...
newmode= MODE_READ;
newmode= MODE_READ;
break;
default:
htrc("Unsupported sql_command=%d\n", thd_sql_command(thd));
Expand Down Expand Up @@ -5584,6 +5587,9 @@ static int connect_assisted_discovery(handlerton *, THD* thd,
break;
#if defined(MONGO_SUPPORT)
case TAB_MONGO:
if (!topt->tabname)
topt->tabname = tab;

ok = true;
break;
#endif // MONGO_SUPPORT
Expand Down Expand Up @@ -6204,7 +6210,7 @@ int ha_connect::create(const char *name, TABLE *table_arg,

// Note that if no support is specified, the default is MS-DOM
// on Windows and libxml2 otherwise
switch (*xsup) {
switch (toupper(*xsup)) {
case '*':
#if defined(__WIN__)
dom= true;
Expand Down
17 changes: 2 additions & 15 deletions storage/connect/mongofam.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ MGOFAM::MGOFAM(PJDEF tdp) : DOSFAM((PDOSDEF)NULL)
Db_name = tdp->Schema;
Coll_name = tdp->Collname;
Options = tdp->Options;
Filter = NULL;
Filter = tdp->Filter;
Done = false;
Pipe = tdp->Pipe;
Lrecl = tdp->Lrecl + tdp->Ending;
Expand Down Expand Up @@ -234,19 +234,6 @@ bool MGOFAM::Init(PGLOBAL g)
if (Done)
return false;

if (Options && !Pipe) {
char *p = (char*)strchr(Options, ';');

if (p) {
*p++ = 0;

if (p)
Filter = p;

} // endif p

} // endif Options

Uri = mongoc_uri_new(Uristr);

if (!Uri) {
Expand Down Expand Up @@ -311,7 +298,7 @@ bool MGOFAM::MakeCursor(PGLOBAL g)
for (cp = Tdbp->GetColumns(); cp; cp = cp->GetNext())
if (!strcmp(cp->GetName(), "_id"))
id = true;
else if (cp->GetFmt() && !strcmp(cp->GetFmt(), "*"))
else if (cp->GetFmt() && !strcmp(cp->GetFmt(), "*") && !Options)
all = true;

if (Pipe) {
Expand Down
1 change: 1 addition & 0 deletions storage/connect/mycat.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ struct ha_table_option_struct {
const char *catfunc;
const char *srcdef;
const char *colist;
const char *filter;
const char *oplist;
const char *data_charset;
ulonglong lrecl;
Expand Down
5 changes: 3 additions & 2 deletions storage/connect/tabjson.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -463,7 +463,7 @@ JSONDEF::JSONDEF(void)
Sep = '.';
#if defined(MONGO_SUPPORT)
Uri = NULL;
Collname = Schema = Options = NULL;
Collname = Schema = Options = Filter = NULL;
Pipe = false;
#endif // MONGO_SUPPORT
} // end of JSONDEF constructor
Expand All @@ -488,6 +488,7 @@ bool JSONDEF::DefineAM(PGLOBAL g, LPCSTR, int poff)
Collname = GetStringCatInfo(g, "Tabname", Collname);
Schema = GetStringCatInfo(g, "Dbname", "test");
Options = GetStringCatInfo(g, "Colist", NULL);
Filter = GetStringCatInfo(g, "Filter", NULL);
Pipe = GetBoolCatInfo("Pipeline", false);
Pretty = 0;
#else // !MONGO_SUPPORT
Expand Down Expand Up @@ -1323,7 +1324,7 @@ char *JSONCOL::GetJpath(PGLOBAL g, bool proj)
*p2++ = '.';
break;
case '[':
if (*p2 != '.')
if (*(p2 - 1) != '.')
*p2++ = '.';

i = 1;
Expand Down
3 changes: 2 additions & 1 deletion storage/connect/tabjson.h
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,8 @@ class DllExport JSONDEF : public DOSDEF { /* Table description */
#if defined(MONGO_SUPPORT)
PCSZ Collname; /* External collection name */
PCSZ Schema; /* External schema (DB) name */
PSZ Options; /* Colist ; filter */
PSZ Options; /* Colist ; Pipe */
PSZ Filter; /* Filter */
bool Pipe; /* True if Colist is a pipeline */
#endif // MONGO_SUPPORT
}; // end of JSONDEF
Expand Down
39 changes: 7 additions & 32 deletions storage/connect/tabmgo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -170,18 +170,9 @@ int MGODISC::GetColumns(PGLOBAL g, char *db, PTOS topt)
tdp->Tabschema = GetStringTableOption(g, topt, "Dbname", db);
tdp->Base = GetIntegerTableOption(g, topt, "Base", 0) ? 1 : 0;
tdp->Colist = GetStringTableOption(g, topt, "Colist", "all");
tdp->Filter = GetStringTableOption(g, topt, "Filter", NULL);
tdp->Pipe = GetBooleanTableOption(g, topt, "Pipeline", false);

if (tdp->Colist) {
char *p = (char*)strchr(tdp->Colist, ';');

if (p) {
*p++ = 0;
tdp->Filter = *p ? p : NULL;
} // endif p

} // endif Colist

if (trace)
htrc("Uri %s coll=%s db=%s colist=%s filter=%s lvl=%d\n",
tdp->Uri, tdp->Tabname, tdp->Tabschema, tdp->Colist, tdp->Filter, lvl);
Expand Down Expand Up @@ -412,8 +403,8 @@ bool MGODEF::DefineAM(PGLOBAL g, LPCSTR, int poff)
/***********************************************************************/
PTDB MGODEF::GetTable(PGLOBAL g, MODE m)
{
//if (Catfunc == FNC_COL)
// return new(g)TDBGOL(this);
if (Catfunc == FNC_COL)
return new(g)TDBGOL(this);

return new(g) TDBMGO(this);
} // end of GetTable
Expand Down Expand Up @@ -650,19 +641,6 @@ bool TDBMGO::Init(PGLOBAL g)

G = g;

if (Options && !Pipe) {
char *p = (char*)strchr(Options, ';');

if (p) {
*p++ = 0;

if (p)
Filter = p;

} // endif p

} // endif Options

Uri = mongoc_uri_new(Uristr);

if (!Uri) {
Expand Down Expand Up @@ -746,7 +724,7 @@ mongoc_cursor_t *TDBMGO::MakeCursor(PGLOBAL g)
for (cp = Columns; cp; cp = cp->GetNext())
if (!strcmp(cp->GetName(), "_id"))
id = true;
else if (cp->GetFmt() && !strcmp(cp->GetFmt(), "*"))
else if (cp->GetFmt() && !strcmp(cp->GetFmt(), "*") && !Options)
all = true;

if (Pipe) {
Expand Down Expand Up @@ -1455,26 +1433,23 @@ bool MGOCOL::AddValue(PGLOBAL g, bson_t *doc, char *key, bool upd)

} // end of AddValue

#if 0
/* ---------------------------TDBGOL class --------------------------- */

/***********************************************************************/
/* TDBGOL class constructor. */
/***********************************************************************/
TDBJCL::TDBJCL(PMGODEF tdp) : TDBCAT(tdp)
TDBGOL::TDBGOL(PMGODEF tdp) : TDBCAT(tdp)
{
Topt = tdp->GetTopt();
Db = (char*)tdp->GetDB();
Dsn = (char*)tdp->Uri;
Db = (char*)tdp->GetTabschema();
} // end of TDBJCL constructor

/***********************************************************************/
/* GetResult: Get the list the JSON file columns. */
/***********************************************************************/
PQRYRES TDBGOL::GetResult(PGLOBAL g)
{
return JSONColumns(g, Db, Dsn, Topt, false);
return MGOColumns(g, Db, Topt, false);
} // end of GetResult
#endif // 0

/* -------------------------- End of mongo --------------------------- */
7 changes: 2 additions & 5 deletions storage/connect/tabmgo.h
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ class DllExport MGODEF : public EXTDEF { /* Table description */
// Members
PCSZ Uri; /* MongoDB connection URI */
PCSZ Colist; /* Options list */
char *Filter; /* Filtering query */
PCSZ Filter; /* Filtering query */
int Level; /* Used for catalog table */
int Base; /* The array index base */
bool Pipe; /* True is Colist is a pipeline */
Expand All @@ -110,7 +110,7 @@ class INCOL : public BLOCK {
}; // end of INCOL;

/***********************************************************************/
/* This is the MongoDB Access Method class declaration. */
/* This is the MongoDB Table Type class declaration. */
/* The table is a collection, each record being a document. */
/***********************************************************************/
class DllExport TDBMGO : public TDBEXT {
Expand Down Expand Up @@ -213,7 +213,6 @@ class DllExport MGOCOL : public EXTCOL {
char *Mbuf; // The Mini buffer
}; // end of class MGOCOL

#if 0
/***********************************************************************/
/* This is the class declaration for the MONGO catalog table. */
/***********************************************************************/
Expand All @@ -229,6 +228,4 @@ class DllExport TDBGOL : public TDBCAT {
// Members
PTOS Topt;
char *Db;
char *Dsn;
}; // end of class TDBGOL
#endif // 0

0 comments on commit bae30c9

Please sign in to comment.