1//===----------------------------------------------------------------------===//
2// DuckDB
3//
4// duckdb/planner/expression/bound_between_expression.hpp
5//
6//
7//===----------------------------------------------------------------------===//
8
9#pragma once
10
11#include "duckdb/planner/expression.hpp"
12
13namespace duckdb {
14
15class BoundBetweenExpression : public Expression {
16public:
17 static constexpr const ExpressionClass TYPE = ExpressionClass::BOUND_BETWEEN;
18
19public:
20 BoundBetweenExpression(unique_ptr<Expression> input, unique_ptr<Expression> lower, unique_ptr<Expression> upper,
21 bool lower_inclusive, bool upper_inclusive);
22
23 unique_ptr<Expression> input;
24 unique_ptr<Expression> lower;
25 unique_ptr<Expression> upper;
26 bool lower_inclusive;
27 bool upper_inclusive;
28
29public:
30 string ToString() const override;
31
32 bool Equals(const BaseExpression &other) const override;
33
34 unique_ptr<Expression> Copy() override;
35 void Serialize(FieldWriter &writer) const override;
36 static unique_ptr<Expression> Deserialize(ExpressionDeserializationState &state, FieldReader &reader);
37
38public:
39 ExpressionType LowerComparisonType() {
40 return lower_inclusive ? ExpressionType::COMPARE_GREATERTHANOREQUALTO : ExpressionType::COMPARE_GREATERTHAN;
41 }
42 ExpressionType UpperComparisonType() {
43 return upper_inclusive ? ExpressionType::COMPARE_LESSTHANOREQUALTO : ExpressionType::COMPARE_LESSTHAN;
44 }
45};
46} // namespace duckdb
47