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


Public Member Functions | |
| Item_func_in (List< Item > &list) | |
| longlong | val_int () |
| bool | fix_fields (THD *, Item **) |
| void | fix_length_and_dec () |
| uint | decimal_precision () const |
| void | cleanup () |
| optimize_type | select_optimize () const |
| void | print (String *str) |
| enum Functype | functype () const |
| const char * | func_name () const |
| bool | nulls_in_row () |
| bool | is_bool_func () |
| CHARSET_INFO * | compare_collation () |
| bool | check_partition_func_processor (byte *bool_arg) |
Public Attributes | |
| Item_result | cmp_type |
| in_vector * | array |
| cmp_item * | in_item |
| bool | have_null |
| DTCollation | cmp_collation |
Definition at line 945 of file item_cmpfunc.h.
Definition at line 954 of file item_cmpfunc.h.
References Item_func::allowed_arg_cols.
00955 :Item_func_opt_neg(list), array(0), in_item(0), have_null(0) 00956 { 00957 allowed_arg_cols= 0; // Fetch this value from first argument 00958 }
| void Item_func_in::cleanup | ( | ) | [inline, virtual] |
Reimplemented from Item_result_field.
Definition at line 963 of file item_cmpfunc.h.
References array, Item_result_field::cleanup(), DBUG_ENTER, DBUG_VOID_RETURN, and in_item.
00964 { 00965 DBUG_ENTER("Item_func_in::cleanup"); 00966 Item_int_func::cleanup(); 00967 delete array; 00968 delete in_item; 00969 array= 0; 00970 in_item= 0; 00971 DBUG_VOID_RETURN; 00972 }
Here is the call graph for this function:

| CHARSET_INFO* Item_func_in::compare_collation | ( | ) | [inline, virtual] |
Reimplemented from Item.
Definition at line 980 of file item_cmpfunc.h.
References cmp_collation, and DTCollation::collation.
00980 { return cmp_collation.collation; }
| uint Item_func_in::decimal_precision | ( | ) | const [inline, virtual] |
Reimplemented from Item_func.
Definition at line 2467 of file item_cmpfunc.cc.
References Item_func::arg_count, Item_func::args, Item_func::fix_fields(), Item_func_opt_neg::negated, Item_func::not_null_tables_cache, and Item_func_opt_neg::pred_level.
02468 { 02469 Item **arg, **arg_end; 02470 02471 if (Item_func_opt_neg::fix_fields(thd, ref)) 02472 return 1; 02473 02474 /* not_null_tables_cache == union(T1(e),union(T1(ei))) */ 02475 if (pred_level && negated) 02476 return 0; 02477 02478 /* not_null_tables_cache = union(T1(e),intersection(T1(ei))) */ 02479 not_null_tables_cache= ~(table_map) 0; 02480 for (arg= args + 1, arg_end= args + arg_count; arg != arg_end; arg++) 02481 not_null_tables_cache&= (*arg)->not_null_tables(); 02482 not_null_tables_cache|= (*args)->not_null_tables(); 02483 return 0; 02484 }
Here is the call graph for this function:

| void Item_func_in::fix_length_and_dec | ( | ) | [virtual] |
Reimplemented from Item_int_func.
Definition at line 2495 of file item_cmpfunc.cc.
References Item_func::agg_arg_charsets(), agg_cmp_type(), Item_func::arg_count, Item_func::args, array, cmp_item::cmp_charset, cmp_collation, cmp_type, DTCollation::collation, Item_func::const_item(), current_thd, DBUG_ASSERT, DECIMAL_RESULT, cmp_item::get_comparator(), have_null, in_item, INT_RESULT, Item::max_length, Item::maybe_null, MY_COLL_CMP_CONV, Item::null_value, nulls_in_row(), REAL_RESULT, ROW_RESULT, in_vector::set(), in_vector::sort(), srtcmp_in(), STRING_RESULT, and in_vector::used_count.
02496 { 02497 Item **arg, **arg_end; 02498 uint const_itm= 1; 02499 THD *thd= current_thd; 02500 02501 agg_cmp_type(thd, &cmp_type, args, arg_count); 02502 02503 if (cmp_type == STRING_RESULT && 02504 agg_arg_charsets(cmp_collation, args, arg_count, MY_COLL_CMP_CONV, 1)) 02505 return; 02506 02507 for (arg=args+1, arg_end=args+arg_count; arg != arg_end ; arg++) 02508 { 02509 if (!arg[0]->const_item()) 02510 { 02511 const_itm= 0; 02512 break; 02513 } 02514 } 02515 02516 /* 02517 Row item with NULLs inside can return NULL or FALSE => 02518 they can't be processed as static 02519 */ 02520 if (const_itm && !nulls_in_row()) 02521 { 02522 switch (cmp_type) { 02523 case STRING_RESULT: 02524 array=new in_string(arg_count-1,(qsort2_cmp) srtcmp_in, 02525 cmp_collation.collation); 02526 break; 02527 case INT_RESULT: 02528 array= new in_longlong(arg_count-1); 02529 break; 02530 case REAL_RESULT: 02531 array= new in_double(arg_count-1); 02532 break; 02533 case ROW_RESULT: 02534 array= new in_row(arg_count-1, args[0]); 02535 break; 02536 case DECIMAL_RESULT: 02537 array= new in_decimal(arg_count - 1); 02538 break; 02539 default: 02540 DBUG_ASSERT(0); 02541 return; 02542 } 02543 if (array && !(thd->is_fatal_error)) // If not EOM 02544 { 02545 uint j=0; 02546 for (uint i=1 ; i < arg_count ; i++) 02547 { 02548 array->set(j,args[i]); 02549 if (!args[i]->null_value) // Skip NULL values 02550 j++; 02551 else 02552 have_null= 1; 02553 } 02554 if ((array->used_count=j)) 02555 array->sort(); 02556 } 02557 } 02558 else 02559 { 02560 in_item= cmp_item::get_comparator(cmp_type, cmp_collation.collation); 02561 if (cmp_type == STRING_RESULT) 02562 in_item->cmp_charset= cmp_collation.collation; 02563 } 02564 maybe_null= args[0]->maybe_null; 02565 max_length= 1; 02566 }
Here is the call graph for this function:

| const char* Item_func_in::func_name | ( | ) | const [inline, virtual] |
| enum Functype Item_func_in::functype | ( | ) | const [inline, virtual] |
Reimplemented from Item_func.
Definition at line 976 of file item_cmpfunc.h.
References Item_func::IN_FUNC.
00976 { return IN_FUNC; }
| bool Item_func_in::is_bool_func | ( | ) | [inline, virtual] |
| bool Item_func_in::nulls_in_row | ( | ) |
Definition at line 2425 of file item_cmpfunc.cc.
References Item_func::arg_count, and Item_func::args.
Referenced by fix_length_and_dec().
02426 { 02427 Item **arg,**arg_end; 02428 for (arg= args+1, arg_end= args+arg_count; arg != arg_end ; arg++) 02429 { 02430 if ((*arg)->null_inside()) 02431 return 1; 02432 } 02433 return 0; 02434 }
Here is the caller graph for this function:

| void Item_func_in::print | ( | String * | str | ) | [virtual] |
Reimplemented from Item_func.
Definition at line 2569 of file item_cmpfunc.cc.
References String::append(), Item_func::args, Item_func_opt_neg::negated, Item::print(), Item_func::print_args(), and STRING_WITH_LEN.
02570 { 02571 str->append('('); 02572 args[0]->print(str); 02573 if (negated) 02574 str->append(STRING_WITH_LEN(" not")); 02575 str->append(STRING_WITH_LEN(" in (")); 02576 print_args(str, 1); 02577 str->append(STRING_WITH_LEN("))")); 02578 }
Here is the call graph for this function:

| optimize_type Item_func_in::select_optimize | ( | ) | const [inline, virtual] |
Reimplemented from Item_func.
Definition at line 973 of file item_cmpfunc.h.
References array, Item_func::OPTIMIZE_KEY, and Item_func::OPTIMIZE_NONE.
00974 { return array ? OPTIMIZE_KEY : OPTIMIZE_NONE; }
| longlong Item_func_in::val_int | ( | ) | [virtual] |
Implements Item.
Definition at line 2581 of file item_cmpfunc.cc.
References Item_func::arg_count, Item_func::args, array, cmp_item::cmp(), DBUG_ASSERT, in_vector::find(), Item::fixed, have_null, in_item, Item_func_opt_neg::negated, Item::null_value, and cmp_item::store_value().
02582 { 02583 DBUG_ASSERT(fixed == 1); 02584 if (array) 02585 { 02586 int tmp=array->find(args[0]); 02587 null_value=args[0]->null_value || (!tmp && have_null); 02588 return (longlong) (!null_value && tmp != negated); 02589 } 02590 in_item->store_value(args[0]); 02591 if ((null_value=args[0]->null_value)) 02592 return 0; 02593 have_null= 0; 02594 for (uint i=1 ; i < arg_count ; i++) 02595 { 02596 if (!in_item->cmp(args[i]) && !args[i]->null_value) 02597 return (longlong) (!negated); 02598 have_null|= args[i]->null_value; 02599 } 02600 null_value= have_null; 02601 return (longlong) (!null_value && negated); 02602 }
Here is the call graph for this function:

Definition at line 949 of file item_cmpfunc.h.
Referenced by cleanup(), fix_length_and_dec(), select_optimize(), and val_int().
Definition at line 952 of file item_cmpfunc.h.
Referenced by compare_collation(), and fix_length_and_dec().
Definition at line 950 of file item_cmpfunc.h.
Referenced by cleanup(), fix_length_and_dec(), and val_int().
1.4.7

