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
0db71aaf
Commit
0db71aaf
authored
Jul 07, 2006
by
konstantin@bodhi.netgear
Browse files
Options
Browse Files
Download
Plain Diff
Merge bk-internal.mysql.com:/home/bk/mysql-4.1
into bodhi.netgear:/opt/local/work/mysql-4.1-19399
parents
cf714573
8e735d2c
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
75 additions
and
7 deletions
+75
-7
mysql-test/r/ps.result
mysql-test/r/ps.result
+14
-0
mysql-test/t/ps.test
mysql-test/t/ps.test
+25
-0
sql/sql_lex.cc
sql/sql_lex.cc
+1
-0
sql/sql_prepare.cc
sql/sql_prepare.cc
+13
-7
sql/table.cc
sql/table.cc
+17
-0
sql/table.h
sql/table.h
+5
-0
No files found.
mysql-test/r/ps.result
View file @
0db71aaf
...
...
@@ -875,3 +875,17 @@ select @@max_prepared_stmt_count, @@prepared_stmt_count;
@@max_prepared_stmt_count @@prepared_stmt_count
3 0
set global max_prepared_stmt_count= @old_max_prepared_stmt_count;
drop table if exists t1;
create temporary table if not exists t1 (a1 int);
prepare stmt from "delete t1 from t1 where (cast(a1/3 as unsigned) * 3) = a1";
drop temporary table t1;
create temporary table if not exists t1 (a1 int);
execute stmt;
drop temporary table t1;
create temporary table if not exists t1 (a1 int);
execute stmt;
drop temporary table t1;
create temporary table if not exists t1 (a1 int);
execute stmt;
drop temporary table t1;
deallocate prepare stmt;
mysql-test/t/ps.test
View file @
0db71aaf
...
...
@@ -926,4 +926,29 @@ select @@max_prepared_stmt_count, @@prepared_stmt_count;
set
global
max_prepared_stmt_count
=
@
old_max_prepared_stmt_count
;
--
enable_ps_protocol
#
# Bug#19399 "Stored Procedures 'Lost Connection' when dropping/creating
# tables"
# Check that multi-delete tables are also cleaned up before re-execution.
#
--
disable_warnings
drop
table
if
exists
t1
;
create
temporary
table
if
not
exists
t1
(
a1
int
);
--
enable_warnings
# exact delete syntax is essential
prepare
stmt
from
"delete t1 from t1 where (cast(a1/3 as unsigned) * 3) = a1"
;
drop
temporary
table
t1
;
create
temporary
table
if
not
exists
t1
(
a1
int
);
# the server crashed on the next statement without the fix
execute
stmt
;
drop
temporary
table
t1
;
create
temporary
table
if
not
exists
t1
(
a1
int
);
# the problem was in memory corruption: repeat the test just in case
execute
stmt
;
drop
temporary
table
t1
;
create
temporary
table
if
not
exists
t1
(
a1
int
);
execute
stmt
;
drop
temporary
table
t1
;
deallocate
prepare
stmt
;
# End of 4.1 tests
sql/sql_lex.cc
View file @
0db71aaf
...
...
@@ -125,6 +125,7 @@ void lex_start(THD *thd, uchar *buf,uint length)
lex
->
value_list
.
empty
();
lex
->
update_list
.
empty
();
lex
->
param_list
.
empty
();
lex
->
auxilliary_table_list
.
empty
();
lex
->
unit
.
next
=
lex
->
unit
.
master
=
lex
->
unit
.
link_next
=
lex
->
unit
.
return_to
=
0
;
lex
->
unit
.
prev
=
lex
->
unit
.
link_prev
=
0
;
...
...
sql/sql_prepare.cc
View file @
0db71aaf
...
...
@@ -1727,12 +1727,7 @@ static void reset_stmt_for_execute(Prepared_statement *stmt)
tables
;
tables
=
tables
->
next
)
{
/*
Reset old pointers to TABLEs: they are not valid since the tables
were closed in the end of previous prepare or execute call.
*/
tables
->
table
=
0
;
tables
->
table_list
=
0
;
tables
->
reinit_before_use
(
thd
);
}
{
...
...
@@ -1743,6 +1738,17 @@ static void reset_stmt_for_execute(Prepared_statement *stmt)
unit
->
reinit_exec_mechanism
();
}
}
/*
Cleanup of the special case of DELETE t1, t2 FROM t1, t2, t3 ...
(multi-delete). We do a full clean up, although at the moment all we
need to clean in the tables of MULTI-DELETE list is 'table' member.
*/
for
(
TABLE_LIST
*
tables
=
(
TABLE_LIST
*
)
lex
->
auxilliary_table_list
.
first
;
tables
;
tables
=
tables
->
next
)
{
tables
->
reinit_before_use
(
thd
);
}
lex
->
current_select
=
&
lex
->
select_lex
;
if
(
lex
->
result
)
lex
->
result
->
cleanup
();
...
...
sql/table.cc
View file @
0db71aaf
...
...
@@ -1544,6 +1544,23 @@ db_type get_table_type(const char *name)
DBUG_RETURN
(
ha_checktype
((
enum
db_type
)
(
uint
)
*
(
head
+
3
)));
}
/*
Cleanup this table for re-execution.
SYNOPSIS
st_table_list::reinit_before_use()
*/
void
st_table_list
::
reinit_before_use
(
THD
*
/* thd */
)
{
/*
Reset old pointers to TABLEs: they are not valid since the tables
were closed in the end of previous prepare or execute call.
*/
table
=
0
;
table_list
=
0
;
}
/*****************************************************************************
** Instansiate templates
...
...
sql/table.h
View file @
0db71aaf
...
...
@@ -238,6 +238,11 @@ typedef struct st_table_list
bool
cacheable_table
;
/* stop PS caching */
/* used in multi-upd privelege check */
bool
table_in_update_from_clause
;
/*
Cleanup for re-execution in a prepared statement or a stored
procedure.
*/
void
reinit_before_use
(
THD
*
thd
);
}
TABLE_LIST
;
typedef
struct
st_changed_table_list
...
...
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