Commit d36ac6b6 authored by monty@hundin.mysql.fi's avatar monty@hundin.mysql.fi
Browse files

Fix some bugs introduced with the new my_getopt

Added counting of rollback's and commits
Fixed bug in 'SELECT 0 LIMIT 0'
Fixed bug in 'SELECT SQL_CALC_FOUND_ROWS'
parent 040b5c29
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -48385,6 +48385,11 @@ Our TODO section contains what we plan to have in 4.0. @xref{TODO MySQL 4.0}.
@itemize @bullet
@item
Fixed a bug where @code{SQL_CALC_ROWS} returned a wrong value when used
with one table and @code{ORDER BY} and with InnoDB tables.
@item
Fixed that @code{SELECT 0 LIMIT 0} doesn't hang thread.
@item
Fixed some problems with @code{USE KEYS} / @code{IGNORE KEYS} when using
many keys with the same start column.
@item
+1 −1
Original line number Diff line number Diff line
@@ -188,7 +188,7 @@ AC_DEFINE(SPRINTF_RETURNS_INT) AC_MSG_RESULT("int"),
   	

# option, cache_name, variable,
# code to execute if yes, code to exectute if fal
# code to execute if yes, code to exectute if fail
AC_DEFUN(AC_SYS_COMPILER_FLAG,
[
  AC_MSG_CHECKING($1)
+62 −39
Original line number Diff line number Diff line
@@ -193,7 +193,7 @@ static struct my_option my_long_options[] =
   0, 0, 0, GET_NO_ARG, NO_ARG, 'i', 0, 0, 0, 0, 0, 0},
  {"keys-used", "Tell MyISAM to update only some specific keys. # is a bit mask of which keys to use. This can be used to get faster inserts!",
   (gptr*) &check_param.keys_in_use, (gptr*) &check_param.keys_in_use, 0,
   GET_LONG, REQUIRED_ARG, 'k', 0, 0, 0, 0, 0, 0},
   GET_LL, REQUIRED_ARG, 'k', -1LL, 0, 0, 0, 0, 0},
  {"medium-check",
   "Faster than extended-check, but only finds 99.99% of all errors. Should be good enough for most cases.", 0, 0, 0, GET_NO_ARG, NO_ARG, 'm', 0, 0, 0, 0, 0,
   0},
@@ -384,8 +384,6 @@ get_one_option(int optid,
	       const struct my_option *opt __attribute__((unused)),
	       char *argument)
{
  uint old_testflag;

  switch (optid) {
  case 'a':
    if (argument && *argument == '0')
@@ -417,10 +415,7 @@ get_one_option(int optid,
    break;
  case 'C':
    if (argument && *argument == '0')
    {
      check_param.testflag&= ~T_CHECK;
      check_param.testflag&= ~T_CHECK_ONLY_CHANGED;
    }
      check_param.testflag&= ~(T_CHECK | T_CHECK_ONLY_CHANGED);
    else
      check_param.testflag|= T_CHECK | T_CHECK_ONLY_CHANGED;
    break;
@@ -429,11 +424,7 @@ get_one_option(int optid,
    break;
  case 's':				/* silent */
    if (argument && *argument == '0')
    {
      if (check_param.testflag & T_VERY_SILENT)
	check_param.testflag&= ~T_VERY_SILENT;
      check_param.testflag&= ~T_SILENT;
    }
      check_param.testflag&= ~(T_SILENT | T_VERY_SILENT);
    else
    {
      if (check_param.testflag & T_SILENT)
@@ -467,8 +458,16 @@ get_one_option(int optid,
      check_param.testflag|= T_INFO;
    break;
  case 'f':
    if (argument && *argument == '0')
    {
      check_param.tmpfile_createflag= O_RDWR | O_TRUNC | O_EXCL;
      check_param.testflag&= ~(T_FORCE_CREATE | T_UPDATE_STATE);
    }
    else
    {
      check_param.tmpfile_createflag= O_RDWR | O_TRUNC;
      check_param.testflag|= T_FORCE_CREATE | T_UPDATE_STATE;
    }
    break;
  case 'F':
    if (argument && *argument == '0')
@@ -486,41 +485,65 @@ get_one_option(int optid,
      check_param.testflag|= T_MEDIUM;		/* Medium check */
    break;
  case 'r':				/* Repair table */
    if (argument && *argument == '0')
      check_param.testflag&= ~(T_REP | T_REP_BY_SORT);
    else
      check_param.testflag= (check_param.testflag & ~T_REP) | T_REP_BY_SORT;
    break;
  case 'o':
    if (argument && *argument == '0')
    {
      check_param.testflag&= ~(T_REP | T_REP_BY_SORT);
      check_param.force_sort= 0;
    }
    else
    {
      check_param.testflag= (check_param.testflag & ~T_REP_BY_SORT) | T_REP;
      check_param.force_sort= 0;
      my_disable_async_io= 1;		/* More safety */
    }
    break;
  case 'n':
    if (argument && *argument == '0')
    {
      check_param.testflag&= ~(T_REP | T_REP_BY_SORT);
      check_param.force_sort= 0;
    }
    else
    {
      check_param.testflag= (check_param.testflag & ~T_REP) | T_REP_BY_SORT;
      check_param.force_sort= 1;
    }
    break;
  case 'q':
    if (argument && *argument == '0')
      check_param.opt_rep_quick--;      
      check_param.opt_rep_quick=0;
    else
      check_param.opt_rep_quick++;
    break;
  case 'u':
    if (argument && *argument == '0')
    {
      check_param.testflag&= ~T_UNPACK;
      check_param.testflag&= ~T_REP_BY_SORT;
    }
      check_param.testflag&= ~(T_UNPACK | T_REP_BY_SORT);
    else
      check_param.testflag|= T_UNPACK | T_REP_BY_SORT;
    break;
  case 'v':				/* Verbose */
    if (argument && *argument == '0')
    {
      check_param.testflag&= ~T_VERBOSE;
      check_param.verbose=0;
    }
    else
    {
      check_param.testflag|= T_VERBOSE;
      check_param.verbose++;
    }
    break;
  case 'R':				/* Sort records */
    old_testflag= check_param.testflag;
    if (argument && *argument == '0')
      check_param.testflag&= ~T_SORT_RECORDS;
    else
    {
      check_param.testflag|= T_SORT_RECORDS;
      check_param.opt_sort_key= (uint) atoi(argument) - 1;
      if (check_param.opt_sort_key >= MI_MAX_KEY)
@@ -530,17 +553,14 @@ get_one_option(int optid,
		MI_MAX_KEY);
	exit(1);
      }
    }
    break;
  case 'S':			      /* Sort index */
    old_testflag= check_param.testflag;
    if (argument && *argument == '0')
      check_param.testflag&= ~T_SORT_INDEX;
    else
      check_param.testflag|= T_SORT_INDEX;
    break;
  case 't':
    check_param.tmpdir= argument;
    break;
  case 'T':
    if (argument && *argument == '0')
      check_param.testflag&= ~T_READONLY;
@@ -554,6 +574,9 @@ get_one_option(int optid,
      check_param.testflag|= T_UPDATE_STATE;
    break;
  case '#':
    if (argument && *argument == '0')
      DBUG_POP();
    else
      DBUG_PUSH(argument ? argument : "d:t:o,/tmp/myisamchk.trace");
    break;
  case 'V':
+2 −0
Original line number Diff line number Diff line
@@ -48,3 +48,5 @@ i
2
1
drop table t1;
select 0 limit 0;
0
+1 −1
Original line number Diff line number Diff line
@@ -7,7 +7,7 @@ use test;
drop table if exists t1,t3;
create table t1 (word char(20) not null);
load data infile '../../std_data/words.dat' into table t1;
load data local infile '/home/sasha/bk/mysql-4.0/mysql-test/std_data/words.dat' into table t1;
load data local infile 'MYSQL_TEST_DIR/std_data/words.dat' into table t1;
select * from t1;
word
Aarhus
Loading