| 1 | #include "duckdb/parser/constraints/not_null_constraint.hpp" |
|---|---|
| 2 | |
| 3 | #include "duckdb/common/field_writer.hpp" |
| 4 | |
| 5 | namespace duckdb { |
| 6 | |
| 7 | NotNullConstraint::NotNullConstraint(LogicalIndex index) : Constraint(ConstraintType::NOT_NULL), index(index) { |
| 8 | } |
| 9 | |
| 10 | NotNullConstraint::~NotNullConstraint() { |
| 11 | } |
| 12 | |
| 13 | string NotNullConstraint::ToString() const { |
| 14 | return "NOT NULL"; |
| 15 | } |
| 16 | |
| 17 | unique_ptr<Constraint> NotNullConstraint::Copy() const { |
| 18 | return make_uniq<NotNullConstraint>(args: index); |
| 19 | } |
| 20 | |
| 21 | void NotNullConstraint::Serialize(FieldWriter &writer) const { |
| 22 | writer.WriteField<idx_t>(element: index.index); |
| 23 | } |
| 24 | |
| 25 | unique_ptr<Constraint> NotNullConstraint::Deserialize(FieldReader &source) { |
| 26 | auto index = source.ReadRequired<idx_t>(); |
| 27 | return make_uniq_base<Constraint, NotNullConstraint>(args: LogicalIndex(index)); |
| 28 | } |
| 29 | |
| 30 | } // namespace duckdb |
| 31 |