Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
MariaDB
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
MariaDB
Commits
59413714
Commit
59413714
authored
Jun 17, 2023
by
Sergei Golubchik
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
cleanup: make some json* helper functions static
parent
6c2c9ddb
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
33 deletions
+20
-33
sql/item_jsonfunc.cc
sql/item_jsonfunc.cc
+20
-14
sql/item_jsonfunc.h
sql/item_jsonfunc.h
+0
-19
No files found.
sql/item_jsonfunc.cc
View file @
59413714
...
@@ -21,6 +21,10 @@
...
@@ -21,6 +21,10 @@
#include "sql_parse.h" // For check_stack_overrun
#include "sql_parse.h" // For check_stack_overrun
#include "json_schema_helper.h"
#include "json_schema_helper.h"
static
bool
get_current_value
(
json_engine_t
*
,
const
uchar
*&
,
size_t
&
);
static
int
check_overlaps
(
json_engine_t
*
,
json_engine_t
*
,
bool
);
static
int
json_find_overlap_with_object
(
json_engine_t
*
,
json_engine_t
*
,
bool
);
/*
/*
Compare ASCII string against the string with the specified
Compare ASCII string against the string with the specified
character set.
character set.
...
@@ -4307,7 +4311,7 @@ bool Item_func_json_normalize::fix_length_and_dec(THD *thd)
...
@@ -4307,7 +4311,7 @@ bool Item_func_json_normalize::fix_length_and_dec(THD *thd)
left in the object that we no longer want to compare. In this case,
left in the object that we no longer want to compare. In this case,
we want to skip the current item.
we want to skip the current item.
*/
*/
void
json_skip_current_level
(
json_engine_t
*
js
,
json_engine_t
*
value
)
static
void
json_skip_current_level
(
json_engine_t
*
js
,
json_engine_t
*
value
)
{
{
json_skip_level
(
js
);
json_skip_level
(
js
);
json_skip_level
(
value
);
json_skip_level
(
value
);
...
@@ -4315,7 +4319,7 @@ void json_skip_current_level(json_engine_t *js, json_engine_t *value)
...
@@ -4315,7 +4319,7 @@ void json_skip_current_level(json_engine_t *js, json_engine_t *value)
/* At least one of the two arguments is a scalar. */
/* At least one of the two arguments is a scalar. */
bool
json_find_overlap_with_scalar
(
json_engine_t
*
js
,
json_engine_t
*
value
)
static
bool
json_find_overlap_with_scalar
(
json_engine_t
*
js
,
json_engine_t
*
value
)
{
{
if
(
json_value_scalar
(
value
))
if
(
json_value_scalar
(
value
))
{
{
...
@@ -4367,7 +4371,7 @@ bool json_find_overlap_with_scalar(json_engine_t *js, json_engine_t *value)
...
@@ -4367,7 +4371,7 @@ bool json_find_overlap_with_scalar(json_engine_t *js, json_engine_t *value)
array is object, then compare the two objects entirely. If they are
array is object, then compare the two objects entirely. If they are
equal return true else return false.
equal return true else return false.
*/
*/
bool
json_compare_arr_and_obj
(
json_engine_t
*
js
,
json_engine_t
*
value
)
static
bool
json_compare_arr_and_obj
(
json_engine_t
*
js
,
json_engine_t
*
value
)
{
{
st_json_engine_t
loc_val
=
*
value
;
st_json_engine_t
loc_val
=
*
value
;
while
(
json_scan_next
(
js
)
==
0
&&
js
->
state
==
JST_VALUE
)
while
(
json_scan_next
(
js
)
==
0
&&
js
->
state
==
JST_VALUE
)
...
@@ -4415,7 +4419,7 @@ bool json_compare_arrays_in_order(json_engine_t *js, json_engine_t *value)
...
@@ -4415,7 +4419,7 @@ bool json_compare_arrays_in_order(json_engine_t *js, json_engine_t *value)
}
}
int
json_find_overlap_with_array
(
json_engine_t
*
js
,
json_engine_t
*
value
,
static
int
json_find_overlap_with_array
(
json_engine_t
*
js
,
json_engine_t
*
value
,
bool
compare_whole
)
bool
compare_whole
)
{
{
if
(
value
->
value_type
==
JSON_VALUE_ARRAY
)
if
(
value
->
value_type
==
JSON_VALUE_ARRAY
)
...
@@ -4500,7 +4504,9 @@ int compare_nested_object(json_engine_t *js, json_engine_t *value)
...
@@ -4500,7 +4504,9 @@ int compare_nested_object(json_engine_t *js, json_engine_t *value)
return
MY_TEST
(
result
);
return
MY_TEST
(
result
);
}
}
int
json_find_overlap_with_object
(
json_engine_t
*
js
,
json_engine_t
*
value
,
static
int
json_find_overlap_with_object
(
json_engine_t
*
js
,
json_engine_t
*
value
,
bool
compare_whole
)
bool
compare_whole
)
{
{
if
(
value
->
value_type
==
JSON_VALUE_OBJECT
)
if
(
value
->
value_type
==
JSON_VALUE_OBJECT
)
...
@@ -4656,7 +4662,7 @@ int json_find_overlap_with_object(json_engine_t *js, json_engine_t *value,
...
@@ -4656,7 +4662,7 @@ int json_find_overlap_with_object(json_engine_t *js, json_engine_t *value,
FALSE - If two json documents do not overlap
FALSE - If two json documents do not overlap
TRUE - if two json documents overlap
TRUE - if two json documents overlap
*/
*/
int
check_overlaps
(
json_engine_t
*
js
,
json_engine_t
*
value
,
bool
compare_whole
)
static
int
check_overlaps
(
json_engine_t
*
js
,
json_engine_t
*
value
,
bool
compare_whole
)
{
{
DBUG_EXECUTE_IF
(
"json_check_min_stack_requirement"
,
DBUG_EXECUTE_IF
(
"json_check_min_stack_requirement"
,
{
{
...
@@ -4984,8 +4990,8 @@ bool Item_func_json_key_value::fix_length_and_dec(THD *thd)
...
@@ -4984,8 +4990,8 @@ bool Item_func_json_key_value::fix_length_and_dec(THD *thd)
}
}
bool
create_hash
(
json_engine_t
*
value
,
HASH
*
items
,
bool
&
hash_inited
,
static
bool
create_hash
(
json_engine_t
*
value
,
HASH
*
items
,
bool
&
hash_inited
,
MEM_ROOT
*
hash_root
)
MEM_ROOT
*
hash_root
)
{
{
int
level
=
value
->
stack_p
;
int
level
=
value
->
stack_p
;
if
(
my_hash_init
(
PSI_INSTRUMENT_ME
,
items
,
value
->
s
.
cs
,
0
,
0
,
0
,
if
(
my_hash_init
(
PSI_INSTRUMENT_ME
,
items
,
value
->
s
.
cs
,
0
,
0
,
0
,
...
@@ -5042,8 +5048,8 @@ bool create_hash(json_engine_t *value, HASH *items, bool &hash_inited,
...
@@ -5042,8 +5048,8 @@ bool create_hash(json_engine_t *value, HASH *items, bool &hash_inited,
FALSE - The function was successfully completed without errors.
FALSE - The function was successfully completed without errors.
TRUE - An error occurred while running.
TRUE - An error occurred while running.
*/
*/
bool
get_current_value
(
json_engine_t
*
js
,
const
uchar
*&
value_start
,
static
bool
get_current_value
(
json_engine_t
*
js
,
const
uchar
*&
value_start
,
size_t
&
value_len
)
size_t
&
value_len
)
{
{
value_start
=
js
->
value_begin
;
value_start
=
js
->
value_begin
;
...
@@ -5072,8 +5078,8 @@ bool get_current_value(json_engine_t *js, const uchar *&value_start,
...
@@ -5072,8 +5078,8 @@ bool get_current_value(json_engine_t *js, const uchar *&value_start,
FALSE - if two array documents have intersection
FALSE - if two array documents have intersection
TRUE - If two array documents do not have intersection
TRUE - If two array documents do not have intersection
*/
*/
bool
get_intersect_between_arrays
(
String
*
str
,
json_engine_t
*
value
,
static
bool
get_intersect_between_arrays
(
String
*
str
,
json_engine_t
*
value
,
HASH
items
)
HASH
items
)
{
{
bool
res
=
true
,
has_value
=
false
;
bool
res
=
true
,
has_value
=
false
;
int
level
=
value
->
stack_p
;
int
level
=
value
->
stack_p
;
...
@@ -5228,7 +5234,7 @@ bool Item_func_json_array_intersect::fix_length_and_dec(THD *thd)
...
@@ -5228,7 +5234,7 @@ bool Item_func_json_array_intersect::fix_length_and_dec(THD *thd)
}
}
bool
filter_keys
(
json_engine_t
*
je1
,
String
*
str
,
HASH
items
)
static
bool
filter_keys
(
json_engine_t
*
je1
,
String
*
str
,
HASH
items
)
{
{
int
level
=
je1
->
stack_p
;
int
level
=
je1
->
stack_p
;
String
temp_str
(
0
);
String
temp_str
(
0
);
...
@@ -5380,7 +5386,7 @@ bool Item_func_json_object_filter_keys::fix_length_and_dec(THD *thd)
...
@@ -5380,7 +5386,7 @@ bool Item_func_json_object_filter_keys::fix_length_and_dec(THD *thd)
return
FALSE
;
return
FALSE
;
}
}
bool
convert_to_array
(
json_engine_t
*
je
,
String
*
str
)
static
bool
convert_to_array
(
json_engine_t
*
je
,
String
*
str
)
{
{
int
level
=
je
->
stack_p
;
int
level
=
je
->
stack_p
;
String
temp_str
(
0
);
String
temp_str
(
0
);
...
...
sql/item_jsonfunc.h
View file @
59413714
...
@@ -48,25 +48,6 @@ void report_path_error_ex(const char *ps, json_path_t *p,
...
@@ -48,25 +48,6 @@ void report_path_error_ex(const char *ps, json_path_t *p,
void
report_json_error_ex
(
const
char
*
js
,
json_engine_t
*
je
,
void
report_json_error_ex
(
const
char
*
js
,
json_engine_t
*
je
,
const
char
*
fname
,
int
n_param
,
const
char
*
fname
,
int
n_param
,
Sql_condition
::
enum_warning_level
lv
);
Sql_condition
::
enum_warning_level
lv
);
int
check_overlaps
(
json_engine_t
*
js
,
json_engine_t
*
value
,
bool
compare_whole
);
int
json_find_overlap_with_object
(
json_engine_t
*
js
,
json_engine_t
*
value
,
bool
compare_whole
);
void
json_skip_current_level
(
json_engine_t
*
js
,
json_engine_t
*
value
);
bool
json_find_overlap_with_scalar
(
json_engine_t
*
js
,
json_engine_t
*
value
);
bool
json_compare_arrays_in_order_in_order
(
json_engine_t
*
js
,
json_engine_t
*
value
);
bool
json_compare_arr_and_obj
(
json_engine_t
*
js
,
json_engine_t
*
value
);
int
json_find_overlap_with_array
(
json_engine_t
*
js
,
json_engine_t
*
value
,
bool
compare_whole
);
bool
create_hash
(
json_engine_t
*
value
,
HASH
*
items
,
bool
&
hash_inited
);
bool
create_item
(
LEX_CSTRING
*&
new_entry
,
const
uchar
*
value_start
,
size_t
value_len
);
bool
get_current_value
(
json_engine_t
*
js
,
const
uchar
*&
value_start
,
size_t
&
value_len
);
bool
get_intersect_between_arrays
(
String
*
str
,
json_engine_t
*
value
);
class
Json_engine_scan
:
public
json_engine_t
class
Json_engine_scan
:
public
json_engine_t
{
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment