IronQuery
A SQL-first query builder for C++
Loading...
Searching...
No Matches
set_op.hpp
1#pragma once
2
3#include <iron_query/virtual_table.hpp>
4#include <string>
5#include <string_view>
6
7namespace iron_query {
8
11struct [[nodiscard]] SetOpKind {
13 virtual std::string_view ToString() const = 0;
14};
15
17struct [[nodiscard]] Union final : SetOpKind {
18 std::string_view ToString() const override;
19};
21struct [[nodiscard]] UnionAll final : SetOpKind {
22 std::string_view ToString() const override;
23};
25struct [[nodiscard]] Intersect final : SetOpKind {
26 std::string_view ToString() const override;
27};
29struct [[nodiscard]] Except final : SetOpKind {
30 std::string_view ToString() const override;
31};
32
36class [[nodiscard]] SetOp final : public VirtualTable {
37public:
41 SetOp(const VirtualTable &a, const VirtualTable &b, const SetOpKind &kind);
42
43 std::string ToString() const override;
44
45private:
46 std::string a_, b_;
47 std::string kind_;
48};
49
50} // namespace iron_query
Transitional representation for UNION/UNION ALL/INTERSECT/EXCEPT.
Definition set_op.hpp:36
SetOp(const VirtualTable &a, const VirtualTable &b, const SetOpKind &kind)
Builds a kind b.
std::string ToString() const override
Renders this table value as single-line SQL text. See also ToStringFormatted for a multi-line,...
Any table value, including physical table, table result, materialized view, etc.
Definition virtual_table.hpp:14
EXCEPT.
Definition set_op.hpp:29
std::string_view ToString() const override
The SQL keyword(s) for this set operation, e.g. "UNION".
INTERSECT.
Definition set_op.hpp:25
std::string_view ToString() const override
The SQL keyword(s) for this set operation, e.g. "UNION".
Kind of SQL set operation, e.g. Union or Except.
Definition set_op.hpp:11
virtual std::string_view ToString() const =0
The SQL keyword(s) for this set operation, e.g. "UNION".
UNION ALL.
Definition set_op.hpp:21
std::string_view ToString() const override
The SQL keyword(s) for this set operation, e.g. "UNION".
UNION.
Definition set_op.hpp:17
std::string_view ToString() const override
The SQL keyword(s) for this set operation, e.g. "UNION".