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
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
MariaDB
Commits
4006e958
Commit
4006e958
authored
Jul 01, 2003
by
pem@mysql.com
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Bugfixes for the sp_head memroot stuff.
parent
9f14ae75
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
46 additions
and
26 deletions
+46
-26
sql/sp.cc
sql/sp.cc
+8
-5
sql/sp_head.cc
sql/sp_head.cc
+15
-8
sql/sp_head.h
sql/sp_head.h
+5
-1
sql/sql_yacc.yy
sql/sql_yacc.yy
+18
-12
No files found.
sql/sp.cc
View file @
4006e958
...
...
@@ -147,12 +147,15 @@ db_find_routine(THD *thd, int type, char *name, uint namelen, sp_head **sphp)
lex_start
(
thd
,
(
uchar
*
)
defstr
,
strlen
(
defstr
));
if
(
yyparse
(
thd
)
||
thd
->
is_fatal_error
||
thd
->
lex
->
sphead
==
NULL
)
{
if
(
thd
->
lex
->
sphead
)
LEX
*
newlex
=
thd
->
lex
;
sp_head
*
sp
=
newlex
->
sphead
;
if
(
sp
)
{
if
(
oldlex
!=
thd
->
lex
)
thd
->
lex
->
sphead
->
restore_lex
(
thd
);
delete
thd
->
lex
->
sphead
;
thd
->
lex
=
NULL
;
if
(
oldlex
!=
new
lex
)
sp
->
restore_lex
(
thd
);
delete
sp
;
newlex
->
sphead
=
NULL
;
}
ret
=
SP_PARSE_ERROR
;
}
...
...
sql/sp_head.cc
View file @
4006e958
...
...
@@ -119,18 +119,27 @@ sp_head::operator delete(void *ptr, size_t size)
DBUG_VOID_RETURN
;
}
sp_head
::
sp_head
(
LEX_STRING
*
name
,
LEX
*
lex
,
LEX_STRING
*
comment
,
char
suid
)
:
Sql_alloc
(),
m_simple_case
(
FALSE
),
m_multi_query
(
FALSE
)
sp_head
::
sp_head
()
:
Sql_alloc
(),
m_simple_case
(
FALSE
),
m_multi_query
(
FALSE
)
,
m_free_list
(
NULL
)
{
DBUG_ENTER
(
"sp_head::sp_head"
);
m_backpatch
.
empty
();
m_lex
.
empty
();
DBUG_VOID_RETURN
;
}
void
sp_head
::
init
(
LEX_STRING
*
name
,
LEX
*
lex
,
LEX_STRING
*
comment
,
char
suid
)
{
DBUG_ENTER
(
"sp_head::init"
);
const
char
*
dstr
=
(
const
char
*
)
lex
->
buf
;
DBUG_PRINT
(
"info"
,
(
"name: %
s"
,
name
->
str
));
DBUG_PRINT
(
"info"
,
(
"name: %
*s"
,
name
->
length
,
name
->
str
));
m_name
.
length
=
name
->
length
;
m_name
.
str
=
name
->
str
;
m_name
.
str
=
lex
->
thd
->
strmake
(
name
->
str
,
name
->
length
)
;
m_defstr
.
length
=
lex
->
end_of_query
-
lex
->
buf
;
m_defstr
.
str
=
lex
->
thd
->
strmake
(
dstr
,
m_defstr
.
length
);
m_free_list
=
NULL
;
m_comment
.
length
=
0
;
m_comment
.
str
=
0
;
...
...
@@ -141,10 +150,8 @@ sp_head::sp_head(LEX_STRING *name, LEX *lex, LEX_STRING *comment, char suid)
}
m_suid
=
suid
;
m_pcont
=
lex
->
spcont
;
lex
->
spcont
=
m_pcont
=
new
sp_pcontext
()
;
my_init_dynamic_array
(
&
m_instr
,
sizeof
(
sp_instr
*
),
16
,
8
);
m_backpatch
.
empty
();
m_lex
.
empty
();
DBUG_VOID_RETURN
;
}
...
...
sql/sp_head.h
View file @
4006e958
...
...
@@ -60,7 +60,11 @@ class sp_head : public Sql_alloc
static
void
operator
delete
(
void
*
ptr
,
size_t
size
);
sp_head
(
LEX_STRING
*
name
,
LEX
*
lex
,
LEX_STRING
*
comment
,
char
suid
);
sp_head
();
// Initialize after we have reset mem_root
void
init
(
LEX_STRING
*
name
,
LEX
*
lex
,
LEX_STRING
*
comment
,
char
suid
);
int
create
(
THD
*
thd
);
...
...
sql/sql_yacc.yy
View file @
4006e958
...
...
@@ -931,24 +931,27 @@ create:
| CREATE PROCEDURE ident
{
LEX *lex= Lex;
sp_head *sp;
if (lex->sphead)
{
net_printf(YYTHD, ER_SP_NO_RECURSIVE_CREATE, "PROCEDURE");
YYABORT;
}
lex->spcont= new sp_pcontext();
lex->sphead= new sp_head(&$3, lex, 0, 0);
lex->sphead->m_type= TYPE_ENUM_PROCEDURE;
/* Order is important here: new - reset - init */
sp= new sp_head();
sp->reset_thd_mem_root(YYTHD);
sp->init(&$3, lex, 0, 0);
sp->m_type= TYPE_ENUM_PROCEDURE;
lex->sphead= sp;
/*
* We have to turn of CLIENT_MULTI_QUERIES while parsing a
* stored procedure, otherwise yylex will chop it into pieces
* at each ';'.
*/
lex->sphead->m_old_cmq=
YYTHD->client_capabilities & CLIENT_MULTI_QUERIES;
sp->m_old_cmq= YYTHD->client_capabilities & CLIENT_MULTI_QUERIES;
YYTHD->client_capabilities &= (~CLIENT_MULTI_QUERIES);
lex->sphead->reset_thd_mem_root(YYTHD);
}
'(' sp_pdparam_list ')'
{
...
...
@@ -982,24 +985,27 @@ create_function_tail:
| '('
{
LEX *lex= Lex;
sp_head *sp;
if (lex->sphead)
{
net_printf(YYTHD, ER_SP_NO_RECURSIVE_CREATE, "FUNCTION");
YYABORT;
}
lex->spcont= new sp_pcontext();
lex->sphead= new sp_head(&lex->udf.name, lex, 0, 0);
lex->sphead->m_type= TYPE_ENUM_FUNCTION;
/* Order is important here: new - reset - init */
sp= new sp_head();
sp->reset_thd_mem_root(YYTHD);
sp->init(&lex->udf.name, lex, 0, 0);
sp->m_type= TYPE_ENUM_FUNCTION;
lex->sphead= sp;
/*
* We have to turn of CLIENT_MULTI_QUERIES while parsing a
* stored procedure, otherwise yylex will chop it into pieces
* at each ';'.
*/
lex->sphead->m_old_cmq=
YYTHD->client_capabilities & CLIENT_MULTI_QUERIES;
sp->m_old_cmq= YYTHD->client_capabilities & CLIENT_MULTI_QUERIES;
YYTHD->client_capabilities &= ~CLIENT_MULTI_QUERIES;
lex->sphead->reset_thd_mem_root(YYTHD);
}
sp_fdparam_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