summaryrefslogtreecommitdiff
path: root/sql-common
diff options
context:
space:
mode:
authorGeorgi Kodinov <Georgi.Kodinov@Oracle.com>2010-10-04 15:54:41 +0300
committerGeorgi Kodinov <Georgi.Kodinov@Oracle.com>2010-10-04 15:54:41 +0300
commitc050a4524ff3ec74a8d6932091e479eeaacff7f0 (patch)
treec60863e20b4656b29eed7bef0606750b8d9bb9ce /sql-common
parent8789c7972339340feb6a49903ff247de580bc5dd (diff)
downloadmariadb-git-c050a4524ff3ec74a8d6932091e479eeaacff7f0.tar.gz
Bug #56767: Make sure client plugins in 1054 are compatible with
connectors plugins Implemented changes needed to keep the client plugin API compatible with the existing plugins : 1. Provided an options() client plugin API to let the application pass options to the plugin after loading it 2. Added "License" (const char *) to specify the client plugin's license 3. Added "mysql_api" as a placeholder that the client library can use to pass function pointers to the plugin so that the plugin can call the C lib back. 4. Updated the existing client plugins to comply with the API change. 5. Added more detailed error message generation for Windows.
Diffstat (limited to 'sql-common')
-rw-r--r--sql-common/client.c6
-rw-r--r--sql-common/client_plugin.c22
2 files changed, 28 insertions, 0 deletions
diff --git a/sql-common/client.c b/sql-common/client.c
index 3897e44fdaf..0a30ef150e1 100644
--- a/sql-common/client.c
+++ b/sql-common/client.c
@@ -2283,6 +2283,9 @@ static auth_plugin_t native_password_client_plugin=
"R.J.Silk, Sergei Golubchik",
"Native MySQL authentication",
{1, 0, 0},
+ "GPL",
+ NULL,
+ NULL,
NULL,
NULL,
native_password_auth_client
@@ -2296,6 +2299,9 @@ static auth_plugin_t old_password_client_plugin=
"R.J.Silk, Sergei Golubchik",
"Old MySQL-3.23 authentication",
{1, 0, 0},
+ "GPL",
+ NULL,
+ NULL,
NULL,
NULL,
old_password_auth_client
diff --git a/sql-common/client_plugin.c b/sql-common/client_plugin.c
index 9526f5fdc4b..858eb492d7a 100644
--- a/sql-common/client_plugin.c
+++ b/sql-common/client_plugin.c
@@ -322,6 +322,9 @@ mysql_load_plugin_v(MYSQL *mysql, const char *name, int type,
char dlpath[FN_REFLEN+1];
void *sym, *dlhandle;
struct st_mysql_client_plugin *plugin;
+#ifdef WIN32
+ char win_errormsg[2048];
+#endif
DBUG_ENTER ("mysql_load_plugin_v");
DBUG_PRINT ("entry", ("name=%s type=%d int argc=%d", name, type, argc));
@@ -359,8 +362,15 @@ mysql_load_plugin_v(MYSQL *mysql, const char *name, int type,
if ((dlhandle= dlopen(dlpath, RTLD_NOW)))
goto have_plugin;
#endif
+
DBUG_PRINT ("info", ("failed to dlopen"));
+#ifdef WIN32
+ FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM,
+ 0, GetLastError(), 0, win_errormsg, 2048, NULL);
+ errormsg= win_errormsg;
+#else
errmsg= dlerror();
+#endif
goto err;
}
@@ -451,3 +461,15 @@ mysql_client_find_plugin(MYSQL *mysql, const char *name, int type)
DBUG_RETURN (p);
}
+
+/* see <mysql/client_plugin.h> for a full description */
+int STDCALL mysql_plugin_options(struct st_mysql_client_plugin *plugin,
+ const char *option,
+ const void *value)
+{
+ DBUG_ENTER("mysql_plugin_options");
+ /* does the plugin support options call? */
+ if (!plugin || !plugin->options)
+ DBUG_RETURN(1);
+ DBUG_RETURN(plugin->options(option, value));
+}