Bug #60075 mysql_load_client_plugin doesn't clear error
Submitted: 10 Feb 2011 6:36 Modified: 21 Apr 2011 0:48
Reporter: Georg Richter Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: C API (client library) Severity:S3 (Non-critical)
Version:5.5 OS:Any
Assigned to: Georgi Kodinov CPU Architecture:Any

[10 Feb 2011 6:36] Georg Richter
Description:
mysql_load_client_plugin api function doesn't clear previous error

How to repeat:
 p= mysql_load_client_plugin(mysql, "foo", 0);
 printf("Error: %s\n", mysql_error(mysql));

 p =mysql_load_client_plugin(mysql, "mytestplugin", 0);
 printf("Error: %s\n", mysql_error(mysql));

Output:
Error: Error while loading plugin foo: /home/georg/work/mysql/connectors/connector-c/plugins/conn-c-trace-plugin/foo.so: cannot open shared object file: No such file or directory
Error: Error while loading plugin foo: /home/georg/work/mysql/connectors/connector-c/plugins/conn-c-trace-plugin/foo.so: cannot open shared object file: No such file or directory

 Output:

Suggested fix:
=== modified file 'sql-common/client_plugin.c'
--- sql-common/client_plugin.c  2011-01-11 09:07:37 +0000
+++ sql-common/client_plugin.c  2011-02-10 06:28:29 +0000
@@ -163,6 +163,7 @@

   p->next= plugin_list[plugin->type];
   plugin_list[plugin->type]= p;
+  net_clear_error(&mysql->net);

   return plugin;

@@ -403,6 +404,7 @@
   plugin= add_plugin(mysql, plugin, dlhandle, argc, args);

   pthread_mutex_unlock(&LOCK_load_client_plugin);
+  net_clear_error(&mysql->net);

   DBUG_PRINT ("leave", ("plugin loaded ok"));
   DBUG_RETURN (plugin);
[21 Apr 2011 0:48] Paul Dubois
Noted in 5.5.11, 5.6.3 changelogs.

The mysql_load_client_plugin() C API function did not clear the
previous error. 

CHANGESET - http://lists.mysql.com/commits/133274