summaryrefslogtreecommitdiff
path: root/sql/my_json_writer.cc
diff options
context:
space:
mode:
authorSergei Petrunia <psergey@askmonty.org>2014-12-06 20:13:38 +0300
committerSergei Petrunia <psergey@askmonty.org>2014-12-06 20:13:38 +0300
commiteeef80d09f8045d99963a2bf2fa92595c55bb26d (patch)
treeea7f35209ac2a6d5c05c955437a70c5c8c6514cf /sql/my_json_writer.cc
parentdc259324d767e10f118c2d14dc905e1bb54aa58a (diff)
downloadmariadb-git-eeef80d09f8045d99963a2bf2fa92595c55bb26d.tar.gz
EXPLAIN FORMAT=JSON : Fix MDEV-7266, bug in pretty-printer
- Single_line_formatting_helper should not accidentally exit the DISABLED state. No JSON construct should be able to move the Single_line_formatting_helper from DISABLED state.
Diffstat (limited to 'sql/my_json_writer.cc')
-rw-r--r--sql/my_json_writer.cc6
1 files changed, 5 insertions, 1 deletions
diff --git a/sql/my_json_writer.cc b/sql/my_json_writer.cc
index 4f933583347..7a3dc776093 100644
--- a/sql/my_json_writer.cc
+++ b/sql/my_json_writer.cc
@@ -218,7 +218,8 @@ bool Single_line_formatting_helper::on_start_array()
}
else
{
- state= INACTIVE;
+ if (state != DISABLED)
+ state= INACTIVE;
// TODO: what if we have accumulated some stuff already? shouldn't we
// flush it?
return false; // not handled
@@ -313,6 +314,9 @@ void Single_line_formatting_helper::flush_on_one_line()
void Single_line_formatting_helper::disable_and_flush()
{
+ if (state == DISABLED)
+ return;
+
bool start_array= (state == IN_ARRAY);
state= DISABLED;
// deactivate ourselves and flush all accumulated calls.