1 | //===----------------------------------------------------------------------===// |
---|---|
2 | // DuckDB |
3 | // |
4 | // duckdb/parser/tableref/subqueryref.hpp |
5 | // |
6 | // |
7 | //===----------------------------------------------------------------------===// |
8 | |
9 | #pragma once |
10 | |
11 | #include "duckdb/parser/statement/select_statement.hpp" |
12 | #include "duckdb/parser/tableref.hpp" |
13 | |
14 | namespace duckdb { |
15 | //! Represents a subquery |
16 | class SubqueryRef : public TableRef { |
17 | public: |
18 | static constexpr const TableReferenceType TYPE = TableReferenceType::SUBQUERY; |
19 | |
20 | public: |
21 | DUCKDB_API explicit SubqueryRef(unique_ptr<SelectStatement> subquery, string alias = string()); |
22 | |
23 | //! The subquery |
24 | unique_ptr<SelectStatement> subquery; |
25 | //! Aliases for the column names |
26 | vector<string> column_name_alias; |
27 | |
28 | public: |
29 | string ToString() const override; |
30 | bool Equals(const TableRef &other_p) const override; |
31 | |
32 | unique_ptr<TableRef> Copy() override; |
33 | |
34 | //! Serializes a blob into a SubqueryRef |
35 | void Serialize(FieldWriter &serializer) const override; |
36 | //! Deserializes a blob back into a SubqueryRef |
37 | static unique_ptr<TableRef> Deserialize(FieldReader &source); |
38 | |
39 | void FormatSerialize(FormatSerializer &serializer) const override; |
40 | static unique_ptr<TableRef> FormatDeserialize(FormatDeserializer &source); |
41 | }; |
42 | } // namespace duckdb |
43 |