summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorRucha Deodhar <rucha.deodhar@mariadb.com>2022-03-05 01:03:49 +0530
committerRucha Deodhar <rucha.deodhar@mariadb.com>2022-04-15 01:02:44 +0530
commitc781cefd8afc0fa5840456c96f5a0c37cac2edfa (patch)
treedb5008c4f763e4d954f7f9fefa0270f6bc3effbd /include
parentabe971219456b1f41923c06ff715fd4efeb02850 (diff)
downloadmariadb-git-c781cefd8afc0fa5840456c96f5a0c37cac2edfa.tar.gz
MDEV-27911: Implement range notation for json path
Range can be thought about in similar manner as wildcard (*) where more than one elements are processed. To implement range notation, extended json parser to parse the 'to' keyword and added JSON_PATH_ARRAY_RANGE for path type. If there is 'to' keyword then use JSON_PATH_ARRAY range for path type along with existing type. This new integer to store the end index of range is n_item_end. When there is 'to' keyword, store the integer in n_item_end else store in n_item.
Diffstat (limited to 'include')
-rw-r--r--include/json_lib.h4
1 files changed, 3 insertions, 1 deletions
diff --git a/include/json_lib.h b/include/json_lib.h
index 41ab88b06ce..1f12487d7e8 100644
--- a/include/json_lib.h
+++ b/include/json_lib.h
@@ -84,7 +84,8 @@ enum json_path_step_types
JSON_PATH_KEY_DOUBLEWILD= 1+8,
JSON_PATH_ARRAY_WILD= 2+4,
JSON_PATH_ARRAY_DOUBLEWILD= 2+8,
- JSON_PATH_NEGATIVE_INDEX= 16
+ JSON_PATH_NEGATIVE_INDEX= 16,
+ JSON_PATH_ARRAY_RANGE= 32
};
@@ -95,6 +96,7 @@ typedef struct st_json_path_step_t
const uchar *key; /* Pointer to the beginning of the key. */
const uchar *key_end; /* Pointer to the end of the key. */
int n_item; /* Item number in an array. No meaning for the key step. */
+ int n_item_end; /* Last index of the range. */
} json_path_step_t;