diff options
author | unknown <bar@bar.mysql.r18.ru> | 2003-03-03 13:16:39 +0400 |
---|---|---|
committer | unknown <bar@bar.mysql.r18.ru> | 2003-03-03 13:16:39 +0400 |
commit | 48df5b7537b38c2af6297cfffb0e9124940558bd (patch) | |
tree | f396bc7d716337fe462df128393075052bcf4020 | |
parent | 310545adf0de5e933cfa346499991beace33f24c (diff) | |
download | mariadb-git-48df5b7537b38c2af6297cfffb0e9124940558bd.tar.gz |
Coercibility is now stored in user vars
sql/item.h:
Change constant values order according to the word "coercibility" nature
sql/item_func.cc:
Change constant values order according to the word "coercibility" nature
-rw-r--r-- | sql/item.h | 4 | ||||
-rw-r--r-- | sql/item_func.cc | 17 | ||||
-rw-r--r-- | sql/item_func.h | 3 | ||||
-rw-r--r-- | sql/log_event.cc | 2 | ||||
-rw-r--r-- | sql/sql_class.h | 1 |
5 files changed, 17 insertions, 10 deletions
diff --git a/sql/item.h b/sql/item.h index 3cf8a885018..e262a9cb4e6 100644 --- a/sql/item.h +++ b/sql/item.h @@ -39,8 +39,8 @@ public: SUBSELECT_ITEM, ROW_ITEM, CACHE_ITEM}; enum cond_result { COND_UNDEF,COND_OK,COND_TRUE,COND_FALSE }; - enum coercion { COER_NOCOLL=0, COER_COERCIBLE=1, - COER_IMPLICIT=2, COER_EXPLICIT=3 }; + enum coercion { COER_NOCOLL=3, COER_COERCIBLE=2, + COER_IMPLICIT=1, COER_EXPLICIT=0 }; String str_value; /* used to store value */ my_string name; /* Name from select */ diff --git a/sql/item_func.cc b/sql/item_func.cc index 545cb14bf2a..e5d32042641 100644 --- a/sql/item_func.cc +++ b/sql/item_func.cc @@ -132,7 +132,7 @@ Item_func::fix_fields(THD *thd, TABLE_LIST *tables, Item **ref) coercibility= (*arg)->coercibility; set_charset((*arg)->charset()); } - else if ((*arg)->coercibility > coercibility) + else if ((*arg)->coercibility < coercibility) { if (strcmp(charset()->csname,(*arg)->charset()->csname)) { @@ -2007,6 +2007,7 @@ static user_var_entry *get_variable(HASH *hash, LEX_STRING &name, } + bool Item_func_set_user_var::fix_fields(THD *thd, TABLE_LIST *tables, Item **ref) { @@ -2030,7 +2031,8 @@ Item_func_set_user_var::fix_length_and_dec() void Item_func_set_user_var::update_hash(void *ptr, uint length, Item_result type, - CHARSET_INFO *cs) + CHARSET_INFO *cs, + enum coercion coercibility) { if ((null_value=args[0]->null_value)) { @@ -2040,6 +2042,7 @@ void Item_func_set_user_var::update_hash(void *ptr, uint length, entry->value=0; entry->length=0; entry->var_charset=cs; + entry->var_coercibility= coercibility; } else { @@ -2071,6 +2074,7 @@ void Item_func_set_user_var::update_hash(void *ptr, uint length, entry->length= length; entry->type=type; entry->var_charset=cs; + entry->var_coercibility= coercibility; } return; @@ -2112,7 +2116,8 @@ double Item_func_set_user_var::val() { double value=args[0]->val(); - update_hash((void*) &value,sizeof(value), REAL_RESULT, default_charset_info); + update_hash((void*) &value,sizeof(value), REAL_RESULT, + &my_charset_bin, COER_NOCOLL); return value; } @@ -2121,7 +2126,7 @@ Item_func_set_user_var::val_int() { longlong value=args[0]->val_int(); update_hash((void*) &value, sizeof(longlong), INT_RESULT, - default_charset_info); + &my_charset_bin, COER_NOCOLL); return value; } @@ -2130,10 +2135,10 @@ Item_func_set_user_var::val_str(String *str) { String *res=args[0]->val_str(str); if (!res) // Null value - update_hash((void*) 0, 0, STRING_RESULT, &my_charset_bin); + update_hash((void*) 0, 0, STRING_RESULT, &my_charset_bin, COER_NOCOLL); else update_hash((void*) res->ptr(), res->length(), STRING_RESULT, - res->charset()); + res->charset(), args[0]->coercibility); return res; } diff --git a/sql/item_func.h b/sql/item_func.h index b958b72d514..fc7145705b2 100644 --- a/sql/item_func.h +++ b/sql/item_func.h @@ -934,7 +934,8 @@ public: double val(); longlong val_int(); String *val_str(String *str); - void update_hash(void *ptr, uint length, enum Item_result type, CHARSET_INFO *cs); + void update_hash(void *ptr, uint length, enum Item_result type, + CHARSET_INFO *cs, enum coercion coercibility); bool update(); enum Item_result result_type () const { return cached_result_type; } bool fix_fields(THD *thd, struct st_table_list *tables, Item **ref); diff --git a/sql/log_event.cc b/sql/log_event.cc index a1cb144a894..0f0bc0d5727 100644 --- a/sql/log_event.cc +++ b/sql/log_event.cc @@ -2177,7 +2177,7 @@ int User_var_log_event::exec_event(struct st_relay_log_info* rli) } Item_func_set_user_var e(user_var_name, it); e.fix_fields(thd, 0, 0); - e.update_hash(val, val_len, type, charset); + e.update_hash(val, val_len, type, charset, Item::COER_NOCOLL); free_root(&thd->mem_root,0); rli->inc_pending(get_event_len()); diff --git a/sql/sql_class.h b/sql/sql_class.h index f943a611d08..1a613f987f6 100644 --- a/sql/sql_class.h +++ b/sql/sql_class.h @@ -935,6 +935,7 @@ class user_var_entry ulong length, update_query_id, used_query_id; Item_result type; CHARSET_INFO *var_charset; + enum Item::coercion var_coercibility; }; /* Class for unique (removing of duplicates) */ |