MCPcopy Create free account
hub / github.com/FirebirdSQL/firebird / sameNodes

Function sameNodes

src/dsql/ExprNodes.cpp:73–92  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

71namespace
72{
73 bool sameNodes(const ValueIfNode* node1, const CoalesceNode* node2, bool ignoreStreams)
74 {
75 // dimitr: COALESCE could be represented as ValueIfNode in older databases,
76 // so compare them for actually being the same thing:
77 // COALESCE(A, B) == VALUE_IF(A IS NULL, B, A)
78
79 if (node1 && node2)
80 {
81 const auto missing = nodeAs<MissingBoolNode>(node1->condition);
82 if (missing && missing->arg->sameAs(node1->falseValue, false) &&
83 node2->args->items.getCount() == 2 &&
84 node2->args->items[0]->sameAs(node1->falseValue, ignoreStreams) &&
85 node2->args->items[1]->sameAs(node1->trueValue, ignoreStreams))
86 {
87 return true;
88 }
89 }
90
91 return false;
92 }
93
94 // Try to expand the given stream. If it's a view reference, collect its base streams
95 // (the ones directly residing in the FROM clause) and recurse.

Callers 1

sameAsMethod · 0.85

Calls 2

sameAsMethod · 0.45
getCountMethod · 0.45

Tested by

no test coverage detected