2019-10-08 18:42:22 +00:00
|
|
|
#include <Common/quoteString.h>
|
|
|
|
#include <IO/WriteHelpers.h>
|
|
|
|
#include <IO/WriteBufferFromString.h>
|
|
|
|
|
|
|
|
|
|
|
|
namespace DB
|
|
|
|
{
|
|
|
|
String quoteString(const StringRef & x)
|
|
|
|
{
|
|
|
|
String res(x.size, '\0');
|
|
|
|
WriteBufferFromString wb(res);
|
|
|
|
writeQuotedString(x, wb);
|
|
|
|
return res;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2019-10-17 16:01:28 +00:00
|
|
|
String doubleQuoteString(const StringRef & x)
|
|
|
|
{
|
|
|
|
String res(x.size, '\0');
|
|
|
|
WriteBufferFromString wb(res);
|
|
|
|
writeDoubleQuotedString(x, wb);
|
|
|
|
return res;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2019-10-08 18:42:22 +00:00
|
|
|
String backQuote(const StringRef & x)
|
|
|
|
{
|
|
|
|
String res(x.size, '\0');
|
|
|
|
{
|
|
|
|
WriteBufferFromString wb(res);
|
|
|
|
writeBackQuotedString(x, wb);
|
|
|
|
}
|
|
|
|
return res;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
String backQuoteIfNeed(const StringRef & x)
|
|
|
|
{
|
|
|
|
String res(x.size, '\0');
|
|
|
|
{
|
|
|
|
WriteBufferFromString wb(res);
|
|
|
|
writeProbablyBackQuotedString(x, wb);
|
|
|
|
}
|
|
|
|
return res;
|
|
|
|
}
|
|
|
|
}
|