mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-12-15 19:02:04 +00:00
deda29b46b
See #39224
48 lines
792 B
C++
48 lines
792 B
C++
#include <Common/quoteString.h>
|
|
#include <IO/WriteHelpers.h>
|
|
#include <IO/WriteBufferFromString.h>
|
|
|
|
|
|
namespace DB
|
|
{
|
|
String quoteString(std::string_view x)
|
|
{
|
|
String res(x.size(), '\0');
|
|
WriteBufferFromString wb(res);
|
|
writeQuotedString(x, wb);
|
|
return res;
|
|
}
|
|
|
|
|
|
String doubleQuoteString(StringRef x)
|
|
{
|
|
String res(x.size, '\0');
|
|
WriteBufferFromString wb(res);
|
|
writeDoubleQuotedString(x, wb);
|
|
return res;
|
|
}
|
|
|
|
|
|
String backQuote(StringRef x)
|
|
{
|
|
String res(x.size, '\0');
|
|
{
|
|
WriteBufferFromString wb(res);
|
|
writeBackQuotedString(x, wb);
|
|
}
|
|
return res;
|
|
}
|
|
|
|
|
|
String backQuoteIfNeed(StringRef x)
|
|
{
|
|
String res(x.size, '\0');
|
|
{
|
|
WriteBufferFromString wb(res);
|
|
writeProbablyBackQuotedString(x, wb);
|
|
}
|
|
return res;
|
|
}
|
|
|
|
}
|