1
0
mirror of https://github.com/MariaDB/server.git synced 2025-08-08 11:22:35 +03:00

- Major update of the json/bson/mongo table types programs.

Fix several bugs, chiefly concerning CURL operations.
        modified:   storage/connect/bson.cpp
        modified:   storage/connect/cmgfam.cpp
        modified:   storage/connect/cmgoconn.cpp
        modified:   storage/connect/cmgoconn.h
        modified:   storage/connect/colblk.h
        modified:   storage/connect/ha_connect.cc
        modified:   storage/connect/jmgfam.cpp
        modified:   storage/connect/jmgoconn.cpp
        modified:   storage/connect/jmgoconn.h
        modified:   storage/connect/json.cpp
        modified:   storage/connect/json.h
        modified:   storage/connect/mysql-test/connect/r/bson_mongo_c.result
        modified:   storage/connect/mysql-test/connect/r/json_mongo_c.result
        modified:   storage/connect/mysql-test/connect/r/mongo_c.result
        modified:   storage/connect/mysql-test/connect/r/mongo_java_2.result
        modified:   storage/connect/mysql-test/connect/r/mongo_java_3.result
        modified:   storage/connect/mysql-test/connect/std_data/Mongo2.jar
        modified:   storage/connect/mysql-test/connect/std_data/Mongo3.jar
        modified:   storage/connect/tabbson.cpp
        modified:   storage/connect/tabbson.h
        modified:   storage/connect/tabcmg.cpp
        modified:   storage/connect/tabcmg.h
        modified:   storage/connect/tabjmg.cpp
        modified:   storage/connect/tabjmg.h
        modified:   storage/connect/tabjson.cpp
        modified:   storage/connect/tabjson.h
This commit is contained in:
Olivier Bertrand
2021-05-01 22:29:38 +02:00
parent 4df6952ce3
commit ef0829ef40
26 changed files with 673 additions and 394 deletions

View File

@@ -77,6 +77,24 @@ bool IsNum(PSZ s)
return true;
} // end of IsNum
/***********************************************************************/
/* IsArray: check whether this is a Mongo array path. */
/***********************************************************************/
bool IsArray(PSZ s)
{
char* p = s;
if (!p || !*p)
return false;
else for (; *p; p++)
if (*p == '.')
break;
else if (!isdigit(*p))
return false;
return true;
} // end of IsArray
/***********************************************************************/
/* NextChr: return the first found '[' or Sep pointer. */
/***********************************************************************/
@@ -1326,9 +1344,9 @@ bool JARRAY::Merge(PGLOBAL g, PJSON jsp)
} // end of Merge
/***********************************************************************/
/* Set the nth Value of the Array Value list. */
/* Set the nth Value of the Array Value list or add it. */
/***********************************************************************/
bool JARRAY::SetArrayValue(PGLOBAL g, PJVAL jvp, int n)
void JARRAY::SetArrayValue(PGLOBAL g, PJVAL jvp, int n)
{
int i = 0;
PJVAL jp, *jpp = &First;
@@ -1339,7 +1357,6 @@ bool JARRAY::SetArrayValue(PGLOBAL g, PJVAL jvp, int n)
*jpp = jvp;
jvp->Next = (jp ? jp->Next : NULL);
return false;
} // end of SetValue
/***********************************************************************/
@@ -1417,7 +1434,7 @@ bool JARRAY::IsNull(void)
/***********************************************************************/
JVALUE::JVALUE(PJSON jsp) : JSON()
{
if (jsp->GetType() == TYPE_JVAL) {
if (jsp && jsp->GetType() == TYPE_JVAL) {
PJVAL jvp = (PJVAL)jsp;
// Val = ((PJVAL)jsp)->GetVal();
@@ -1434,7 +1451,7 @@ JVALUE::JVALUE(PJSON jsp) : JSON()
} else {
Jsp = jsp;
// Val = NULL;
DataType = TYPE_JSON;
DataType = Jsp ? TYPE_JSON : TYPE_NULL;
Nd = 0;
} // endif Type