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
32dc0aad
Commit
32dc0aad
authored
Sep 13, 2005
by
unknown
Browse files
Options
Browse Files
Download
Plain Diff
Merge mysql.com:/usr/local/bk/mysql-5.0
into mysql.com:/usr/home/pem/mysql-5.0
parents
468c357a
902932a1
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
124 additions
and
73 deletions
+124
-73
mysql-test/r/sp.result
mysql-test/r/sp.result
+39
-0
mysql-test/t/sp.test
mysql-test/t/sp.test
+45
-0
sql/sp_head.cc
sql/sp_head.cc
+9
-26
sql/sp_pcontext.cc
sql/sp_pcontext.cc
+0
-1
sql/sp_pcontext.h
sql/sp_pcontext.h
+0
-10
sql/sql_yacc.yy
sql/sql_yacc.yy
+31
-36
No files found.
mysql-test/r/sp.result
View file @
32dc0aad
...
...
@@ -3225,4 +3225,43 @@ select @var|
@var
abcdabcd
drop procedure bug12849_2|
drop procedure if exists bug131333|
drop function if exists bug131333|
create procedure bug131333()
begin
begin
declare a int;
select a;
set a = 1;
select a;
end;
begin
declare b int;
select b;
end;
end|
create function bug131333()
returns int
begin
begin
declare a int;
set a = 1;
end;
begin
declare b int;
return b;
end;
end|
call bug131333()|
a
NULL
a
1
b
NULL
select bug131333()|
bug131333()
NULL
drop procedure bug131333|
drop function bug131333|
drop table t1,t2;
mysql-test/t/sp.test
View file @
32dc0aad
...
...
@@ -4063,6 +4063,51 @@ call bug12849_2(@var)|
select
@
var
|
drop
procedure
bug12849_2
|
#
# BUG#13133: Local variables in stored procedures are not initialized correctly.
#
--
disable_warnings
drop
procedure
if
exists
bug131333
|
drop
function
if
exists
bug131333
|
--
enable_warnings
create
procedure
bug131333
()
begin
begin
declare
a
int
;
select
a
;
set
a
=
1
;
select
a
;
end
;
begin
declare
b
int
;
select
b
;
end
;
end
|
create
function
bug131333
()
returns
int
begin
begin
declare
a
int
;
set
a
=
1
;
end
;
begin
declare
b
int
;
return
b
;
end
;
end
|
call
bug131333
()
|
select
bug131333
()
|
drop
procedure
bug131333
|
drop
function
bug131333
|
#
# BUG#NNNN: New bug synopsis
#
...
...
sql/sp_head.cc
View file @
32dc0aad
...
...
@@ -1078,7 +1078,6 @@ sp_head::execute_function(THD *thd, Item **argp, uint argcount, Item **resp)
sp_rcontext
*
octx
=
thd
->
spcont
;
sp_rcontext
*
nctx
=
NULL
;
uint
i
;
Item_null
*
nit
;
int
ret
=
-
1
;
// Assume error
if
(
argcount
!=
params
)
...
...
@@ -1109,22 +1108,15 @@ sp_head::execute_function(THD *thd, Item **argp, uint argcount, Item **resp)
nctx
->
push_item
(
it
);
}
/*
The rest of the frame are local variables which are all IN.
Default all variables to null (those with default clauses will
be set by an set instruction)
.
Push NULLs to get the right size (and make the reuse mechanism work) -
the will be initialized by set instructions in each frame
.
*/
nit
=
NULL
;
// Re-use this, and only create if needed
for
(;
i
<
csize
;
i
++
)
{
if
(
!
nit
)
{
if
(
!
(
nit
=
new
Item_null
()))
DBUG_RETURN
(
-
1
);
}
nctx
->
push_item
(
nit
);
}
nctx
->
push_item
(
NULL
);
thd
->
spcont
=
nctx
;
binlog_save_options
=
thd
->
options
;
...
...
@@ -1321,23 +1313,14 @@ int sp_head::execute_procedure(THD *thd, List<Item> *args)
close_thread_tables
(
thd
,
0
,
0
);
DBUG_PRINT
(
"info"
,(
" %.*s: eval args done"
,
m_name
.
length
,
m_name
.
str
));
/*
The rest of the frame are local variables which are all IN.
Default all variables to null (those with default clauses will
be set by an set instruction)
.
Push NULLs to get the right size (and make the reuse mechanism work) -
the will be initialized by set instructions in each frame
.
*/
for
(;
i
<
csize
;
i
++
)
{
if
(
!
nit
)
{
if
(
!
(
nit
=
new
Item_null
()))
{
ret
=
-
1
;
break
;
}
}
nctx
->
push_item
(
nit
);
}
nctx
->
push_item
(
NULL
);
}
thd
->
spcont
=
nctx
;
...
...
sql/sp_pcontext.cc
View file @
32dc0aad
...
...
@@ -184,7 +184,6 @@ sp_pcontext::push_pvar(LEX_STRING *name, enum enum_field_types type,
p
->
type
=
type
;
p
->
mode
=
mode
;
p
->
offset
=
current_pvars
();
p
->
isset
=
(
mode
==
sp_param_out
?
FALSE
:
TRUE
);
p
->
dflt
=
NULL
;
insert_dynamic
(
&
m_pvar
,
(
gptr
)
&
p
);
}
...
...
sql/sp_pcontext.h
View file @
32dc0aad
...
...
@@ -35,7 +35,6 @@ typedef struct sp_pvar
enum
enum_field_types
type
;
sp_param_mode_t
mode
;
uint
offset
;
// Offset in current frame
my_bool
isset
;
Item
*
dflt
;
}
sp_pvar_t
;
...
...
@@ -147,15 +146,6 @@ class sp_pcontext : public Sql_alloc
p
->
type
=
type
;
}
inline
void
set_isset
(
uint
i
,
my_bool
val
)
{
sp_pvar_t
*
p
=
find_pvar
(
i
);
if
(
p
)
p
->
isset
=
val
;
}
inline
void
set_default
(
uint
i
,
Item
*
it
)
{
...
...
sql/sql_yacc.yy
View file @
32dc0aad
...
...
@@ -1666,15 +1666,16 @@ sp_decl:
uint max= ctx->context_pvars();
enum enum_field_types type= (enum enum_field_types)$3;
Item *it= $5;
bool has_default= (it != NULL);
for (uint i = max-$2 ; i < max ; i++)
{
sp_instr_set *in;
ctx->set_type(i, type);
if (! it)
ctx->set_isset(i, FALSE);
else
{
sp_instr_set *in= new sp_instr_set(lex->sphead->instructions(),
if (! has_default)
it= new Item_null(); /* QQ Set to the type with null_value? */
in = new sp_instr_set(lex->sphead->instructions(),
ctx,
ctx->pvar_context2index(i),
it, type, lex,
...
...
@@ -1685,10 +1686,8 @@ sp_decl:
freeing LEX.
*/
lex->sphead->add_instr(in);
ctx->set_isset(i, TRUE);
ctx->set_default(i, it);
}
}
lex->sphead->restore_lex(YYTHD);
$$.vars= $2;
$$.conds= $$.hndlrs= $$.curs= 0;
...
...
@@ -2268,7 +2267,6 @@ sp_fetch_list:
sp_instr_cfetch *i= (sp_instr_cfetch *)sp->last_instruction();
i->add_to_varlist(spv);
spv->isset= TRUE;
}
}
|
...
...
@@ -2290,7 +2288,6 @@ sp_fetch_list:
sp_instr_cfetch *i= (sp_instr_cfetch *)sp->last_instruction();
i->add_to_varlist(spv);
spv->isset= TRUE;
}
}
;
...
...
@@ -5894,7 +5891,6 @@ select_var_ident:
else
{
((select_dumpvar *)lex->result)->var_list.push_back( new my_var($1,1,t->offset,t->type));
t->isset= TRUE;
}
}
;
...
...
@@ -7925,7 +7921,6 @@ sys_option_value:
sp_set= new sp_instr_set(lex->sphead->instructions(), ctx,
spv->offset, it, spv->type, lex, TRUE);
lex->sphead->add_instr(sp_set);
spv->isset= TRUE;
}
}
| option_type TRANSACTION_SYM ISOLATION LEVEL_SYM isolation_types
...
...
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