Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
mariadb
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
mariadb
Commits
d099c0ed
Commit
d099c0ed
authored
Oct 02, 2003
by
guilhem@gbichot2
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
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
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
17 additions
and
12 deletions
+17
-12
mysql-test/r/user_var.result
mysql-test/r/user_var.result
+4
-0
mysql-test/t/user_var.test
mysql-test/t/user_var.test
+3
-0
sql/item_func.cc
sql/item_func.cc
+10
-12
No files found.
mysql-test/r/user_var.result
View file @
d099c0ed
...
@@ -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));
...
...
mysql-test/t/user_var.test
View file @
d099c0ed
...
@@ -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
));
...
...
sql/item_func.cc
View file @
d099c0ed
...
@@ -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'
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment