>>>>> "John" == John Birrell <jb@stripped> writes:
John> In testing my use of embedded server, I find that
John> the server thread specific data containing last_errno
John> is not being reset when a new command is dispatched.
John> In the stand-alone server it looks like the reset
John> occurs as the command is obtained from the socket
John> (in sql/sql_parse.cc:do_command). In the case of
John> embedded server, I find that last_errno is not
John> necessarily zero when dispatch_command is
John> called. When an error is detected, the code in
John> my_message_sql thinks that it is not the first error
John> and ignores it.
John> I think that dispatch_command should reset last_errno
John> etc. Alternately, libmysqld/lib_sql.cc:lib_dispatch_command
John> will need to do it.
You are right. Here is how I fixed this:
===== libmysqld/lib_sql.cc 1.4 vs edited =====
*** /tmp/lib_sql.cc-1.4-27258 Fri Jun 15 22:55:15 2001
--- edited/libmysqld/lib_sql.cc Mon Jun 18 14:33:12 2001
*** 74,79 ****
--- 74,82 ----
THD *thd=(THD *) net->vio->dest_thd;
thd->store_globals(); // Fix if more than one
+ thd->net.last_error=0; // Clear error message
return dispatch_command(command, thd, (char *) arg, length + 1);
Thanks for finding this!