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
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
MariaDB
Commits
12d1bf12
Commit
12d1bf12
authored
Dec 01, 2005
by
bell@sanja.is.com.ua
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
We should skip beggining '(' characters when test query on possibility
to be in the query cache. (BUG#14652)
parent
1a8ac44c
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
59 additions
and
9 deletions
+59
-9
mysql-test/r/query_cache.result
mysql-test/r/query_cache.result
+25
-0
mysql-test/t/query_cache.test
mysql-test/t/query_cache.test
+15
-0
sql/sql_cache.cc
sql/sql_cache.cc
+19
-9
No files found.
mysql-test/r/query_cache.result
View file @
12d1bf12
...
@@ -982,4 +982,29 @@ show status like "Qcache_hits";
...
@@ -982,4 +982,29 @@ show status like "Qcache_hits";
Variable_name Value
Variable_name Value
Qcache_hits 1
Qcache_hits 1
drop table t1;
drop table t1;
create table t1 (a int);
flush status;
(select a from t1) union (select a from t1);
a
show status like "Qcache_queries_in_cache";
Variable_name Value
Qcache_queries_in_cache 1
show status like "Qcache_inserts";
Variable_name Value
Qcache_inserts 1
show status like "Qcache_hits";
Variable_name Value
Qcache_hits 0
(select a from t1) union (select a from t1);
a
show status like "Qcache_queries_in_cache";
Variable_name Value
Qcache_queries_in_cache 1
show status like "Qcache_inserts";
Variable_name Value
Qcache_inserts 1
show status like "Qcache_hits";
Variable_name Value
Qcache_hits 1
drop table t1;
set GLOBAL query_cache_size=0;
set GLOBAL query_cache_size=0;
mysql-test/t/query_cache.test
View file @
12d1bf12
...
@@ -712,6 +712,21 @@ show status like "Qcache_inserts";
...
@@ -712,6 +712,21 @@ show status like "Qcache_inserts";
show
status
like
"Qcache_hits"
;
show
status
like
"Qcache_hits"
;
drop
table
t1
;
drop
table
t1
;
#
# BUG#14652: Queries with leading '(' characters.
#
create
table
t1
(
a
int
);
flush
status
;
(
select
a
from
t1
)
union
(
select
a
from
t1
);
show
status
like
"Qcache_queries_in_cache"
;
show
status
like
"Qcache_inserts"
;
show
status
like
"Qcache_hits"
;
(
select
a
from
t1
)
union
(
select
a
from
t1
);
show
status
like
"Qcache_queries_in_cache"
;
show
status
like
"Qcache_inserts"
;
show
status
like
"Qcache_hits"
;
drop
table
t1
;
set
GLOBAL
query_cache_size
=
0
;
set
GLOBAL
query_cache_size
=
0
;
# End of 4.1 tests
# End of 4.1 tests
sql/sql_cache.cc
View file @
12d1bf12
...
@@ -956,16 +956,26 @@ Query_cache::send_result_to_client(THD *thd, char *sql, uint query_length)
...
@@ -956,16 +956,26 @@ Query_cache::send_result_to_client(THD *thd, char *sql, uint query_length)
goto
err
;
goto
err
;
}
}
/*
Test if the query is a SELECT
(pre-space is removed in dispatch_command)
*/
if
(
my_toupper
(
system_charset_info
,
sql
[
0
])
!=
'S'
||
my_toupper
(
system_charset_info
,
sql
[
1
])
!=
'E'
||
my_toupper
(
system_charset_info
,
sql
[
2
])
!=
'L'
)
{
{
DBUG_PRINT
(
"qcache"
,
(
"The statement is not a SELECT; Not cached"
));
uint
i
=
0
;
goto
err
;
/*
Skip '(' characters in queries like following:
(select a from t1) union (select a from t1);
*/
while
(
sql
[
i
]
==
'('
)
i
++
;
/*
Test if the query is a SELECT
(pre-space is removed in dispatch_command)
*/
if
(
my_toupper
(
system_charset_info
,
sql
[
i
])
!=
'S'
||
my_toupper
(
system_charset_info
,
sql
[
i
+
1
])
!=
'E'
||
my_toupper
(
system_charset_info
,
sql
[
i
+
2
])
!=
'L'
)
{
DBUG_PRINT
(
"qcache"
,
(
"The statement is not a SELECT; Not cached"
));
goto
err
;
}
}
}
STRUCT_LOCK
(
&
structure_guard_mutex
);
STRUCT_LOCK
(
&
structure_guard_mutex
);
...
...
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