List:Internals« Previous MessageNext Message »
From:Michael Widenius Date:June 18 2001 12:31pm
Subject:Resetting last error in embedded server
View as plain text  

>>>>> "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/ 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/
John> will need to do it.

You are right. Here is how I fixed this:

===== libmysqld/ 1.4 vs edited =====
*** /tmp/   Fri Jun 15 22:55:15 2001
--- edited/libmysqld/ 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]=0;                   // Clear error message
+   thd->net.last_errno=0;
    return dispatch_command(command, thd, (char *) arg, length + 1);

Thanks for finding this!

Resetting last error in embedded serverJohn Birrell16 Jun
  • Resetting last error in embedded serverMichael Widenius18 Jun