Skip to content

Conversation

@bocharov
Copy link
Contributor

@bocharov bocharov commented Aug 6, 2018

Add output_format_json_escape_slashes setting - controls escaping slashes for string outputs in JSON output format.

I hereby agree to the terms of the CLA available at: https://yandex.ru/legal/cla/?lang=en


writeCString("\t\t\t", ostr);
writeJSONString(column.name, ostr);
writeJSONString(column.name, ostr, settings);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

settings are propagated not in every call to writeJSONString.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@alexey-milovidov please have another look, should be fine now.
Also added some basic tests.

* - all other non-ASCII characters remain as is
*/
inline void writeJSONString(const char * begin, const char * end, WriteBuffer & buf)
inline void writeJSONString(const char * begin, const char * end, WriteBuffer & buf, const FormatSettings & settings = FormatSettings())
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Try to remove default whenever possible.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not in every place the settings are available, e.g. FileChecker::save method doesn't have settings instance available.
How should we approach this case?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just create default FormatSettings before call to this function.
If the function is called in the loop - move FormatSettings out of the loop, just in case.

Copy link
Member

@alexey-milovidov alexey-milovidov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

.

@alexey-milovidov alexey-milovidov merged commit b1d70c1 into ClickHouse:master Aug 7, 2018
@bocharov bocharov deleted the feature-add-output_format_json_escape_slashes-setting branch August 11, 2018 09:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants