1#include "duckdb/parser/parsed_data/drop_info.hpp"
2
3namespace duckdb {
4
5DropInfo::DropInfo() : catalog(INVALID_CATALOG), schema(INVALID_SCHEMA), cascade(false) {
6}
7
8unique_ptr<DropInfo> DropInfo::Copy() const {
9 auto result = make_uniq<DropInfo>();
10 result->type = type;
11 result->catalog = catalog;
12 result->schema = schema;
13 result->name = name;
14 result->if_not_found = if_not_found;
15 result->cascade = cascade;
16 result->allow_drop_internal = allow_drop_internal;
17 return result;
18}
19
20void DropInfo::Serialize(Serializer &serializer) const {
21 FieldWriter writer(serializer);
22 writer.WriteField<CatalogType>(element: type);
23 writer.WriteString(val: catalog);
24 writer.WriteString(val: schema);
25 writer.WriteString(val: name);
26 writer.WriteField(element: if_not_found);
27 writer.WriteField(element: cascade);
28 writer.WriteField(element: allow_drop_internal);
29 writer.Finalize();
30}
31
32unique_ptr<ParseInfo> DropInfo::Deserialize(Deserializer &deserializer) {
33 FieldReader reader(deserializer);
34 auto drop_info = make_uniq<DropInfo>();
35 drop_info->type = reader.ReadRequired<CatalogType>();
36 drop_info->catalog = reader.ReadRequired<string>();
37 drop_info->schema = reader.ReadRequired<string>();
38 drop_info->name = reader.ReadRequired<string>();
39 drop_info->if_not_found = reader.ReadRequired<OnEntryNotFound>();
40 drop_info->cascade = reader.ReadRequired<bool>();
41 drop_info->allow_drop_internal = reader.ReadRequired<bool>();
42 reader.Finalize();
43 return std::move(drop_info);
44}
45
46} // namespace duckdb
47