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
b6890a79
Commit
b6890a79
authored
Feb 02, 2003
by
pem@mysql.com
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed crash bug when certain procedures are called from the top level.
parent
58d0b0ea
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
38 additions
and
4 deletions
+38
-4
sql/sp_head.cc
sql/sp_head.cc
+38
-4
No files found.
sql/sp_head.cc
View file @
b6890a79
...
@@ -117,6 +117,7 @@ sp_head::execute(THD *thd)
...
@@ -117,6 +117,7 @@ sp_head::execute(THD *thd)
uint
params
=
pctx
->
params
();
uint
params
=
pctx
->
params
();
sp_rcontext
*
octx
=
thd
->
spcont
;
sp_rcontext
*
octx
=
thd
->
spcont
;
sp_rcontext
*
nctx
=
NULL
;
sp_rcontext
*
nctx
=
NULL
;
my_bool
tmp_octx
=
FALSE
;
// True if we have allocated a temporary octx
if
(
csize
>
0
)
if
(
csize
>
0
)
{
{
...
@@ -125,6 +126,11 @@ sp_head::execute(THD *thd)
...
@@ -125,6 +126,11 @@ sp_head::execute(THD *thd)
Item
*
it
=
li
++
;
// Skip first one, it's the procedure name
Item
*
it
=
li
++
;
// Skip first one, it's the procedure name
nctx
=
new
sp_rcontext
(
csize
);
nctx
=
new
sp_rcontext
(
csize
);
if
(
!
octx
)
{
// Create a temporary old context
octx
=
new
sp_rcontext
(
csize
);
tmp_octx
=
TRUE
;
}
// QQ: No error checking whatsoever right now. Should do type checking?
// QQ: No error checking whatsoever right now. Should do type checking?
for
(
i
=
0
;
(
it
=
li
++
)
&&
i
<
params
;
i
++
)
for
(
i
=
0
;
(
it
=
li
++
)
&&
i
<
params
;
i
++
)
{
{
...
@@ -172,16 +178,44 @@ sp_head::execute(THD *thd)
...
@@ -172,16 +178,44 @@ sp_head::execute(THD *thd)
// Don't copy back OUT values if we got an error
// Don't copy back OUT values if we got an error
if
(
ret
==
0
&&
csize
>
0
)
if
(
ret
==
0
&&
csize
>
0
)
{
{
// Copy back all OUT or INOUT values to the previous frame
List_iterator_fast
<
Item
>
li
(
m_call_lex
->
value_list
);
for
(
uint
i
=
0
;
i
<
params
;
i
++
)
Item
*
it
=
li
++
;
// Skip first one, it's the procedure name
// Copy back all OUT or INOUT values to the previous frame, or
// set global user variables
for
(
uint
i
=
0
;
(
it
=
li
++
)
&&
i
<
params
;
i
++
)
{
{
int
oi
=
nctx
->
get_oindex
(
i
);
int
oi
=
nctx
->
get_oindex
(
i
);
if
(
oi
>=
0
)
if
(
oi
>=
0
)
octx
->
set_item
(
nctx
->
get_oindex
(
i
),
nctx
->
get_item
(
i
));
{
if
(
!
tmp_octx
)
octx
->
set_item
(
nctx
->
get_oindex
(
i
),
nctx
->
get_item
(
i
));
else
{
// A global user variable
#if 0
// QQ This works if the parameter really is a user variable, but
// for the moment we can't assure that, so it will crash if it's
// something else. So for now, we just do nothing, to avoid a crash.
// Note: This also assumes we have a get_name() method in
// the Item_func_get_user_var class.
Item *item= nctx->get_item(i);
Item_func_set_user_var *suv;
Item_func_get_user_var *guv= static_cast<Item_func_get_user_var*>(it);
suv= new Item_func_set_user_var(guv->get_name(), item);
suv->fix_fields(thd, NULL, &item);
suv->fix_length_and_dec();
suv->update();
#endif
}
}
}
}
thd
->
spcont
=
octx
;
if
(
tmp_octx
)
thd
->
spcont
=
NULL
;
else
thd
->
spcont
=
octx
;
}
}
return
ret
;
return
ret
;
...
...
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