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
a1270b65
Commit
a1270b65
authored
Jul 14, 2005
by
konstantin@mysql.com
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
A fix and a test case for Bug#11183 "mysql_stmt_reset() doesn't reset
information about error".
parent
3892f1d2
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
57 additions
and
0 deletions
+57
-0
libmysql/libmysql.c
libmysql/libmysql.c
+12
-0
tests/mysql_client_test.c
tests/mysql_client_test.c
+45
-0
No files found.
libmysql/libmysql.c
View file @
a1270b65
...
@@ -1834,6 +1834,17 @@ static void net_clear_error(NET *net)
...
@@ -1834,6 +1834,17 @@ static void net_clear_error(NET *net)
}
}
}
}
static
void
stmt_clear_error
(
MYSQL_STMT
*
stmt
)
{
if
(
stmt
->
last_errno
)
{
stmt
->
last_errno
=
0
;
stmt
->
last_error
[
0
]
=
'\0'
;
strmov
(
stmt
->
sqlstate
,
not_error_sqlstate
);
}
}
/*
/*
Set statement error code, sqlstate, and error message
Set statement error code, sqlstate, and error message
from given errcode and sqlstate.
from given errcode and sqlstate.
...
@@ -4625,6 +4636,7 @@ my_bool STDCALL mysql_stmt_reset(MYSQL_STMT *stmt)
...
@@ -4625,6 +4636,7 @@ my_bool STDCALL mysql_stmt_reset(MYSQL_STMT *stmt)
param
<
param_end
;
param
<
param_end
;
param
++
)
param
++
)
param
->
long_data_used
=
0
;
param
->
long_data_used
=
0
;
stmt_clear_error
(
stmt
);
DBUG_RETURN
(
0
);
DBUG_RETURN
(
0
);
}
}
...
...
tests/mysql_client_test.c
View file @
a1270b65
...
@@ -11697,6 +11697,50 @@ static void test_bug9735()
...
@@ -11697,6 +11697,50 @@ static void test_bug9735()
myquery
(
rc
);
myquery
(
rc
);
}
}
/* Bug#11183 "mysql_stmt_reset() doesn't reset information about error" */
static
void
test_bug11183
()
{
int
rc
;
MYSQL_STMT
*
stmt
;
char
bug_statement
[]
=
"insert into t1 values (1)"
;
myheader
(
"test_bug11183"
);
mysql_query
(
mysql
,
"drop table t1 if exists"
);
mysql_query
(
mysql
,
"create table t1 (a int)"
);
stmt
=
mysql_stmt_init
(
mysql
);
DIE_UNLESS
(
stmt
!=
0
);
rc
=
mysql_stmt_prepare
(
stmt
,
bug_statement
,
strlen
(
bug_statement
));
check_execute
(
stmt
,
rc
);
rc
=
mysql_query
(
mysql
,
"drop table t1"
);
myquery
(
rc
);
/* Trying to execute statement that should fail on execute stage */
rc
=
mysql_stmt_execute
(
stmt
);
DIE_UNLESS
(
rc
);
mysql_stmt_reset
(
stmt
);
DIE_UNLESS
(
mysql_stmt_errno
(
stmt
)
==
0
);
mysql_query
(
mysql
,
"create table t1 (a int)"
);
/* Trying to execute statement that should pass ok */
if
(
mysql_stmt_execute
(
stmt
))
{
mysql_stmt_reset
(
stmt
);
DIE_UNLESS
(
mysql_stmt_errno
(
stmt
)
==
0
);
}
mysql_stmt_close
(
stmt
);
rc
=
mysql_query
(
mysql
,
"drop table t1"
);
myquery
(
rc
);
}
/*
/*
Read and parse arguments and MySQL options from my.cnf
Read and parse arguments and MySQL options from my.cnf
...
@@ -11913,6 +11957,7 @@ static struct my_tests_st my_tests[]= {
...
@@ -11913,6 +11957,7 @@ static struct my_tests_st my_tests[]= {
{
"test_bug7990"
,
test_bug7990
},
{
"test_bug7990"
,
test_bug7990
},
{
"test_bug8378"
,
test_bug8378
},
{
"test_bug8378"
,
test_bug8378
},
{
"test_bug9735"
,
test_bug9735
},
{
"test_bug9735"
,
test_bug9735
},
{
"test_bug11183"
,
test_bug11183
},
{
0
,
0
}
{
0
,
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