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
11f70bdf
Commit
11f70bdf
authored
Nov 18, 2003
by
serg@serg.mylan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Bug#1826, HANDLER+ALTER TABLE=crash (unfortunately, it cannot be tested in mysql-test suite)
more user variable tests
parent
60d60a29
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
43 additions
and
0 deletions
+43
-0
mysql-test/r/user_var.result
mysql-test/r/user_var.result
+19
-0
mysql-test/t/user_var.test
mysql-test/t/user_var.test
+11
-0
sql/sql_handler.cc
sql/sql_handler.cc
+13
-0
No files found.
mysql-test/r/user_var.result
View file @
11f70bdf
...
@@ -97,3 +97,22 @@ drop table t1;
...
@@ -97,3 +97,22 @@ drop table t1;
select @a:=10, @b:=2, @a>@b, @a:="10", @b:="2", @a>@b, @a:=10, @b:=2, @a>@b, @a:="10", @b:="2", @a>@b;
select @a:=10, @b:=2, @a>@b, @a:="10", @b:="2", @a>@b, @a:=10, @b:=2, @a>@b, @a:="10", @b:="2", @a>@b;
@a:=10 @b:=2 @a>@b @a:="10" @b:="2" @a>@b @a:=10 @b:=2 @a>@b @a:="10" @b:="2" @a>@b
@a:=10 @b:=2 @a>@b @a:="10" @b:="2" @a>@b @a:=10 @b:=2 @a>@b @a:="10" @b:="2" @a>@b
10 2 1 10 2 1 10 2 1 10 2 1
10 2 1 10 2 1 10 2 1 10 2 1
create table t1 (i int not null);
insert t1 values (1),(2),(2),(3),(3),(3);
select @a:=0;
@a:=0
0
select @a, @a:=@a+count(*), count(*), @a from t1 group by i;
@a @a:=@a+count(*) count(*) @a
0 1 1 0
0 2 2 0
0 3 3 0
select @a:=0;
@a:=0
0
select @a+0, @a:=@a+0+count(*), count(*), @a+0 from t1 group by i;
@a+0 @a:=@a+0+count(*) count(*) @a+0
0 1 1 0
1 3 2 0
3 6 3 0
drop table t1;
mysql-test/t/user_var.test
View file @
11f70bdf
...
@@ -53,3 +53,14 @@ drop table t1;
...
@@ -53,3 +53,14 @@ drop table t1;
# just for fun :)
# just for fun :)
select
@
a
:=
10
,
@
b
:=
2
,
@
a
>@
b
,
@
a
:=
"10"
,
@
b
:=
"2"
,
@
a
>@
b
,
@
a
:=
10
,
@
b
:=
2
,
@
a
>@
b
,
@
a
:=
"10"
,
@
b
:=
"2"
,
@
a
>@
b
;
select
@
a
:=
10
,
@
b
:=
2
,
@
a
>@
b
,
@
a
:=
"10"
,
@
b
:=
"2"
,
@
a
>@
b
,
@
a
:=
10
,
@
b
:=
2
,
@
a
>@
b
,
@
a
:=
"10"
,
@
b
:=
"2"
,
@
a
>@
b
;
#
# bug#1739
# Item_func_set_user_var sets update_query_id, Item_func_get_user_var checks it
#
create
table
t1
(
i
int
not
null
);
insert
t1
values
(
1
),(
2
),(
2
),(
3
),(
3
),(
3
);
select
@
a
:=
0
;
select
@
a
,
@
a
:=@
a
+
count
(
*
),
count
(
*
),
@
a
from
t1
group
by
i
;
select
@
a
:=
0
;
select
@
a
+
0
,
@
a
:=@
a
+
0
+
count
(
*
),
count
(
*
),
@
a
+
0
from
t1
group
by
i
;
drop
table
t1
;
sql/sql_handler.cc
View file @
11f70bdf
...
@@ -285,7 +285,20 @@ static TABLE **find_table_ptr_by_name(THD *thd, const char *db,
...
@@ -285,7 +285,20 @@ static TABLE **find_table_ptr_by_name(THD *thd, const char *db,
{
{
if
(
!
memcmp
(
table
->
table_cache_key
,
db
,
dblen
)
&&
if
(
!
memcmp
(
table
->
table_cache_key
,
db
,
dblen
)
&&
!
my_strcasecmp
((
is_alias
?
table
->
table_name
:
table
->
real_name
),
table_name
))
!
my_strcasecmp
((
is_alias
?
table
->
table_name
:
table
->
real_name
),
table_name
))
{
if
(
table
->
version
!=
refresh_version
)
{
VOID
(
pthread_mutex_lock
(
&
LOCK_open
));
if
(
close_thread_table
(
thd
,
ptr
))
{
/* Tell threads waiting for refresh that something has happened */
VOID
(
pthread_cond_broadcast
(
&
COND_refresh
));
}
VOID
(
pthread_mutex_unlock
(
&
LOCK_open
));
continue
;
}
break
;
break
;
}
ptr
=&
(
table
->
next
);
ptr
=&
(
table
->
next
);
}
}
return
ptr
;
return
ptr
;
...
...
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