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
745181ce
Commit
745181ce
authored
Sep 07, 2005
by
unknown
Browse files
Options
Browse Files
Download
Plain Diff
Merge bk-internal.mysql.com:/home/bk/mysql-4.1
into neptunus.(none):/home/msvensson/mysql/mysql-4.1
parents
291d59d4
a3536083
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
52 additions
and
27 deletions
+52
-27
client/mysqltest.c
client/mysqltest.c
+51
-26
mysql-test/t/mysqltest.test
mysql-test/t/mysqltest.test
+1
-1
No files found.
client/mysqltest.c
View file @
745181ce
...
@@ -456,6 +456,7 @@ my_bool mysql_rpl_probe(MYSQL *mysql __attribute__((unused))) { return 1; }
...
@@ -456,6 +456,7 @@ my_bool mysql_rpl_probe(MYSQL *mysql __attribute__((unused))) { return 1; }
#endif
#endif
static
void
replace_dynstr_append_mem
(
DYNAMIC_STRING
*
ds
,
const
char
*
val
,
static
void
replace_dynstr_append_mem
(
DYNAMIC_STRING
*
ds
,
const
char
*
val
,
int
len
);
int
len
);
static
int
handle_no_error
(
struct
st_query
*
q
);
static
void
do_eval
(
DYNAMIC_STRING
*
query_eval
,
const
char
*
query
)
static
void
do_eval
(
DYNAMIC_STRING
*
query_eval
,
const
char
*
query
)
{
{
...
@@ -2907,22 +2908,9 @@ static int run_query_normal(MYSQL* mysql, struct st_query* q, int flags)
...
@@ -2907,22 +2908,9 @@ static int run_query_normal(MYSQL* mysql, struct st_query* q, int flags)
}
}
if
(
q
->
expected_errno
[
0
].
type
==
ERR_ERRNO
&&
if
(
handle_no_error
(
q
))
q
->
expected_errno
[
0
].
code
.
errnum
!=
0
)
{
{
/* Error code we wanted was != 0, i.e. not an expected success */
error
=
1
;
verbose_msg
(
"query '%s' succeeded - should have failed with errno %d..."
,
q
->
query
,
q
->
expected_errno
[
0
].
code
.
errnum
);
error
=
1
;
goto
end
;
}
else
if
(
q
->
expected_errno
[
0
].
type
==
ERR_SQLSTATE
&&
strcmp
(
q
->
expected_errno
[
0
].
code
.
sqlstate
,
"00000"
)
!=
0
)
{
/* SQLSTATE we wanted was != "00000", i.e. not an expected success */
verbose_msg
(
"query '%s' succeeded - should have failed with sqlstate %s..."
,
q
->
query
,
q
->
expected_errno
[
0
].
code
.
sqlstate
);
error
=
1
;
goto
end
;
goto
end
;
}
}
...
@@ -3102,10 +3090,8 @@ static int run_query_stmt(MYSQL *mysql, struct st_query *q, int flags)
...
@@ -3102,10 +3090,8 @@ static int run_query_stmt(MYSQL *mysql, struct st_query *q, int flags)
{
{
if
(
q
->
abort_on_error
)
if
(
q
->
abort_on_error
)
{
{
die
(
"unable to prepare statement '%s': "
die
(
"query '%s' failed: %d: %s"
,
query
,
"%s (mysql_stmt_errno=%d returned=%d)"
,
mysql_stmt_errno
(
stmt
),
mysql_stmt_error
(
stmt
));
query
,
mysql_stmt_error
(
stmt
),
mysql_stmt_errno
(
stmt
),
err
);
}
}
else
else
{
{
...
@@ -3186,12 +3172,8 @@ static int run_query_stmt(MYSQL *mysql, struct st_query *q, int flags)
...
@@ -3186,12 +3172,8 @@ static int run_query_stmt(MYSQL *mysql, struct st_query *q, int flags)
}
}
/* If we got here the statement was both executed and read succeesfully */
/* If we got here the statement was both executed and read succeesfully */
if
(
handle_no_error
(
q
))
if
(
q
->
expected_errno
[
0
].
type
==
ERR_ERRNO
&&
q
->
expected_errno
[
0
].
code
.
errnum
!=
0
)
{
{
verbose_msg
(
"query '%s' succeeded - should have failed with errno %d..."
,
q
->
query
,
q
->
expected_errno
[
0
].
code
.
errnum
);
error
=
1
;
error
=
1
;
goto
end
;
goto
end
;
}
}
...
@@ -3518,8 +3500,14 @@ static int run_query_stmt_handle_error(char *query, struct st_query *q,
...
@@ -3518,8 +3500,14 @@ static int run_query_stmt_handle_error(char *query, struct st_query *q,
dynstr_append_mem
(
ds
,
"
\n
"
,
1
);
dynstr_append_mem
(
ds
,
"
\n
"
,
1
);
if
(
i
)
if
(
i
)
{
{
if
(
q
->
expected_errno
[
0
].
type
==
ERR_ERRNO
)
verbose_msg
(
"query '%s' failed with wrong errno %d instead of %d..."
,
verbose_msg
(
"query '%s' failed with wrong errno %d instead of %d..."
,
q
->
query
,
mysql_stmt_errno
(
stmt
),
q
->
expected_errno
[
0
]);
q
->
query
,
mysql_stmt_errno
(
stmt
),
q
->
expected_errno
[
0
].
code
.
errnum
);
else
verbose_msg
(
"query '%s' failed with wrong sqlstate %s instead of %s..."
,
q
->
query
,
mysql_stmt_sqlstate
(
stmt
),
q
->
expected_errno
[
0
].
code
.
sqlstate
);
return
1
;
/* Error */
return
1
;
/* Error */
}
}
verbose_msg
(
"query '%s' failed: %d: %s"
,
q
->
query
,
mysql_stmt_errno
(
stmt
),
verbose_msg
(
"query '%s' failed: %d: %s"
,
q
->
query
,
mysql_stmt_errno
(
stmt
),
...
@@ -3534,6 +3522,43 @@ static int run_query_stmt_handle_error(char *query, struct st_query *q,
...
@@ -3534,6 +3522,43 @@ static int run_query_stmt_handle_error(char *query, struct st_query *q,
return
0
;
return
0
;
}
}
/*
Handle absence of errors after execution
SYNOPSIS
handle_no_error()
q - context of query
RETURN VALUE
0 - OK
1 - Some error was expected from this query.
*/
static
int
handle_no_error
(
struct
st_query
*
q
)
{
DBUG_ENTER
(
"handle_no_error"
);
if
(
q
->
expected_errno
[
0
].
type
==
ERR_ERRNO
&&
q
->
expected_errno
[
0
].
code
.
errnum
!=
0
)
{
/* Error code we wanted was != 0, i.e. not an expected success */
verbose_msg
(
"query '%s' succeeded - should have failed with errno %d..."
,
q
->
query
,
q
->
expected_errno
[
0
].
code
.
errnum
);
DBUG_RETURN
(
1
);
}
else
if
(
q
->
expected_errno
[
0
].
type
==
ERR_SQLSTATE
&&
strcmp
(
q
->
expected_errno
[
0
].
code
.
sqlstate
,
"00000"
)
!=
0
)
{
/* SQLSTATE we wanted was != "00000", i.e. not an expected success */
verbose_msg
(
"query '%s' succeeded - should have failed with sqlstate %s..."
,
q
->
query
,
q
->
expected_errno
[
0
].
code
.
sqlstate
);
DBUG_RETURN
(
1
);
}
DBUG_RETURN
(
0
);
}
/****************************************************************************\
/****************************************************************************\
* Functions to match SQL statements that can be prepared
* Functions to match SQL statements that can be prepared
\****************************************************************************/
\****************************************************************************/
...
...
mysql-test/t/mysqltest.test
View file @
745181ce
...
@@ -592,7 +592,7 @@ while ($num)
...
@@ -592,7 +592,7 @@ while ($num)
--
source
var
/
tmp
/
sourced1
.
sql
--
source
var
/
tmp
/
sourced1
.
sql
dec
$num
;
dec
$num
;
}
}
--
enable_abort_on_error
;
--
enable_abort_on_error
--
enable_query_log
--
enable_query_log
# ----------------------------------------------------------------------------
# ----------------------------------------------------------------------------
...
...
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