| 2036 | // |
| 2037 | |
| 2038 | InversionCandidate* Retrieval::matchDbKey(BoolExprNode* boolean) const |
| 2039 | { |
| 2040 | // If this isn't an equality, it isn't even interesting |
| 2041 | |
| 2042 | const auto cmpNode = nodeAs<ComparativeBoolNode>(boolean); |
| 2043 | const auto listNode = nodeAs<InListBoolNode>(boolean); |
| 2044 | |
| 2045 | if (cmpNode) |
| 2046 | { |
| 2047 | switch (cmpNode->blrOp) |
| 2048 | { |
| 2049 | case blr_equiv: |
| 2050 | case blr_eql: |
| 2051 | case blr_gtr: |
| 2052 | case blr_geq: |
| 2053 | case blr_lss: |
| 2054 | case blr_leq: |
| 2055 | case blr_between: |
| 2056 | break; |
| 2057 | |
| 2058 | default: |
| 2059 | return nullptr; |
| 2060 | } |
| 2061 | } |
| 2062 | else if (!listNode) |
| 2063 | return nullptr; |
| 2064 | |
| 2065 | // Find the side of the equality that is potentially a dbkey. |
| 2066 | // If neither, make the obvious deduction. |
| 2067 | |
| 2068 | SLONG n = 0; |
| 2069 | int dbkeyArg = 1; |
| 2070 | ValueExprNode* dbkey = nullptr; |
| 2071 | |
| 2072 | if (cmpNode) |
| 2073 | { |
| 2074 | dbkey = findDbKey(cmpNode->arg1, &n); |
| 2075 | |
| 2076 | if (!dbkey) |
| 2077 | { |
| 2078 | n = 0; |
| 2079 | dbkeyArg = 2; |
| 2080 | dbkey = findDbKey(cmpNode->arg2, &n); |
| 2081 | } |
| 2082 | |
| 2083 | if (!dbkey && (cmpNode->blrOp == blr_between)) |
| 2084 | { |
| 2085 | n = 0; |
| 2086 | dbkeyArg = 3; |
| 2087 | dbkey = findDbKey(cmpNode->arg3, &n); |
| 2088 | } |
| 2089 | } |
| 2090 | else |
| 2091 | { |
| 2092 | fb_assert(listNode); |
| 2093 | dbkey = findDbKey(listNode->arg, &n); |
| 2094 | } |
| 2095 |
nothing calls this directly
no test coverage detected