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
a74247bd
Commit
a74247bd
authored
Jun 15, 2005
by
tulin@dl145c.mysql.com
Browse files
Options
Browse Files
Download
Plain Diff
Merge tulin@bk-internal.mysql.com:/home/bk/mysql-5.0
into dl145c.mysql.com:/home/ndbdev/tomas/mysql-5.1
parents
f07c0e80
303dafc5
Changes
8
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
104 additions
and
21 deletions
+104
-21
mysql-test/r/query_cache.result
mysql-test/r/query_cache.result
+29
-0
mysql-test/t/query_cache.test
mysql-test/t/query_cache.test
+32
-0
sql/item.h
sql/item.h
+3
-6
sql/sp_head.h
sql/sp_head.h
+4
-0
sql/sp_rcontext.cc
sql/sp_rcontext.cc
+11
-0
sql/sp_rcontext.h
sql/sp_rcontext.h
+1
-5
sql/sql_select.cc
sql/sql_select.cc
+1
-1
tests/mysql_client_test.c
tests/mysql_client_test.c
+23
-9
No files found.
mysql-test/r/query_cache.result
View file @
a74247bd
This diff is collapsed.
Click to expand it.
mysql-test/t/query_cache.test
View file @
a74247bd
...
@@ -756,4 +756,36 @@ flush query cache;
...
@@ -756,4 +756,36 @@ flush query cache;
drop
table
t1
,
t2
;
drop
table
t1
,
t2
;
#
# SP cursors and selects with query cache (BUG#9715)
#
create
table
t1
(
a
int
);
insert
into
t1
values
(
1
),(
2
);
delimiter
//;
CREATE
PROCEDURE
`p1`
()
begin
Declare
c1
cursor
for
select
a
from
t1
;
open
c1
;
select
*
from
t1
;
end
//
call
p1
()
//
drop
procedure
p1
;
create
function
f1
()
returns
int
begin
Declare
var1
int
;
select
max
(
a
)
from
t1
into
var1
;
return
var1
;
end
//
create
procedure
`p1`
()
begin
select
a
,
f1
()
from
t1
;
end
//
call
p1
()
//
drop
procedure
p1
//
drop
table
t1
//
delimiter
;
//
set
GLOBAL
query_cache_size
=
0
;
set
GLOBAL
query_cache_size
=
0
;
sql/item.h
View file @
a74247bd
...
@@ -1352,12 +1352,9 @@ public:
...
@@ -1352,12 +1352,9 @@ public:
{
{
(
*
ref
)
->
save_in_field
(
result_field
,
no_conversions
);
(
*
ref
)
->
save_in_field
(
result_field
,
no_conversions
);
}
}
Item
*
real_item
()
{
Item
*
real_item
()
Item
*
item
=
this
;
{
do
return
(
*
ref
)
->
real_item
();
item
=
*
((
Item_ref
*
)
item
)
->
ref
;
while
(
item
->
type
()
==
Item
::
REF_ITEM
);
return
item
;
}
}
bool
walk
(
Item_processor
processor
,
byte
*
arg
)
bool
walk
(
Item_processor
processor
,
byte
*
arg
)
{
return
(
*
ref
)
->
walk
(
processor
,
arg
);
}
{
return
(
*
ref
)
->
walk
(
processor
,
arg
);
}
...
...
sql/sp_head.h
View file @
a74247bd
...
@@ -377,6 +377,10 @@ public:
...
@@ -377,6 +377,10 @@ public:
return
(
uint
)
m_lex
->
sql_command
;
return
(
uint
)
m_lex
->
sql_command
;
}
}
void
disable_query_cache
()
{
m_lex
->
safe_to_cache_query
=
0
;
}
private:
private:
LEX
*
m_lex
;
LEX
*
m_lex
;
...
...
sql/sp_rcontext.cc
View file @
a74247bd
...
@@ -169,6 +169,17 @@ sp_rcontext::pop_cursors(uint count)
...
@@ -169,6 +169,17 @@ sp_rcontext::pop_cursors(uint count)
*
*
*/
*/
sp_cursor
::
sp_cursor
(
sp_lex_keeper
*
lex_keeper
)
:
m_lex_keeper
(
lex_keeper
),
m_prot
(
NULL
),
m_isopen
(
0
),
m_current_row
(
NULL
)
{
/*
currsor can't be stored in QC, so we should prevent opening QC for
try to write results which are absent.
*/
lex_keeper
->
disable_query_cache
();
}
/*
/*
pre_open cursor
pre_open cursor
...
...
sql/sp_rcontext.h
View file @
a74247bd
...
@@ -203,11 +203,7 @@ class sp_cursor : public Sql_alloc
...
@@ -203,11 +203,7 @@ class sp_cursor : public Sql_alloc
{
{
public:
public:
sp_cursor
(
sp_lex_keeper
*
lex_keeper
)
sp_cursor
(
sp_lex_keeper
*
lex_keeper
);
:
m_lex_keeper
(
lex_keeper
),
m_prot
(
NULL
),
m_isopen
(
0
),
m_current_row
(
NULL
)
{
/* Empty */
}
virtual
~
sp_cursor
()
virtual
~
sp_cursor
()
{
{
...
...
sql/sql_select.cc
View file @
a74247bd
...
@@ -7954,7 +7954,7 @@ Field *create_tmp_field(THD *thd, TABLE *table,Item *item, Item::Type type,
...
@@ -7954,7 +7954,7 @@ Field *create_tmp_field(THD *thd, TABLE *table,Item *item, Item::Type type,
convert_blob_length
);
convert_blob_length
);
}
}
case
Item
:
:
REF_ITEM
:
case
Item
:
:
REF_ITEM
:
if
(
((
Item_ref
*
)
item
)
->
real_item
()
->
type
()
==
Item
::
FIELD_ITEM
)
if
(
item
->
real_item
()
->
type
()
==
Item
::
FIELD_ITEM
)
{
{
Item_field
*
field
=
(
Item_field
*
)
*
((
Item_ref
*
)
item
)
->
ref
;
Item_field
*
field
=
(
Item_field
*
)
*
((
Item_ref
*
)
item
)
->
ref
;
Field
*
new_field
=
create_tmp_field_from_field
(
thd
,
Field
*
new_field
=
create_tmp_field_from_field
(
thd
,
...
...
tests/mysql_client_test.c
View file @
a74247bd
...
@@ -13156,14 +13156,24 @@ static void test_bug11111()
...
@@ -13156,14 +13156,24 @@ static void test_bug11111()
char
buf
[
2
][
20
];
char
buf
[
2
][
20
];
long
len
[
2
];
long
len
[
2
];
int
i
;
int
i
;
int
rc
;
const
char
*
query
=
"SELECT DISTINCT f1,ff2 FROM v1"
;
const
char
*
query
=
"SELECT DISTINCT f1,ff2 FROM v1"
;
myheader
(
"test_bug11111"
);
mysql_query
(
mysql
,
"drop table if exists t1, t2, v1"
);
rc
=
mysql_query
(
mysql
,
"drop table if exists t1, t2, v1"
);
mysql_query
(
mysql
,
"create table t1 (f1 int, f2 int)"
);
myquery
(
rc
);
mysql_query
(
mysql
,
"create table t2 (ff1 int, ff2 int)"
);
rc
=
mysql_query
(
mysql
,
"drop view if exists t1, t2, v1"
);
mysql_query
(
mysql
,
"create view v1 as select * from t1, t2 where f1=ff1"
);
myquery
(
rc
);
mysql_query
(
mysql
,
"insert into t1 values (1,1), (2,2), (3,3)"
);
rc
=
mysql_query
(
mysql
,
"create table t1 (f1 int, f2 int)"
);
mysql_query
(
mysql
,
"insert into t2 values (1,1), (2,2), (3,3)"
);
myquery
(
rc
);
rc
=
mysql_query
(
mysql
,
"create table t2 (ff1 int, ff2 int)"
);
myquery
(
rc
);
rc
=
mysql_query
(
mysql
,
"create view v1 as select * from t1, t2 where f1=ff1"
);
myquery
(
rc
);
rc
=
mysql_query
(
mysql
,
"insert into t1 values (1,1), (2,2), (3,3)"
);
myquery
(
rc
);
rc
=
mysql_query
(
mysql
,
"insert into t2 values (1,1), (2,2), (3,3)"
);
myquery
(
rc
);
stmt
=
mysql_stmt_init
(
mysql
);
stmt
=
mysql_stmt_init
(
mysql
);
...
@@ -13176,15 +13186,19 @@ static void test_bug11111()
...
@@ -13176,15 +13186,19 @@ static void test_bug11111()
bind
[
i
].
buffer
=
(
gptr
*
)
&
buf
[
i
];
bind
[
i
].
buffer
=
(
gptr
*
)
&
buf
[
i
];
bind
[
i
].
buffer_length
=
20
;
bind
[
i
].
buffer_length
=
20
;
bind
[
i
].
length
=
&
len
[
i
];
bind
[
i
].
length
=
&
len
[
i
];
}
}
if
(
mysql_stmt_bind_result
(
stmt
,
bind
))
if
(
mysql_stmt_bind_result
(
stmt
,
bind
))
printf
(
"Error: %s
\n
"
,
mysql_stmt_error
(
stmt
));
printf
(
"Error: %s
\n
"
,
mysql_stmt_error
(
stmt
));
mysql_stmt_fetch
(
stmt
);
mysql_stmt_fetch
(
stmt
);
DIE_UNLESS
(
!
strcmp
(
buf
[
1
],
"1"
));
printf
(
"return: %s"
,
buf
[
1
]);
DIE_UNLESS
(
!
strcmp
(
buf
[
1
],
"1"
));
mysql_stmt_close
(
stmt
);
mysql_stmt_close
(
stmt
);
mysql_query
(
mysql
,
"drop table t1, t2, v1"
);
rc
=
mysql_query
(
mysql
,
"drop view v1"
);
myquery
(
rc
);
rc
=
mysql_query
(
mysql
,
"drop table t1, t2"
);
myquery
(
rc
);
}
}
/*
/*
...
...
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