summaryrefslogtreecommitdiff
path: root/include/json_lib.h
diff options
context:
space:
mode:
authorSergei Petrunia <psergey@askmonty.org>2022-01-19 18:35:27 +0300
committerSergei Petrunia <psergey@askmonty.org>2022-01-19 18:35:27 +0300
commitda78030ec87e30d2218a0de182ffb87fc541da97 (patch)
tree7f7ce9bb818d56679eaf034b52f05738b8d83da1 /include/json_lib.h
parente222e44d1bfc995870430bb90d8ac97e91f66cb4 (diff)
parentce4956f3229a8b2c26a4913fdbc190b5c822cb8e (diff)
downloadmariadb-git-preview-10.8-MDEV-26519-json-histograms.tar.gz
Merge MDEV-26519: JSON_HB histograms into 10.8preview-10.8-MDEV-26519-json-histograms
Diffstat (limited to 'include/json_lib.h')
-rw-r--r--include/json_lib.h14
1 files changed, 10 insertions, 4 deletions
diff --git a/include/json_lib.h b/include/json_lib.h
index 6d802860cff..853c4a6f7fa 100644
--- a/include/json_lib.h
+++ b/include/json_lib.h
@@ -373,6 +373,9 @@ int json_find_paths_first(json_engine_t *je, json_find_paths_t *state,
int json_find_paths_next(json_engine_t *je, json_find_paths_t *state);
+#define JSON_ERROR_OUT_OF_SPACE (-1)
+#define JSON_ERROR_ILLEGAL_SYMBOL (-2)
+
/*
Converst JSON string constant into ordinary string constant
which can involve unpacking json escapes and changing character set.
@@ -385,10 +388,13 @@ int json_unescape(CHARSET_INFO *json_cs,
uchar *res, uchar *res_end);
/*
- Converst ordinary string constant into JSON string constant.
- which can involve appropriate escaping and changing character set.
- Returns negative integer in the case of an error,
- the length of the result otherwise.
+ Convert a string constant into JSON string constant.
+ This can involve appropriate escaping and changing the character set.
+ Returns the length of the result on success,
+ on error returns a negative error code.
+ Some error codes:
+ JSON_ERROR_OUT_OF_SPACE Not enough space in the provided buffer
+ JSON_ERROR_ILLEGAL_SYMBOL Source symbol cannot be represented in JSON
*/
int json_escape(CHARSET_INFO *str_cs, const uchar *str, const uchar *str_end,
CHARSET_INFO *json_cs, uchar *json, uchar *json_end);