Commit a69a96e2 authored by unknown's avatar unknown
Browse files

Merge tsmith@bk-internal.mysql.com:/home/bk/mysql-5.1-runtime

into  quadxeon.mysql.com:/benchmarks/ext3/TOSAVE/tsmith/bk/maint/mrg0306/51


client/mysqltest.c:
  Auto merged
include/my_pthread.h:
  Auto merged
mysql-test/mysql-test-run.pl:
  Auto merged
mysql-test/r/sp.result:
  Auto merged
mysql-test/t/disabled.def:
  Auto merged
mysql-test/t/sp.test:
  Auto merged
mysys/my_wincond.c:
  Auto merged
sql/event_queue.cc:
  Auto merged
sql/field.cc:
  Auto merged
sql/item_cmpfunc.cc:
  Auto merged
sql/item_cmpfunc.h:
  Auto merged
sql/log.cc:
  Auto merged
sql/mysql_priv.h:
  Auto merged
sql/mysqld.cc:
  Auto merged
sql/set_var.cc:
  Auto merged
sql/sql_class.cc:
  Auto merged
sql/sql_class.h:
  Auto merged
sql/sql_load.cc:
  Auto merged
sql/sql_parse.cc:
  Auto merged
sql/sql_trigger.cc:
  Auto merged
client/mysql_upgrade.c:
  Manual merge; I chose to keep Magnus' changes because they make the code
  more simple; always use *only* the option file created by mysql_upgrade.
mysql-test/extra/binlog_tests/ctype_cp932.test:
  Manual merge
mysql-test/r/binlog_row_ctype_cp932.result:
  Manual merge
mysql-test/r/binlog_stm_ctype_cp932.result:
  Manual merge
mysql-test/r/mysqlbinlog.result:
  Manual merge
mysql-test/r/rpl_switch_stm_row_mixed.result:
  Manual merge
mysql-test/t/mysqlbinlog.test:
  Manual merge
mysql-test/t/rpl_switch_stm_row_mixed.test:
  Manual merge
parents 0ac63815 01fc4d06
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -1249,6 +1249,7 @@ mysql-test/*.ds?
mysql-test/*.vcproj
mysql-test/gmon.out
mysql-test/install_test_db
mysql-test/lib/init_db.sql
mysql-test/mtr
mysql-test/mysql-test-run
mysql-test/mysql-test-run-shell
@@ -1813,6 +1814,7 @@ scripts/mysql_explain_log
scripts/mysql_find_rows
scripts/mysql_fix_extensions
scripts/mysql_fix_privilege_tables
scripts/mysql_fix_privilege_tables.sql
scripts/mysql_install_db
scripts/mysql_secure_installation
scripts/mysql_setpermission
+3 −0
Original line number Diff line number Diff line
@@ -96,3 +96,6 @@ TARGET_LINK_LIBRARIES(mysqladmin mysqlclient mysys dbug yassl taocrypt zlib wsoc

ADD_EXECUTABLE(mysqlslap mysqlslap.c)
TARGET_LINK_LIBRARIES(mysqlslap mysqlclient mysys yassl taocrypt zlib wsock32 dbug)

ADD_EXECUTABLE(echo echo.c)
+1 −0
Original line number Diff line number Diff line
@@ -96,6 +96,7 @@ DEFS = -DUNDEF_THREADS_HACK \

sql_src=log_event.h mysql_priv.h log_event.cc my_decimal.h my_decimal.cc
strings_src=decimal.c
EXTRA_DIST =		get_password.c CMakeLists.txt echo.c

link_sources:
	for f in $(sql_src) ; do \

client/echo.c

0 → 100644
+45 −0
Original line number Diff line number Diff line
/* Copyright (C) 2000 MySQL AB

   This program is free software; you can redistribute it and/or modify
   it under the terms of the GNU General Public License as published by
   the Free Software Foundation; either version 2 of the License, or
   (at your option) any later version.

   This program is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   GNU General Public License for more details.

   You should have received a copy of the GNU General Public License
   along with this program; if not, write to the Free Software
   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA */

/*
  echo is a replacement for the "echo" command builtin to cmd.exe
  on Windows, to get a Unix eqvivalent behaviour when running commands
  like:
    $> echo "hello" | mysql

  The windows "echo" would have sent "hello" to mysql while
  Unix echo will send hello without the enclosing hyphens

  This is a very advanced high tech program so take care when
  you change it and remember to valgrind it before production
  use.

*/

#include <stdio.h>

int main(int argc, char **argv)
{
  int i;
  for (i= 1; i < argc; i++)
  {
    fprintf(stdout, "%s", argv[i]);
    if (i < argc - 1)
      fprintf(stdout, " ");
  }
  fprintf(stdout, "\n");
  return 0;
}
+57 −58
Original line number Diff line number Diff line
@@ -54,6 +54,8 @@ static char *default_dbug_option= (char*) "d:t:O,/tmp/mysql_upgrade.trace";
#endif
static my_bool info_flag= 0, tty_password= 0;

static char **defaults_argv;

static struct my_option my_long_options[]=
{
  {"help", '?', "Display this help message and exit.", 0, 0, 0, GET_NO_ARG,
@@ -282,6 +284,10 @@ static int create_defaults_file(const char *path, const char *forced_path)
  DYNAMIC_STRING buf;
  extra_default_t *d;

  DBUG_ENTER("create_defaults_file");
  DBUG_PRINT("enter", ("path: %s, forced_path: %s", path, forced_path));

  /* Delete any previous defaults file generated by mysql_upgrade */
  my_delete(path, MYF(0));
  
  defaults_file= my_open(path, O_BINARY | O_CREAT | O_WRONLY | O_EXCL,
@@ -298,6 +304,7 @@ static int create_defaults_file(const char *path, const char *forced_path)
    goto error;
  }

  /* Copy forced_path file into the defaults_file being generated */
  if (forced_path)
  {
    forced_file= my_open(forced_path, O_RDONLY, MYF(MY_FAE | MY_WME));
@@ -306,6 +313,7 @@ static int create_defaults_file(const char *path, const char *forced_path)
      ret= 1;
      goto error;
    }
    DBUG_PRINT("info", ("Copying from %s to %s", forced_path, path));
    do
    {
      cnt= my_read(forced_file, buf.str, buf.max_length, MYF(MY_WME));
@@ -316,10 +324,12 @@ static int create_defaults_file(const char *path, const char *forced_path)
        my_close(forced_file, MYF(0));
        goto error;
      }
      DBUG_PRINT("info", ("%s", buf.str));
    } while (cnt == buf.max_length);
    my_close(forced_file, MYF(0));
  }

  /* Write all extra_default options into the [client] section */
  dynstr_set(&buf, "\n[client]");
  if (opt_password) 
  {
@@ -330,6 +340,7 @@ static int create_defaults_file(const char *path, const char *forced_path)
      goto error;
    }
  }
  DBUG_PRINT("info", ("Writing extra_defaults to file"));
  while (extra_defaults) 
  {
    int len;
@@ -338,6 +349,7 @@ static int create_defaults_file(const char *path, const char *forced_path)
    len= d->n_len + d->v_len + 1; 
    if (buf.length + len >= buf.max_length)     /* to avoid realloc() */
    {
      
      if (my_write(defaults_file, buf.str, buf.length, MYF(MY_FNABP | MY_WME)))
      {
        ret= 1;
@@ -353,9 +365,8 @@ static int create_defaults_file(const char *path, const char *forced_path)
      ret= 1;
      goto error;
    }
    my_delete((gptr)d, MYF(0));
    DBUG_PRINT("info", ("%s", buf.str));
    my_free((gptr) d, MYF(0));

    list_pop(extra_defaults);                   /* pop off the head */
  }
  if (my_write(defaults_file, buf.str, buf.length, MYF(MY_FNABP | MY_WME)))
@@ -375,7 +386,7 @@ static int create_defaults_file(const char *path, const char *forced_path)
    my_delete(path, MYF(0));
  
out:
  return ret;
  DBUG_RETURN(ret);
}


@@ -452,12 +463,8 @@ int main(int argc, char **argv)
  char *forced_defaults_file;
  char *forced_extra_defaults;
  char *local_defaults_group_suffix;
  const char *script_line;
  char *upgrade_defaults_path= NULL;
  char *defaults_to_use= NULL;
  int upgrade_defaults_created= 0;
  int no_defaults;
  char path[FN_REFLEN];

  char path[FN_REFLEN], upgrade_defaults_path[FN_REFLEN];
  DYNAMIC_STRING cmdline;

  MY_INIT(argv[0]);
@@ -466,15 +473,12 @@ int main(int argc, char **argv)
#endif

  /* Check if we are forced to use specific defaults */
  no_defaults= 0;
  if (argc >= 2 && !strcmp(argv[1],"--no-defaults"))
    no_defaults= 1;

  get_defaults_options(argc, argv,
                       &forced_defaults_file, &forced_extra_defaults,
                       &local_defaults_group_suffix);
  
  load_defaults("my", load_default_groups, &argc, &argv);
  defaults_argv= argv;

  /* 
     Must init_dynamic_string before handle_options because string is freed
@@ -524,23 +528,17 @@ int main(int argc, char **argv)

  /*
     Create the modified defaults file to be used by mysqlcheck
     and mysql tools                                            
     and mysql command line client
   */
  fn_format(path, UPGRADE_DEFAULTS_NAME, datadir, "", MYF(0));
  upgrade_defaults_path= my_strdup(path, MYF(0));
  fn_format(upgrade_defaults_path, UPGRADE_DEFAULTS_NAME, datadir, "", MYF(0));
  create_defaults_file(upgrade_defaults_path, forced_extra_defaults);

  if (extra_defaults) 
  {
    ret= create_defaults_file(upgrade_defaults_path, forced_extra_defaults);
    if (ret)
      goto error;
    
    defaults_to_use= upgrade_defaults_path;
    upgrade_defaults_created= 1;
  } 
  else
    defaults_to_use= forced_extra_defaults;

  /*
    Read the mysql_upgrade_info file to check if mysql_upgrade
    already has been done
    Maybe this could be done a little earlier?
  */
  if (!find_file(MYSQL_UPGRADE_INFO_NAME, datadir, MY_SEARCH_SELF, 
                          path, sizeof(path), NULL, NullS)
     && !opt_force)
@@ -560,6 +558,8 @@ int main(int argc, char **argv)
    }
  }


  /* Find mysqlcheck */
  if (find_file(mysqlcheck_name, basedir, MYF(0), path, sizeof(path),
                "bin", EXTRA_CLIENT_PATHS, NullS))
  {
@@ -581,15 +581,13 @@ int main(int argc, char **argv)
    dynstr_append_os_quoted(&cmdline, path, NullS);
  }

  if (defaults_to_use)
  {
  /*
    All settings have been written to the "upgrade_defaults_path"
    instruct mysqlcheck to only read options from that file
  */
  dynstr_append(&cmdline, " ");
    dynstr_append_os_quoted(&cmdline,
                            (no_defaults ? "--defaults-file=" :
                             "--defaults-extra-file="),
                            defaults_to_use, NullS);
  }

  dynstr_append_os_quoted(&cmdline, "--defaults-file=",
                          upgrade_defaults_path, NullS);
  dynstr_append(&cmdline, " ");
  dynstr_append_os_quoted(&cmdline, "--check-upgrade", NullS);
  dynstr_append(&cmdline, " ");
@@ -602,9 +600,10 @@ int main(int argc, char **argv)
  dynstr_append(&cmdline, "\"");
#endif /* __WIN__ */

  /* Execute mysqlcheck */
  if (opt_verbose)
    printf("Running %s\n", cmdline.str);

  DBUG_PRINT("info", ("Running: %s", cmdline.str));
  ret= system(cmdline.str);
  if (ret)
  {
@@ -618,6 +617,7 @@ int main(int argc, char **argv)
    goto error;

fix_priv_tables:
  /* Find mysql */
  if (find_file(mysql_name, basedir, MYF(0), path, sizeof(path), 
                "bin", EXTRA_CLIENT_PATHS, NullS))
  {
@@ -639,6 +639,7 @@ int main(int argc, char **argv)
    dynstr_append_os_quoted(&cmdline, path, NullS);
  }

  /* Find mysql_fix_privililege_tables.sql */
  if (find_file(MYSQL_FIX_PRIV_TABLES_NAME, basedir, MYF(0), 
                          path, sizeof(path), 
                          "support_files", "share", "share/mysql", "scripts",
@@ -654,17 +655,14 @@ int main(int argc, char **argv)
           " where MySQL is installed");
    goto error;
  }
  else
    script_line= my_strdup(path, MYF(0));

  if (defaults_to_use)
  {
  /*
    All settings have been written to the "upgrade_defaults_path",
    instruct mysql to only read options from that file
  */
  dynstr_append(&cmdline, " ");
    dynstr_append_os_quoted(&cmdline,
                            (no_defaults ? "--defaults-file=" :
                             "--defaults-extra-file="),
                            defaults_to_use, NullS);
  }
  dynstr_append_os_quoted(&cmdline, "--defaults-file=",
                          upgrade_defaults_path, NullS);
  dynstr_append(&cmdline, " ");
  dynstr_append_os_quoted(&cmdline, "--force", NullS);
  dynstr_append(&cmdline, " ");
@@ -676,14 +674,15 @@ int main(int argc, char **argv)
  dynstr_append(&cmdline, " ");
  dynstr_append_os_quoted(&cmdline, "--database=mysql", NullS);
  dynstr_append(&cmdline, " < ");
  dynstr_append_os_quoted(&cmdline, script_line, NullS);
  dynstr_append_os_quoted(&cmdline, path, NullS);
#ifdef __WIN__
  dynstr_append(&cmdline, "\"");
#endif /* __WIN__ */

  /* Execute "mysql --force < mysql_fix_privilege_tables.sql" */
  if (opt_verbose)
    printf("Running %s\n", cmdline.str);

  DBUG_PRINT("info", ("Running: %s", cmdline.str));
  ret= system(cmdline.str);
  if (ret)
    fprintf(stderr, "Error executing '%s'\n", cmdline.str);
@@ -691,10 +690,10 @@ int main(int argc, char **argv)
error:
  dynstr_free(&cmdline);

  if (upgrade_defaults_created)
  /* Delete the generated defaults file */
  my_delete(upgrade_defaults_path, MYF(0));

  my_free(upgrade_defaults_path, MYF(MY_ALLOW_ZERO_PTR));
  free_defaults(defaults_argv);
  my_end(info_flag ? MY_CHECK_ERROR : 0);
  return ret;
}
Loading