1//===----------------------------------------------------------------------===//
2// DuckDB
3//
4// duckdb/parser/statement/select_statement.hpp
5//
6//
7//===----------------------------------------------------------------------===//
8
9#pragma once
10
11#include "duckdb/common/unordered_map.hpp"
12#include "duckdb/parser/parsed_expression.hpp"
13#include "duckdb/parser/sql_statement.hpp"
14#include "duckdb/parser/tableref.hpp"
15#include "duckdb/parser/query_node.hpp"
16
17namespace duckdb {
18
19class QueryNode;
20class FormatSerializer;
21class FormatDeserializer;
22
23//! SelectStatement is a typical SELECT clause
24class SelectStatement : public SQLStatement {
25public:
26 static constexpr const StatementType TYPE = StatementType::SELECT_STATEMENT;
27
28public:
29 SelectStatement() : SQLStatement(StatementType::SELECT_STATEMENT) {
30 }
31
32 //! The main query node
33 unique_ptr<QueryNode> node;
34
35protected:
36 SelectStatement(const SelectStatement &other);
37
38public:
39 //! Convert the SELECT statement to a string
40 DUCKDB_API string ToString() const override;
41 //! Create a copy of this SelectStatement
42 DUCKDB_API unique_ptr<SQLStatement> Copy() const override;
43 //! Serializes a SelectStatement to a stand-alone binary blob
44 void Serialize(Serializer &serializer) const;
45 //! Deserializes a blob back into a SelectStatement, returns nullptr if
46 //! deserialization is not possible
47 static unique_ptr<SelectStatement> Deserialize(Deserializer &source);
48 //! Whether or not the statements are equivalent
49 bool Equals(const SQLStatement &other) const;
50
51 void FormatSerialize(FormatSerializer &serializer) const;
52 static unique_ptr<SelectStatement> FormatDeserialize(FormatDeserializer &deserializer);
53};
54} // namespace duckdb
55