summaryrefslogtreecommitdiff
path: root/storage/connect/json.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'storage/connect/json.cpp')
-rw-r--r--storage/connect/json.cpp25
1 files changed, 25 insertions, 0 deletions
diff --git a/storage/connect/json.cpp b/storage/connect/json.cpp
index 2b339e9e9f6..60c42a7c277 100644
--- a/storage/connect/json.cpp
+++ b/storage/connect/json.cpp
@@ -893,6 +893,20 @@ PJPR JOBJECT::AddPair(PGLOBAL g, PSZ key)
} // end of AddPair
/***********************************************************************/
+/* Return all keys as an array. */
+/***********************************************************************/
+PJAR JOBJECT::GetKeyList(PGLOBAL g)
+{
+ PJAR jarp = new(g) JARRAY();
+
+ for (PJPR jpp = First; jpp; jpp = jpp->Next)
+ jarp->AddValue(g, new(g) JVALUE(g, jpp->GetKey()));
+
+ jarp->InitArray(g);
+ return jarp;
+} // end of GetKeyList
+
+/***********************************************************************/
/* Get the value corresponding to the given key. */
/***********************************************************************/
PJVAL JOBJECT::GetValue(const char* key)
@@ -1107,6 +1121,17 @@ JVALUE::JVALUE(PGLOBAL g, PVAL valp) : JSON()
} // end of JVALUE constructor
/***********************************************************************/
+/* Constructor for a given string. */
+/***********************************************************************/
+JVALUE::JVALUE(PGLOBAL g, PSZ strp) : JSON()
+{
+ Jsp = NULL;
+ Value = AllocateValue(g, strp, TYPE_STRING);
+ Next = NULL;
+ Del = false;
+} // end of JVALUE constructor
+
+/***********************************************************************/
/* Returns the type of the Value's value. */
/***********************************************************************/
JTYP JVALUE::GetValType(void)