56 lines
1.0 KiB
C++
56 lines
1.0 KiB
C++
#ifndef QUERY_QUERY_PARTS_HPP
|
|
#define QUERY_QUERY_PARTS_HPP
|
|
|
|
#include "matador/query/query_part_visitor.hpp"
|
|
#include "matador/query/column.hpp"
|
|
|
|
#include "matador/sql/dialect.hpp"
|
|
|
|
namespace matador::query {
|
|
|
|
class query_part
|
|
{
|
|
protected:
|
|
explicit query_part(sql::dialect::token_t token);
|
|
|
|
public:
|
|
virtual ~query_part() = default;
|
|
virtual void accept(query_part_visitor &visitor) = 0;
|
|
|
|
protected:
|
|
sql::dialect::token_t token_;
|
|
};
|
|
|
|
/**
|
|
* Represents the SQL SELECT part
|
|
*/
|
|
class query_select_part : public query_part
|
|
{
|
|
public:
|
|
explicit query_select_part(std::vector<column> columns);
|
|
void accept(query_part_visitor &visitor) override;
|
|
|
|
private:
|
|
std::vector<column> columns_;
|
|
};
|
|
|
|
/**
|
|
* Represents the SQL FROM part
|
|
*/
|
|
class query_from_part : public query_part
|
|
{
|
|
public:
|
|
explicit query_from_part(std::string table_name);
|
|
query_from_part(std::string table_name, std::string as);
|
|
|
|
private:
|
|
void accept(query_part_visitor &visitor) override;
|
|
|
|
private:
|
|
std::string table_;
|
|
std::string alias_;
|
|
};
|
|
|
|
}
|
|
#endif //QUERY_QUERY_PARTS_HPP
|