1#include "duckdb/parser/parsed_data/vacuum_info.hpp"
2#include "duckdb/common/field_writer.hpp"
3
4namespace duckdb {
5
6VacuumInfo::VacuumInfo(VacuumOptions options) : options(options), has_table(false) {
7}
8
9unique_ptr<VacuumInfo> VacuumInfo::Copy() {
10 auto result = make_uniq<VacuumInfo>(args: options);
11 result->has_table = has_table;
12 if (has_table) {
13 result->ref = ref->Copy();
14 }
15 return result;
16}
17
18void VacuumInfo::Serialize(Serializer &serializer) const {
19 FieldWriter writer(serializer);
20 writer.WriteField(element: options.analyze);
21 writer.WriteField(element: options.vacuum);
22 writer.Finalize();
23}
24
25unique_ptr<ParseInfo> VacuumInfo::Deserialize(Deserializer &deserializer) {
26
27 VacuumOptions options;
28 FieldReader reader(deserializer);
29 options.analyze = reader.ReadRequired<bool>();
30 options.vacuum = reader.ReadRequired<bool>();
31 reader.Finalize();
32
33 auto vacuum_info = make_uniq<VacuumInfo>(args&: options);
34 return std::move(vacuum_info);
35}
36
37} // namespace duckdb
38