1#include <Common/quoteString.h>
2#include <IO/WriteHelpers.h>
3#include <IO/WriteBufferFromString.h>
4
5
6namespace DB
7{
8String quoteString(const StringRef & x)
9{
10 String res(x.size, '\0');
11 WriteBufferFromString wb(res);
12 writeQuotedString(x, wb);
13 return res;
14}
15
16
17String doubleQuoteString(const StringRef & x)
18{
19 String res(x.size, '\0');
20 WriteBufferFromString wb(res);
21 writeDoubleQuotedString(x, wb);
22 return res;
23}
24
25
26String backQuote(const StringRef & x)
27{
28 String res(x.size, '\0');
29 {
30 WriteBufferFromString wb(res);
31 writeBackQuotedString(x, wb);
32 }
33 return res;
34}
35
36
37String backQuoteIfNeed(const StringRef & x)
38{
39 String res(x.size, '\0');
40 {
41 WriteBufferFromString wb(res);
42 writeProbablyBackQuotedString(x, wb);
43 }
44 return res;
45}
46}
47