Skip to content

Commit bae30c9

Browse files
committed
Last 3 commits of 10.2
1 parent 96f2294 commit bae30c9

File tree

7 files changed

+27
-59
lines changed

7 files changed

+27
-59
lines changed

storage/connect/ha_connect.cc

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -508,7 +508,8 @@ ha_create_table_option connect_table_option_list[]=
508508
HA_TOPTION_STRING("CATFUNC", catfunc),
509509
HA_TOPTION_STRING("SRCDEF", srcdef),
510510
HA_TOPTION_STRING("COLIST", colist),
511-
HA_TOPTION_STRING("OPTION_LIST", oplist),
511+
HA_TOPTION_STRING("FILTER", filter),
512+
HA_TOPTION_STRING("OPTION_LIST", oplist),
512513
HA_TOPTION_STRING("DATA_CHARSET", data_charset),
513514
HA_TOPTION_NUMBER("LRECL", lrecl, 0, 0, INT_MAX32, 1),
514515
HA_TOPTION_NUMBER("BLOCK_SIZE", elements, 0, 0, INT_MAX32, 1),
@@ -1106,7 +1107,9 @@ PCSZ GetStringTableOption(PGLOBAL g, PTOS options, PCSZ opname, PCSZ sdef)
11061107
opval= options->srcdef;
11071108
else if (!stricmp(opname, "Colist"))
11081109
opval= options->colist;
1109-
else if (!stricmp(opname, "Data_charset"))
1110+
else if (!stricmp(opname, "Filter"))
1111+
opval = options->filter;
1112+
else if (!stricmp(opname, "Data_charset"))
11101113
opval= options->data_charset;
11111114

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

44484451
case SQLCOM_CHECK: // TODO implement it
44494452
case SQLCOM_END: // Met in procedures: IF(EXISTS(SELECT...
4450-
newmode= MODE_READ;
4453+
newmode= MODE_READ;
44514454
break;
44524455
default:
44534456
htrc("Unsupported sql_command=%d\n", thd_sql_command(thd));
@@ -5584,6 +5587,9 @@ static int connect_assisted_discovery(handlerton *, THD* thd,
55845587
break;
55855588
#if defined(MONGO_SUPPORT)
55865589
case TAB_MONGO:
5590+
if (!topt->tabname)
5591+
topt->tabname = tab;
5592+
55875593
ok = true;
55885594
break;
55895595
#endif // MONGO_SUPPORT
@@ -6204,7 +6210,7 @@ int ha_connect::create(const char *name, TABLE *table_arg,
62046210

62056211
// Note that if no support is specified, the default is MS-DOM
62066212
// on Windows and libxml2 otherwise
6207-
switch (*xsup) {
6213+
switch (toupper(*xsup)) {
62086214
case '*':
62096215
#if defined(__WIN__)
62106216
dom= true;

storage/connect/mongofam.cpp

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ MGOFAM::MGOFAM(PJDEF tdp) : DOSFAM((PDOSDEF)NULL)
8787
Db_name = tdp->Schema;
8888
Coll_name = tdp->Collname;
8989
Options = tdp->Options;
90-
Filter = NULL;
90+
Filter = tdp->Filter;
9191
Done = false;
9292
Pipe = tdp->Pipe;
9393
Lrecl = tdp->Lrecl + tdp->Ending;
@@ -234,19 +234,6 @@ bool MGOFAM::Init(PGLOBAL g)
234234
if (Done)
235235
return false;
236236

237-
if (Options && !Pipe) {
238-
char *p = (char*)strchr(Options, ';');
239-
240-
if (p) {
241-
*p++ = 0;
242-
243-
if (p)
244-
Filter = p;
245-
246-
} // endif p
247-
248-
} // endif Options
249-
250237
Uri = mongoc_uri_new(Uristr);
251238

252239
if (!Uri) {
@@ -311,7 +298,7 @@ bool MGOFAM::MakeCursor(PGLOBAL g)
311298
for (cp = Tdbp->GetColumns(); cp; cp = cp->GetNext())
312299
if (!strcmp(cp->GetName(), "_id"))
313300
id = true;
314-
else if (cp->GetFmt() && !strcmp(cp->GetFmt(), "*"))
301+
else if (cp->GetFmt() && !strcmp(cp->GetFmt(), "*") && !Options)
315302
all = true;
316303

317304
if (Pipe) {

storage/connect/mycat.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ struct ha_table_option_struct {
4747
const char *catfunc;
4848
const char *srcdef;
4949
const char *colist;
50+
const char *filter;
5051
const char *oplist;
5152
const char *data_charset;
5253
ulonglong lrecl;

storage/connect/tabjson.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -463,7 +463,7 @@ JSONDEF::JSONDEF(void)
463463
Sep = '.';
464464
#if defined(MONGO_SUPPORT)
465465
Uri = NULL;
466-
Collname = Schema = Options = NULL;
466+
Collname = Schema = Options = Filter = NULL;
467467
Pipe = false;
468468
#endif // MONGO_SUPPORT
469469
} // end of JSONDEF constructor
@@ -488,6 +488,7 @@ bool JSONDEF::DefineAM(PGLOBAL g, LPCSTR, int poff)
488488
Collname = GetStringCatInfo(g, "Tabname", Collname);
489489
Schema = GetStringCatInfo(g, "Dbname", "test");
490490
Options = GetStringCatInfo(g, "Colist", NULL);
491+
Filter = GetStringCatInfo(g, "Filter", NULL);
491492
Pipe = GetBoolCatInfo("Pipeline", false);
492493
Pretty = 0;
493494
#else // !MONGO_SUPPORT
@@ -1323,7 +1324,7 @@ char *JSONCOL::GetJpath(PGLOBAL g, bool proj)
13231324
*p2++ = '.';
13241325
break;
13251326
case '[':
1326-
if (*p2 != '.')
1327+
if (*(p2 - 1) != '.')
13271328
*p2++ = '.';
13281329

13291330
i = 1;

storage/connect/tabjson.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,8 @@ class DllExport JSONDEF : public DOSDEF { /* Table description */
6666
#if defined(MONGO_SUPPORT)
6767
PCSZ Collname; /* External collection name */
6868
PCSZ Schema; /* External schema (DB) name */
69-
PSZ Options; /* Colist ; filter */
69+
PSZ Options; /* Colist ; Pipe */
70+
PSZ Filter; /* Filter */
7071
bool Pipe; /* True if Colist is a pipeline */
7172
#endif // MONGO_SUPPORT
7273
}; // end of JSONDEF

storage/connect/tabmgo.cpp

Lines changed: 7 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -170,18 +170,9 @@ int MGODISC::GetColumns(PGLOBAL g, char *db, PTOS topt)
170170
tdp->Tabschema = GetStringTableOption(g, topt, "Dbname", db);
171171
tdp->Base = GetIntegerTableOption(g, topt, "Base", 0) ? 1 : 0;
172172
tdp->Colist = GetStringTableOption(g, topt, "Colist", "all");
173+
tdp->Filter = GetStringTableOption(g, topt, "Filter", NULL);
173174
tdp->Pipe = GetBooleanTableOption(g, topt, "Pipeline", false);
174175

175-
if (tdp->Colist) {
176-
char *p = (char*)strchr(tdp->Colist, ';');
177-
178-
if (p) {
179-
*p++ = 0;
180-
tdp->Filter = *p ? p : NULL;
181-
} // endif p
182-
183-
} // endif Colist
184-
185176
if (trace)
186177
htrc("Uri %s coll=%s db=%s colist=%s filter=%s lvl=%d\n",
187178
tdp->Uri, tdp->Tabname, tdp->Tabschema, tdp->Colist, tdp->Filter, lvl);
@@ -412,8 +403,8 @@ bool MGODEF::DefineAM(PGLOBAL g, LPCSTR, int poff)
412403
/***********************************************************************/
413404
PTDB MGODEF::GetTable(PGLOBAL g, MODE m)
414405
{
415-
//if (Catfunc == FNC_COL)
416-
// return new(g)TDBGOL(this);
406+
if (Catfunc == FNC_COL)
407+
return new(g)TDBGOL(this);
417408

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

651642
G = g;
652643

653-
if (Options && !Pipe) {
654-
char *p = (char*)strchr(Options, ';');
655-
656-
if (p) {
657-
*p++ = 0;
658-
659-
if (p)
660-
Filter = p;
661-
662-
} // endif p
663-
664-
} // endif Options
665-
666644
Uri = mongoc_uri_new(Uristr);
667645

668646
if (!Uri) {
@@ -746,7 +724,7 @@ mongoc_cursor_t *TDBMGO::MakeCursor(PGLOBAL g)
746724
for (cp = Columns; cp; cp = cp->GetNext())
747725
if (!strcmp(cp->GetName(), "_id"))
748726
id = true;
749-
else if (cp->GetFmt() && !strcmp(cp->GetFmt(), "*"))
727+
else if (cp->GetFmt() && !strcmp(cp->GetFmt(), "*") && !Options)
750728
all = true;
751729

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

14561434
} // end of AddValue
14571435

1458-
#if 0
14591436
/* ---------------------------TDBGOL class --------------------------- */
14601437

14611438
/***********************************************************************/
14621439
/* TDBGOL class constructor. */
14631440
/***********************************************************************/
1464-
TDBJCL::TDBJCL(PMGODEF tdp) : TDBCAT(tdp)
1441+
TDBGOL::TDBGOL(PMGODEF tdp) : TDBCAT(tdp)
14651442
{
14661443
Topt = tdp->GetTopt();
1467-
Db = (char*)tdp->GetDB();
1468-
Dsn = (char*)tdp->Uri;
1444+
Db = (char*)tdp->GetTabschema();
14691445
} // end of TDBJCL constructor
14701446

14711447
/***********************************************************************/
14721448
/* GetResult: Get the list the JSON file columns. */
14731449
/***********************************************************************/
14741450
PQRYRES TDBGOL::GetResult(PGLOBAL g)
14751451
{
1476-
return JSONColumns(g, Db, Dsn, Topt, false);
1452+
return MGOColumns(g, Db, Topt, false);
14771453
} // end of GetResult
1478-
#endif // 0
14791454

14801455
/* -------------------------- End of mongo --------------------------- */

storage/connect/tabmgo.h

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ class DllExport MGODEF : public EXTDEF { /* Table description */
8585
// Members
8686
PCSZ Uri; /* MongoDB connection URI */
8787
PCSZ Colist; /* Options list */
88-
char *Filter; /* Filtering query */
88+
PCSZ Filter; /* Filtering query */
8989
int Level; /* Used for catalog table */
9090
int Base; /* The array index base */
9191
bool Pipe; /* True is Colist is a pipeline */
@@ -110,7 +110,7 @@ class INCOL : public BLOCK {
110110
}; // end of INCOL;
111111

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

216-
#if 0
217216
/***********************************************************************/
218217
/* This is the class declaration for the MONGO catalog table. */
219218
/***********************************************************************/
@@ -229,6 +228,4 @@ class DllExport TDBGOL : public TDBCAT {
229228
// Members
230229
PTOS Topt;
231230
char *Db;
232-
char *Dsn;
233231
}; // end of class TDBGOL
234-
#endif // 0

0 commit comments

Comments
 (0)