1#include "duckdb/parser/column_definition.hpp"
2#include "duckdb/common/serializer.hpp"
3
4namespace duckdb {
5
6ColumnDefinition ColumnDefinition::Copy() {
7 ColumnDefinition copy(name, type);
8 copy.oid = oid;
9 copy.default_value = default_value ? default_value->Copy() : nullptr;
10 return copy;
11}
12
13void ColumnDefinition::Serialize(Serializer &serializer) {
14 serializer.WriteString(name);
15 type.Serialize(serializer);
16 serializer.WriteOptional(default_value);
17}
18
19ColumnDefinition ColumnDefinition::Deserialize(Deserializer &source) {
20 auto column_name = source.Read<string>();
21 auto column_type = SQLType::Deserialize(source);
22 auto default_value = source.ReadOptional<ParsedExpression>();
23 return ColumnDefinition(column_name, column_type, move(default_value));
24}
25
26} // namespace duckdb
27