mirror of
https://github.com/MariaDB/server.git
synced 2025-01-18 04:53:01 +01:00
Last 3 commits of 10.2
This commit is contained in:
parent
96f229460f
commit
bae30c93da
7 changed files with 27 additions and 59 deletions
|
@ -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),
|
||||
|
@ -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)
|
||||
|
@ -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));
|
||||
|
@ -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
|
||||
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
@ -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) {
|
||||
|
@ -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) {
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -1323,7 +1324,7 @@ char *JSONCOL::GetJpath(PGLOBAL g, bool proj)
|
|||
*p2++ = '.';
|
||||
break;
|
||||
case '[':
|
||||
if (*p2 != '.')
|
||||
if (*(p2 - 1) != '.')
|
||||
*p2++ = '.';
|
||||
|
||||
i = 1;
|
||||
|
|
|
@ -66,7 +66,8 @@ public:
|
|||
#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
|
||||
|
|
|
@ -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);
|
||||
|
@ -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
|
||||
|
@ -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) {
|
||||
|
@ -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) {
|
||||
|
@ -1455,17 +1433,15 @@ 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
|
||||
|
||||
/***********************************************************************/
|
||||
|
@ -1473,8 +1449,7 @@ TDBJCL::TDBJCL(PMGODEF tdp) : TDBCAT(tdp)
|
|||
/***********************************************************************/
|
||||
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 --------------------------- */
|
||||
|
|
|
@ -85,7 +85,7 @@ protected:
|
|||
// 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 */
|
||||
|
@ -110,7 +110,7 @@ public:
|
|||
}; // 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 {
|
||||
|
@ -213,7 +213,6 @@ protected:
|
|||
char *Mbuf; // The Mini buffer
|
||||
}; // end of class MGOCOL
|
||||
|
||||
#if 0
|
||||
/***********************************************************************/
|
||||
/* This is the class declaration for the MONGO catalog table. */
|
||||
/***********************************************************************/
|
||||
|
@ -229,6 +228,4 @@ protected:
|
|||
// Members
|
||||
PTOS Topt;
|
||||
char *Db;
|
||||
char *Dsn;
|
||||
}; // end of class TDBGOL
|
||||
#endif // 0
|
||||
|
|
Loading…
Reference in a new issue