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
3add51b7
Commit
3add51b7
authored
Jul 01, 2021
by
Sergei Golubchik
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
cleanup: move the common code into the function
parent
3cc278e9
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
21 deletions
+4
-21
sql/item_jsonfunc.cc
sql/item_jsonfunc.cc
+4
-21
No files found.
sql/item_jsonfunc.cc
View file @
3add51b7
...
...
@@ -133,16 +133,15 @@ static int json_nice(json_engine_t *je, String *nice_js,
Item_func_json_format
::
formats
mode
,
int
tab_size
=
4
)
{
int
depth
=
0
;
const
char
*
comma
,
*
colon
;
static
const
char
*
comma
=
", "
,
*
colon
=
"
\"
: "
;
uint
comma_len
,
colon_len
;
int
first_value
=
1
;
DBUG_ASSERT
(
je
->
s
.
cs
==
nice_js
->
charset
());
nice_js
->
length
(
0
);
nice_js
->
set_charset
(
je
->
s
.
cs
);
DBUG_ASSERT
(
mode
!=
Item_func_json_format
::
DETAILED
||
(
tab_size
>=
0
&&
tab_size
<=
TAB_SIZE_LIMIT
));
comma
=
", "
;
colon
=
"
\"
: "
;
if
(
mode
==
Item_func_json_format
::
LOOSE
)
{
comma_len
=
2
;
...
...
@@ -873,8 +872,6 @@ String *Item_func_json_extract::read_json(String *str,
js
=
str
;
json_scan_start
(
&
je
,
js
->
charset
(),(
const
uchar
*
)
js
->
ptr
(),
(
const
uchar
*
)
js
->
ptr
()
+
js
->
length
());
tmp_js
.
length
(
0
);
tmp_js
.
set_charset
(
js
->
charset
());
if
(
json_nice
(
&
je
,
&
tmp_js
,
Item_func_json_format
::
LOOSE
))
goto
error
;
...
...
@@ -1761,8 +1758,6 @@ String *Item_func_json_array_append::val_str(String *str)
json_scan_start
(
&
je
,
js
->
charset
(),(
const
uchar
*
)
js
->
ptr
(),
(
const
uchar
*
)
js
->
ptr
()
+
js
->
length
());
str
->
length
(
0
);
str
->
set_charset
(
js
->
charset
());
if
(
json_nice
(
&
je
,
str
,
Item_func_json_format
::
LOOSE
))
goto
js_error
;
...
...
@@ -1902,8 +1897,6 @@ String *Item_func_json_array_insert::val_str(String *str)
json_scan_start
(
&
je
,
js
->
charset
(),(
const
uchar
*
)
js
->
ptr
(),
(
const
uchar
*
)
js
->
ptr
()
+
js
->
length
());
str
->
length
(
0
);
str
->
set_charset
(
js
->
charset
());
if
(
json_nice
(
&
je
,
str
,
Item_func_json_format
::
LOOSE
))
goto
js_error
;
...
...
@@ -2070,8 +2063,7 @@ static int do_merge(String *str, json_engine_t *je1, json_engine_t *je2)
return
2
;
continue
;
}
if
(
json_skip_key
(
je2
)
||
json_skip_level
(
je1
))
if
(
json_skip_key
(
je2
)
||
json_skip_level
(
je1
))
return
1
;
goto
continue_j2
;
}
...
...
@@ -2211,8 +2203,6 @@ String *Item_func_json_merge::val_str(String *str)
json_scan_start
(
&
je1
,
js1
->
charset
(),(
const
uchar
*
)
js1
->
ptr
(),
(
const
uchar
*
)
js1
->
ptr
()
+
js1
->
length
());
str
->
length
(
0
);
str
->
set_charset
(
js1
->
charset
());
if
(
json_nice
(
&
je1
,
str
,
Item_func_json_format
::
LOOSE
))
goto
error_return
;
...
...
@@ -2538,8 +2528,6 @@ String *Item_func_json_merge_patch::val_str(String *str)
json_scan_start
(
&
je1
,
js1
->
charset
(),(
const
uchar
*
)
js1
->
ptr
(),
(
const
uchar
*
)
js1
->
ptr
()
+
js1
->
length
());
str
->
length
(
0
);
str
->
set_charset
(
js1
->
charset
());
if
(
json_nice
(
&
je1
,
str
,
Item_func_json_format
::
LOOSE
))
goto
error_return
;
...
...
@@ -3008,7 +2996,6 @@ String *Item_func_json_insert::val_str(String *str)
json_scan_start
(
&
je
,
js
->
charset
(),(
const
uchar
*
)
js
->
ptr
(),
(
const
uchar
*
)
js
->
ptr
()
+
js
->
length
());
str
->
length
(
0
);
if
(
json_nice
(
&
je
,
str
,
Item_func_json_format
::
LOOSE
))
goto
js_error
;
...
...
@@ -3193,8 +3180,6 @@ String *Item_func_json_remove::val_str(String *str)
json_scan_start
(
&
je
,
js
->
charset
(),(
const
uchar
*
)
js
->
ptr
(),
(
const
uchar
*
)
js
->
ptr
()
+
js
->
length
());
str
->
length
(
0
);
str
->
set_charset
(
js
->
charset
());
if
(
json_nice
(
&
je
,
str
,
Item_func_json_format
::
LOOSE
))
goto
js_error
;
...
...
@@ -3616,8 +3601,6 @@ String *Item_func_json_format::val_str(String *str)
json_scan_start
(
&
je
,
js
->
charset
(),
(
const
uchar
*
)
js
->
ptr
(),
(
const
uchar
*
)
js
->
ptr
()
+
js
->
length
());
str
->
length
(
0
);
str
->
set_charset
(
js
->
charset
());
if
(
json_nice
(
&
je
,
str
,
fmt
,
tab_size
))
{
null_value
=
1
;
...
...
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