Commit d099c0ed authored by guilhem@gbichot2's avatar guilhem@gbichot2

Had mangled the order of if()s in a previous changeset (1.1596) (not pushed),

correcting it now. Thanks Dmitri for spotting this.
parent 2f11e5d1
...@@ -5,6 +5,10 @@ set @a := connection_id() + 3; ...@@ -5,6 +5,10 @@ set @a := connection_id() + 3;
select @a - connection_id(); select @a - connection_id();
@a - connection_id() @a - connection_id()
3 3
set @b := 1;
select @b;
@b
1
CREATE TABLE t1 ( i int not null, v int not null,index (i)); CREATE TABLE t1 ( i int not null, v int not null,index (i));
insert into t1 values (1,1),(1,3),(2,1); insert into t1 values (1,1),(1,3),(2,1);
create table t2 (i int not null, unique (i)); create table t2 (i int not null, unique (i));
......
...@@ -8,6 +8,9 @@ set @a := foo; ...@@ -8,6 +8,9 @@ set @a := foo;
set @a := connection_id() + 3; set @a := connection_id() + 3;
select @a - connection_id(); select @a - connection_id();
set @b := 1;
select @b;
# Check using and setting variables with SELECT DISTINCT # Check using and setting variables with SELECT DISTINCT
CREATE TABLE t1 ( i int not null, v int not null,index (i)); CREATE TABLE t1 ( i int not null, v int not null,index (i));
......
...@@ -2343,25 +2343,23 @@ longlong Item_func_get_user_var::val_int() ...@@ -2343,25 +2343,23 @@ longlong Item_func_get_user_var::val_int()
void Item_func_get_user_var::fix_length_and_dec() void Item_func_get_user_var::fix_length_and_dec()
{ {
THD *thd=current_thd; THD *thd=current_thd;
if (!(opt_bin_log && is_update_query(thd->lex.sql_command)))
return;
BINLOG_USER_VAR_EVENT *user_var_event; BINLOG_USER_VAR_EVENT *user_var_event;
maybe_null=1; maybe_null=1;
decimals=NOT_FIXED_DEC; decimals=NOT_FIXED_DEC;
max_length=MAX_BLOB_WIDTH; max_length=MAX_BLOB_WIDTH;
var_entry= get_variable(&thd->user_vars, name, 0);
if (!(opt_bin_log && is_update_query(thd->lex.sql_command)))
return;
if (!var_entry)
{
/* /*
If the variable does not exist, it's NULL, but we want to create it so If the variable does not exist, it's NULL, but we want to create it so
that it gets into the binlog (if it didn't, the slave could be that it gets into the binlog (if it didn't, the slave could be
influenced by a variable of the same name previously set by another influenced by a variable of the same name previously set by another
thread). thread).
*/
if (!(var_entry= get_variable(&thd->user_vars, name, 0)))
{
/*
We create it like if it had been explicitely set with SET before. We create it like if it had been explicitely set with SET before.
The 'new' mimicks what sql_yacc.yy does when 'SET @a=10;'. The 'new' mimicks what sql_yacc.yy does when 'SET @a=10;'.
sql_set_variables() is what is called from 'case SQLCOM_SET_OPTION' sql_set_variables() is what is called from 'case SQLCOM_SET_OPTION'
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment