#include <item.h>
Inheritance diagram for Item_param:


Definition at line 1381 of file item.h.
| NO_VALUE | |
| NULL_VALUE | |
| INT_VALUE | |
| REAL_VALUE | |
| STRING_VALUE | |
| TIME_VALUE | |
| LONG_DATA_VALUE | |
| DECIMAL_VALUE |
Definition at line 1388 of file item.h.
01389 { 01390 NO_VALUE, NULL_VALUE, INT_VALUE, REAL_VALUE, 01391 STRING_VALUE, TIME_VALUE, LONG_DATA_VALUE, 01392 DECIMAL_VALUE 01393 } state;
| Item_param::Item_param | ( | uint | pos_in_query_arg | ) |
| bool Item_param::basic_const_item | ( | ) | const [virtual] |
| bool Item_param::convert_str_value | ( | THD * | thd | ) |
Definition at line 2755 of file item.cc.
References String::charset(), Item::collation, Item::decimals, DERIVATION_COERCIBLE, FALSE, String::length(), LONG_DATA_VALUE, Item::max_length, String::ptr(), DTCollation::set(), String::set(), String::set_charset(), state, Item::str_value, str_value_ptr, STRING_VALUE, and value.
Referenced by insert_params(), and insert_params_withlog().
02756 { 02757 bool rc= FALSE; 02758 if (state == STRING_VALUE || state == LONG_DATA_VALUE) 02759 { 02760 /* 02761 Check is so simple because all charsets were set up properly 02762 in setup_one_conversion_function, where typecode of 02763 placeholder was also taken into account: the variables are different 02764 here only if conversion is really necessary. 02765 */ 02766 if (value.cs_info.final_character_set_of_str_value != 02767 value.cs_info.character_set_of_placeholder) 02768 { 02769 rc= thd->convert_string(&str_value, 02770 value.cs_info.character_set_of_placeholder, 02771 value.cs_info.final_character_set_of_str_value); 02772 } 02773 else 02774 str_value.set_charset(value.cs_info.final_character_set_of_str_value); 02775 /* Here str_value is guaranteed to be in final_character_set_of_str_value */ 02776 02777 max_length= str_value.length(); 02778 decimals= 0; 02779 /* 02780 str_value_ptr is returned from val_str(). It must be not alloced 02781 to prevent it's modification by val_str() invoker. 02782 */ 02783 str_value_ptr.set(str_value.ptr(), str_value.length(), 02784 str_value.charset()); 02785 /* Synchronize item charset with value charset */ 02786 collation.set(str_value.charset(), DERIVATION_COERCIBLE); 02787 } 02788 return rc; 02789 }
Here is the call graph for this function:

Here is the caller graph for this function:

Reimplemented from Item.
Definition at line 2828 of file item.cc.
References Item::basic_const_item(), basic_const_item(), DTCollation::collation, Item::collation, FALSE, INT_VALUE, LONG_DATA_VALUE, NULL_VALUE, REAL_VALUE, sortcmp(), state, Item::str_value, STRING_VALUE, stringcmp(), TRUE, type(), Item::type(), Item::unsigned_flag, Item::val_int(), Item::val_real(), and value.
02829 { 02830 Item *item; 02831 if (!basic_const_item() || !arg->basic_const_item() || arg->type() != type()) 02832 return FALSE; 02833 /* 02834 We need to cast off const to call val_int(). This should be OK for 02835 a basic constant. 02836 */ 02837 item= (Item*) arg; 02838 02839 switch (state) { 02840 case NULL_VALUE: 02841 return TRUE; 02842 case INT_VALUE: 02843 return value.integer == item->val_int() && 02844 unsigned_flag == item->unsigned_flag; 02845 case REAL_VALUE: 02846 return value.real == item->val_real(); 02847 case STRING_VALUE: 02848 case LONG_DATA_VALUE: 02849 if (binary_cmp) 02850 return !stringcmp(&str_value, &item->str_value); 02851 return !sortcmp(&str_value, &item->str_value, collation.collation); 02852 default: 02853 break; 02854 } 02855 return FALSE; 02856 }
Here is the call graph for this function:

| enum_field_types Item_param::field_type | ( | ) | const [inline, virtual] |
Reimplemented from Item.
Definition at line 1455 of file item.h.
References param_type.
01455 { return param_type; }
Reimplemented from Item.
Definition at line 2552 of file item.cc.
References Item::get_date(), state, TIME_VALUE, and value.
02553 { 02554 if (state == TIME_VALUE) 02555 { 02556 *res= value.time; 02557 return 0; 02558 } 02559 return Item::get_date(res, fuzzydate); 02560 }
Here is the call graph for this function:

Reimplemented from Item.
Definition at line 2537 of file item.cc.
References Item::get_time(), state, TIME_VALUE, and value.
02538 { 02539 if (state == TIME_VALUE) 02540 { 02541 *res= value.time; 02542 return 0; 02543 } 02544 /* 02545 If parameter value isn't supplied assertion will fire in val_str() 02546 which is called from Item::get_time(). 02547 */ 02548 return Item::get_time(res); 02549 }
Here is the call graph for this function:

| bool Item_param::is_null | ( | ) | [inline, virtual] |
Reimplemented from Item.
Definition at line 1494 of file item.h.
References DBUG_ASSERT, NO_VALUE, NULL_VALUE, and state.
01495 { DBUG_ASSERT(state != NO_VALUE); return state == NULL_VALUE; }
| Item * Item_param::new_item | ( | ) | [virtual] |
Reimplemented from Item.
Definition at line 2801 of file item.cc.
References String::c_ptr_quick(), String::charset(), DBUG_ASSERT, Item::decimals, INT_VALUE, String::length(), LONG_DATA_VALUE, Item::max_length, Item::name, NO_VALUE, NULL_VALUE, REAL_VALUE, state, Item::str_value, STRING_VALUE, TIME_VALUE, Item::unsigned_flag, and value.
02802 { 02803 /* see comments in the header file */ 02804 switch (state) { 02805 case NULL_VALUE: 02806 return new Item_null(name); 02807 case INT_VALUE: 02808 return (unsigned_flag ? 02809 new Item_uint(name, value.integer, max_length) : 02810 new Item_int(name, value.integer, max_length)); 02811 case REAL_VALUE: 02812 return new Item_float(name, value.real, decimals, max_length); 02813 case STRING_VALUE: 02814 case LONG_DATA_VALUE: 02815 return new Item_string(name, str_value.c_ptr_quick(), str_value.length(), 02816 str_value.charset()); 02817 case TIME_VALUE: 02818 break; 02819 case NO_VALUE: 02820 default: 02821 DBUG_ASSERT(0); 02822 }; 02823 return 0; 02824 }
Here is the call graph for this function:

| void Item_param::print | ( | String * | str | ) | [virtual] |
Reimplemented from Item.
Definition at line 2860 of file item.cc.
References String::append(), buffer, my_charset_bin, NO_VALUE, query_val_str(), state, and STRING_BUFFER_USUAL_SIZE.
02861 { 02862 if (state == NO_VALUE) 02863 { 02864 str->append('?'); 02865 } 02866 else 02867 { 02868 char buffer[STRING_BUFFER_USUAL_SIZE]; 02869 String tmp(buffer, sizeof(buffer), &my_charset_bin); 02870 const String *res; 02871 res= query_val_str(&tmp); 02872 str->append(*res); 02873 } 02874 }
Here is the call graph for this function:

Definition at line 2700 of file item.cc.
References append_query_string(), buf, String::c_ptr_quick(), DBUG_ASSERT, decimal_value, DECIMAL_VALUE, E_DEC_FATAL_ERROR, INT_VALUE, String::length(), LONG_DATA_VALUE, MAX_DATE_STRING_REP_LENGTH, my_charset_bin, my_decimal2string(), my_null_string, my_TIME_to_str(), NOT_FIXED_DEC, NULL_VALUE, REAL_VALUE, String::reserve(), String::set(), String::set_real(), state, Item::str_value, STRING_VALUE, TIME_VALUE, and value.
Referenced by insert_params_withlog(), and print().
02701 { 02702 switch (state) { 02703 case INT_VALUE: 02704 str->set(value.integer, &my_charset_bin); 02705 break; 02706 case REAL_VALUE: 02707 str->set_real(value.real, NOT_FIXED_DEC, &my_charset_bin); 02708 break; 02709 case DECIMAL_VALUE: 02710 if (my_decimal2string(E_DEC_FATAL_ERROR, &decimal_value, 02711 0, 0, 0, str) > 1) 02712 return &my_null_string; 02713 break; 02714 case TIME_VALUE: 02715 { 02716 char *buf, *ptr; 02717 str->length(0); 02718 /* 02719 TODO: in case of error we need to notify replication 02720 that binary log contains wrong statement 02721 */ 02722 if (str->reserve(MAX_DATE_STRING_REP_LENGTH+3)) 02723 break; 02724 02725 /* Create date string inplace */ 02726 buf= str->c_ptr_quick(); 02727 ptr= buf; 02728 *ptr++= '\''; 02729 ptr+= (uint) my_TIME_to_str(&value.time, ptr); 02730 *ptr++= '\''; 02731 str->length((uint32) (ptr - buf)); 02732 break; 02733 } 02734 case STRING_VALUE: 02735 case LONG_DATA_VALUE: 02736 { 02737 str->length(0); 02738 append_query_string(value.cs_info.character_set_client, &str_value, str); 02739 break; 02740 } 02741 case NULL_VALUE: 02742 return &my_null_string; 02743 default: 02744 DBUG_ASSERT(0); 02745 } 02746 return str; 02747 }
Here is the call graph for this function:

Here is the caller graph for this function:

| void Item_param::reset | ( | ) |
Definition at line 2478 of file item.cc.
References String::alloced_length(), Item::collation, DBUG_ENTER, DBUG_VOID_RETURN, DERIVATION_COERCIBLE, String::free(), String::length(), MAX_CHAR_WIDTH, Item::maybe_null, my_charset_bin, NO_VALUE, Item::null_value, DTCollation::set(), String::set_charset(), state, Item::str_value, and str_value_ptr.
02479 { 02480 DBUG_ENTER("Item_param::reset"); 02481 /* Shrink string buffer if it's bigger than max possible CHAR column */ 02482 if (str_value.alloced_length() > MAX_CHAR_WIDTH) 02483 str_value.free(); 02484 else 02485 str_value.length(0); 02486 str_value_ptr.length(0); 02487 /* 02488 We must prevent all charset conversions until data has been written 02489 to the binary log. 02490 */ 02491 str_value.set_charset(&my_charset_bin); 02492 collation.set(&my_charset_bin, DERIVATION_COERCIBLE); 02493 state= NO_VALUE; 02494 maybe_null= 1; 02495 null_value= 0; 02496 /* 02497 Don't reset item_type to PARAM_ITEM: it's only needed to guard 02498 us from item optimizations at prepare stage, when item doesn't yet 02499 contain a literal of some kind. 02500 In all other cases when this object is accessed its value is 02501 set (this assumption is guarded by 'state' and 02502 DBUG_ASSERTS(state != NO_VALUE) in all Item_param::get_* 02503 methods). 02504 */ 02505 DBUG_VOID_RETURN; 02506 }
Here is the call graph for this function:

| enum Item_result Item_param::result_type | ( | ) | const [inline, virtual] |
Reimplemented from Item.
Definition at line 1453 of file item.h.
References item_result_type.
01453 { return item_result_type; }
| Item * Item_param::safe_charset_converter | ( | CHARSET_INFO * | tocs | ) | [virtual] |
Reimplemented from Item.
Definition at line 712 of file item.cc.
References String::charset(), cnvitem, cnvstr, Item::const_item(), String::copy(), String::length(), String::mark_as_const(), Item::max_length, charset_info_st::mbmaxlen, NULL, String::numchars(), String::ptr(), Item::str_value, and val_str().
00713 { 00714 if (const_item()) 00715 { 00716 uint cnv_errors; 00717 String *ostr= val_str(&cnvstr); 00718 cnvitem->str_value.copy(ostr->ptr(), ostr->length(), 00719 ostr->charset(), tocs, &cnv_errors); 00720 if (cnv_errors) 00721 return NULL; 00722 cnvitem->str_value.mark_as_const(); 00723 cnvitem->max_length= cnvitem->str_value.numchars() * tocs->mbmaxlen; 00724 return cnvitem; 00725 } 00726 return NULL; 00727 }
Here is the call graph for this function:

Reimplemented from Item.
Definition at line 2509 of file item.cc.
References String::charset(), DBUG_ASSERT, decimal_value, DECIMAL_VALUE, INT_VALUE, String::length(), LONG_DATA_VALUE, NO_VALUE, NULL_VALUE, String::ptr(), REAL_VALUE, set_field_to_null_with_conversions(), Field::set_notnull(), state, Field::store(), Field::store_decimal(), Field::store_time(), Item::str_value, STRING_VALUE, TIME_VALUE, Item::unsigned_flag, and value.
02510 { 02511 field->set_notnull(); 02512 02513 switch (state) { 02514 case INT_VALUE: 02515 return field->store(value.integer, unsigned_flag); 02516 case REAL_VALUE: 02517 return field->store(value.real); 02518 case DECIMAL_VALUE: 02519 return field->store_decimal(&decimal_value); 02520 case TIME_VALUE: 02521 field->store_time(&value.time, value.time.time_type); 02522 return 0; 02523 case STRING_VALUE: 02524 case LONG_DATA_VALUE: 02525 return field->store(str_value.ptr(), str_value.length(), 02526 str_value.charset()); 02527 case NULL_VALUE: 02528 return set_field_to_null_with_conversions(field, no_conversions); 02529 case NO_VALUE: 02530 default: 02531 DBUG_ASSERT(0); 02532 } 02533 return 1; 02534 }
Here is the call graph for this function:

| void Item_param::set_decimal | ( | const char * | str, | |
| ulong | length | |||
| ) |
Definition at line 2290 of file item.cc.
References DBUG_ENTER, DBUG_VOID_RETURN, DECIMAL_VALUE, decimal_value, Item::decimals, E_DEC_FATAL_ERROR, st_decimal_t::frac, Item::max_length, Item::maybe_null, my_decimal_precision_to_length(), my_decimal::precision(), state, str2my_decimal(), and Item::unsigned_flag.
Referenced by set_param_decimal().
02291 { 02292 char *end; 02293 DBUG_ENTER("Item_param::set_decimal"); 02294 02295 end= (char*) str+length; 02296 str2my_decimal(E_DEC_FATAL_ERROR, str, &decimal_value, &end); 02297 state= DECIMAL_VALUE; 02298 decimals= decimal_value.frac; 02299 max_length= my_decimal_precision_to_length(decimal_value.precision(), 02300 decimals, unsigned_flag); 02301 maybe_null= 0; 02302 DBUG_VOID_RETURN; 02303 }
Here is the call graph for this function:

Here is the caller graph for this function:

| void Item_param::set_double | ( | double | i | ) |
Definition at line 2264 of file item.cc.
References DBUG_ENTER, DBUG_VOID_RETURN, Item::decimals, Item::max_length, Item::maybe_null, NOT_FIXED_DEC, REAL_VALUE, state, and value.
Referenced by set_from_user_var(), set_param_double(), and set_param_float().
02265 { 02266 DBUG_ENTER("Item_param::set_double"); 02267 value.real= d; 02268 state= REAL_VALUE; 02269 max_length= DBL_DIG + 8; 02270 decimals= NOT_FIXED_DEC; 02271 maybe_null= 0; 02272 DBUG_VOID_RETURN; 02273 }
Here is the caller graph for this function:

| bool Item_param::set_from_user_var | ( | THD * | thd, | |
| const user_var_entry * | entry | |||
| ) |
Definition at line 2402 of file item.cc.
References DBUG_ASSERT, DBUG_ENTER, DBUG_RETURN, DECIMAL_RESULT, DECIMAL_VALUE, decimal_value, Item::decimals, st_decimal_t::frac, Item::INT_ITEM, INT_RESULT, item_result_type, item_type, Item::max_length, my_decimal2decimal(), my_decimal_precision_to_length(), String::needs_conversion(), my_decimal::precision(), Item::REAL_ITEM, REAL_RESULT, set_double(), set_int(), set_null(), set_str(), state, Item::STRING_ITEM, STRING_RESULT, Item::unsigned_flag, and value.
02403 { 02404 DBUG_ENTER("Item_param::set_from_user_var"); 02405 if (entry && entry->value) 02406 { 02407 item_result_type= entry->type; 02408 switch (entry->type) { 02409 case REAL_RESULT: 02410 set_double(*(double*)entry->value); 02411 item_type= Item::REAL_ITEM; 02412 item_result_type= REAL_RESULT; 02413 break; 02414 case INT_RESULT: 02415 set_int(*(longlong*)entry->value, 21); 02416 item_type= Item::INT_ITEM; 02417 item_result_type= INT_RESULT; 02418 break; 02419 case STRING_RESULT: 02420 { 02421 CHARSET_INFO *fromcs= entry->collation.collation; 02422 CHARSET_INFO *tocs= thd->variables.collation_connection; 02423 uint32 dummy_offset; 02424 02425 value.cs_info.character_set_of_placeholder= 02426 value.cs_info.character_set_client= fromcs; 02427 /* 02428 Setup source and destination character sets so that they 02429 are different only if conversion is necessary: this will 02430 make later checks easier. 02431 */ 02432 value.cs_info.final_character_set_of_str_value= 02433 String::needs_conversion(0, fromcs, tocs, &dummy_offset) ? 02434 tocs : fromcs; 02435 /* 02436 Exact value of max_length is not known unless data is converted to 02437 charset of connection, so we have to set it later. 02438 */ 02439 item_type= Item::STRING_ITEM; 02440 item_result_type= STRING_RESULT; 02441 02442 if (set_str((const char *)entry->value, entry->length)) 02443 DBUG_RETURN(1); 02444 break; 02445 } 02446 case DECIMAL_RESULT: 02447 { 02448 const my_decimal *ent_value= (const my_decimal *)entry->value; 02449 my_decimal2decimal(ent_value, &decimal_value); 02450 state= DECIMAL_VALUE; 02451 decimals= ent_value->frac; 02452 max_length= my_decimal_precision_to_length(ent_value->precision(), 02453 decimals, unsigned_flag); 02454 break; 02455 } 02456 default: 02457 DBUG_ASSERT(0); 02458 set_null(); 02459 } 02460 } 02461 else 02462 set_null(); 02463 02464 DBUG_RETURN(0); 02465 }
Here is the call graph for this function:

Definition at line 2253 of file item.cc.
References DBUG_ENTER, DBUG_VOID_RETURN, Item::decimals, INT_VALUE, Item::max_length, Item::maybe_null, state, and value.
Referenced by set_from_user_var(), set_param_int32(), set_param_int64(), set_param_short(), and set_param_tiny().
02254 { 02255 DBUG_ENTER("Item_param::set_int"); 02256 value.integer= (longlong) i; 02257 state= INT_VALUE; 02258 max_length= max_length_arg; 02259 decimals= 0; 02260 maybe_null= 0; 02261 DBUG_VOID_RETURN; 02262 }
Here is the caller graph for this function:

Definition at line 2367 of file item.cc.
References String::append(), DBUG_ENTER, DBUG_RETURN, FALSE, LONG_DATA_VALUE, Item::maybe_null, my_charset_bin, state, Item::str_value, and TRUE.
Referenced by mysql_stmt_get_longdata().
02368 { 02369 DBUG_ENTER("Item_param::set_longdata"); 02370 02371 /* 02372 If client character set is multibyte, end of long data packet 02373 may hit at the middle of a multibyte character. Additionally, 02374 if binary log is open we must write long data value to the 02375 binary log in character set of client. This is why we can't 02376 convert long data to connection character set as it comes 02377 (here), and first have to concatenate all pieces together, 02378 write query to the binary log and only then perform conversion. 02379 */ 02380 if (str_value.append(str, length, &my_charset_bin)) 02381 DBUG_RETURN(TRUE); 02382 state= LONG_DATA_VALUE; 02383 maybe_null= 0; 02384 02385 DBUG_RETURN(FALSE); 02386 }
Here is the call graph for this function:

Here is the caller graph for this function:

| void Item_param::set_null | ( | ) |
Definition at line 2236 of file item.cc.
References DBUG_ENTER, DBUG_VOID_RETURN, Item::decimals, item_type, Item::max_length, Item::NULL_ITEM, NULL_VALUE, Item::null_value, and state.
Referenced by default_set_param_func(), insert_params(), insert_params_withlog(), and set_from_user_var().
02237 { 02238 DBUG_ENTER("Item_param::set_null"); 02239 /* These are cleared after each execution by reset() method */ 02240 null_value= 1; 02241 /* 02242 Because of NULL and string values we need to set max_length for each new 02243 placeholder value: user can submit NULL for any placeholder type, and 02244 string length can be different in each execution. 02245 */ 02246 max_length= 0; 02247 decimals= 0; 02248 state= NULL_VALUE; 02249 item_type= Item::NULL_ITEM; 02250 DBUG_VOID_RETURN; 02251 }
Here is the caller graph for this function:

Definition at line 2347 of file item.cc.
References String::copy(), DBUG_ENTER, DBUG_RETURN, FALSE, Item::max_length, Item::maybe_null, my_charset_bin, state, Item::str_value, STRING_VALUE, and TRUE.
Referenced by set_from_user_var(), and set_param_str().
02348 { 02349 DBUG_ENTER("Item_param::set_str"); 02350 /* 02351 Assign string with no conversion: data is converted only after it's 02352 been written to the binary log. 02353 */ 02354 uint dummy_errors; 02355 if (str_value.copy(str, length, &my_charset_bin, &my_charset_bin, 02356 &dummy_errors)) 02357 DBUG_RETURN(TRUE); 02358 state= STRING_VALUE; 02359 max_length= length; 02360 maybe_null= 0; 02361 /* max_length and decimals are set after charset conversion */ 02362 /* sic: str may be not null-terminated, don't add DBUG_PRINT here */ 02363 DBUG_RETURN(FALSE); 02364 }
Here is the call graph for this function:

Here is the caller graph for this function:

| void Item_param::set_time | ( | TIME * | tm, | |
| timestamp_type | type, | |||
| uint32 | max_length_arg | |||
| ) |
Definition at line 2321 of file item.cc.
References current_thd, DBUG_ENTER, DBUG_VOID_RETURN, Item::decimals, make_truncated_value_warning(), MAX_DATE_STRING_REP_LENGTH, Item::max_length, Item::maybe_null, my_TIME_to_str(), MYSQL_TIMESTAMP_ERROR, MYSQL_TIMESTAMP_TIME, set_zero_time(), state, TIME_VALUE, and value.
Referenced by set_param_date(), set_param_datetime(), and set_param_time().
02322 { 02323 DBUG_ENTER("Item_param::set_time"); 02324 02325 value.time= *tm; 02326 value.time.time_type= type; 02327 02328 if (value.time.year > 9999 || value.time.month > 12 || 02329 value.time.day > 31 || 02330 type != MYSQL_TIMESTAMP_TIME && value.time.hour > 23 || 02331 value.time.minute > 59 || value.time.second > 59) 02332 { 02333 char buff[MAX_DATE_STRING_REP_LENGTH]; 02334 uint length= my_TIME_to_str(&value.time, buff); 02335 make_truncated_value_warning(current_thd, buff, length, type, 0); 02336 set_zero_time(&value.time, MYSQL_TIMESTAMP_ERROR); 02337 } 02338 02339 state= TIME_VALUE; 02340 maybe_null= 0; 02341 max_length= max_length_arg; 02342 decimals= 0; 02343 DBUG_VOID_RETURN; 02344 }
Here is the call graph for this function:

Here is the caller graph for this function:

| enum Type Item_param::type | ( | ) | const [inline, virtual] |
| virtual table_map Item_param::used_tables | ( | ) | const [inline, virtual] |
Reimplemented from Item.
Definition at line 1491 of file item.h.
References NO_VALUE, PARAM_TABLE_BIT, and state.
01492 { return state != NO_VALUE ? (table_map)0 : PARAM_TABLE_BIT; }
| my_decimal * Item_param::val_decimal | ( | my_decimal * | ) | [virtual] |
Implements Item.
Definition at line 2630 of file item.cc.
References DBUG_ASSERT, decimal_value, DECIMAL_VALUE, double2my_decimal(), E_DEC_FATAL_ERROR, int2my_decimal(), INT_VALUE, LONG_DATA_VALUE, NULL_VALUE, REAL_VALUE, state, Item::str_value, STRING_VALUE, TIME_to_ulonglong(), TIME_VALUE, Item::unsigned_flag, and value.
02631 { 02632 switch (state) { 02633 case DECIMAL_VALUE: 02634 return &decimal_value; 02635 case REAL_VALUE: 02636 double2my_decimal(E_DEC_FATAL_ERROR, value.real, dec); 02637 return dec; 02638 case INT_VALUE: 02639 int2my_decimal(E_DEC_FATAL_ERROR, value.integer, unsigned_flag, dec); 02640 return dec; 02641 case STRING_VALUE: 02642 case LONG_DATA_VALUE: 02643 string2my_decimal(E_DEC_FATAL_ERROR, &str_value, dec); 02644 return dec; 02645 case TIME_VALUE: 02646 { 02647 longlong i= (longlong) TIME_to_ulonglong(&value.time); 02648 int2my_decimal(E_DEC_FATAL_ERROR, i, 0, dec); 02649 return dec; 02650 } 02651 case NULL_VALUE: 02652 return 0; 02653 default: 02654 DBUG_ASSERT(0); 02655 } 02656 return 0; 02657 }
Here is the call graph for this function:

| longlong Item_param::val_int | ( | ) | [virtual] |
Implements Item.
Definition at line 2599 of file item.cc.
References String::charset(), DBUG_ASSERT, decimal_value, DECIMAL_VALUE, E_DEC_FATAL_ERROR, INT_VALUE, String::length(), LONG_DATA_VALUE, my_decimal2int(), my_strntoll, NULL_VALUE, String::ptr(), REAL_VALUE, rint, state, Item::str_value, STRING_VALUE, TIME_to_ulonglong(), TIME_VALUE, Item::unsigned_flag, and value.
02600 { 02601 switch (state) { 02602 case REAL_VALUE: 02603 return (longlong) rint(value.real); 02604 case INT_VALUE: 02605 return value.integer; 02606 case DECIMAL_VALUE: 02607 { 02608 longlong i; 02609 my_decimal2int(E_DEC_FATAL_ERROR, &decimal_value, unsigned_flag, &i); 02610 return i; 02611 } 02612 case STRING_VALUE: 02613 case LONG_DATA_VALUE: 02614 { 02615 int dummy_err; 02616 return my_strntoll(str_value.charset(), str_value.ptr(), 02617 str_value.length(), 10, (char**) 0, &dummy_err); 02618 } 02619 case TIME_VALUE: 02620 return (longlong) TIME_to_ulonglong(&value.time); 02621 case NULL_VALUE: 02622 return 0; 02623 default: 02624 DBUG_ASSERT(0); 02625 } 02626 return 0; 02627 }
Here is the call graph for this function:

| double Item_param::val_real | ( | ) | [virtual] |
Implements Item.
Definition at line 2563 of file item.cc.
References String::charset(), DBUG_ASSERT, decimal_value, DECIMAL_VALUE, E_DEC_FATAL_ERROR, INT_VALUE, String::length(), LONG_DATA_VALUE, my_decimal2double(), my_strntod, NULL_VALUE, String::ptr(), REAL_VALUE, state, Item::str_value, STRING_VALUE, TIME_to_ulonglong(), TIME_VALUE, ulonglong2double, and value.
02564 { 02565 switch (state) { 02566 case REAL_VALUE: 02567 return value.real; 02568 case INT_VALUE: 02569 return (double) value.integer; 02570 case DECIMAL_VALUE: 02571 { 02572 double result; 02573 my_decimal2double(E_DEC_FATAL_ERROR, &decimal_value, &result); 02574 return result; 02575 } 02576 case STRING_VALUE: 02577 case LONG_DATA_VALUE: 02578 { 02579 int dummy_err; 02580 char *end_not_used; 02581 return my_strntod(str_value.charset(), (char*) str_value.ptr(), 02582 str_value.length(), &end_not_used, &dummy_err); 02583 } 02584 case TIME_VALUE: 02585 /* 02586 This works for example when user says SELECT ?+0.0 and supplies 02587 time value for the placeholder. 02588 */ 02589 return ulonglong2double(TIME_to_ulonglong(&value.time)); 02590 case NULL_VALUE: 02591 return 0.0; 02592 default: 02593 DBUG_ASSERT(0); 02594 } 02595 return 0.0; 02596 }
Here is the call graph for this function:

Implements Item.
Definition at line 2660 of file item.cc.
References DBUG_ASSERT, decimal_value, DECIMAL_VALUE, E_DEC_FATAL_ERROR, INT_VALUE, String::length(), LONG_DATA_VALUE, MAX_DATE_STRING_REP_LENGTH, my_charset_bin, my_decimal2string(), my_TIME_to_str(), NOT_FIXED_DEC, NULL, NULL_VALUE, String::ptr(), REAL_VALUE, String::reserve(), String::set(), String::set_charset(), String::set_real(), state, str_value_ptr, STRING_VALUE, TIME_VALUE, and value.
Referenced by safe_charset_converter().
02661 { 02662 switch (state) { 02663 case STRING_VALUE: 02664 case LONG_DATA_VALUE: 02665 return &str_value_ptr; 02666 case REAL_VALUE: 02667 str->set_real(value.real, NOT_FIXED_DEC, &my_charset_bin); 02668 return str; 02669 case INT_VALUE: 02670 str->set(value.integer, &my_charset_bin); 02671 return str; 02672 case DECIMAL_VALUE: 02673 if (my_decimal2string(E_DEC_FATAL_ERROR, &decimal_value, 02674 0, 0, 0, str) <= 1) 02675 return str; 02676 return NULL; 02677 case TIME_VALUE: 02678 { 02679 if (str->reserve(MAX_DATE_STRING_REP_LENGTH)) 02680 break; 02681 str->length((uint) my_TIME_to_str(&value.time, (char*) str->ptr())); 02682 str->set_charset(&my_charset_bin); 02683 return str; 02684 } 02685 case NULL_VALUE: 02686 return NULL; 02687 default: 02688 DBUG_ASSERT(0); 02689 } 02690 return str; 02691 }
Here is the call graph for this function:

Here is the caller graph for this function:

char Item_param::cnvbuf[MAX_FIELD_WIDTH] [private] |
Item* Item_param::cnvitem [private] |
String Item_param::cnvstr [private] |
| struct { ... } ::CONVERSION_INFO Item_param::cs_info |
Referenced by setup_one_conversion_function().
Definition at line 1406 of file item.h.
Referenced by query_val_str(), save_in_field(), set_decimal(), set_from_user_var(), val_decimal(), val_int(), val_real(), and val_str().
Definition at line 1433 of file item.h.
Referenced by result_type(), set_from_user_var(), and setup_one_conversion_function().
Definition at line 1434 of file item.h.
Referenced by set_from_user_var(), set_null(), setup_one_conversion_function(), and type().
Definition at line 1444 of file item.h.
Referenced by field_type(), and setup_one_conversion_function().
| double Item_param::real |
| void(* Item_param::set_param_func)(Item_param *param, uchar **pos, ulong len) |
Referenced by insert_params(), insert_params_withlog(), and setup_one_conversion_function().
Referenced by basic_const_item(), convert_str_value(), eq(), get_date(), get_time(), insert_params(), insert_params_withlog(), is_null(), new_item(), print(), query_val_str(), reset(), save_in_field(), set_decimal(), set_double(), set_from_user_var(), set_int(), set_longdata(), set_null(), set_str(), set_time(), used_tables(), val_decimal(), val_int(), val_real(), and val_str().
| union { ... } Item_param::value |
1.4.7

