mirror of
https://github.com/MariaDB/server.git
synced 2025-08-08 11:22:35 +03:00
- Mongo defined columns
modified: storage/connect/cmgoconn.cpp modified: storage/connect/cmgoconn.h - Change default array LIMIT from 10 to 50 modified: storage/connect/ha_connect.cc modified: storage/connect/tabbson.cpp modified: storage/connect/tabjson.cpp modified: storage/connect/tabxml.cpp
This commit is contained in:
@@ -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;
|
||||
|
||||
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
|
||||
@@ -888,6 +898,9 @@ void CMgoConn::GetColumnValue(PGLOBAL g, PCOL colp)
|
||||
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) &&
|
||||
|
@@ -44,6 +44,7 @@ typedef struct _path_list *PTHP;
|
||||
|
||||
typedef struct _path_list {
|
||||
PSZ Path;
|
||||
PSZ Name;
|
||||
PTHP Next;
|
||||
} PTH;
|
||||
|
||||
|
@@ -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)
|
||||
{
|
||||
|
@@ -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);
|
||||
|
@@ -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);
|
||||
|
@@ -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));
|
||||
|
Reference in New Issue
Block a user