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
a644dc0d
Commit
a644dc0d
authored
Feb 28, 2005
by
pem@mysql.com
Browse files
Options
Browse Files
Download
Plain Diff
Merge mysql.com:/usr/local/bk/mysql-5.0
into mysql.com:/home/pem/work/mysql-5.0
parents
092a6a1f
54a2448b
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
109 additions
and
6 deletions
+109
-6
mysql-test/r/sp-error.result
mysql-test/r/sp-error.result
+28
-0
mysql-test/t/sp-error.test
mysql-test/t/sp-error.test
+38
-0
sql/share/errmsg.txt
sql/share/errmsg.txt
+2
-0
sql/sp_pcontext.cc
sql/sp_pcontext.cc
+24
-0
sql/sp_pcontext.h
sql/sp_pcontext.h
+6
-0
sql/sql_repl.cc
sql/sql_repl.cc
+4
-1
sql/sql_yacc.yy
sql/sql_yacc.yy
+7
-5
No files found.
mysql-test/r/sp-error.result
View file @
a644dc0d
...
@@ -466,4 +466,32 @@ ERROR 70100: Query execution was interrupted
...
@@ -466,4 +466,32 @@ ERROR 70100: Query execution was interrupted
call bug6807()|
call bug6807()|
ERROR 70100: Query execution was interrupted
ERROR 70100: Query execution was interrupted
drop procedure bug6807|
drop procedure bug6807|
drop procedure if exists bug8776_1|
drop procedure if exists bug8776_2|
drop procedure if exists bug8776_3|
drop procedure if exists bug8776_4|
create procedure bug8776_1()
begin
declare continue handler for sqlstate '42S0200test' begin end;
begin end;
end|
ERROR 42000: Bad SQLSTATE: '42S0200test'
create procedure bug8776_2()
begin
declare continue handler for sqlstate '4200' begin end;
begin end;
end|
ERROR 42000: Bad SQLSTATE: '4200'
create procedure bug8776_3()
begin
declare continue handler for sqlstate '420000' begin end;
begin end;
end|
ERROR 42000: Bad SQLSTATE: '420000'
create procedure bug8776_4()
begin
declare continue handler for sqlstate '42x00' begin end;
begin end;
end|
ERROR 42000: Bad SQLSTATE: '42x00'
drop table t1|
drop table t1|
mysql-test/t/sp-error.test
View file @
a644dc0d
...
@@ -641,6 +641,44 @@ call bug6807()|
...
@@ -641,6 +641,44 @@ call bug6807()|
drop
procedure
bug6807
|
drop
procedure
bug6807
|
#
# BUG#876: Stored Procedures: Invalid SQLSTATE is allowed in
# a DECLARE ? HANDLER FOR stmt.
#
--
disable_warnings
drop
procedure
if
exists
bug8776_1
|
drop
procedure
if
exists
bug8776_2
|
drop
procedure
if
exists
bug8776_3
|
drop
procedure
if
exists
bug8776_4
|
--
enable_warnings
--
error
ER_SP_BAD_SQLSTATE
create
procedure
bug8776_1
()
begin
declare
continue
handler
for
sqlstate
'42S0200test'
begin
end
;
begin
end
;
end
|
--
error
ER_SP_BAD_SQLSTATE
create
procedure
bug8776_2
()
begin
declare
continue
handler
for
sqlstate
'4200'
begin
end
;
begin
end
;
end
|
--
error
ER_SP_BAD_SQLSTATE
create
procedure
bug8776_3
()
begin
declare
continue
handler
for
sqlstate
'420000'
begin
end
;
begin
end
;
end
|
--
error
ER_SP_BAD_SQLSTATE
create
procedure
bug8776_4
()
begin
declare
continue
handler
for
sqlstate
'42x00'
begin
end
;
begin
end
;
end
|
drop
table
t1
|
drop
table
t1
|
...
...
sql/share/errmsg.txt
View file @
a644dc0d
...
@@ -5326,3 +5326,5 @@ ER_PROC_AUTO_REVOKE_FAIL
...
@@ -5326,3 +5326,5 @@ ER_PROC_AUTO_REVOKE_FAIL
eng "Failed to revoke all privileges to dropped routine"
eng "Failed to revoke all privileges to dropped routine"
ER_DATA_TOO_LONG 22001
ER_DATA_TOO_LONG 22001
eng "Data too long for column '%s' at row %ld"
eng "Data too long for column '%s' at row %ld"
ER_SP_BAD_SQLSTATE 42000
eng "Bad SQLSTATE: '%s'"
sql/sp_pcontext.cc
View file @
a644dc0d
...
@@ -26,6 +26,30 @@
...
@@ -26,6 +26,30 @@
#include "sp_pcontext.h"
#include "sp_pcontext.h"
#include "sp_head.h"
#include "sp_head.h"
/*
* Sanity check for SQLSTATEs. Will not check if it's really an existing
* state (there are just too many), but will check length and bad characters.
* Returns TRUE if it's ok, FALSE if it's bad.
*/
bool
sp_cond_check
(
LEX_STRING
*
sqlstate
)
{
int
i
;
const
char
*
p
;
if
(
sqlstate
->
length
!=
5
)
return
FALSE
;
for
(
p
=
sqlstate
->
str
,
i
=
0
;
i
<
5
;
i
++
)
{
char
c
=
p
[
i
];
if
((
c
<
'0'
||
'9'
<
c
)
&&
(
c
<
'A'
||
'Z'
<
c
))
return
FALSE
;
}
return
TRUE
;
}
sp_pcontext
::
sp_pcontext
(
sp_pcontext
*
prev
)
sp_pcontext
::
sp_pcontext
(
sp_pcontext
*
prev
)
:
Sql_alloc
(),
m_psubsize
(
0
),
m_csubsize
(
0
),
m_hsubsize
(
0
),
:
Sql_alloc
(),
m_psubsize
(
0
),
m_csubsize
(
0
),
m_hsubsize
(
0
),
m_handlers
(
0
),
m_parent
(
prev
)
m_handlers
(
0
),
m_parent
(
prev
)
...
...
sql/sp_pcontext.h
View file @
a644dc0d
...
@@ -60,6 +60,12 @@ typedef struct sp_cond_type
...
@@ -60,6 +60,12 @@ typedef struct sp_cond_type
uint
mysqlerr
;
uint
mysqlerr
;
}
sp_cond_type_t
;
}
sp_cond_type_t
;
/* Sanity check for SQLSTATEs. Will not check if it's really an existing
* state (there are just too many), but will check length bad characters.
*/
extern
bool
sp_cond_check
(
LEX_STRING
*
sqlstate
);
typedef
struct
sp_cond
typedef
struct
sp_cond
{
{
LEX_STRING
name
;
LEX_STRING
name
;
...
...
sql/sql_repl.cc
View file @
a644dc0d
...
@@ -1274,6 +1274,7 @@ bool mysql_show_binlog_events(THD* thd)
...
@@ -1274,6 +1274,7 @@ bool mysql_show_binlog_events(THD* thd)
DBUG_ENTER
(
"show_binlog_events"
);
DBUG_ENTER
(
"show_binlog_events"
);
List
<
Item
>
field_list
;
List
<
Item
>
field_list
;
const
char
*
errmsg
=
0
;
const
char
*
errmsg
=
0
;
bool
ret
=
TRUE
;
IO_CACHE
log
;
IO_CACHE
log
;
File
file
=
-
1
;
File
file
=
-
1
;
Format_description_log_event
*
description_event
=
new
Format_description_log_event
*
description_event
=
new
...
@@ -1376,6 +1377,8 @@ bool mysql_show_binlog_events(THD* thd)
...
@@ -1376,6 +1377,8 @@ bool mysql_show_binlog_events(THD* thd)
pthread_mutex_unlock
(
log_lock
);
pthread_mutex_unlock
(
log_lock
);
}
}
ret
=
FALSE
;
err:
err:
delete
description_event
;
delete
description_event
;
if
(
file
>=
0
)
if
(
file
>=
0
)
...
@@ -1395,7 +1398,7 @@ bool mysql_show_binlog_events(THD* thd)
...
@@ -1395,7 +1398,7 @@ bool mysql_show_binlog_events(THD* thd)
pthread_mutex_lock
(
&
LOCK_thread_count
);
pthread_mutex_lock
(
&
LOCK_thread_count
);
thd
->
current_linfo
=
0
;
thd
->
current_linfo
=
0
;
pthread_mutex_unlock
(
&
LOCK_thread_count
);
pthread_mutex_unlock
(
&
LOCK_thread_count
);
DBUG_RETURN
(
TRUE
);
DBUG_RETURN
(
ret
);
}
}
...
...
sql/sql_yacc.yy
View file @
a644dc0d
...
@@ -1760,13 +1760,15 @@ sp_cond:
...
@@ -1760,13 +1760,15 @@ sp_cond:
}
}
| SQLSTATE_SYM opt_value TEXT_STRING_literal
| SQLSTATE_SYM opt_value TEXT_STRING_literal
{ /* SQLSTATE */
{ /* SQLSTATE */
uint len= ($3.length < sizeof($$->sqlstate)-1 ?
if (!sp_cond_check(&$3))
$3.length : sizeof($$->sqlstate)-1);
{
my_error(ER_SP_BAD_SQLSTATE, MYF(0), $3.str);
YYABORT;
}
$$= (sp_cond_type_t *)YYTHD->alloc(sizeof(sp_cond_type_t));
$$= (sp_cond_type_t *)YYTHD->alloc(sizeof(sp_cond_type_t));
$$->type= sp_cond_type_t::state;
$$->type= sp_cond_type_t::state;
memcpy($$->sqlstate, $3.str,
len
);
memcpy($$->sqlstate, $3.str,
5
);
$$->sqlstate[
len
]= '\0';
$$->sqlstate[
5
]= '\0';
}
}
;
;
...
...
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