summaryrefslogtreecommitdiff
path: root/storage/connect
diff options
context:
space:
mode:
Diffstat (limited to 'storage/connect')
-rw-r--r--storage/connect/tabbson.cpp16
-rw-r--r--storage/connect/tabbson.h1
-rw-r--r--storage/connect/tabjson.cpp12
-rw-r--r--storage/connect/tabjson.h6
4 files changed, 29 insertions, 6 deletions
diff --git a/storage/connect/tabbson.cpp b/storage/connect/tabbson.cpp
index 309eef2e292..ba4380c5f89 100644
--- a/storage/connect/tabbson.cpp
+++ b/storage/connect/tabbson.cpp
@@ -784,6 +784,12 @@ PVAL BCUTIL::MakeBson(PGLOBAL g, PBVAL jsp)
{
if (Cp->Value->IsTypeNum()) {
strcpy(g->Message, "Cannot make Json for a numeric column");
+
+ if (!Cp->Warned) {
+ PushWarning(g, Tp);
+ Cp->Warned = true;
+ } // endif Warned
+
Cp->Value->Reset();
#if 0
} else if (Value->GetType() == TYPE_BIN) {
@@ -1635,6 +1641,7 @@ BSONCOL::BSONCOL(PGLOBAL g, PCOLDEF cdp, PTDB tdbp, PCOL cprec, int i)
Xnod = -1;
Xpd = false;
Parsed = false;
+ Warned = false;
} // end of BSONCOL constructor
/***********************************************************************/
@@ -1653,6 +1660,7 @@ BSONCOL::BSONCOL(BSONCOL* col1, PTDB tdbp) : DOSCOL(col1, tdbp)
Xnod = col1->Xnod;
Xpd = col1->Xpd;
Parsed = col1->Parsed;
+ Warned = col1->Warned;
} // end of BSONCOL copy constructor
/***********************************************************************/
@@ -1986,8 +1994,10 @@ void BSONCOL::ReadColumn(PGLOBAL g)
if (!Tbp->SameRow || Xnod >= Tbp->SameRow)
Value->SetValue_pval(Cp->GetColumnValue(g, Tbp->Row, 0));
+#if defined(DEVELOPMENT)
if (Xpd && Value->IsNull() && !((PBDEF)Tbp->To_Def)->Accept)
- throw("Null expandable JSON value");
+ htrc("Null expandable JSON value for column %s\n", Name);
+#endif // DEVELOPMENT
// Set null when applicable
if (!Nullable)
@@ -2274,8 +2284,10 @@ int TDBBSON::MakeDocument(PGLOBAL g)
Docp = Bp->NewVal(TYPE_JAR);
Bp->AddArrayValue(Docp, jsp);
Bp->SetArrayValue(arp, Docp, i);
- } else
+ } else {
Top = Docp = Bp->NewVal(TYPE_JAR);
+ Bp->AddArrayValue(Docp, jsp);
+ } // endif's
} // endif jsp
diff --git a/storage/connect/tabbson.h b/storage/connect/tabbson.h
index a53f33bd737..bb3f32bd945 100644
--- a/storage/connect/tabbson.h
+++ b/storage/connect/tabbson.h
@@ -265,6 +265,7 @@ protected:
char Sep; // The Jpath separator
bool Xpd; // True for expandable column
bool Parsed; // True when parsed
+ bool Warned; // True when warning issued
}; // end of class BSONCOL
/* -------------------------- TDBBSON class -------------------------- */
diff --git a/storage/connect/tabjson.cpp b/storage/connect/tabjson.cpp
index 0ef281f2aae..19f721f692b 100644
--- a/storage/connect/tabjson.cpp
+++ b/storage/connect/tabjson.cpp
@@ -1255,6 +1255,7 @@ JSONCOL::JSONCOL(PGLOBAL g, PCOLDEF cdp, PTDB tdbp, PCOL cprec, int i)
Xnod = -1;
Xpd = false;
Parsed = false;
+ Warned = false;
} // end of JSONCOL constructor
/***********************************************************************/
@@ -1273,6 +1274,7 @@ JSONCOL::JSONCOL(JSONCOL *col1, PTDB tdbp) : DOSCOL(col1, tdbp)
Xnod = col1->Xnod;
Xpd = col1->Xpd;
Parsed = col1->Parsed;
+ Warned = col1->Warned;
} // end of JSONCOL copy constructor
/***********************************************************************/
@@ -1606,6 +1608,12 @@ PVAL JSONCOL::MakeJson(PGLOBAL g, PJSON jsp)
{
if (Value->IsTypeNum()) {
strcpy(g->Message, "Cannot make Json for a numeric column");
+
+ if (!Warned) {
+ PushWarning(g, Tjp);
+ Warned = true;
+ } // endif Warned
+
Value->Reset();
#if 0
} else if (Value->GetType() == TYPE_BIN) {
@@ -1703,8 +1711,8 @@ void JSONCOL::ReadColumn(PGLOBAL g)
if (!Tjp->SameRow || Xnod >= Tjp->SameRow)
Value->SetValue_pval(GetColumnValue(g, Tjp->Row, 0));
- if (Xpd && Value->IsNull() && !((PJDEF)Tjp->To_Def)->Accept)
- throw("Null expandable JSON value");
+// if (Xpd && Value->IsNull() && !((PJDEF)Tjp->To_Def)->Accept)
+// throw("Null expandable JSON value");
// Set null when applicable
if (!Nullable)
diff --git a/storage/connect/tabjson.h b/storage/connect/tabjson.h
index 9b4f508880e..b47dc9b0665 100644
--- a/storage/connect/tabjson.h
+++ b/storage/connect/tabjson.h
@@ -192,7 +192,8 @@ protected:
char Sep; // The Jpath separator
bool Strict; // Strict syntax checking
bool Comma; // Row has final comma
- }; // end of class TDBJSN
+ bool Xpdable; // False: expandable columns are NULL
+}; // end of class TDBJSN
/* -------------------------- JSONCOL class -------------------------- */
@@ -247,7 +248,8 @@ public:
char Sep; // The Jpath separator
bool Xpd; // True for expandable column
bool Parsed; // True when parsed
- }; // end of class JSONCOL
+ bool Warned; // True when warning issued
+}; // end of class JSONCOL
/* -------------------------- TDBJSON class -------------------------- */