1 | //===----------------------------------------------------------------------===// |
---|---|
2 | // DuckDB |
3 | // |
4 | // duckdb/parser/parsed_data/vacuum_info.hpp |
5 | // |
6 | // |
7 | //===----------------------------------------------------------------------===// |
8 | |
9 | #pragma once |
10 | |
11 | #include "duckdb/common/field_writer.hpp" |
12 | #include "duckdb/parser/parsed_data/parse_info.hpp" |
13 | |
14 | namespace duckdb { |
15 | |
16 | enum class LoadType { LOAD, INSTALL, FORCE_INSTALL }; |
17 | |
18 | struct LoadInfo : public ParseInfo { |
19 | std::string filename; |
20 | LoadType load_type; |
21 | |
22 | public: |
23 | unique_ptr<LoadInfo> Copy() const { |
24 | auto result = make_uniq<LoadInfo>(); |
25 | result->filename = filename; |
26 | result->load_type = load_type; |
27 | return result; |
28 | } |
29 | |
30 | void Serialize(Serializer &serializer) const { |
31 | FieldWriter writer(serializer); |
32 | writer.WriteString(val: filename); |
33 | writer.WriteField<LoadType>(element: load_type); |
34 | writer.Finalize(); |
35 | } |
36 | |
37 | static unique_ptr<ParseInfo> Deserialize(Deserializer &deserializer) { |
38 | FieldReader reader(deserializer); |
39 | auto load_info = make_uniq<LoadInfo>(); |
40 | load_info->filename = reader.ReadRequired<string>(); |
41 | load_info->load_type = reader.ReadRequired<LoadType>(); |
42 | reader.Finalize(); |
43 | return std::move(load_info); |
44 | } |
45 | }; |
46 | |
47 | } // namespace duckdb |
48 |