diff options
-rw-r--r-- | storage/connect/cmgoconn.cpp | 21 | ||||
-rw-r--r-- | storage/connect/cmgoconn.h | 1 | ||||
-rw-r--r-- | storage/connect/ha_connect.cc | 6 | ||||
-rw-r--r-- | storage/connect/tabbson.cpp | 4 | ||||
-rw-r--r-- | storage/connect/tabjson.cpp | 4 | ||||
-rw-r--r-- | storage/connect/tabxml.cpp | 2 |
6 files changed, 26 insertions, 12 deletions
diff --git a/storage/connect/cmgoconn.cpp b/storage/connect/cmgoconn.cpp index 5a81799c4a2..6ab9e781994 100644 --- a/storage/connect/cmgoconn.cpp +++ b/storage/connect/cmgoconn.cpp @@ -300,6 +300,7 @@ void CMgoConn::Project(PGLOBAL g, PSTRG s) for (cp = tp->GetColumns(); cp; cp = cp->GetNext()) { path = cp->GetJpath(g, true); + // Resolve path collision for (hp = php; hp; hp = hp->Next) { if (strlen(path) < strlen(hp->Path)) { n = strlen(path); @@ -318,6 +319,7 @@ void CMgoConn::Project(PGLOBAL g, PSTRG s) // New path hp = (PTHP)PlugSubAlloc(g, NULL, sizeof(PTH)); hp->Path = path; + hp->Name = cp->GetName(); hp->Next = NULL; *nphp = hp; nphp = &hp->Next; @@ -332,8 +334,16 @@ void CMgoConn::Project(PGLOBAL g, PSTRG s) else b = true; - s->Append(hp->Path); - s->Append("\":1"); + if (*hp->Path == '{') { + // This is a Mongo defined column + s->Append(hp->Name); + s->Append("\":"); + s->Append(hp->Path); + } else { + s->Append(hp->Path); + s->Append("\":1"); + } // endif Path + } // endfor hp } // end of Project @@ -885,9 +895,12 @@ void CMgoConn::GetColumnValue(PGLOBAL g, PCOL colp) char *jpath = colp->GetJpath(g, false); bool b = false; PVAL value = colp->GetValue(); - bson_iter_t Iter; // Used to retrieve column value - bson_iter_t Desc; // Descendant iter + bson_iter_t Iter; // Used to retrieve column value + bson_iter_t Desc; // Descendant iter + if (*jpath == '{') + jpath = colp->GetName(); // This is a Mongo defined column + if (!*jpath || !strcmp(jpath, "*")) { value->SetValue_psz(Mini(g, colp, Document, false)); } else if (bson_iter_init(&Iter, Document) && diff --git a/storage/connect/cmgoconn.h b/storage/connect/cmgoconn.h index c69f53b366f..f37a96cb7b9 100644 --- a/storage/connect/cmgoconn.h +++ b/storage/connect/cmgoconn.h @@ -44,6 +44,7 @@ typedef struct _path_list *PTHP; typedef struct _path_list { PSZ Path; + PSZ Name; PTHP Next; } PTH; diff --git a/storage/connect/ha_connect.cc b/storage/connect/ha_connect.cc index 5f210f649f5..416bbb5d071 100644 --- a/storage/connect/ha_connect.cc +++ b/storage/connect/ha_connect.cc @@ -167,10 +167,10 @@ #define SZCONV 1024 // Default converted text size #define SZWORK 67108864 // Default work area size 64M #define SZWMIN 4194304 // Minimum work area size 4M -#define JSONMAX 10 // JSON Default max grp size +#define JSONMAX 50 // JSON Default max grp size extern "C" { - char version[]= "Version 1.07.0003 May 02, 2021"; + char version[]= "Version 1.07.0003 May 22, 2021"; #if defined(__WIN__) char compver[]= "Version 1.07.0003 " __DATE__ " " __TIME__; char slash= '\\'; @@ -508,7 +508,7 @@ char *GetJsonNull(void) int GetDefaultDepth(void) {return THDVAR(current_thd, default_depth);} int GetDefaultPrec(void) {return THDVAR(current_thd, default_prec);} uint GetJsonGrpSize(void) - {return connect_hton ? THDVAR(current_thd, json_grp_size) : 10;} + {return connect_hton ? THDVAR(current_thd, json_grp_size) : 50;} size_t GetWorkSize(void) {return (size_t)THDVAR(current_thd, work_size);} void SetWorkSize(size_t) { diff --git a/storage/connect/tabbson.cpp b/storage/connect/tabbson.cpp index d36b9718cd6..c6758b21707 100644 --- a/storage/connect/tabbson.cpp +++ b/storage/connect/tabbson.cpp @@ -173,7 +173,7 @@ int BSONDISC::GetColumns(PGLOBAL g, PCSZ db, PCSZ dsn, PTOS topt) lvl = GetIntegerTableOption(g, topt, "Depth", lvl); sep = GetStringTableOption(g, topt, "Separator", "."); sz = GetIntegerTableOption(g, topt, "Jsize", 1024); - limit = GetIntegerTableOption(g, topt, "Limit", 10); + limit = GetIntegerTableOption(g, topt, "Limit", 50); strfy = GetStringTableOption(g, topt, "Stringify", NULL); /*********************************************************************/ @@ -1159,7 +1159,7 @@ bool BSONDEF::DefineAM(PGLOBAL g, LPCSTR am, int poff) Objname = GetStringCatInfo(g, "Object", NULL); Xcol = GetStringCatInfo(g, "Expand", NULL); Pretty = GetIntCatInfo("Pretty", 2); - Limit = GetIntCatInfo("Limit", 10); + Limit = GetIntCatInfo("Limit", 50); Base = GetIntCatInfo("Base", 0) ? 1 : 0; Sep = *GetStringCatInfo(g, "Separator", "."); Accept = GetBoolCatInfo("Accept", false); diff --git a/storage/connect/tabjson.cpp b/storage/connect/tabjson.cpp index 4a8031113d2..cad098e0f9b 100644 --- a/storage/connect/tabjson.cpp +++ b/storage/connect/tabjson.cpp @@ -179,7 +179,7 @@ int JSONDISC::GetColumns(PGLOBAL g, PCSZ db, PCSZ dsn, PTOS topt) sep = GetStringTableOption(g, topt, "Separator", "."); strfy = GetStringTableOption(g, topt, "Stringify", NULL); sz = GetIntegerTableOption(g, topt, "Jsize", 1024); - limit = GetIntegerTableOption(g, topt, "Limit", 10); + limit = GetIntegerTableOption(g, topt, "Limit", 50); /*********************************************************************/ /* Open the input file. */ @@ -635,7 +635,7 @@ bool JSONDEF::DefineAM(PGLOBAL g, LPCSTR am, int poff) Objname = GetStringCatInfo(g, "Object", NULL); Xcol = GetStringCatInfo(g, "Expand", NULL); Pretty = GetIntCatInfo("Pretty", 2); - Limit = GetIntCatInfo("Limit", 10); + Limit = GetIntCatInfo("Limit", 50); Base = GetIntCatInfo("Base", 0) ? 1 : 0; Sep = *GetStringCatInfo(g, "Separator", "."); Accept = GetBoolCatInfo("Accept", false); diff --git a/storage/connect/tabxml.cpp b/storage/connect/tabxml.cpp index 6065bb1b5d2..d7f199a8092 100644 --- a/storage/connect/tabxml.cpp +++ b/storage/connect/tabxml.cpp @@ -525,7 +525,7 @@ bool XMLDEF::DefineAM(PGLOBAL g, LPCSTR am, int poff) XmlDB = GetStringCatInfo(g, "XmlDB", NULL); Nslist = GetStringCatInfo(g, "Nslist", NULL); DefNs = GetStringCatInfo(g, "DefNs", NULL); - Limit = GetIntCatInfo("Limit", 10); + Limit = GetIntCatInfo("Limit", 50); Xpand = GetBoolCatInfo("Expand", false); Header = GetIntCatInfo("Header", 0); GetCharCatInfo("Xmlsup", "*", buf, sizeof(buf)); |