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
403cac0f
Commit
403cac0f
authored
Jul 16, 2012
by
Elena Stepanova
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Allow multiple error codes inside a variable in --error command
parent
49da8e7e
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
33 additions
and
6 deletions
+33
-6
client/mysqltest.cc
client/mysqltest.cc
+27
-6
mysql-test/r/mysqltest.result
mysql-test/r/mysqltest.result
+1
-0
mysql-test/t/mysqltest.test
mysql-test/t/mysqltest.test
+5
-0
No files found.
client/mysqltest.cc
View file @
403cac0f
...
...
@@ -5205,15 +5205,32 @@ const char *get_errname_from_code (uint error_code)
void
do_get_errcodes
(
struct
st_command
*
command
)
{
struct
st_match_err
*
to
=
saved_expected_errors
.
err
;
char
*
p
=
command
->
first_argument
;
uint
count
=
0
;
char
*
next
;
DBUG_ENTER
(
"do_get_errcodes"
);
if
(
!*
p
)
if
(
!*
command
->
first_argument
)
die
(
"Missing argument(s) to 'error'"
);
/* TODO: Potentially, there is a possibility of variables
being expanded twice, e.g.
let $errcodes = 1,\$a;
let $a = 1051;
error $errcodes;
DROP TABLE unknown_table;
...
Got one of the listed errors
But since it requires manual escaping, it does not seem
particularly dangerous or error-prone.
*/
DYNAMIC_STRING
ds
;
init_dynamic_string
(
&
ds
,
0
,
command
->
query_len
+
64
,
256
);
do_eval
(
&
ds
,
command
->
first_argument
,
command
->
end
,
!
is_windows
);
char
*
p
=
ds
.
str
;
uint
count
=
0
;
char
*
next
;
do
{
char
*
end
;
...
...
@@ -5323,11 +5340,15 @@ void do_get_errcodes(struct st_command *command)
}
while
(
*
p
);
command
->
last_argument
=
p
;
command
->
last_argument
=
command
->
first_argument
;
while
(
*
command
->
last_argument
)
command
->
last_argument
++
;
to
->
type
=
ERR_EMPTY
;
/* End of data */
DBUG_PRINT
(
"info"
,
(
"Expected errors: %d"
,
count
));
saved_expected_errors
.
count
=
count
;
dynstr_free
(
&
ds
);
DBUG_VOID_RETURN
;
}
...
...
mysql-test/r/mysqltest.result
View file @
403cac0f
...
...
@@ -690,6 +690,7 @@ Got one of the listed errors
insert into t1 values ("Abcd");
Got one of the listed errors
garbage;
SELECT * FROM non_existing_table;
drop table t2;
create table t1 ( f1 char(10));
insert into t1 values ("Abcd");
...
...
mysql-test/t/mysqltest.test
View file @
403cac0f
...
...
@@ -2120,6 +2120,11 @@ insert into t1 values ("Abcd");
--
error
$errno1
,
ER_PARSE_ERROR
garbage
;
let
$errno_multi
=
$errno1
,
ER_NO_SUCH_TABLE
,
$errno2
,
1062
;
--
error
$errno_multi
SELECT
*
FROM
non_existing_table
;
drop
table
t2
;
...
...
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