mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-18 05:32:52 +00:00
47 lines
814 B
C++
47 lines
814 B
C++
#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;
|
|
}
|
|
|
|
|
|
String doubleQuoteString(const StringRef & x)
|
|
{
|
|
String res(x.size, '\0');
|
|
WriteBufferFromString wb(res);
|
|
writeDoubleQuotedString(x, wb);
|
|
return res;
|
|
}
|
|
|
|
|
|
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;
|
|
}
|
|
}
|