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
d53fc319
Commit
d53fc319
authored
Feb 12, 2003
by
pem@mysql.com
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed some DBUGing, and optimized SET slightly.
parent
f2d6ec93
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
50 additions
and
23 deletions
+50
-23
sql/sp.cc
sql/sp.cc
+11
-5
sql/sp_head.cc
sql/sp_head.cc
+21
-8
sql/sql_parse.cc
sql/sql_parse.cc
+6
-6
sql/sql_yacc.yy
sql/sql_yacc.yy
+12
-4
No files found.
sql/sp.cc
View file @
d53fc319
...
...
@@ -26,6 +26,7 @@
sp_head
*
sp_find_procedure
(
THD
*
thd
,
Item_string
*
iname
)
{
DBUG_ENTER
(
"sp_find_procedure"
);
extern
int
yyparse
(
void
*
thd
);
LEX
*
tmplex
;
TABLE
*
table
;
...
...
@@ -35,11 +36,12 @@ sp_find_procedure(THD *thd, Item_string *iname)
sp_head
*
sp
=
NULL
;
name
=
iname
->
const_string
();
DBUG_PRINT
(
"enter"
,
(
"name: %*s"
,
name
->
length
(),
name
->
c_ptr
()));
memset
(
&
tables
,
0
,
sizeof
(
tables
));
tables
.
db
=
(
char
*
)
"mysql"
;
tables
.
real_name
=
tables
.
alias
=
(
char
*
)
"proc"
;
if
(
!
(
table
=
open_ltable
(
thd
,
&
tables
,
TL_READ
)))
return
NULL
;
DBUG_RETURN
(
NULL
)
;
if
(
table
->
file
->
index_read_idx
(
table
->
record
[
0
],
0
,
(
byte
*
)
name
->
c_ptr
(),
name
->
length
(),
...
...
@@ -59,12 +61,14 @@ sp_find_procedure(THD *thd, Item_string *iname)
done:
if
(
table
)
close_thread_tables
(
thd
);
return
sp
;
DBUG_RETURN
(
sp
)
;
}
int
sp_create_procedure
(
THD
*
thd
,
char
*
name
,
uint
namelen
,
char
*
def
,
uint
deflen
)
{
DBUG_ENTER
(
"sp_create_procedure"
);
DBUG_PRINT
(
"enter"
,
(
"name: %*s def: %*s"
,
namelen
,
name
,
deflen
,
def
));
int
ret
=
0
;
TABLE
*
table
;
TABLE_LIST
tables
;
...
...
@@ -88,12 +92,14 @@ sp_create_procedure(THD *thd, char *name, uint namelen, char *def, uint deflen)
done:
close_thread_tables
(
thd
);
return
ret
;
DBUG_RETURN
(
ret
)
;
}
int
sp_drop_procedure
(
THD
*
thd
,
char
*
name
,
uint
namelen
)
{
DBUG_ENTER
(
"sp_drop_procedure"
);
DBUG_PRINT
(
"enter"
,
(
"name: %*s"
,
namelen
,
name
));
TABLE
*
table
;
TABLE_LIST
tables
;
...
...
@@ -111,9 +117,9 @@ sp_drop_procedure(THD *thd, char *name, uint namelen)
table
->
file
->
print_error
(
error
,
MYF
(
0
));
}
close_thread_tables
(
thd
);
return
0
;
DBUG_RETURN
(
0
)
;
err:
close_thread_tables
(
thd
);
return
-
1
;
DBUG_RETURN
(
-
1
)
;
}
sql/sp_head.cc
View file @
d53fc319
...
...
@@ -99,17 +99,21 @@ sp_head::sp_head(LEX_STRING *name, LEX *lex)
int
sp_head
::
create
(
THD
*
thd
)
{
DBUG_ENTER
(
"sp_head::create"
);
String
*
name
=
m_name
->
const_string
();
String
*
def
=
m_defstr
->
const_string
();
return
sp_create_procedure
(
thd
,
DBUG_PRINT
(
"info"
,
(
"name: %s def: %s"
,
name
->
c_ptr
(),
def
->
c_ptr
()));
DBUG_RETURN
(
sp_create_procedure
(
thd
,
name
->
c_ptr
(),
name
->
length
(),
def
->
c_ptr
(),
def
->
length
(
));
def
->
c_ptr
(),
def
->
length
()
));
}
int
sp_head
::
execute
(
THD
*
thd
)
{
DBUG_ENTER
(
"sp_head::execute"
);
DBUG_PRINT
(
"executing"
,
(
"procedure %s"
,
((
String
*
)
m_name
->
const_string
())
->
c_ptr
()));
int
ret
=
0
;
sp_instr
*
p
;
sp_pcontext
*
pctx
=
m_call_lex
->
spcont
;
...
...
@@ -171,6 +175,7 @@ sp_head::execute(THD *thd)
i
=
get_instr
(
ip
);
// Returns NULL when we're done.
if
(
i
==
NULL
)
break
;
DBUG_PRINT
(
"execute"
,
(
"Instruction %u"
,
ip
));
ret
=
i
->
execute
(
thd
,
&
ip
);
}
}
...
...
@@ -218,7 +223,7 @@ sp_head::execute(THD *thd)
thd
->
spcont
=
octx
;
}
return
ret
;
DBUG_RETURN
(
ret
)
;
}
...
...
@@ -351,6 +356,8 @@ sp_head::backpatch(sp_label_t *lab)
int
sp_instr_stmt
::
execute
(
THD
*
thd
,
uint
*
nextp
)
{
DBUG_ENTER
(
"sp_instr_stmt::execute"
);
DBUG_PRINT
(
"info"
,
(
"command: %d"
,
m_lex
.
sql_command
));
LEX
olex
;
// The other lex
int
res
;
...
...
@@ -364,7 +371,7 @@ sp_instr_stmt::execute(THD *thd, uint *nextp)
memcpy
(
&
thd
->
lex
,
&
olex
,
sizeof
(
LEX
));
// Restore the other lex
*
nextp
=
m_ip
+
1
;
return
res
;
DBUG_RETURN
(
res
)
;
}
//
...
...
@@ -373,9 +380,11 @@ sp_instr_stmt::execute(THD *thd, uint *nextp)
int
sp_instr_set
::
execute
(
THD
*
thd
,
uint
*
nextp
)
{
DBUG_ENTER
(
"sp_instr_set::execute"
);
DBUG_PRINT
(
"info"
,
(
"offset: %u"
,
m_offset
));
thd
->
spcont
->
set_item
(
m_offset
,
eval_func_item
(
thd
,
m_value
,
m_type
));
*
nextp
=
m_ip
+
1
;
return
0
;
DBUG_RETURN
(
0
)
;
}
//
...
...
@@ -384,13 +393,15 @@ sp_instr_set::execute(THD *thd, uint *nextp)
int
sp_instr_jump_if
::
execute
(
THD
*
thd
,
uint
*
nextp
)
{
DBUG_ENTER
(
"sp_instr_jump_if::execute"
);
DBUG_PRINT
(
"info"
,
(
"destination: %u"
,
m_dest
));
Item
*
it
=
eval_func_item
(
thd
,
m_expr
,
MYSQL_TYPE_TINY
);
if
(
it
->
val_int
())
*
nextp
=
m_dest
;
else
*
nextp
=
m_ip
+
1
;
return
0
;
DBUG_RETURN
(
0
)
;
}
//
...
...
@@ -399,11 +410,13 @@ sp_instr_jump_if::execute(THD *thd, uint *nextp)
int
sp_instr_jump_if_not
::
execute
(
THD
*
thd
,
uint
*
nextp
)
{
DBUG_ENTER
(
"sp_instr_jump_if_not::execute"
);
DBUG_PRINT
(
"info"
,
(
"destination: %u"
,
m_dest
));
Item
*
it
=
eval_func_item
(
thd
,
m_expr
,
MYSQL_TYPE_TINY
);
if
(
!
it
->
val_int
())
*
nextp
=
m_dest
;
else
*
nextp
=
m_ip
+
1
;
return
0
;
DBUG_RETURN
(
0
)
;
}
sql/sql_parse.cc
View file @
d53fc319
...
...
@@ -1513,7 +1513,7 @@ mysql_execute_command(THD *thd)
given and the table list says the query should not be replicated
*/
if
(
table_rules_on
&&
tables
&&
!
tables_ok
(
thd
,
tables
))
return
0
;
DBUG_RETURN
(
0
)
;
#ifndef TO_BE_DELETED
/*
This is a workaround to deal with the shortcoming in 3.23.44-3.23.46
...
...
@@ -1549,7 +1549,7 @@ mysql_execute_command(THD *thd)
{
if
(
res
<
0
||
thd
->
net
.
report_error
)
send_error
(
thd
,
thd
->
killed
?
ER_SERVER_SHUTDOWN
:
0
);
return
res
;
DBUG_RETURN
(
res
)
;
}
}
}
...
...
@@ -1558,7 +1558,7 @@ mysql_execute_command(THD *thd)
lex
->
unit
.
create_total_list
(
thd
,
lex
,
&
tables
))
||
(
table_rules_on
&&
tables
&&
thd
->
slave_thread
&&
!
tables_ok
(
thd
,
tables
)))
return
0
;
DBUG_RETURN
(
0
)
;
statistic_increment
(
com_stat
[
lex
->
sql_command
],
&
LOCK_status
);
switch
(
lex
->
sql_command
)
{
...
...
@@ -1838,7 +1838,7 @@ mysql_execute_command(THD *thd)
find_real_table_in_list
(
tables
->
next
,
tables
->
db
,
tables
->
real_name
))
{
net_printf
(
thd
,
ER_UPDATE_TABLE_USED
,
tables
->
real_name
);
return
-
1
;
DBUG_RETURN
(
-
1
)
;
}
if
(
tables
->
next
)
{
...
...
@@ -2912,11 +2912,11 @@ mysql_execute_command(THD *thd)
// or res != 0 and no send_error() has yet been done.
if
(
res
<
0
)
send_error
(
thd
,
thd
->
killed
?
ER_SERVER_SHUTDOWN
:
0
);
return
res
;
DBUG_RETURN
(
res
)
;
error:
// We end up here if send_error() has already been done.
return
-
1
;
DBUG_RETURN
(
-
1
)
;
}
...
...
sql/sql_yacc.yy
View file @
d53fc319
...
...
@@ -1048,11 +1048,19 @@ sp_proc_stmt:
YYABORT;
}
else
{
/* Don't add an instruction for empty SET statements.
** (This happens if the SET only contained local variables,
** which get their set instructions generated separately.)
*/
if (lex->sql_command != SQLCOM_SET_OPTION ||
!lex->var_list.is_empty())
{
sp_instr_stmt *i= new sp_instr_stmt(lex->sphead->instructions());
i->set_lex(lex);
lex->sphead->add_instr(i);
}
lex->sphead->restore_lex(YYTHD);
}
}
...
...
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