#include <item_cmpfunc.h>
Inheritance diagram for Item_func_if:


Public Member Functions | |
| Item_func_if (Item *a, Item *b, Item *c) | |
| double | val_real () |
| longlong | val_int () |
| String * | val_str (String *str) |
| my_decimal * | val_decimal (my_decimal *) |
| enum Item_result | result_type () const |
| bool | fix_fields (THD *, Item **) |
| void | fix_length_and_dec () |
| uint | decimal_precision () const |
| const char * | func_name () const |
Private Attributes | |
| enum Item_result | cached_result_type |
Definition at line 550 of file item_cmpfunc.h.
Definition at line 554 of file item_cmpfunc.h.
00555 :Item_func(a,b,c), cached_result_type(INT_RESULT) 00556 {}
| uint Item_func_if::decimal_precision | ( | ) | const [virtual] |
Reimplemented from Item.
Definition at line 1538 of file item_cmpfunc.cc.
References Item_func::args, Item::decimal_int_part(), DECIMAL_MAX_PRECISION, Item::decimals, max, and min.
01539 { 01540 int precision=(max(args[1]->decimal_int_part(),args[2]->decimal_int_part())+ 01541 decimals); 01542 return min(precision, DECIMAL_MAX_PRECISION); 01543 }
Here is the call graph for this function:

Reimplemented from Item_func.
Definition at line 1480 of file item_cmpfunc.cc.
References Item_func::args, DBUG_ASSERT, Item_func::fix_fields(), Item::fixed, Item::not_null_tables(), Item_func::not_null_tables_cache, and Item::top_level_item().
01481 { 01482 DBUG_ASSERT(fixed == 0); 01483 args[0]->top_level_item(); 01484 01485 if (Item_func::fix_fields(thd, ref)) 01486 return 1; 01487 01488 not_null_tables_cache= (args[1]->not_null_tables() & 01489 args[2]->not_null_tables()); 01490 01491 return 0; 01492 }
Here is the call graph for this function:

| void Item_func_if::fix_length_and_dec | ( | ) | [virtual] |
Implements Item_result_field.
Definition at line 1496 of file item_cmpfunc.cc.
References Item_func::agg_arg_charsets(), agg_result_type(), Item_func::args, cached_result_type, DTCollation::collation, Item::collation, Item::const_item(), DECIMAL_RESULT, Item::decimals, INT_RESULT, max, Item::max_length, Item::maybe_null, my_charset_bin, MY_COLL_ALLOW_CONV, Item::null_value, Item::result_type(), DTCollation::set(), STRING_RESULT, and Item::unsigned_flag.
01497 { 01498 maybe_null=args[1]->maybe_null || args[2]->maybe_null; 01499 decimals= max(args[1]->decimals, args[2]->decimals); 01500 01501 enum Item_result arg1_type=args[1]->result_type(); 01502 enum Item_result arg2_type=args[2]->result_type(); 01503 bool null1=args[1]->const_item() && args[1]->null_value; 01504 bool null2=args[2]->const_item() && args[2]->null_value; 01505 01506 if (null1) 01507 { 01508 cached_result_type= arg2_type; 01509 collation.set(args[2]->collation.collation); 01510 } 01511 else if (null2) 01512 { 01513 cached_result_type= arg1_type; 01514 collation.set(args[1]->collation.collation); 01515 } 01516 else 01517 { 01518 agg_result_type(&cached_result_type, args+1, 2); 01519 if (cached_result_type == STRING_RESULT) 01520 { 01521 if (agg_arg_charsets(collation, args+1, 2, MY_COLL_ALLOW_CONV, 1)) 01522 return; 01523 } 01524 else 01525 { 01526 collation.set(&my_charset_bin); // Number 01527 } 01528 } 01529 max_length= 01530 (cached_result_type == DECIMAL_RESULT || cached_result_type == INT_RESULT) ? 01531 (max(args[1]->max_length - args[1]->decimals, 01532 args[2]->max_length - args[2]->decimals) + decimals + 01533 (unsigned_flag ? 0 : 1) ) : 01534 max(args[1]->max_length, args[2]->max_length); 01535 }
Here is the call graph for this function:

| const char* Item_func_if::func_name | ( | ) | const [inline, virtual] |
| enum Item_result Item_func_if::result_type | ( | ) | const [inline, virtual] |
Reimplemented from Item.
Definition at line 561 of file item_cmpfunc.h.
References cached_result_type.
00561 { return cached_result_type; }
| my_decimal * Item_func_if::val_decimal | ( | my_decimal * | ) | [virtual] |
Reimplemented from Item_func.
Definition at line 1580 of file item_cmpfunc.cc.
References Item_func::args, DBUG_ASSERT, Item::fixed, Item::null_value, Item::val_bool(), Item::val_decimal(), and value.
01581 { 01582 DBUG_ASSERT(fixed == 1); 01583 Item *arg= args[0]->val_bool() ? args[1] : args[2]; 01584 my_decimal *value= arg->val_decimal(decimal_value); 01585 null_value= arg->null_value; 01586 return value; 01587 }
Here is the call graph for this function:

| longlong Item_func_if::val_int | ( | ) | [virtual] |
Implements Item.
Definition at line 1557 of file item_cmpfunc.cc.
References Item_func::args, DBUG_ASSERT, Item::fixed, Item::null_value, Item::val_bool(), Item::val_int(), and value.
01558 { 01559 DBUG_ASSERT(fixed == 1); 01560 Item *arg= args[0]->val_bool() ? args[1] : args[2]; 01561 longlong value=arg->val_int(); 01562 null_value=arg->null_value; 01563 return value; 01564 }
Here is the call graph for this function:

| double Item_func_if::val_real | ( | ) | [virtual] |
Implements Item.
Definition at line 1547 of file item_cmpfunc.cc.
References Item_func::args, DBUG_ASSERT, Item::fixed, Item::null_value, Item::val_bool(), Item::val_real(), and value.
01548 { 01549 DBUG_ASSERT(fixed == 1); 01550 Item *arg= args[0]->val_bool() ? args[1] : args[2]; 01551 double value= arg->val_real(); 01552 null_value=arg->null_value; 01553 return value; 01554 }
Here is the call graph for this function:

Implements Item.
Definition at line 1567 of file item_cmpfunc.cc.
References Item_func::args, DTCollation::collation, Item::collation, DBUG_ASSERT, Item::fixed, Item::null_value, String::set_charset(), Item::val_bool(), and Item::val_str().
01568 { 01569 DBUG_ASSERT(fixed == 1); 01570 Item *arg= args[0]->val_bool() ? args[1] : args[2]; 01571 String *res=arg->val_str(str); 01572 if (res) 01573 res->set_charset(collation.collation); 01574 null_value=arg->null_value; 01575 return res; 01576 }
Here is the call graph for this function:

enum Item_result Item_func_if::cached_result_type [private] |
Definition at line 552 of file item_cmpfunc.h.
Referenced by fix_length_and_dec(), and result_type().
1.4.7

