1#include "duckdb/parser/statement/select_statement.hpp"
2
3#include "duckdb/common/serializer.hpp"
4#include "duckdb/common/serializer/format_serializer.hpp"
5#include "duckdb/common/serializer/format_deserializer.hpp"
6
7namespace duckdb {
8
9SelectStatement::SelectStatement(const SelectStatement &other) : SQLStatement(other), node(other.node->Copy()) {
10}
11
12unique_ptr<SQLStatement> SelectStatement::Copy() const {
13 return unique_ptr<SelectStatement>(new SelectStatement(*this));
14}
15
16void SelectStatement::Serialize(Serializer &serializer) const {
17 node->Serialize(serializer);
18}
19
20void SelectStatement::FormatSerialize(FormatSerializer &serializer) const {
21 serializer.WriteProperty(tag: "node", value: node);
22}
23
24unique_ptr<SelectStatement> SelectStatement::Deserialize(Deserializer &source) {
25 auto result = make_uniq<SelectStatement>();
26 result->node = QueryNode::Deserialize(source);
27 return result;
28}
29
30unique_ptr<SelectStatement> SelectStatement::FormatDeserialize(FormatDeserializer &deserializer) {
31 auto result = make_uniq<SelectStatement>();
32 deserializer.ReadProperty(tag: "node", ret&: result->node);
33 return result;
34}
35
36bool SelectStatement::Equals(const SQLStatement &other_p) const {
37 if (type != other_p.type) {
38 return false;
39 }
40 auto &other = other_p.Cast<SelectStatement>();
41 return node->Equals(other: other.node.get());
42}
43
44string SelectStatement::ToString() const {
45 return node->ToString();
46}
47
48} // namespace duckdb
49