moved prepare_* methods from dialect to query_utils
This commit is contained in:
@@ -21,15 +21,14 @@ namespace matador::sql {
|
||||
|
||||
class connection_impl;
|
||||
|
||||
class dialect final
|
||||
{
|
||||
class dialect final {
|
||||
public:
|
||||
/**
|
||||
* Holding enums concerning escaping identifiers
|
||||
*/
|
||||
enum class escape_identifier_t : uint8_t {
|
||||
ESCAPE_BOTH_SAME, /**< The escape quotes are the same */
|
||||
ESCAPE_CLOSING_BRACKET /**< The escape quotes differ; escape the closing one */
|
||||
EscapeBothSame, /**< The escape quotes are the same */
|
||||
EscapeClosingBracket /**< The escape quotes differ; escape the closing one */
|
||||
};
|
||||
|
||||
using token_to_string_map = std::unordered_map<dialect_token, std::string>;
|
||||
@@ -44,50 +43,10 @@ public:
|
||||
[[nodiscard]] const std::string& data_type_at(utils::basic_type type) const;
|
||||
[[nodiscard]] const std::string& sql_function_at(sql_function_t func) const;
|
||||
|
||||
/**
|
||||
* Prepare sql dialect identifier for execution
|
||||
* and escape quotes and quote the identifier
|
||||
* string
|
||||
*
|
||||
* @param col The identifier string to be prepared
|
||||
* @return The prepared string
|
||||
*/
|
||||
[[nodiscard]] std::string prepare_identifier_string(const std::string &col) const;
|
||||
|
||||
[[nodiscard]] const std::string& to_string(bool val) const;
|
||||
|
||||
[[nodiscard]] std::string to_sql_string(const utils::value &val) const ;
|
||||
|
||||
void bool_strings(const std::string &true_string, const std::string &false_string);
|
||||
|
||||
/**
|
||||
* Prepare string literal
|
||||
*
|
||||
* @param str String literal to be prepared
|
||||
*/
|
||||
[[nodiscard]] std::string prepare_literal(const std::string &str) const;
|
||||
|
||||
/**
|
||||
* Wrap identifier quotes around a SQL identifier keyword
|
||||
*
|
||||
* @param str Identifier to put quotes around
|
||||
*/
|
||||
void quote_identifier(std::string &str) const;
|
||||
|
||||
/**
|
||||
* Escape identifier quotes inside identifiers.
|
||||
*
|
||||
* @param str Identifier to be escaped
|
||||
*/
|
||||
void escape_quotes_in_identifier(std::string &str) const;
|
||||
|
||||
/**
|
||||
* Escape quotes in string literals
|
||||
*
|
||||
* @param str String literal to be escaped
|
||||
*/
|
||||
void escape_quotes_in_literals(std::string &str) const;
|
||||
|
||||
/**
|
||||
* Returns how the identifier quotes should be
|
||||
* escaped.
|
||||
@@ -192,7 +151,7 @@ private:
|
||||
next_placeholder_func placeholder_func_ = [](size_t) { return "?"; };
|
||||
to_escaped_string_func to_escaped_string_func_ = [](const utils::blob_type_t &val) { return utils::to_string(val); };
|
||||
|
||||
escape_identifier_t identifier_escape_type_ = escape_identifier_t::ESCAPE_BOTH_SAME;
|
||||
escape_identifier_t identifier_escape_type_ = escape_identifier_t::EscapeBothSame;
|
||||
|
||||
std::string default_schema_name_;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user