summaryrefslogtreecommitdiff
path: root/storage/connect/jsonudf.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'storage/connect/jsonudf.cpp')
-rw-r--r--storage/connect/jsonudf.cpp29
1 files changed, 17 insertions, 12 deletions
diff --git a/storage/connect/jsonudf.cpp b/storage/connect/jsonudf.cpp
index 2733479a4e6..a79fd0a7124 100644
--- a/storage/connect/jsonudf.cpp
+++ b/storage/connect/jsonudf.cpp
@@ -499,28 +499,23 @@ PVAL JSNX::ExpandArray(PGLOBAL g, PJAR arp, int n)
/*********************************************************************************/
PVAL JSNX::CalculateArray(PGLOBAL g, PJAR arp, int n)
{
-//int i, ars, nv = 0, nextsame = Tjp->NextSame;
- int i, nv = 0, nextsame = 0;
- my_bool err;
+ int i, ars = arp->size(), nv = 0;
+ bool err;
OPVAL op = Nodes[n].Op;
PVAL val[2], vp = Nodes[n].Valp;
PJVAL jvrp, jvp;
JVALUE jval;
vp->Reset();
-//ars = arp->size();
if (trace)
- htrc("CalculateArray size=%d\n", arp->size());
-// htrc("CalculateArray size=%d\n", ars);
+ htrc("CalculateArray size=%d op=%d\n", ars, op);
- for (i = 0; i < arp->size(); i++) {
-//for (i = 0; i < ars; i++) { because compiler bug
+ for (i = 0; i < ars; i++) {
jvrp = arp->GetValue(i);
if (trace)
- htrc("Value %s null=%d nv=%d\n",
- jvrp->GetString(g), jvrp->IsNull() ? 1 : 0, nv);
+ htrc("i=%d nv=%d\n", i, nv);
if (!jvrp->IsNull() || (op == OP_CNC && GetJsonNull())) {
if (jvrp->IsNull()) {
@@ -532,6 +527,10 @@ PVAL JSNX::CalculateArray(PGLOBAL g, PJAR arp, int n)
} else
jvp = jvrp;
+ if (trace)
+ htrc("jvp=%s null=%d\n",
+ jvp->GetString(g), jvp->IsNull() ? 1 : 0);
+
if (!nv++) {
SetJsonValue(g, vp, jvp, n);
continue;
@@ -564,6 +563,13 @@ PVAL JSNX::CalculateArray(PGLOBAL g, PJAR arp, int n)
if (err)
vp->Reset();
+ if (trace) {
+ char buf(32);
+
+ htrc("vp='%s' err=%d\n",
+ vp->GetCharString(&buf), err ? 1 : 0);
+ } // endif trace
+
} // endif Zero
} // endif jvrp
@@ -581,7 +587,6 @@ PVAL JSNX::CalculateArray(PGLOBAL g, PJAR arp, int n)
} // endif Op
-//Tjp->NextSame = nextsame;
return vp;
} // end of CalculateArray
@@ -1512,7 +1517,7 @@ static my_bool CheckMemory(PGLOBAL g, UDF_INIT *initid, UDF_ARGS *args, uint n,
if (!(g->Sarea = PlugAllocMem(g, ml))) {
char errmsg[MAX_STR];
- sprintf(errmsg, MSG(WORK_AREA), g->Message);
+ snprintf(errmsg, sizeof(errmsg)-1, MSG(WORK_AREA), g->Message);
strcpy(g->Message, errmsg);
g->Sarea_Size = 0;
return true;