78
78
extern "C" void free_user_var(user_var_entry *entry)
80
char *pos= (char*) entry+ALIGN_SIZE(sizeof(*entry));
81
if (entry->value && entry->value != pos)
86
83
bool Key_part_spec::operator==(const Key_part_spec& other) const
1897
1894
user_var_entry *entry= NULL;
1899
assert(name.length == strlen (name.str));
1900
1896
entry= (user_var_entry*) hash_search(&user_vars, (unsigned char*) name.str, name.length);
1902
1898
if ((entry == NULL) && create_if_not_exists)
1904
uint32_t size=ALIGN_SIZE(sizeof(user_var_entry))+name.length+1+extra_size;
1905
1900
if (!hash_inited(&user_vars))
1907
if (!(entry = (user_var_entry*) malloc(size)))
1909
entry->name.str=(char*) entry+ ALIGN_SIZE(sizeof(user_var_entry))+
1911
entry->name.length=name.length;
1914
entry->update_query_id=0;
1915
entry->collation.set(NULL, DERIVATION_IMPLICIT);
1916
entry->unsigned_flag= 0;
1918
If we are here, we were called from a SET or a query which sets a
1919
variable. Imagine it is this:
1920
INSERT INTO t SELECT @a:=10, @a:=@a+1.
1921
Then when we have a Item_func_get_user_var (because of the @a+1) so we
1922
think we have to write the value of @a to the binlog. But before that,
1923
we have a Item_func_set_user_var to create @a (@a:=10), in this we mark
1924
the variable as "already logged" (line below) so that it won't be logged
1925
by Item_func_get_user_var (because that's not necessary).
1927
entry->used_query_id= query_id;
1928
entry->type=STRING_RESULT;
1929
memcpy(entry->name.str, name.str, name.length+1);
1902
entry= new (nothrow) user_var_entry(name.str, query_id);
1930
1907
if (my_hash_insert(&user_vars, (unsigned char*) entry))