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
8101af68
Commit
8101af68
authored
Nov 14, 2021
by
Sergei Krivonos
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
MDEV-27036: allow Json_writer_[array|object] from Json_writer
parent
70e788b1
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
31 additions
and
10 deletions
+31
-10
sql/my_json_writer.h
sql/my_json_writer.h
+31
-10
No files found.
sql/my_json_writer.h
View file @
8101af68
...
...
@@ -367,14 +367,24 @@ class Json_writer_struct
*/
bool
closed
;
public:
explicit
Json_writer_struct
(
THD
*
thd
)
explicit
Json_writer_struct
(
Json_writer
*
writer
)
:
my_writer
(
writer
)
{
my_writer
=
thd
->
opt_trace
.
get_current_json
();
context
.
init
(
my_writer
);
closed
=
false
;
}
bool
trace_started
()
explicit
Json_writer_struct
(
THD
*
thd
)
:
Json_writer_struct
(
thd
->
opt_trace
.
get_current_json
())
{
}
public:
virtual
~
Json_writer_struct
()
{
}
bool
trace_started
()
const
{
return
my_writer
!=
0
;
}
...
...
@@ -397,8 +407,8 @@ class Json_writer_object : public Json_writer_struct
my_writer
->
add_member
(
name
);
}
public:
explicit
Json_writer_object
(
THD
*
thd
,
const
char
*
str
=
nullptr
)
:
Json_writer_struct
(
thd
)
explicit
Json_writer_object
(
Json_writer
*
writer
,
const
char
*
str
=
nullptr
)
:
Json_writer_struct
(
writer
)
{
if
(
unlikely
(
my_writer
))
{
...
...
@@ -408,6 +418,11 @@ class Json_writer_object : public Json_writer_struct
}
}
explicit
Json_writer_object
(
THD
*
thd
,
const
char
*
str
=
nullptr
)
:
Json_writer_object
(
thd
->
opt_trace
.
get_current_json
(),
str
)
{
}
~
Json_writer_object
()
{
if
(
my_writer
&&
!
closed
)
...
...
@@ -567,17 +582,22 @@ class Json_writer_object : public Json_writer_struct
class
Json_writer_array
:
public
Json_writer_struct
{
public:
Json_writer_array
(
THD
*
thd
)
:
Json_writer_struct
(
thd
)
explicit
Json_writer_array
(
Json_writer
*
writer
,
const
char
*
str
=
nullptr
)
:
Json_writer_struct
(
writer
)
{
if
(
unlikely
(
my_writer
))
{
if
(
str
)
my_writer
->
add_member
(
str
);
my_writer
->
start_array
();
}
}
Json_writer_array
(
THD
*
thd
,
const
char
*
str
)
:
Json_writer_struct
(
thd
)
explicit
Json_writer_array
(
THD
*
thd
,
const
char
*
str
=
nullptr
)
:
Json_writer_array
(
thd
->
opt_trace
.
get_current_json
(),
str
)
{
if
(
unlikely
(
my_writer
))
my_writer
->
add_member
(
str
).
start_array
();
}
~
Json_writer_array
()
{
if
(
unlikely
(
my_writer
&&
!
closed
))
...
...
@@ -586,6 +606,7 @@ class Json_writer_array : public Json_writer_struct
closed
=
TRUE
;
}
}
void
end
()
{
DBUG_ASSERT
(
!
closed
);
...
...
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