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
e70f139d
Commit
e70f139d
authored
Nov 07, 2008
by
Kristofer Pettersson
Browse files
Options
Browse Files
Download
Plain Diff
automerge
parents
94ac4f70
a8dc3236
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
47 additions
and
0 deletions
+47
-0
sql/sql_cache.cc
sql/sql_cache.cc
+47
-0
No files found.
sql/sql_cache.cc
View file @
e70f139d
...
...
@@ -363,6 +363,43 @@ TYPELIB query_cache_type_typelib=
array_elements
(
query_cache_type_names
)
-
1
,
""
,
query_cache_type_names
,
NULL
};
/**
Helper function for determine if a SELECT statement has a SQL_NO_CACHE
directive.
@param sql A pointer to the first white space character after SELECT
@return
@retval TRUE The character string contains SQL_NO_CACHE
@retval FALSE No directive found.
*/
static
bool
has_no_cache_directive
(
char
*
sql
)
{
int
i
=
0
;
while
(
sql
[
i
]
==
' '
)
++
i
;
if
(
my_toupper
(
system_charset_info
,
sql
[
i
])
==
'S'
&&
my_toupper
(
system_charset_info
,
sql
[
i
+
1
])
==
'Q'
&&
my_toupper
(
system_charset_info
,
sql
[
i
+
2
])
==
'L'
&&
my_toupper
(
system_charset_info
,
sql
[
i
+
3
])
==
'_'
&&
my_toupper
(
system_charset_info
,
sql
[
i
+
4
])
==
'N'
&&
my_toupper
(
system_charset_info
,
sql
[
i
+
5
])
==
'O'
&&
my_toupper
(
system_charset_info
,
sql
[
i
+
6
])
==
'_'
&&
my_toupper
(
system_charset_info
,
sql
[
i
+
7
])
==
'C'
&&
my_toupper
(
system_charset_info
,
sql
[
i
+
8
])
==
'A'
&&
my_toupper
(
system_charset_info
,
sql
[
i
+
9
])
==
'C'
&&
my_toupper
(
system_charset_info
,
sql
[
i
+
10
])
==
'H'
&&
my_toupper
(
system_charset_info
,
sql
[
i
+
11
])
==
'E'
&&
my_toupper
(
system_charset_info
,
sql
[
i
+
12
])
==
' '
)
return
TRUE
;
return
FALSE
;
}
/*****************************************************************************
Query_cache_block_table method(s)
*****************************************************************************/
...
...
@@ -1085,6 +1122,16 @@ Query_cache::send_result_to_client(THD *thd, char *sql, uint query_length)
DBUG_PRINT
(
"qcache"
,
(
"The statement is not a SELECT; Not cached"
));
goto
err
;
}
if
(
query_length
>
20
&&
has_no_cache_directive
(
&
sql
[
i
+
6
]))
{
/*
We do not increase 'refused' statistics here since it will be done
later when the query is parsed.
*/
DBUG_PRINT
(
"qcache"
,
(
"The statement has a SQL_NO_CACHE directive"
));
goto
err
;
}
}
#ifdef __WIN__
...
...
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