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
b196fa2c
Commit
b196fa2c
authored
Feb 07, 2005
by
bell@sanja.is.com.ua
Browse files
Options
Browse Files
Download
Plain Diff
merge
parents
0a8595df
34b85449
Changes
8
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
265 additions
and
79 deletions
+265
-79
mysql-test/r/sp.result
mysql-test/r/sp.result
+13
-0
mysql-test/r/view_query_cache.result
mysql-test/r/view_query_cache.result
+25
-0
mysql-test/t/sp.test
mysql-test/t/sp.test
+21
-0
mysql-test/t/view_query_cache.test
mysql-test/t/view_query_cache.test
+30
-1
sql/sp_head.cc
sql/sp_head.cc
+1
-0
sql/sql_cache.cc
sql/sql_cache.cc
+168
-78
sql/sql_cache.h
sql/sql_cache.h
+4
-0
sql/sql_view.cc
sql/sql_view.cc
+3
-0
No files found.
mysql-test/r/sp.result
View file @
b196fa2c
...
...
@@ -2321,3 +2321,16 @@ select `foo` ();
`foo` ()
5
drop function `foo`;
drop procedure if exists p1;
create table t1(id int);
insert into t1 values(1);
create procedure p1()
begin
declare i int;
select max(id)+1 into i from t1;
end
//
call p1()//
call p1()//
drop procedure p1;
drop table t1;
mysql-test/r/view_query_cache.result
View file @
b196fa2c
drop table if exists t1,t2,v1,v2,v3;
drop view if exists t1,t2,v1,v2,v3;
set GLOBAL query_cache_size=1355776;
flush status;
create table t1 (a int, b int);
...
...
@@ -98,4 +100,27 @@ Qcache_hits 1
drop view v1;
set query_cache_type=default;
drop table t1;
create table t1 (a int);
insert into t1 values (1), (2), (3);
create view v1 as select a from t1 where a > 1;
select * from v1;
a
2
3
alter view v1 as select a from t1 where a > 2;
select * from v1;
a
3
drop view v1;
select * from v1;
ERROR 42S02: Table 'test.v1' doesn't exist
drop table t1;
create table t1 (a int, primary key (a), b int);
create table t2 (a int, primary key (a), b int);
insert into t2 values (1000, 2000);
create view v3 (a,b) as select t1.a as a, t2.a as b from t1, t2;
select * from v3;
a b
drop view v3;
drop table t1, t2;
set GLOBAL query_cache_size=default;
mysql-test/t/sp.test
View file @
b196fa2c
...
...
@@ -2739,3 +2739,24 @@ drop function if exists foo;
create
function
`
foo
` () returns int return 5;
select `
foo
` ();
drop function `
foo
`
;
#
# rolling back temporary Item tree changes in SP
#
--
disable_warnings
drop
procedure
if
exists
p1
;
--
enable_warnings
create
table
t1
(
id
int
);
insert
into
t1
values
(
1
);
delimiter
//;
create
procedure
p1
()
begin
declare
i
int
;
select
max
(
id
)
+
1
into
i
from
t1
;
end
//
call
p1
()
//
call
p1
()
//
delimiter
;
//
drop
procedure
p1
;
drop
table
t1
;
mysql-test/t/view_query_cache.test
View file @
b196fa2c
...
...
@@ -2,6 +2,11 @@
#
# QUERY CACHE options for VIEWs
#
--
disable_warnings
drop
table
if
exists
t1
,
t2
,
v1
,
v2
,
v3
;
drop
view
if
exists
t1
,
t2
,
v1
,
v2
,
v3
;
--
enable_warnings
set
GLOBAL
query_cache_size
=
1355776
;
flush
status
;
create
table
t1
(
a
int
,
b
int
);
...
...
@@ -53,6 +58,30 @@ drop view v1;
set
query_cache_type
=
default
;
drop
table
t1
;
set
GLOBAL
query_cache_size
=
default
;
#
# invalidation of view
#
create
table
t1
(
a
int
);
insert
into
t1
values
(
1
),
(
2
),
(
3
);
create
view
v1
as
select
a
from
t1
where
a
>
1
;
select
*
from
v1
;
alter
view
v1
as
select
a
from
t1
where
a
>
2
;
select
*
from
v1
;
drop
view
v1
;
--
error
1146
select
*
from
v1
;
drop
table
t1
;
#
# join view with QC
#
create
table
t1
(
a
int
,
primary
key
(
a
),
b
int
);
create
table
t2
(
a
int
,
primary
key
(
a
),
b
int
);
insert
into
t2
values
(
1000
,
2000
);
create
view
v3
(
a
,
b
)
as
select
t1
.
a
as
a
,
t2
.
a
as
b
from
t1
,
t2
;
select
*
from
v3
;
drop
view
v3
;
drop
table
t1
,
t2
;
set
GLOBAL
query_cache_size
=
default
;
sql/sp_head.cc
View file @
b196fa2c
...
...
@@ -482,6 +482,7 @@ sp_head::execute(THD *thd)
break
;
DBUG_PRINT
(
"execute"
,
(
"Instruction %u"
,
ip
));
ret
=
i
->
execute
(
thd
,
&
ip
);
thd
->
rollback_item_tree_changes
();
if
(
i
->
free_list
)
cleanup_items
(
i
->
free_list
);
// Check if an exception has occurred and a handler has been found
...
...
sql/sql_cache.cc
View file @
b196fa2c
This diff is collapsed.
Click to expand it.
sql/sql_cache.h
View file @
b196fa2c
...
...
@@ -285,6 +285,10 @@ protected:
void
invalidate_table
(
TABLE
*
table
);
void
invalidate_table
(
byte
*
key
,
uint32
key_length
);
void
invalidate_table
(
Query_cache_block
*
table_block
);
TABLE_COUNTER_TYPE
register_tables_from_list
(
TABLE_LIST
*
tables_used
,
TABLE_COUNTER_TYPE
counter
,
Query_cache_block_table
*
block_table
);
my_bool
register_all_tables
(
Query_cache_block
*
block
,
TABLE_LIST
*
tables_used
,
TABLE_COUNTER_TYPE
tables
);
...
...
sql/sql_view.cc
View file @
b196fa2c
...
...
@@ -305,6 +305,8 @@ bool mysql_create_view(THD *thd,
VOID
(
pthread_mutex_lock
(
&
LOCK_open
));
res
=
mysql_register_view
(
thd
,
view
,
mode
);
VOID
(
pthread_mutex_unlock
(
&
LOCK_open
));
if
(
view
->
revision
!=
1
)
query_cache_invalidate3
(
thd
,
view
,
0
);
start_waiting_global_read_lock
(
thd
);
if
(
res
)
goto
err
;
...
...
@@ -912,6 +914,7 @@ bool mysql_drop_view(THD *thd, TABLE_LIST *views, enum_drop_mode drop_mode)
}
if
(
my_delete
(
path
,
MYF
(
MY_WME
)))
goto
err
;
query_cache_invalidate3
(
thd
,
view
,
0
);
VOID
(
pthread_mutex_unlock
(
&
LOCK_open
));
}
send_ok
(
thd
);
...
...
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