| 65 | */ |
| 66 | |
| 67 | bool Item::val_bool() |
| 68 | { |
| 69 | switch(result_type()) { |
| 70 | case INT_RESULT: |
| 71 | return val_int() != 0; |
| 72 | case DECIMAL_RESULT: |
| 73 | { |
| 74 | my_decimal decimal_value; |
| 75 | my_decimal *val= val_decimal(&decimal_value); |
| 76 | if (val) |
| 77 | return !my_decimal_is_zero(val); |
| 78 | return 0; |
| 79 | } |
| 80 | case REAL_RESULT: |
| 81 | case STRING_RESULT: |
| 82 | return val_real() != 0.0; |
| 83 | case ROW_RESULT: |
| 84 | default: |
| 85 | DBUG_ASSERT(0); |
| 86 | return 0; // Wrong (but safe) |
| 87 | } |
| 88 | } |
| 89 | |
| 90 | |
| 91 | /* |
nothing calls this directly
no test coverage detected