mirror of
https://github.com/MariaDB/server.git
synced 2025-08-07 00:04:31 +03:00
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.
This commit is contained in:
@@ -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;
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user