1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-30 16:24:05 +03:00

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

correcting it now. Thanks Dmitri for spotting this.
This commit is contained in:
guilhem@gbichot2
2003-10-02 16:19:33 +02:00
parent 2f11e5d1d3
commit d099c0ed40
3 changed files with 17 additions and 12 deletions

View File

@ -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));

View File

@ -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));

View File

@ -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 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 if (!(opt_bin_log && is_update_query(thd->lex.sql_command)))
influenced by a variable of the same name previously set by another return;
thread).
*/ if (!var_entry)
if (!(var_entry= get_variable(&thd->user_vars, name, 0)))
{ {
/* /*
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
influenced by a variable of the same name previously set by another
thread).
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'