progress on query compiler

This commit is contained in:
Sascha Kühl
2026-01-22 16:14:42 +01:00
parent b331ef6923
commit 686b1ddb7a
19 changed files with 241 additions and 175 deletions
@@ -0,0 +1,14 @@
#ifndef MATADOR_STRING_BUILDER_UTILS_HPP
#define MATADOR_STRING_BUILDER_UTILS_HPP
#include <string>
namespace matador::sql {
class dialect;
}
namespace matador::query {
void prepare_identifier_string_append(std::string& out, std::string_view col, const sql::dialect &d);
}
#endif // MATADOR_STRING_BUILDER_UTILS_HPP
+2 -2
View File
@@ -14,8 +14,8 @@ table_column count(const std::string &column);
table_column count_all();
table_column sum(const std::string &column);
table_column avg(const std::string &column);
table_column max(const std::string &column);
table_column min(const std::string &column);
table_column maximum(const std::string &column);
table_column minimum(const std::string &column);
class query
{
+20 -9
View File
@@ -16,13 +16,19 @@ class table;
class table_column {
public:
table_column(const char *name); // NOLINT(*-explicit-constructor)
table_column(std::string name); // NOLINT(*-explicit-constructor)
table_column(std::string name, std::string alias);
table_column(sql::sql_function_t func, std::string name);
table_column(const class table* tab, std::string name);
table_column(const class table* tab, std::string name, std::string alias);
table_column(const class table* tab, std::string name, utils::basic_type type, const utils::field_attributes& attributes);
table_column(const class table*, std::string name, std::string alias, utils::basic_type type, const utils::field_attributes& attributes, sql::sql_function_t func = sql::sql_function_t::None);
table_column(const std::string& name); // NOLINT(*-explicit-constructor)
table_column(const std::string& name, const std::string& alias);
table_column(sql::sql_function_t func, const std::string& name);
table_column(const class table* tab, const std::string& name);
table_column(const class table* tab, const std::string& name,
const std::string& alias);
table_column(const class table* tab, const std::string& name, utils::basic_type type, const utils::field_attributes& attributes);
table_column(const class table*,
const std::string& name,
const std::string& alias,
utils::basic_type type,
const utils::field_attributes& attributes,
sql::sql_function_t func = sql::sql_function_t::None);
table_column& operator=(const table_column& other);
table_column(const table_column& other) = default;
table_column(table_column&& other) noexcept = default;
@@ -30,10 +36,11 @@ public:
[[nodiscard]] bool equals(const table_column &x) const;
table_column as(const std::string& alias) const;
[[nodiscard]] table_column as(const std::string& alias) const;
[[nodiscard]] const std::string& name() const;
[[nodiscard]] std::string canonical_name() const;
[[nodiscard]] const std::string& column_name() const;
[[nodiscard]] const std::string& canonical_name() const;
[[nodiscard]] const std::string& alias() const;
[[nodiscard]] utils::basic_type type() const;
[[nodiscard]] utils::field_attributes attributes() const;
@@ -49,11 +56,15 @@ public:
// ReSharper disable once CppNonExplicitConversionOperator
operator const std::string&() const; // NOLINT(*-explicit-constructor)
private:
static std::string build_column_name(const class table *tab, const std::string& name);
private:
friend class table;
const class table* table_{nullptr};
std::string name_;
std::string column_name_;
std::string alias_;
utils::basic_type type_{utils::basic_type::Unknown};
utils::field_attributes attributes_{};