MCPcopy Create free account
hub / github.com/Meituan-Dianping/SQLAdvisor / val_bool

Method val_bool

sql/item.cc:67–88  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

65*/
66
67bool 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/*

Callers

nothing calls this directly

Calls 5

result_typeFunction · 0.85
val_intFunction · 0.85
val_decimalFunction · 0.85
my_decimal_is_zeroFunction · 0.85
val_realFunction · 0.85

Tested by

no test coverage detected