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

- All this concern Json or Mongo tables based on MongoDB collections.

- Limit decimals of doubles printed from MongoDB
  Done in function Mini for Mongo C Driver and Java Driver
  Done in function SerializeValue for Java tables using the J Driver
        modified:   storage/connect/cmgoconn.cpp
        modified:   storage/connect/json.cpp
        modified:   storage/connect/json.h
        modified:   storage/connect/tabjmg.cpp

- Fix crash when using BSON_TYPE_DECIMAL128
        modified:   storage/connect/cmgoconn.cpp

- Collection name default to table name
  Fix it when creating tables via discovery
        modified:   storage/connect/ha_connect.cc
        modified:   storage/connect/tabbson.cpp
        modified:   storage/connect/tabjson.cpp
This commit is contained in:
Olivier Bertrand
2021-05-05 00:31:21 +02:00
parent 3b5dabeb96
commit 5ae67c6d63
7 changed files with 53 additions and 28 deletions

View File

@@ -245,6 +245,7 @@ PSZ Serialize(PGLOBAL g, PJSON jsp, char* fn, int pretty) {
try {
jdp = new(g) JDOC; // MUST BE ALLOCATED BEFORE jp !!!!!
jdp->dfp = GetDefaultPrec();
if (!jsp) {
strcpy(g->Message, "Null json tree");
@@ -1005,8 +1006,8 @@ bool JDOC::SerializeValue(PJVAL jvp)
case TYPE_BINT:
sprintf(buf, "%lld", jvp->LLn);
return js->WriteStr(buf);
case TYPE_DBL:
sprintf(buf, "%.*lf", jvp->Nd, jvp->F);
case TYPE_DBL: // dfp to limit to the default number of decimals
sprintf(buf, "%.*f", MY_MIN(jvp->Nd, dfp), jvp->F);
return js->WriteStr(buf);
case TYPE_NULL:
return js->WriteStr("null");