The world's most popular open source database
#include <item.h>
Inheritance diagram for Item_sp_variable:


Public Member Functions | |
| Item_sp_variable (char *sp_var_name_str, uint sp_var_name_length) | |
| bool | fix_fields (THD *thd, Item **) |
| double | val_real () |
| longlong | val_int () |
| String * | val_str (String *sp) |
| my_decimal * | val_decimal (my_decimal *decimal_value) |
| bool | is_null () |
| void | make_field (Send_field *field) |
| bool | const_item () const |
| int | save_in_field (Field *field, bool no_conversions) |
| bool | send (Protocol *protocol, String *str) |
Public Attributes | |
| LEX_STRING | m_name |
| sp_head * | m_sp |
Protected Attributes | |
| THD * | m_thd |
Definition at line 889 of file item.h.
| Item_sp_variable::Item_sp_variable | ( | char * | sp_var_name_str, | |
| uint | sp_var_name_length | |||
| ) |
| bool Item_sp_variable::const_item | ( | ) | const [inline, virtual] |
Reimplemented from Item.
Definition at line 852 of file item.cc.
References DTCollation::collation, Item::collation, DBUG_ASSERT, Item::decimals, DTCollation::derivation, FALSE, Item::fixed, m_thd, Item::max_length, DTCollation::set(), Item::this_item(), and Item::unsigned_flag.
00853 { 00854 Item *it; 00855 00856 m_thd= thd; /* NOTE: this must be set before any this_xxx() */ 00857 it= this_item(); 00858 00859 DBUG_ASSERT(it->fixed); 00860 00861 max_length= it->max_length; 00862 decimals= it->decimals; 00863 unsigned_flag= it->unsigned_flag; 00864 fixed= 1; 00865 collation.set(it->collation.collation, it->collation.derivation); 00866 00867 return FALSE; 00868 }
Here is the call graph for this function:

| bool Item_sp_variable::is_null | ( | ) | [virtual] |
Reimplemented from Item.
Definition at line 937 of file item.cc.
References Item::is_null(), and Item::this_item().
Here is the call graph for this function:

| void Item_sp_variable::make_field | ( | Send_field * | field | ) | [inline, virtual] |
Reimplemented from Item.
Definition at line 935 of file item.h.
References LEX_STRING::length, m_name, Item::make_field(), Item::name, Item::set_name(), LEX_STRING::str, strlen(), system_charset_info, and Item::this_item().
00936 { 00937 Item *it= this_item(); 00938 00939 if (name) 00940 it->set_name(name, (uint) strlen(name), system_charset_info); 00941 else 00942 it->set_name(m_name.str, m_name.length, system_charset_info); 00943 it->make_field(field); 00944 }
Here is the call graph for this function:

Reimplemented from Item.
Definition at line 951 of file item.h.
References Item::save_in_field(), and Item::this_item().
00952 { 00953 return this_item()->save_in_field(field, no_conversions); 00954 }
Here is the call graph for this function:

Reimplemented from Item.
Definition at line 956 of file item.h.
References Item::send(), and Item::this_item().
Here is the call graph for this function:

| my_decimal * Item_sp_variable::val_decimal | ( | my_decimal * | decimal_value | ) | [virtual] |
Implements Item.
Definition at line 927 of file item.cc.
References DBUG_ASSERT, Item::fixed, Item::null_value, Item::this_item(), and Item::val_decimal().
00928 { 00929 DBUG_ASSERT(fixed); 00930 Item *it= this_item(); 00931 my_decimal *val= it->val_decimal(decimal_value); 00932 null_value= it->null_value; 00933 return val; 00934 }
Here is the call graph for this function:

| longlong Item_sp_variable::val_int | ( | ) | [virtual] |
Implements Item.
Definition at line 881 of file item.cc.
References DBUG_ASSERT, Item::fixed, Item::null_value, Item::this_item(), and Item::val_int().
00882 { 00883 DBUG_ASSERT(fixed); 00884 Item *it= this_item(); 00885 longlong ret= it->val_int(); 00886 null_value= it->null_value; 00887 return ret; 00888 }
Here is the call graph for this function:

| double Item_sp_variable::val_real | ( | ) | [virtual] |
Implements Item.
Definition at line 871 of file item.cc.
References DBUG_ASSERT, Item::fixed, Item::null_value, Item::this_item(), and Item::val_real().
00872 { 00873 DBUG_ASSERT(fixed); 00874 Item *it= this_item(); 00875 double ret= it->val_real(); 00876 null_value= it->null_value; 00877 return ret; 00878 }
Here is the call graph for this function:

Implements Item.
Definition at line 891 of file item.cc.
References String::charset(), DBUG_ASSERT, Item::fixed, String::length(), String::mark_as_const(), NULL, Item::null_value, String::ptr(), String::set(), Item::str_value, Item::this_item(), and Item::val_str().
00892 { 00893 DBUG_ASSERT(fixed); 00894 Item *it= this_item(); 00895 String *res= it->val_str(sp); 00896 00897 null_value= it->null_value; 00898 00899 if (!res) 00900 return NULL; 00901 00902 /* 00903 This way we mark returned value of val_str as const, 00904 so that various functions (e.g. CONCAT) won't try to 00905 modify the value of the Item. Analogous mechanism is 00906 implemented for Item_param. 00907 Without this trick Item_splocal could be changed as a 00908 side-effect of expression computation. Here is an example 00909 of what happens without it: suppose x is varchar local 00910 variable in a SP with initial value 'ab' Then 00911 select concat(x,'c'); 00912 would change x's value to 'abc', as Item_func_concat::val_str() 00913 would use x's internal buffer to compute the result. 00914 This is intended behaviour of Item_func_concat. Comments to 00915 Item_param class contain some more details on the topic. 00916 */ 00917 00918 if (res != &str_value) 00919 str_value.set(res->ptr(), res->length(), res->charset()); 00920 else 00921 res->mark_as_const(); 00922 00923 return &str_value; 00924 }
Here is the call graph for this function:

Definition at line 899 of file item.h.
Referenced by Item_sp_variable(), make_field(), Item_splocal::my_name(), and Item_splocal::print().
Definition at line 907 of file item.h.
Referenced by Item_case_expr::this_item(), Item_splocal::this_item(), Item_case_expr::this_item_addr(), and Item_splocal::this_item_addr().
THD* Item_sp_variable::m_thd [protected] |
Definition at line 896 of file item.h.
Referenced by fix_fields(), Item_case_expr::this_item(), and Item_splocal::this_item().
1.4.7

