Commit fb86a496 authored by Olivier Bertrand's avatar Olivier Bertrand

Re-fix compile error (overloaded-virtual)

parent e4294729
...@@ -531,7 +531,7 @@ PJAR JDOC::ParseArray(PGLOBAL g, int& i) ...@@ -531,7 +531,7 @@ PJAR JDOC::ParseArray(PGLOBAL g, int& i)
sprintf(g->Message, "Unexpected value near %.*s", ARGS); sprintf(g->Message, "Unexpected value near %.*s", ARGS);
throw 1; throw 1;
} else } else
jarp->AddValue(g, ParseValue(g, i)); jarp->AddArrayValue(g, ParseValue(g, i));
level = (b) ? 1 : 2; level = (b) ? 1 : 2;
break; break;
...@@ -886,7 +886,7 @@ bool JDOC::SerializeArray(PJAR jarp, bool b) ...@@ -886,7 +886,7 @@ bool JDOC::SerializeArray(PJAR jarp, bool b)
} // endif b } // endif b
if (SerializeValue(jarp->GetValue(i))) if (SerializeValue(jarp->GetArrayValue(i)))
return true; return true;
} // endfor i } // endfor i
...@@ -1010,7 +1010,7 @@ PJAR JOBJECT::GetKeyList(PGLOBAL g) ...@@ -1010,7 +1010,7 @@ PJAR JOBJECT::GetKeyList(PGLOBAL g)
PJAR jarp = new(g) JARRAY(); PJAR jarp = new(g) JARRAY();
for (PJPR jpp = First; jpp; jpp = jpp->Next) for (PJPR jpp = First; jpp; jpp = jpp->Next)
jarp->AddValue(g, new(g) JVALUE(g, jpp->Key)); jarp->AddArrayValue(g, new(g) JVALUE(g, jpp->Key));
jarp->InitArray(g); jarp->InitArray(g);
return jarp; return jarp;
...@@ -1024,7 +1024,7 @@ PJAR JOBJECT::GetValList(PGLOBAL g) ...@@ -1024,7 +1024,7 @@ PJAR JOBJECT::GetValList(PGLOBAL g)
PJAR jarp = new(g) JARRAY(); PJAR jarp = new(g) JARRAY();
for (PJPR jpp = First; jpp; jpp = jpp->Next) for (PJPR jpp = First; jpp; jpp = jpp->Next)
jarp->AddValue(g, jpp->Val); jarp->AddArrayValue(g, jpp->Val);
jarp->InitArray(g); jarp->InitArray(g);
return jarp; return jarp;
...@@ -1033,7 +1033,7 @@ PJAR JOBJECT::GetValList(PGLOBAL g) ...@@ -1033,7 +1033,7 @@ PJAR JOBJECT::GetValList(PGLOBAL g)
/***********************************************************************/ /***********************************************************************/
/* Get the value corresponding to the given key. */ /* Get the value corresponding to the given key. */
/***********************************************************************/ /***********************************************************************/
PJVAL JOBJECT::GetValue(const char* key) PJVAL JOBJECT::GetKeyValue(const char* key)
{ {
for (PJPR jp = First; jp; jp = jp->Next) for (PJPR jp = First; jp; jp = jp->Next)
if (!strcmp(jp->Key, key)) if (!strcmp(jp->Key, key))
...@@ -1111,7 +1111,7 @@ bool JOBJECT::Merge(PGLOBAL g, PJSON jsp) ...@@ -1111,7 +1111,7 @@ bool JOBJECT::Merge(PGLOBAL g, PJSON jsp)
PJOB jobp = (PJOB)jsp; PJOB jobp = (PJOB)jsp;
for (PJPR jpp = jobp->First; jpp; jpp = jpp->Next) for (PJPR jpp = jobp->First; jpp; jpp = jpp->Next)
SetValue(g, jpp->Val, jpp->Key); SetKeyValue(g, jpp->Val, jpp->Key);
return false; return false;
} // end of Marge; } // end of Marge;
...@@ -1119,7 +1119,7 @@ bool JOBJECT::Merge(PGLOBAL g, PJSON jsp) ...@@ -1119,7 +1119,7 @@ bool JOBJECT::Merge(PGLOBAL g, PJSON jsp)
/***********************************************************************/ /***********************************************************************/
/* Set or add a value corresponding to the given key. */ /* Set or add a value corresponding to the given key. */
/***********************************************************************/ /***********************************************************************/
void JOBJECT::SetValue(PGLOBAL g, PJVAL jvp, PCSZ key) void JOBJECT::SetKeyValue(PGLOBAL g, PJVAL jvp, PCSZ key)
{ {
PJPR jp; PJPR jp;
...@@ -1166,6 +1166,18 @@ bool JOBJECT::IsNull(void) ...@@ -1166,6 +1166,18 @@ bool JOBJECT::IsNull(void)
/* -------------------------- Class JARRAY --------------------------- */ /* -------------------------- Class JARRAY --------------------------- */
/***********************************************************************/
/* JARRAY constructor. */
/***********************************************************************/
JARRAY::JARRAY(void) : JSON()
{
Type = TYPE_JAR;
Size = 0;
Alloc = 0;
First = Last = NULL;
Mvals = NULL;
} // end of JARRAY constructor
/***********************************************************************/ /***********************************************************************/
/* Return the number of values in this object. */ /* Return the number of values in this object. */
/***********************************************************************/ /***********************************************************************/
...@@ -1216,7 +1228,7 @@ void JARRAY::InitArray(PGLOBAL g) ...@@ -1216,7 +1228,7 @@ void JARRAY::InitArray(PGLOBAL g)
/***********************************************************************/ /***********************************************************************/
/* Get the Nth value of an Array. */ /* Get the Nth value of an Array. */
/***********************************************************************/ /***********************************************************************/
PJVAL JARRAY::GetValue(int i) PJVAL JARRAY::GetArrayValue(int i)
{ {
if (Mvals && i >= 0 && i < Size) if (Mvals && i >= 0 && i < Size)
return Mvals[i]; return Mvals[i];
...@@ -1227,7 +1239,7 @@ PJVAL JARRAY::GetValue(int i) ...@@ -1227,7 +1239,7 @@ PJVAL JARRAY::GetValue(int i)
/***********************************************************************/ /***********************************************************************/
/* Add a Value to the Array Value list. */ /* Add a Value to the Array Value list. */
/***********************************************************************/ /***********************************************************************/
PJVAL JARRAY::AddValue(PGLOBAL g, PJVAL jvp, int *x) PJVAL JARRAY::AddArrayValue(PGLOBAL g, PJVAL jvp, int *x)
{ {
if (!jvp) if (!jvp)
jvp = new(g) JVALUE; jvp = new(g) JVALUE;
...@@ -1271,7 +1283,7 @@ bool JARRAY::Merge(PGLOBAL g, PJSON jsp) ...@@ -1271,7 +1283,7 @@ bool JARRAY::Merge(PGLOBAL g, PJSON jsp)
PJAR arp = (PJAR)jsp; PJAR arp = (PJAR)jsp;
for (int i = 0; i < arp->size(); i++) for (int i = 0; i < arp->size(); i++)
AddValue(g, arp->GetValue(i)); AddArrayValue(g, arp->GetArrayValue(i));
InitArray(g); InitArray(g);
return false; return false;
...@@ -1280,7 +1292,7 @@ bool JARRAY::Merge(PGLOBAL g, PJSON jsp) ...@@ -1280,7 +1292,7 @@ bool JARRAY::Merge(PGLOBAL g, PJSON jsp)
/***********************************************************************/ /***********************************************************************/
/* Set the nth Value of the Array Value list. */ /* Set the nth Value of the Array Value list. */
/***********************************************************************/ /***********************************************************************/
bool JARRAY::SetValue(PGLOBAL g, PJVAL jvp, int n) bool JARRAY::SetArrayValue(PGLOBAL g, PJVAL jvp, int n)
{ {
int i = 0; int i = 0;
PJVAL jp, *jpp = &First; PJVAL jp, *jpp = &First;
...@@ -1340,7 +1352,7 @@ PSZ JARRAY::GetText(PGLOBAL g, PSTRG text) ...@@ -1340,7 +1352,7 @@ PSZ JARRAY::GetText(PGLOBAL g, PSTRG text)
/***********************************************************************/ /***********************************************************************/
bool JARRAY::DeleteValue(int n) bool JARRAY::DeleteValue(int n)
{ {
PJVAL jvp = GetValue(n); PJVAL jvp = GetArrayValue(n);
if (jvp) { if (jvp) {
jvp->Del = true; jvp->Del = true;
...@@ -1365,7 +1377,7 @@ bool JARRAY::IsNull(void) ...@@ -1365,7 +1377,7 @@ bool JARRAY::IsNull(void)
/* -------------------------- Class JVALUE- -------------------------- */ /* -------------------------- Class JVALUE- -------------------------- */
/***********************************************************************/ /***********************************************************************/
/* Constructor for a JSON. */ /* Constructor for a JVALUE. */
/***********************************************************************/ /***********************************************************************/
JVALUE::JVALUE(PJSON jsp) : JSON() JVALUE::JVALUE(PJSON jsp) : JSON()
{ {
...@@ -1383,7 +1395,7 @@ JVALUE::JVALUE(PJSON jsp) : JSON() ...@@ -1383,7 +1395,7 @@ JVALUE::JVALUE(PJSON jsp) : JSON()
} // end of JVALUE constructor } // end of JVALUE constructor
/***********************************************************************/ /***********************************************************************/
/* Constructor for a Val with a given string or numeric value. */ /* Constructor for a JVALUE with a given string or numeric value. */
/***********************************************************************/ /***********************************************************************/
JVALUE::JVALUE(PGLOBAL g, PVL vlp) : JSON() JVALUE::JVALUE(PGLOBAL g, PVL vlp) : JSON()
{ {
...@@ -1395,7 +1407,7 @@ JVALUE::JVALUE(PGLOBAL g, PVL vlp) : JSON() ...@@ -1395,7 +1407,7 @@ JVALUE::JVALUE(PGLOBAL g, PVL vlp) : JSON()
} // end of JVALUE constructor } // end of JVALUE constructor
/***********************************************************************/ /***********************************************************************/
/* Constructor for a Value with a given string or numeric value. */ /* Constructor for a JVALUE with a given string or numeric value. */
/***********************************************************************/ /***********************************************************************/
JVALUE::JVALUE(PGLOBAL g, PVAL valp) : JSON() { JVALUE::JVALUE(PGLOBAL g, PVAL valp) : JSON() {
Jsp = NULL; Jsp = NULL;
......
...@@ -140,36 +140,16 @@ class JSON : public BLOCK { ...@@ -140,36 +140,16 @@ class JSON : public BLOCK {
// Methods // Methods
virtual int size(void) { return 1; } virtual int size(void) { return 1; }
// virtual JTYP GetValType(void) { X return TYPE_JSON; }
// virtual void InitArray(PGLOBAL g) { X }
//virtual PJVAL AddValue(PGLOBAL g, PJVAL jvp = NULL, int *x = NULL) {X return NULL;}
// virtual PJPR AddPair(PGLOBAL g, PCSZ key) { X return NULL; }
virtual void Clear(void) { X } virtual void Clear(void) { X }
// virtual PJAR GetKeyList(PGLOBAL g) { X return NULL; }
// virtual PJAR GetValList(PGLOBAL g) { X return NULL; }
// virtual PJVAL GetValue(const char* key) { X return NULL; }
virtual PJOB GetObject(void) { return NULL; } virtual PJOB GetObject(void) { return NULL; }
virtual PJAR GetArray(void) { return NULL; } virtual PJAR GetArray(void) { return NULL; }
virtual PJVAL GetValue(int i) { X return NULL; } virtual PJVAL GetArrayValue(int i) { X return NULL; }
virtual int GetSize(bool b) { X return 0; } virtual int GetSize(bool b) { X return 0; }
//virtual PVL GetVal(void) { X return NULL; }
virtual PJSON GetJsp(void) { X return NULL; } virtual PJSON GetJsp(void) { X return NULL; }
// virtual PJSON GetJson(void) { X return NULL; }
virtual PJPR GetFirst(void) { X return NULL; } virtual PJPR GetFirst(void) { X return NULL; }
// virtual int GetInteger(void) { X return 0; }
// virtual double GetFloat() { X return 0.0; }
// virtual PSZ GetString(PGLOBAL g, char *buff = NULL) { X return NULL; }
virtual PSZ GetText(PGLOBAL g, PSTRG text) { X return NULL; } virtual PSZ GetText(PGLOBAL g, PSTRG text) { X return NULL; }
virtual bool Merge(PGLOBAL g, PJSON jsp) { X return true; } virtual bool Merge(PGLOBAL g, PJSON jsp) { X return true; }
// virtual bool SetValue(PGLOBAL g, PJVAL jvp, int i) { X return true; }
// virtual void SetValue(PGLOBAL g, PJVAL jvp, PCSZ key) { X }
// virtual void SetVal(PVL vlp) { X }
// virtual void SetValue(PGLOBAL g, PVAL valp) { X }
virtual void SetValue(PJSON jsp) { X } virtual void SetValue(PJSON jsp) { X }
// virtual void SetString(PGLOBAL g, PSZ s, short c) { X }
// virtual void SetInteger(PGLOBAL g, int n) { X }
// virtual void SetFloat(PGLOBAL g, double f) { X }
// virtual void DeleteKey(PCSZ k) { X }
virtual bool DeleteValue(int i) { X return true; } virtual bool DeleteValue(int i) { X return true; }
virtual bool IsNull(void) { X return true; } virtual bool IsNull(void) { X return true; }
...@@ -188,9 +168,6 @@ class JOBJECT : public JSON { ...@@ -188,9 +168,6 @@ class JOBJECT : public JSON {
JOBJECT(void) : JSON() { Type = TYPE_JOB; First = Last = NULL; } JOBJECT(void) : JSON() { Type = TYPE_JOB; First = Last = NULL; }
JOBJECT(int i) : JSON(i) {} JOBJECT(int i) : JSON(i) {}
//using JSON::GetVal;
//using JSON::SetVal;
// Methods // Methods
virtual void Clear(void) {First = Last = NULL;} virtual void Clear(void) {First = Last = NULL;}
//virtual JTYP GetValType(void) {return TYPE_JOB;} //virtual JTYP GetValType(void) {return TYPE_JOB;}
...@@ -203,10 +180,10 @@ class JOBJECT : public JSON { ...@@ -203,10 +180,10 @@ class JOBJECT : public JSON {
// Specific // Specific
PJPR AddPair(PGLOBAL g, PCSZ key); PJPR AddPair(PGLOBAL g, PCSZ key);
PJVAL GetValue(const char* key); PJVAL GetKeyValue(const char* key);
PJAR GetKeyList(PGLOBAL g); PJAR GetKeyList(PGLOBAL g);
PJAR GetValList(PGLOBAL g); PJAR GetValList(PGLOBAL g);
void SetValue(PGLOBAL g, PJVAL jvp, PCSZ key); void SetKeyValue(PGLOBAL g, PJVAL jvp, PCSZ key);
void DeleteKey(PCSZ k); void DeleteKey(PCSZ k);
protected: protected:
...@@ -220,28 +197,23 @@ class JOBJECT : public JSON { ...@@ -220,28 +197,23 @@ class JOBJECT : public JSON {
class JARRAY : public JSON { class JARRAY : public JSON {
friend class SWAP; friend class SWAP;
public: public:
JARRAY(void) : JSON() JARRAY(void);
{ Type = TYPE_JAR; Alloc = 0; First = Last = NULL; Mvals = NULL; }
JARRAY(int i) : JSON(i) {} JARRAY(int i) : JSON(i) {}
//using JSON::GetVal;
//using JSON::SetVal;
// Methods // Methods
virtual void Clear(void) {First = Last = NULL; Size = 0;} virtual void Clear(void) {First = Last = NULL; Size = 0;}
virtual int size(void) { return Size; } virtual int size(void) { return Size; }
//virtual JTYP GetType(void) {return TYPE_JAR;}
virtual PJAR GetArray(void) {return this;} virtual PJAR GetArray(void) {return this;}
virtual int GetSize(bool b); virtual int GetSize(bool b);
virtual PJVAL GetValue(int i); virtual PJVAL GetArrayValue(int i);
virtual PSZ GetText(PGLOBAL g, PSTRG text); virtual PSZ GetText(PGLOBAL g, PSTRG text);
virtual bool Merge(PGLOBAL g, PJSON jsp); virtual bool Merge(PGLOBAL g, PJSON jsp);
virtual bool DeleteValue(int n); virtual bool DeleteValue(int n);
virtual bool IsNull(void); virtual bool IsNull(void);
// Specific // Specific
PJVAL AddValue(PGLOBAL g, PJVAL jvp = NULL, int* x = NULL); PJVAL AddArrayValue(PGLOBAL g, PJVAL jvp = NULL, int* x = NULL);
bool SetValue(PGLOBAL g, PJVAL jvp, int i); bool SetArrayValue(PGLOBAL g, PJVAL jvp, int i);
void InitArray(PGLOBAL g); void InitArray(PGLOBAL g);
protected: protected:
......
This diff is collapsed.
...@@ -240,7 +240,7 @@ int JSONDISC::GetColumns(PGLOBAL g, PCSZ db, PCSZ dsn, PTOS topt) ...@@ -240,7 +240,7 @@ int JSONDISC::GetColumns(PGLOBAL g, PCSZ db, PCSZ dsn, PTOS topt)
if (tjsp->MakeDocument(g)) if (tjsp->MakeDocument(g))
return 0; return 0;
jsp = (tjsp->GetDoc()) ? tjsp->GetDoc()->GetValue(0) : NULL; jsp = (tjsp->GetDoc()) ? tjsp->GetDoc()->GetArrayValue(0) : NULL;
} else { } else {
if (!((tdp->Lrecl = GetIntegerTableOption(g, topt, "Lrecl", 0)))) { if (!((tdp->Lrecl = GetIntegerTableOption(g, topt, "Lrecl", 0)))) {
if (!mgo) { if (!mgo) {
...@@ -365,7 +365,7 @@ int JSONDISC::GetColumns(PGLOBAL g, PCSZ db, PCSZ dsn, PTOS topt) ...@@ -365,7 +365,7 @@ int JSONDISC::GetColumns(PGLOBAL g, PCSZ db, PCSZ dsn, PTOS topt)
} // endswitch ReadDB } // endswitch ReadDB
} else } else
jsp = tjsp->GetDoc()->GetValue(i); jsp = tjsp->GetDoc()->GetArrayValue(i);
if (!(row = (jsp) ? jsp->GetObject() : NULL)) if (!(row = (jsp) ? jsp->GetObject() : NULL))
break; break;
...@@ -483,7 +483,7 @@ bool JSONDISC::Find(PGLOBAL g, PJVAL jvp, PCSZ key, int j) ...@@ -483,7 +483,7 @@ bool JSONDISC::Find(PGLOBAL g, PJVAL jvp, PCSZ key, int j)
strncat(fmt, (tdp->Uri ? sep : "[*]"), n); strncat(fmt, (tdp->Uri ? sep : "[*]"), n);
} }
if (Find(g, jar->GetValue(k), "", j)) if (Find(g, jar->GetArrayValue(k), "", j))
return true; return true;
*p = *pc = 0; *p = *pc = 0;
...@@ -922,7 +922,7 @@ PJSON TDBJSN::FindRow(PGLOBAL g) ...@@ -922,7 +922,7 @@ PJSON TDBJSN::FindRow(PGLOBAL g)
if (*objpath != '[' && !IsNum(objpath)) { // objpass is a key if (*objpath != '[' && !IsNum(objpath)) { // objpass is a key
val = (jsp->GetType() == TYPE_JOB) ? val = (jsp->GetType() == TYPE_JOB) ?
jsp->GetObject()->GetValue(objpath) : NULL; jsp->GetObject()->GetKeyValue(objpath) : NULL;
} else { } else {
if (*objpath == '[') { if (*objpath == '[') {
if (objpath[strlen(objpath) - 1] == ']') if (objpath[strlen(objpath) - 1] == ']')
...@@ -932,7 +932,7 @@ PJSON TDBJSN::FindRow(PGLOBAL g) ...@@ -932,7 +932,7 @@ PJSON TDBJSN::FindRow(PGLOBAL g)
} // endif [ } // endif [
val = (jsp->GetType() == TYPE_JAR) ? val = (jsp->GetType() == TYPE_JAR) ?
jsp->GetArray()->GetValue(atoi(objpath) - B) : NULL; jsp->GetArray()->GetArrayValue(atoi(objpath) - B) : NULL;
} // endif objpath } // endif objpath
jsp = (val) ? val->GetJson() : NULL; jsp = (val) ? val->GetJson() : NULL;
...@@ -1128,7 +1128,7 @@ int TDBJSN::MakeTopTree(PGLOBAL g, PJSON jsp) ...@@ -1128,7 +1128,7 @@ int TDBJSN::MakeTopTree(PGLOBAL g, PJSON jsp)
val->SetValue(objp); val->SetValue(objp);
val = new(g) JVALUE; val = new(g) JVALUE;
objp->SetValue(g, val, objpath); objp->SetKeyValue(g, val, objpath);
} else { } else {
if (*objpath == '[') { if (*objpath == '[') {
// Old style // Old style
...@@ -1150,7 +1150,7 @@ int TDBJSN::MakeTopTree(PGLOBAL g, PJSON jsp) ...@@ -1150,7 +1150,7 @@ int TDBJSN::MakeTopTree(PGLOBAL g, PJSON jsp)
val = new(g) JVALUE; val = new(g) JVALUE;
i = atoi(objpath) - B; i = atoi(objpath) - B;
arp->SetValue(g, val, i); arp->SetArrayValue(g, val, i);
arp->InitArray(g); arp->InitArray(g);
} // endif objpath } // endif objpath
...@@ -1703,7 +1703,7 @@ PVAL JSONCOL::GetColumnValue(PGLOBAL g, PJSON row, int i) ...@@ -1703,7 +1703,7 @@ PVAL JSONCOL::GetColumnValue(PGLOBAL g, PJSON row, int i)
val = new(G) JVALUE(row); val = new(G) JVALUE(row);
} else } else
val = ((PJOB)row)->GetValue(Nodes[i].Key); val = ((PJOB)row)->GetKeyValue(Nodes[i].Key);
break; break;
case TYPE_JAR: case TYPE_JAR:
...@@ -1711,7 +1711,7 @@ PVAL JSONCOL::GetColumnValue(PGLOBAL g, PJSON row, int i) ...@@ -1711,7 +1711,7 @@ PVAL JSONCOL::GetColumnValue(PGLOBAL g, PJSON row, int i)
if (!Nodes[i].Key) { if (!Nodes[i].Key) {
if (Nodes[i].Op == OP_EQ) if (Nodes[i].Op == OP_EQ)
val = arp->GetValue(Nodes[i].Rank); val = arp->GetArrayValue(Nodes[i].Rank);
else if (Nodes[i].Op == OP_EXP) else if (Nodes[i].Op == OP_EXP)
return ExpandArray(g, arp, i); return ExpandArray(g, arp, i);
else else
...@@ -1719,7 +1719,7 @@ PVAL JSONCOL::GetColumnValue(PGLOBAL g, PJSON row, int i) ...@@ -1719,7 +1719,7 @@ PVAL JSONCOL::GetColumnValue(PGLOBAL g, PJSON row, int i)
} else { } else {
// Unexpected array, unwrap it as [0] // Unexpected array, unwrap it as [0]
val = arp->GetValue(0); val = arp->GetArrayValue(0);
i--; i--;
} // endif's } // endif's
...@@ -1757,7 +1757,7 @@ PVAL JSONCOL::ExpandArray(PGLOBAL g, PJAR arp, int n) ...@@ -1757,7 +1757,7 @@ PVAL JSONCOL::ExpandArray(PGLOBAL g, PJAR arp, int n)
return Value; return Value;
} // endif ars } // endif ars
if (!(jvp = arp->GetValue((Nodes[n].Rx = Nodes[n].Nx)))) { if (!(jvp = arp->GetArrayValue((Nodes[n].Rx = Nodes[n].Nx)))) {
strcpy(g->Message, "Logical error expanding array"); strcpy(g->Message, "Logical error expanding array");
throw 666; throw 666;
} // endif jvp } // endif jvp
...@@ -1801,7 +1801,7 @@ PVAL JSONCOL::CalculateArray(PGLOBAL g, PJAR arp, int n) ...@@ -1801,7 +1801,7 @@ PVAL JSONCOL::CalculateArray(PGLOBAL g, PJAR arp, int n)
ars, op, nextsame); ars, op, nextsame);
for (i = 0; i < ars; i++) { for (i = 0; i < ars; i++) {
jvrp = arp->GetValue(i); jvrp = arp->GetArrayValue(i);
if (trace(1)) if (trace(1))
htrc("i=%d nv=%d\n", i, nv); htrc("i=%d nv=%d\n", i, nv);
...@@ -1901,20 +1901,20 @@ PJSON JSONCOL::GetRow(PGLOBAL g) ...@@ -1901,20 +1901,20 @@ PJSON JSONCOL::GetRow(PGLOBAL g)
// Expected Array was not there, wrap the value // Expected Array was not there, wrap the value
continue; continue;
val = ((PJOB)row)->GetValue(Nodes[i].Key); val = ((PJOB)row)->GetKeyValue(Nodes[i].Key);
break; break;
case TYPE_JAR: case TYPE_JAR:
arp = (PJAR)row; arp = (PJAR)row;
if (!Nodes[i].Key) { if (!Nodes[i].Key) {
if (Nodes[i].Op == OP_EQ) if (Nodes[i].Op == OP_EQ)
val = arp->GetValue(Nodes[i].Rank); val = arp->GetArrayValue(Nodes[i].Rank);
else else
val = arp->GetValue(Nodes[i].Rx); val = arp->GetArrayValue(Nodes[i].Rx);
} else { } else {
// Unexpected array, unwrap it as [0] // Unexpected array, unwrap it as [0]
val = arp->GetValue(0); val = arp->GetArrayValue(0);
i--; i--;
} // endif Nodes } // endif Nodes
...@@ -1941,9 +1941,9 @@ PJSON JSONCOL::GetRow(PGLOBAL g) ...@@ -1941,9 +1941,9 @@ PJSON JSONCOL::GetRow(PGLOBAL g)
nwr = new(G) JOBJECT; nwr = new(G) JOBJECT;
if (row->GetType() == TYPE_JOB) { if (row->GetType() == TYPE_JOB) {
((PJOB)row)->SetValue(G, new(G) JVALUE(nwr), Nodes[i-1].Key); ((PJOB)row)->SetKeyValue(G, new(G) JVALUE(nwr), Nodes[i-1].Key);
} else if (row->GetType() == TYPE_JAR) { } else if (row->GetType() == TYPE_JAR) {
((PJAR)row)->AddValue(G, new(G) JVALUE(nwr)); ((PJAR)row)->AddArrayValue(G, new(G) JVALUE(nwr));
((PJAR)row)->InitArray(G); ((PJAR)row)->InitArray(G);
} else { } else {
strcpy(g->Message, "Wrong type when writing new row"); strcpy(g->Message, "Wrong type when writing new row");
...@@ -2008,14 +2008,14 @@ void JSONCOL::WriteColumn(PGLOBAL g) ...@@ -2008,14 +2008,14 @@ void JSONCOL::WriteColumn(PGLOBAL g)
if (arp) { if (arp) {
if (Nod > 1 && Nodes[Nod-2].Op == OP_EQ) if (Nod > 1 && Nodes[Nod-2].Op == OP_EQ)
arp->SetValue(G, new(G) JVALUE(jsp), Nodes[Nod-2].Rank); arp->SetArrayValue(G, new(G) JVALUE(jsp), Nodes[Nod-2].Rank);
else else
arp->AddValue(G, new(G) JVALUE(jsp)); arp->AddArrayValue(G, new(G) JVALUE(jsp));
arp->InitArray(G); arp->InitArray(G);
} else if (objp) { } else if (objp) {
if (Nod > 1 && Nodes[Nod-2].Key) if (Nod > 1 && Nodes[Nod-2].Key)
objp->SetValue(G, new(G) JVALUE(jsp), Nodes[Nod-2].Key); objp->SetKeyValue(G, new(G) JVALUE(jsp), Nodes[Nod-2].Key);
} else if (jvp) } else if (jvp)
jvp->SetValue(jsp); jvp->SetValue(jsp);
...@@ -2032,14 +2032,14 @@ void JSONCOL::WriteColumn(PGLOBAL g) ...@@ -2032,14 +2032,14 @@ void JSONCOL::WriteColumn(PGLOBAL g)
case TYPE_DOUBLE: case TYPE_DOUBLE:
if (arp) { if (arp) {
if (Nodes[Nod-1].Op == OP_EQ) if (Nodes[Nod-1].Op == OP_EQ)
arp->SetValue(G, new(G) JVALUE(G, Value), Nodes[Nod-1].Rank); arp->SetArrayValue(G, new(G) JVALUE(G, Value), Nodes[Nod-1].Rank);
else else
arp->AddValue(G, new(G) JVALUE(G, Value)); arp->AddArrayValue(G, new(G) JVALUE(G, Value));
arp->InitArray(G); arp->InitArray(G);
} else if (objp) { } else if (objp) {
if (Nodes[Nod-1].Key) if (Nodes[Nod-1].Key)
objp->SetValue(G, new(G) JVALUE(G, Value), Nodes[Nod-1].Key); objp->SetKeyValue(G, new(G) JVALUE(G, Value), Nodes[Nod-1].Key);
} else if (jvp) } else if (jvp)
jvp->SetValue(g, Value); jvp->SetValue(g, Value);
...@@ -2189,7 +2189,7 @@ int TDBJSON::MakeDocument(PGLOBAL g) ...@@ -2189,7 +2189,7 @@ int TDBJSON::MakeDocument(PGLOBAL g)
key = p; key = p;
objp = jsp->GetObject(); objp = jsp->GetObject();
arp = NULL; arp = NULL;
val = objp->GetValue(key); val = objp->GetKeyValue(key);
if (!val || !(jsp = val->GetJson())) { if (!val || !(jsp = val->GetJson())) {
sprintf(g->Message, "Cannot find object key %s", key); sprintf(g->Message, "Cannot find object key %s", key);
...@@ -2215,7 +2215,7 @@ int TDBJSON::MakeDocument(PGLOBAL g) ...@@ -2215,7 +2215,7 @@ int TDBJSON::MakeDocument(PGLOBAL g)
arp = jsp->GetArray(); arp = jsp->GetArray();
objp = NULL; objp = NULL;
i = atoi(p) - B; i = atoi(p) - B;
val = arp->GetValue(i); val = arp->GetArrayValue(i);
if (!val) { if (!val) {
sprintf(g->Message, "Cannot find array value %d", i); sprintf(g->Message, "Cannot find array value %d", i);
...@@ -2236,17 +2236,17 @@ int TDBJSON::MakeDocument(PGLOBAL g) ...@@ -2236,17 +2236,17 @@ int TDBJSON::MakeDocument(PGLOBAL g)
Doc = new(g) JARRAY; Doc = new(g) JARRAY;
if (val) { if (val) {
Doc->AddValue(g, val); Doc->AddArrayValue(g, val);
Doc->InitArray(g); Doc->InitArray(g);
} else if (jsp) { } else if (jsp) {
Doc->AddValue(g, new(g) JVALUE(jsp)); Doc->AddArrayValue(g, new(g) JVALUE(jsp));
Doc->InitArray(g); Doc->InitArray(g);
} // endif val } // endif val
if (objp) if (objp)
objp->SetValue(g, new(g) JVALUE(Doc), key); objp->SetKeyValue(g, new(g) JVALUE(Doc), key);
else if (arp) else if (arp)
arp->SetValue(g, new(g) JVALUE(Doc), i); arp->SetArrayValue(g, new(g) JVALUE(Doc), i);
else else
Top = Doc; Top = Doc;
...@@ -2409,7 +2409,7 @@ int TDBJSON::ReadDB(PGLOBAL) ...@@ -2409,7 +2409,7 @@ int TDBJSON::ReadDB(PGLOBAL)
M++; M++;
rc = RC_OK; rc = RC_OK;
} else if (++Fpos < (signed)Doc->size()) { } else if (++Fpos < (signed)Doc->size()) {
Row = Doc->GetValue(Fpos); Row = Doc->GetArrayValue(Fpos);
if (Row->GetType() == TYPE_JVAL) if (Row->GetType() == TYPE_JVAL)
Row = ((PJVAL)Row)->GetJson(); Row = ((PJVAL)Row)->GetJson();
...@@ -2432,25 +2432,25 @@ int TDBJSON::WriteDB(PGLOBAL g) ...@@ -2432,25 +2432,25 @@ int TDBJSON::WriteDB(PGLOBAL g)
PJVAL vp = new(g) JVALUE(Row); PJVAL vp = new(g) JVALUE(Row);
if (Mode == MODE_INSERT) { if (Mode == MODE_INSERT) {
Doc->AddValue(g, vp); Doc->AddArrayValue(g, vp);
Row = new(g) JOBJECT; Row = new(g) JOBJECT;
} else if (Doc->SetValue(g, vp, Fpos)) } else if (Doc->SetArrayValue(g, vp, Fpos))
return RC_FX; return RC_FX;
} else if (Jmode == MODE_ARRAY) { } else if (Jmode == MODE_ARRAY) {
PJVAL vp = new(g) JVALUE(Row); PJVAL vp = new(g) JVALUE(Row);
if (Mode == MODE_INSERT) { if (Mode == MODE_INSERT) {
Doc->AddValue(g, vp); Doc->AddArrayValue(g, vp);
Row = new(g) JARRAY; Row = new(g) JARRAY;
} else if (Doc->SetValue(g, vp, Fpos)) } else if (Doc->SetArrayValue(g, vp, Fpos))
return RC_FX; return RC_FX;
} else { // if (Jmode == MODE_VALUE) } else { // if (Jmode == MODE_VALUE)
if (Mode == MODE_INSERT) { if (Mode == MODE_INSERT) {
Doc->AddValue(g, (PJVAL)Row); Doc->AddArrayValue(g, (PJVAL)Row);
Row = new(g) JVALUE; Row = new(g) JVALUE;
} else if (Doc->SetValue(g, (PJVAL)Row, Fpos)) } else if (Doc->SetArrayValue(g, (PJVAL)Row, Fpos))
return RC_FX; return RC_FX;
} // endif Jmode } // endif Jmode
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment