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
a9336302
Commit
a9336302
authored
Sep 12, 2018
by
Alexey Botchkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
MDEV-17018 JSON_SEARCH and User-Defined Variables.
Item_func_json_search needs a member to store the path.
parent
c3124174
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
18 additions
and
2 deletions
+18
-2
mysql-test/r/func_json.result
mysql-test/r/func_json.result
+8
-0
mysql-test/t/func_json.test
mysql-test/t/func_json.test
+8
-0
sql/item_jsonfunc.cc
sql/item_jsonfunc.cc
+1
-1
sql/item_jsonfunc.h
sql/item_jsonfunc.h
+1
-1
No files found.
mysql-test/r/func_json.result
View file @
a9336302
...
...
@@ -796,3 +796,11 @@ JSON_SET('{}', '$.a', _utf8 X'C3B6', '$.x', 1, '$.b', _utf8 X'C3B6')
select json_array_append('[ ]', '$', 'aue');
json_array_append('[ ]', '$', 'aue')
["aue"]
#
# MDEV-17018 JSON_SEARCH and User-Defined Variables.
#
SET @`json` := '["A", [{"B": "1"}], {"C": "AB"}, {"D": "BC"}]', @`value` := 'AB';
SELECT JSON_SEARCH(@`json`, 'one', @`value`);
JSON_SEARCH(@`json`, 'one', @`value`)
"$[2].C"
SET @`json` := NULL, @`value` := NULL;
mysql-test/t/func_json.test
View file @
a9336302
...
...
@@ -455,3 +455,11 @@ SELECT JSON_SET('{}', '$.a', _utf8 X'C3B6', '$.x', 1, '$.b', _utf8 X'C3B6');
select
json_array_append
(
'[ ]'
,
'$'
,
'aue'
);
--
echo
#
--
echo
# MDEV-17018 JSON_SEARCH and User-Defined Variables.
--
echo
#
SET
@
`json`
:=
'["A", [{"B": "1"}], {"C": "AB"}, {"D": "BC"}]'
,
@
`value`
:=
'AB'
;
SELECT
JSON_SEARCH
(
@
`json`
,
'one'
,
@
`value`
);
SET
@
`json`
:=
NULL
,
@
`value`
:=
NULL
;
sql/item_jsonfunc.cc
View file @
a9336302
...
...
@@ -3056,7 +3056,7 @@ static int append_json_path(String *str, const json_path_t *p)
String
*
Item_func_json_search
::
val_str
(
String
*
str
)
{
String
*
js
=
args
[
0
]
->
val_json
(
&
tmp_js
);
String
*
s_str
=
args
[
2
]
->
val_str
(
&
tmp_
js
);
String
*
s_str
=
args
[
2
]
->
val_str
(
&
tmp_
path
);
json_engine_t
je
;
json_path_t
p
,
sav_path
;
uint
n_arg
;
...
...
sql/item_jsonfunc.h
View file @
a9336302
...
...
@@ -400,7 +400,7 @@ class Item_func_json_keys: public Item_str_func
class
Item_func_json_search
:
public
Item_json_str_multipath
{
protected:
String
tmp_js
,
esc_value
;
String
tmp_js
,
tmp_path
,
esc_value
;
bool
mode_one
;
bool
ooa_constant
,
ooa_parsed
;
int
escape
;
...
...
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