#include <item_func.h>
Inheritance diagram for Item_func_get_user_var:


Public Member Functions | |
| Item_func_get_user_var (LEX_STRING a) | |
| enum Functype | functype () const |
| LEX_STRING | get_name () |
| double | val_real () |
| longlong | val_int () |
| my_decimal * | val_decimal (my_decimal *) |
| String * | val_str (String *str) |
| void | fix_length_and_dec () |
| void | print (String *str) |
| enum Item_result | result_type () const |
| enum_field_types | field_type () const |
| const char * | func_name () const |
| bool | const_item () const |
| table_map | used_tables () const |
| bool | eq (const Item *item, bool binary_cmp) const |
| Settable_routine_parameter * | get_settable_routine_parameter () |
Public Attributes | |
| LEX_STRING | name |
Private Member Functions | |
| bool | set_value (THD *thd, sp_rcontext *ctx, Item **it) |
Private Attributes | |
| user_var_entry * | var_entry |
Definition at line 1216 of file item_func.h.
| Item_func_get_user_var::Item_func_get_user_var | ( | LEX_STRING | a | ) | [inline] |
Definition at line 1223 of file item_func.h.
01223 : 01224 Item_func(), name(a) {} enum Functype functype() const { return GUSERVAR_FUNC; }
| bool Item_func_get_user_var::const_item | ( | ) | const [virtual] |
Reimplemented from Item_func.
Definition at line 4120 of file item_func.cc.
References current_thd, and var_entry.
Referenced by used_tables().
04121 { 04122 return (!var_entry || current_thd->query_id != var_entry->update_query_id); 04123 }
Here is the caller graph for this function:

Reimplemented from Item_func.
Definition at line 4145 of file item_func.cc.
References Item::FUNC_ITEM, functype(), LEX_STRING::length, memcmp(), name, LEX_STRING::str, and Item::type().
04146 { 04147 /* Assume we don't have rtti */ 04148 if (this == item) 04149 return 1; // Same item is same. 04150 /* Check if other type is also a get_user_var() object */ 04151 if (item->type() != FUNC_ITEM || 04152 ((Item_func*) item)->functype() != functype()) 04153 return 0; 04154 Item_func_get_user_var *other=(Item_func_get_user_var*) item; 04155 return (name.length == other->name.length && 04156 !memcmp(name.str, other->name.str, name.length)); 04157 }
Here is the call graph for this function:

| enum_field_types Item_func_get_user_var::field_type | ( | ) | const [inline, virtual] |
Reimplemented from Item.
Definition at line 1238 of file item_func.h.
References MYSQL_TYPE_VARCHAR.
01238 { return MYSQL_TYPE_VARCHAR; }
| void Item_func_get_user_var::fix_length_and_dec | ( | ) | [virtual] |
Implements Item_result_field.
Definition at line 4073 of file item_func.cc.
References Item::collation, current_thd, DBUG_ASSERT, DECIMAL_MAX_SCALE, DECIMAL_MAX_STR_LENGTH, DECIMAL_RESULT, DERIVATION_IMPLICIT, get_var_with_binlog(), INT_RESULT, MAX_BIGINT_WIDTH, MAX_BLOB_WIDTH, Item::max_length, Item::maybe_null, name, NOT_FIXED_DEC, REAL_RESULT, ROW_RESULT, DTCollation::set(), STRING_RESULT, and var_entry.
04074 { 04075 THD *thd=current_thd; 04076 int error; 04077 maybe_null=1; 04078 decimals=NOT_FIXED_DEC; 04079 max_length=MAX_BLOB_WIDTH; 04080 04081 error= get_var_with_binlog(thd, thd->lex->sql_command, name, &var_entry); 04082 04083 if (var_entry) 04084 { 04085 collation.set(var_entry->collation); 04086 switch (var_entry->type) { 04087 case REAL_RESULT: 04088 max_length= DBL_DIG + 8; 04089 break; 04090 case INT_RESULT: 04091 max_length= MAX_BIGINT_WIDTH; 04092 decimals=0; 04093 break; 04094 case STRING_RESULT: 04095 max_length= MAX_BLOB_WIDTH; 04096 break; 04097 case DECIMAL_RESULT: 04098 max_length= DECIMAL_MAX_STR_LENGTH; 04099 decimals= DECIMAL_MAX_SCALE; 04100 break; 04101 case ROW_RESULT: // Keep compiler happy 04102 default: 04103 DBUG_ASSERT(0); 04104 break; 04105 } 04106 } 04107 else 04108 { 04109 collation.set(&my_charset_bin, DERIVATION_IMPLICIT); 04110 null_value= 1; 04111 } 04112 04113 if (error) 04114 thd->fatal_error(); 04115 04116 return; 04117 }
Here is the call graph for this function:

| const char* Item_func_get_user_var::func_name | ( | ) | const [inline, virtual] |
| enum Functype Item_func_get_user_var::functype | ( | ) | const [inline, virtual] |
Reimplemented from Item_func.
Definition at line 1225 of file item_func.h.
References Item_func::GUSERVAR_FUNC.
Referenced by eq().
01225 { return GUSERVAR_FUNC; }
Here is the caller graph for this function:

| LEX_STRING Item_func_get_user_var::get_name | ( | ) | [inline] |
Definition at line 1226 of file item_func.h.
References name.
Referenced by set_value().
01226 { return name; }
Here is the caller graph for this function:

| Settable_routine_parameter* Item_func_get_user_var::get_settable_routine_parameter | ( | ) | [inline, virtual] |
| void Item_func_get_user_var::print | ( | String * | str | ) | [virtual] |
Reimplemented from Item_func.
Definition at line 4137 of file item_func.cc.
References String::append(), LEX_STRING::length, name, LEX_STRING::str, and STRING_WITH_LEN.
04138 { 04139 str->append(STRING_WITH_LEN("(@")); 04140 str->append(name.str,name.length); 04141 str->append(')'); 04142 }
Here is the call graph for this function:

| enum Item_result Item_func_get_user_var::result_type | ( | ) | const [virtual] |
Reimplemented from Item.
Definition at line 4126 of file item_func.cc.
References current_thd, hash_search(), LEX_STRING::length, name, LEX_STRING::str, and STRING_RESULT.
04127 { 04128 user_var_entry *entry; 04129 if (!(entry = (user_var_entry*) hash_search(¤t_thd->user_vars, 04130 (byte*) name.str, 04131 name.length))) 04132 return STRING_RESULT; 04133 return entry->type; 04134 }
Here is the call graph for this function:

| bool Item_func_get_user_var::set_value | ( | THD * | thd, | |
| sp_rcontext * | ctx, | |||
| Item ** | it | |||
| ) | [private, virtual] |
Implements Settable_routine_parameter.
Definition at line 4160 of file item_func.cc.
References Item_func_set_user_var::check(), Item_func_set_user_var::fix_fields(), get_name(), and Item_func_set_user_var::update().
04162 { 04163 Item_func_set_user_var *suv= new Item_func_set_user_var(get_name(), *it); 04164 /* 04165 Item_func_set_user_var is not fixed after construction, call 04166 fix_fields(). 04167 */ 04168 return (!suv || suv->fix_fields(thd, it) || suv->check() || suv->update()); 04169 }
Here is the call graph for this function:

| table_map Item_func_get_user_var::used_tables | ( | ) | const [inline, virtual] |
Reimplemented from Item_func.
Definition at line 1241 of file item_func.h.
References const_item(), and RAND_TABLE_BIT.
01242 { return const_item() ? 0 : RAND_TABLE_BIT; }
Here is the call graph for this function:

| my_decimal * Item_func_get_user_var::val_decimal | ( | my_decimal * | ) | [virtual] |
Reimplemented from Item_func.
Definition at line 3924 of file item_func.cc.
References DBUG_ASSERT, Item::fixed, and var_entry.
03925 { 03926 DBUG_ASSERT(fixed == 1); 03927 if (!var_entry) 03928 return 0; 03929 return var_entry->val_decimal(&null_value, dec); 03930 }
| longlong Item_func_get_user_var::val_int | ( | ) | [virtual] |
Implements Item.
Definition at line 3933 of file item_func.cc.
References DBUG_ASSERT, Item::fixed, LL, and var_entry.
03934 { 03935 DBUG_ASSERT(fixed == 1); 03936 if (!var_entry) 03937 return LL(0); // No such variable 03938 return (var_entry->val_int(&null_value)); 03939 }
| double Item_func_get_user_var::val_real | ( | ) | [virtual] |
Implements Item.
Definition at line 3915 of file item_func.cc.
References DBUG_ASSERT, Item::fixed, and var_entry.
03916 { 03917 DBUG_ASSERT(fixed == 1); 03918 if (!var_entry) 03919 return 0.0; // No such variable 03920 return (var_entry->val_real(&null_value)); 03921 }
Implements Item.
Definition at line 3905 of file item_func.cc.
References DBUG_ASSERT, DBUG_ENTER, DBUG_RETURN, Item::fixed, and var_entry.
03906 { 03907 DBUG_ASSERT(fixed == 1); 03908 DBUG_ENTER("Item_func_get_user_var::val_str"); 03909 if (!var_entry) 03910 DBUG_RETURN((String*) 0); // No such variable 03911 DBUG_RETURN(var_entry->val_str(&null_value, str, decimals)); 03912 }
Reimplemented from Item.
Definition at line 1222 of file item_func.h.
Referenced by eq(), fix_length_and_dec(), get_name(), print(), and result_type().
user_var_entry* Item_func_get_user_var::var_entry [private] |
Definition at line 1219 of file item_func.h.
Referenced by const_item(), fix_length_and_dec(), val_decimal(), val_int(), val_real(), and val_str().
1.4.7

