2019-10-08 18:42:22 +00:00
|
|
|
#pragma once
|
|
|
|
|
2021-10-02 07:13:14 +00:00
|
|
|
#include <base/types.h>
|
|
|
|
#include <base/StringRef.h>
|
2021-10-03 15:36:08 +00:00
|
|
|
#include <concepts>
|
2019-10-08 18:42:22 +00:00
|
|
|
|
|
|
|
|
|
|
|
namespace DB
|
|
|
|
{
|
2021-10-03 15:36:08 +00:00
|
|
|
[[nodiscard]] String quoteString(std::string_view x);
|
|
|
|
|
|
|
|
// Prefer string_view over StringRef for implicit conversions
|
|
|
|
[[nodiscard]] inline String quoteString(std::same_as<StringRef> auto x)
|
|
|
|
{
|
|
|
|
return quoteString(std::string_view{x.data, x.size});
|
|
|
|
}
|
2019-10-08 18:42:22 +00:00
|
|
|
|
2019-10-17 16:01:28 +00:00
|
|
|
/// Double quote the string.
|
|
|
|
String doubleQuoteString(const StringRef & x);
|
|
|
|
|
2019-10-08 18:42:22 +00:00
|
|
|
/// Quote the identifier with backquotes.
|
|
|
|
String backQuote(const StringRef & x);
|
|
|
|
|
|
|
|
/// Quote the identifier with backquotes, if required.
|
|
|
|
String backQuoteIfNeed(const StringRef & x);
|
|
|
|
}
|