summaryrefslogtreecommitdiff
path: root/sql/item_func.cc
diff options
context:
space:
mode:
authorunknown <guilhem@gbichot2>2003-10-02 16:19:33 +0200
committerunknown <guilhem@gbichot2>2003-10-02 16:19:33 +0200
commit311cd84db83f3fad56ecbd0fdbe8e20fb708d55d (patch)
treed4eb0769faf0734bc11f814ee7337885a6e5c7d6 /sql/item_func.cc
parent031b6b5fbbde116e6a37b0658a9f090d2e7265ae (diff)
downloadmariadb-git-311cd84db83f3fad56ecbd0fdbe8e20fb708d55d.tar.gz
Had mangled the order of if()s in a previous changeset (1.1596) (not pushed),
correcting it now. Thanks Dmitri for spotting this. mysql-test/r/user_var.result: result update mysql-test/t/user_var.test: a simple test sql/item_func.cc: Had mangled the order of if()s in a previous changeset (1.1596) (not pushed), correcting it now.
Diffstat (limited to 'sql/item_func.cc')
-rw-r--r--sql/item_func.cc22
1 files changed, 10 insertions, 12 deletions
diff --git a/sql/item_func.cc b/sql/item_func.cc
index 8073ee60572..0f9ee512be1 100644
--- a/sql/item_func.cc
+++ b/sql/item_func.cc
@@ -2343,25 +2343,23 @@ longlong Item_func_get_user_var::val_int()
void Item_func_get_user_var::fix_length_and_dec()
{
THD *thd=current_thd;
-
- if (!(opt_bin_log && is_update_query(thd->lex.sql_command)))
- return;
-
BINLOG_USER_VAR_EVENT *user_var_event;
maybe_null=1;
decimals=NOT_FIXED_DEC;
max_length=MAX_BLOB_WIDTH;
- /*
- 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).
- */
-
- if (!(var_entry= get_variable(&thd->user_vars, name, 0)))
+ 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
+ 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.
The 'new' mimicks what sql_yacc.yy does when 'SET @a=10;'.
sql_set_variables() is what is called from 'case SQLCOM_SET_OPTION'