1#include "duckdb/parser/parsed_data/alter_scalar_function_info.hpp"
2
3#include "duckdb/common/field_writer.hpp"
4#include "duckdb/parser/constraint.hpp"
5
6namespace duckdb {
7
8//===--------------------------------------------------------------------===//
9// AlterScalarFunctionInfo
10//===--------------------------------------------------------------------===//
11AlterScalarFunctionInfo::AlterScalarFunctionInfo(AlterScalarFunctionType type, AlterEntryData data)
12 : AlterInfo(AlterType::ALTER_SCALAR_FUNCTION, std::move(data.catalog), std::move(data.schema), std::move(data.name),
13 data.if_not_found),
14 alter_scalar_function_type(type) {
15}
16AlterScalarFunctionInfo::~AlterScalarFunctionInfo() {
17}
18
19CatalogType AlterScalarFunctionInfo::GetCatalogType() const {
20 return CatalogType::SCALAR_FUNCTION_ENTRY;
21}
22
23void AlterScalarFunctionInfo::Serialize(FieldWriter &writer) const {
24 writer.WriteField<AlterScalarFunctionType>(element: alter_scalar_function_type);
25 writer.WriteString(val: catalog);
26 writer.WriteString(val: schema);
27 writer.WriteString(val: name);
28 writer.WriteField(element: if_not_found);
29}
30
31unique_ptr<AlterInfo> AlterScalarFunctionInfo::Deserialize(FieldReader &reader) {
32 // auto type = reader.ReadRequired<AlterScalarFunctionType>();
33 // auto schema = reader.ReadRequired<string>();
34 // auto table = reader.ReadRequired<string>();
35 // auto if_exists = reader.ReadRequired<bool>();
36
37 throw NotImplementedException("AlterScalarFunctionInfo cannot be deserialized");
38}
39
40//===--------------------------------------------------------------------===//
41// AddScalarFunctionOverloadInfo
42//===--------------------------------------------------------------------===//
43AddScalarFunctionOverloadInfo::AddScalarFunctionOverloadInfo(AlterEntryData data, ScalarFunctionSet new_overloads_p)
44 : AlterScalarFunctionInfo(AlterScalarFunctionType::ADD_FUNCTION_OVERLOADS, std::move(data)),
45 new_overloads(std::move(new_overloads_p)) {
46 this->allow_internal = true;
47}
48
49AddScalarFunctionOverloadInfo::~AddScalarFunctionOverloadInfo() {
50}
51
52unique_ptr<AlterInfo> AddScalarFunctionOverloadInfo::Copy() const {
53 return make_uniq_base<AlterInfo, AddScalarFunctionOverloadInfo>(args: GetAlterEntryData(), args: new_overloads);
54}
55
56} // namespace duckdb
57