1#include "duckdb/planner/expression/bound_conjunction_expression.hpp"
2#include "duckdb/parser/expression_util.hpp"
3
4using namespace duckdb;
5using namespace std;
6
7BoundConjunctionExpression::BoundConjunctionExpression(ExpressionType type)
8 : Expression(type, ExpressionClass::BOUND_CONJUNCTION, TypeId::BOOL) {
9}
10
11BoundConjunctionExpression::BoundConjunctionExpression(ExpressionType type, unique_ptr<Expression> left,
12 unique_ptr<Expression> right)
13 : Expression(type, ExpressionClass::BOUND_CONJUNCTION, TypeId::BOOL) {
14 children.push_back(move(left));
15 children.push_back(move(right));
16}
17
18string BoundConjunctionExpression::ToString() const {
19 string result = "(" + children[0]->ToString();
20 for (idx_t i = 1; i < children.size(); i++) {
21 result += " " + ExpressionTypeToOperator(type) + " " + children[i]->ToString();
22 }
23 return result + ")";
24}
25
26bool BoundConjunctionExpression::Equals(const BaseExpression *other_) const {
27 if (!BaseExpression::Equals(other_)) {
28 return false;
29 }
30 auto other = (BoundConjunctionExpression *)other_;
31 return ExpressionUtil::SetEquals(children, other->children);
32}
33
34unique_ptr<Expression> BoundConjunctionExpression::Copy() {
35 auto copy = make_unique<BoundConjunctionExpression>(type);
36 for (auto &expr : children) {
37 copy->children.push_back(expr->Copy());
38 }
39 copy->CopyProperties(*this);
40 return move(copy);
41}
42