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
796b6254
Commit
796b6254
authored
Sep 10, 2004
by
bell@sanja.is.com.ua
Browse files
Options
Browse Files
Download
Plain Diff
Merge sanja.is.com.ua:/home/bell/mysql/bk/mysql-4.1
into sanja.is.com.ua:/home/bell/mysql/bk/work-4.1
parents
74336d59
24e1464d
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
100 additions
and
5 deletions
+100
-5
mysql-test/r/query_cache.result
mysql-test/r/query_cache.result
+56
-0
mysql-test/t/query_cache.test
mysql-test/t/query_cache.test
+34
-0
sql/mysql_priv.h
sql/mysql_priv.h
+3
-0
sql/sql_cache.cc
sql/sql_cache.cc
+7
-1
sql/sql_cache.h
sql/sql_cache.h
+0
-4
No files found.
mysql-test/r/query_cache.result
View file @
796b6254
...
...
@@ -851,4 +851,60 @@ select @@character_set_results;
@@character_set_results
NULL
set character_set_results=default;
set GLOBAL query_cache_size=1355776;
create table t1 (id int auto_increment primary key, c char(25));
insert into t1 set c = repeat('x',24);
insert into t1 set c = concat(repeat('x',24),'x');
insert into t1 set c = concat(repeat('x',24),'w');
insert into t1 set c = concat(repeat('x',24),'y');
set max_sort_length=200;
select c from t1 order by c, id;
c
xxxxxxxxxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxxxxxxw
xxxxxxxxxxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxxxxxxy
reset query cache;
set max_sort_length=20;
select c from t1 order by c, id;
c
xxxxxxxxxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxxxxxxw
xxxxxxxxxxxxxxxxxxxxxxxxy
set max_sort_length=200;
select c from t1 order by c, id;
c
xxxxxxxxxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxxxxxxw
xxxxxxxxxxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxxxxxxy
set max_sort_length=default;
select '1' || '3' from t1;
'1' || '3'
1
1
1
1
set SQL_MODE=oracle;
select '1' || '3' from t1;
'1' || '3'
13
13
13
13
set SQL_MODE=default;
drop table t1;
create table t1 (a varchar(20), b int);
insert into t1 values ('12345678901234567890', 1);
set group_concat_max_len=10;
select group_concat(a) FROM t1 group by b;
group_concat(a)
1234567890
set group_concat_max_len=1024;
select group_concat(a) FROM t1 group by b;
group_concat(a)
12345678901234567890
set group_concat_max_len=default;
drop table t1;
SET GLOBAL query_cache_size=0;
mysql-test/t/query_cache.test
View file @
796b6254
...
...
@@ -627,4 +627,38 @@ set character_set_results=null;
select
@@
character_set_results
;
set
character_set_results
=
default
;
#
# query cache and environment variables
#
# max_sort_length
set
GLOBAL
query_cache_size
=
1355776
;
create
table
t1
(
id
int
auto_increment
primary
key
,
c
char
(
25
));
insert
into
t1
set
c
=
repeat
(
'x'
,
24
);
insert
into
t1
set
c
=
concat
(
repeat
(
'x'
,
24
),
'x'
);
insert
into
t1
set
c
=
concat
(
repeat
(
'x'
,
24
),
'w'
);
insert
into
t1
set
c
=
concat
(
repeat
(
'x'
,
24
),
'y'
);
set
max_sort_length
=
200
;
select
c
from
t1
order
by
c
,
id
;
reset
query
cache
;
set
max_sort_length
=
20
;
select
c
from
t1
order
by
c
,
id
;
set
max_sort_length
=
200
;
select
c
from
t1
order
by
c
,
id
;
set
max_sort_length
=
default
;
# sql_mode
select
'1'
||
'3'
from
t1
;
set
SQL_MODE
=
oracle
;
select
'1'
||
'3'
from
t1
;
set
SQL_MODE
=
default
;
drop
table
t1
;
# group_concat_max_len
create
table
t1
(
a
varchar
(
20
),
b
int
);
insert
into
t1
values
(
'12345678901234567890'
,
1
);
set
group_concat_max_len
=
10
;
select
group_concat
(
a
)
FROM
t1
group
by
b
;
set
group_concat_max_len
=
1024
;
select
group_concat
(
a
)
FROM
t1
group
by
b
;
set
group_concat_max_len
=
default
;
drop
table
t1
;
SET
GLOBAL
query_cache_size
=
0
;
sql/mysql_priv.h
View file @
796b6254
...
...
@@ -390,6 +390,9 @@ struct Query_cache_query_flags
uint
collation_connection_num
;
ha_rows
limit
;
Time_zone
*
time_zone
;
ulong
sql_mode
;
ulong
max_sort_length
;
ulong
group_concat_max_len
;
};
#define QUERY_CACHE_FLAGS_SIZE sizeof(Query_cache_query_flags)
#include "sql_cache.h"
...
...
sql/sql_cache.cc
View file @
796b6254
...
...
@@ -787,6 +787,9 @@ void Query_cache::store_query(THD *thd, TABLE_LIST *tables_used)
thd
->
variables
.
collation_connection
->
number
;
flags
.
limit
=
thd
->
variables
.
select_limit
;
flags
.
time_zone
=
thd
->
variables
.
time_zone
;
flags
.
sql_mode
=
thd
->
variables
.
sql_mode
;
flags
.
max_sort_length
=
thd
->
variables
.
max_sort_length
;
flags
.
group_concat_max_len
=
thd
->
variables
.
group_concat_max_len
;
STRUCT_LOCK
(
&
structure_guard_mutex
);
if
(
query_cache_size
==
0
)
...
...
@@ -974,8 +977,11 @@ Query_cache::send_result_to_client(THD *thd, char *sql, uint query_length)
flags
.
collation_connection_num
=
thd
->
variables
.
collation_connection
->
number
;
flags
.
limit
=
thd
->
variables
.
select_limit
;
flags
.
time_zone
=
thd
->
variables
.
time_zone
;
flags
.
sql_mode
=
thd
->
variables
.
sql_mode
;
flags
.
max_sort_length
=
thd
->
variables
.
max_sort_length
;
flags
.
group_concat_max_len
=
thd
->
variables
.
group_concat_max_len
;
memcpy
((
void
*
)(
sql
+
(
tot_length
-
QUERY_CACHE_FLAGS_SIZE
)),
&
flags
,
QUERY_CACHE_FLAGS_SIZE
);
&
flags
,
QUERY_CACHE_FLAGS_SIZE
);
query_block
=
(
Query_cache_block
*
)
hash_search
(
&
queries
,
(
byte
*
)
sql
,
tot_length
);
/* Quick abort on unlocked data */
...
...
sql/sql_cache.h
View file @
796b6254
...
...
@@ -53,10 +53,6 @@
of list of free blocks */
#define QUERY_CACHE_MEM_BIN_TRY 5
/* query flags masks */
#define QUERY_CACHE_CLIENT_LONG_FLAG_MASK 0x80
#define QUERY_CACHE_CHARSET_CONVERT_MASK 0x7F
/* packing parameters */
#define QUERY_CACHE_PACK_ITERATION 2
#define QUERY_CACHE_PACK_LIMIT (512*1024L)
...
...
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