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
b58df2e9
Commit
b58df2e9
authored
May 06, 2004
by
konstantin@mysql.com
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
mysql_stmt_reset now expects ok/error packet from server.
parent
db127864
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
17 additions
and
9 deletions
+17
-9
libmysql/libmysql.c
libmysql/libmysql.c
+2
-1
sql/sql_prepare.cc
sql/sql_prepare.cc
+11
-7
tests/client_test.c
tests/client_test.c
+4
-1
No files found.
libmysql/libmysql.c
View file @
b58df2e9
...
...
@@ -3992,7 +3992,8 @@ my_bool STDCALL mysql_stmt_reset(MYSQL_STMT *stmt)
mysql
=
stmt
->
mysql
->
last_used_con
;
int4store
(
buff
,
stmt
->
stmt_id
);
/* Send stmt id to server */
if
((
*
mysql
->
methods
->
advanced_command
)(
mysql
,
COM_RESET_STMT
,
buff
,
MYSQL_STMT_HEADER
,
0
,
0
,
1
))
if
((
*
mysql
->
methods
->
advanced_command
)(
mysql
,
COM_RESET_STMT
,
buff
,
MYSQL_STMT_HEADER
,
0
,
0
,
0
))
{
set_stmt_errmsg
(
stmt
,
mysql
->
net
.
last_error
,
mysql
->
net
.
last_errno
,
mysql
->
net
.
sqlstate
);
...
...
sql/sql_prepare.cc
View file @
b58df2e9
...
...
@@ -1555,18 +1555,20 @@ void mysql_stmt_execute(THD *thd, char *packet, uint packet_length)
/*
Reset a prepared statement, in case there was an error in send_longdata.
Note: we don't send any reply to that command.
Reset a prepared statement in case there was a recoverable error.
SYNOPSIS
mysql_stmt_reset()
thd Thread handle
packet Packet with stmt id
DESCRIPTION
This function is useful when one gets an error after calling
mysql_stmt_getlongdata() and wants to reset the handle
so that one can call execute again.
See also bug #1664
This function resets statement to the state it was right after prepare.
It can be used to:
- clear an error happened during mysql_stmt_send_long_data
- cancel long data stream for all placeholders without
having to call mysql_stmt_execute.
Sends 'OK' packet in case of success (statement was reset)
or 'ERROR' packet (unrecoverable error/statement not found/etc).
*/
void
mysql_stmt_reset
(
THD
*
thd
,
char
*
packet
)
...
...
@@ -1577,7 +1579,7 @@ void mysql_stmt_reset(THD *thd, char *packet)
DBUG_ENTER
(
"mysql_stmt_reset"
);
if
(
!
(
stmt
=
find_prepared_statement
(
thd
,
stmt_id
,
"reset"
,
DONT_
SEND_ERROR
)))
if
(
!
(
stmt
=
find_prepared_statement
(
thd
,
stmt_id
,
"reset"
,
SEND_ERROR
)))
DBUG_VOID_RETURN
;
stmt
->
get_longdata_error
=
0
;
...
...
@@ -1587,6 +1589,8 @@ void mysql_stmt_reset(THD *thd, char *packet)
mysql_stmt_send_long_data() call.
*/
reset_stmt_params
(
stmt
);
send_ok
(
thd
);
DBUG_VOID_RETURN
;
}
...
...
tests/client_test.c
View file @
b58df2e9
...
...
@@ -163,8 +163,11 @@ MYSQL_STMT *STDCALL
mysql_simple_prepare
(
MYSQL
*
mysql
,
const
char
*
query
)
{
MYSQL_STMT
*
stmt
=
mysql_stmt_init
(
mysql
);
if
(
mysql_stmt_prepare
(
stmt
,
query
,
strlen
(
query
)))
if
(
stmt
&&
mysql_stmt_prepare
(
stmt
,
query
,
strlen
(
query
)))
{
mysql_stmt_close
(
stmt
);
return
0
;
}
return
stmt
;
}
...
...
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