| 2168 | */ |
| 2169 | |
| 2170 | Item *negate_expression(THD *thd, Item *expr) |
| 2171 | { |
| 2172 | Item *negated; |
| 2173 | if (expr->type() == Item::FUNC_ITEM && |
| 2174 | ((Item_func *) expr)->functype() == Item_func::NOT_FUNC) |
| 2175 | { |
| 2176 | /* it is NOT(NOT( ... )) */ |
| 2177 | Item *arg= ((Item_func *) expr)->arguments()[0]; |
| 2178 | enum_parsing_place place= thd->lex->current_select->parsing_place; |
| 2179 | if (arg->is_bool_func() || place == IN_WHERE || place == IN_HAVING) |
| 2180 | return arg; |
| 2181 | /* |
| 2182 | if it is not boolean function then we have to emulate value of |
| 2183 | not(not(a)), it will be a != 0 |
| 2184 | */ |
| 2185 | return new Item_func_ne(arg, new Item_int_0()); |
| 2186 | } |
| 2187 | |
| 2188 | if ((negated= expr->neg_transformer(thd)) != 0) |
| 2189 | return negated; |
| 2190 | return new Item_func_not(expr); |
| 2191 | } |
| 2192 | |
| 2193 | /** |
| 2194 | Set the specified definer to the default value, which is the |
nothing calls this directly
no test coverage detected