List:Commits« Previous MessageNext Message »
From:ingo Date:April 19 2007 5:58pm
Subject:bk commit into 5.1 tree (istruewing:1.2583)
View as plain text  
Below is the list of changes that have just been committed into a local
5.1 repository of istruewing. When istruewing does a push these changes will
be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html

ChangeSet@stripped, 2007-04-19 19:58:21+02:00, istruewing@stripped +3 -0
  WL#2936 - Falcon & MySQL plugin interface: server variables
  Added initialization for the plugin structure created in
  plugin_add().
  Made a correct argument vector in mysql_install_plugin():
  handle_options() assumes that arg0 (program name) always exists.

  mysys/my_getopt.c@stripped, 2007-04-19 19:58:17+02:00, istruewing@stripped +3 -0
    WL#2936 - Falcon & MySQL plugin interface: server variables
    Added DBUG_ASSERTs. handle_options() assumes that arg0
    (program name) always exists.

  plugin/fulltext/plugin_example.c@stripped, 2007-04-19 19:58:17+02:00, istruewing@stripped +24 -1
    WL#2936 - Falcon & MySQL plugin interface: server variables
    Extended the fulltext parser example plugin with system variables.

  sql/sql_plugin.cc@stripped, 2007-04-19 19:58:17+02:00, istruewing@stripped +9 -2
    WL#2936 - Falcon & MySQL plugin interface: server variables
    Added initialization for the plugin structure created in
    plugin_add().
    Made a correct argument vector in mysql_install_plugin():
    handle_options() assumes that arg0 (program name) always exists.

# This is a BitKeeper patch.  What follows are the unified diffs for the
# set of deltas contained in the patch.  The rest of the patch, the part
# that BitKeeper cares about, is below these diffs.
# User:	istruewing
# Host:	chilla.local
# Root:	/home/mydev/mysql-5.1-wl2936

--- 1.68/mysys/my_getopt.c	2007-04-19 19:58:29 +02:00
+++ 1.69/mysys/my_getopt.c	2007-04-19 19:58:29 +02:00
@@ -111,6 +111,9 @@ int handle_options(int *argc, char ***ar
   int error, i;
 
   LINT_INIT(opt_found);
+  /* handle_options() assumes arg0 (program name) always exists */
+  DBUG_ASSERT(argc && *argc >= 1);
+  DBUG_ASSERT(argv && *argv);
   (*argc)--; /* Skip the program name */
   (*argv)++; /*      --- || ----      */
   init_variables(longopts);

--- 1.52/sql/sql_plugin.cc	2007-04-19 19:58:29 +02:00
+++ 1.53/sql/sql_plugin.cc	2007-04-19 19:58:29 +02:00
@@ -701,6 +701,8 @@ static bool plugin_add(MEM_ROOT *tmp_roo
       sql_print_error(ER(ER_UDF_EXISTS), name->str);
     DBUG_RETURN(TRUE);
   }
+  /* Clear the whole struct to catch future extensions. */
+  bzero((char*) &tmp, sizeof(tmp));
   if (! (tmp.plugin_dl= plugin_dl_add(dl, report)))
     DBUG_RETURN(TRUE);
   /* Find plugin by name */
@@ -975,6 +977,7 @@ void plugin_unlock_list(THD *thd, plugin
 static int plugin_initialize(struct st_plugin_int *plugin)
 {
   DBUG_ENTER("plugin_initialize");
+  DBUG_PRINT("plugin", ("name: '%s'", plugin->name.str));
 
   safe_mutex_assert_owner(&LOCK_plugin);
 
@@ -1569,7 +1572,8 @@ bool mysql_install_plugin(THD *thd, cons
 {
   TABLE_LIST tables;
   TABLE *table;
-  int error, argc=0;
+  int error, argc;
+  char *argv[2];
   struct st_plugin_int *tmp;
   DBUG_ENTER("mysql_install_plugin");
 
@@ -1585,7 +1589,10 @@ bool mysql_install_plugin(THD *thd, cons
 
   pthread_mutex_lock(&LOCK_plugin);
   rw_wrlock(&LOCK_system_variables_hash);
-  error= plugin_add(thd->mem_root, name, dl, &argc, NULL, REPORT_TO_USER);
+  argv[0]= ""; /* handle_options() assumes arg0 (program name) always exists */
+  argv[1]= NULL;
+  argc= 1;
+  error= plugin_add(thd->mem_root, name, dl, &argc, argv, REPORT_TO_USER);
   rw_unlock(&LOCK_system_variables_hash);
 
   if (error || !(tmp= plugin_find_internal(name, MYSQL_ANY_PLUGIN)))

--- 1.17/plugin/fulltext/plugin_example.c	2007-04-19 19:58:29 +02:00
+++ 1.18/plugin/fulltext/plugin_example.c	2007-04-19 19:58:29 +02:00
@@ -216,6 +216,29 @@ static struct st_mysql_show_var simple_s
 };
 
 /*
+  Plugin system variables.
+*/
+
+static long     sysvar_one_value;
+static char     *sysvar_two_value;
+
+static MYSQL_SYSVAR_LONG(simple_sysvar_one, sysvar_one_value,
+  PLUGIN_VAR_RQCMDARG,
+  "Simple fulltext parser example system variable number one. Give a number.",
+  NULL, NULL, 100L, 10L, ~0L, 0);
+
+static MYSQL_SYSVAR_STR(simple_sysvar_two, sysvar_two_value,
+  PLUGIN_VAR_RQCMDARG,
+  "Simple fulltext parser example system variable number two. Give a string.",
+  NULL, NULL, NULL);
+
+static struct st_mysql_sys_var* simple_system_variables[]= {
+  MYSQL_SYSVAR(simple_sysvar_one),
+  MYSQL_SYSVAR(simple_sysvar_two),
+  NULL
+};
+
+/*
   Plugin library descriptor
 */
 
@@ -231,7 +254,7 @@ mysql_declare_plugin(ftexample)
   simple_parser_plugin_deinit,/* deinit function (when unloaded) */
   0x0001,                     /* version                         */
   simple_status,              /* status variables                */
-  NULL,                       /* system variables                */
+  simple_system_variables,    /* system variables                */
   NULL                        /* config options                  */
 }
 mysql_declare_plugin_end;
Thread
bk commit into 5.1 tree (istruewing:1.2583)ingo19 Apr