summaryrefslogtreecommitdiff
path: root/myisam
diff options
context:
space:
mode:
authorunknown <monty@hundin.mysql.fi>2002-02-08 03:21:34 +0200
committerunknown <monty@hundin.mysql.fi>2002-02-08 03:21:34 +0200
commit0f9932a162bdd80d83fd0c4a3d6641d41ff3f1e3 (patch)
tree6fb2be8a25c87f580e5d7831b049ad0839a48237 /myisam
parent6340283614f9f5cc4b9212ec5affa177b3f71711 (diff)
downloadmariadb-git-0f9932a162bdd80d83fd0c4a3d6641d41ff3f1e3.tar.gz
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' Docs/manual.texi: Changelog configure.in: Cleanup myisam/myisamchk.c: Fix some bugs introduced with the new my_getopt mysql-test/r/limit.result: Test for bugfix mysql-test/r/rpl000001.result: fix wrong result mysql-test/r/select.result: Fix things after fixing ignore index() mysql-test/r/select_found.result: Test of bug in SQL_CALC_FOUND_ROWS mysql-test/t/limit.test: Test bug in LIMIT 0 mysql-test/t/rpl000001.test: fix wrong result mysql-test/t/select_found.test: Test of bug in SQL_CALC_FOUND_ROWS sql/handler.cc: Added counting of rollback's and commits sql/mysql_priv.h: Added counting of rollback's and commits sql/mysqld.cc: Added counting of rollback's and commits sql/sql_select.cc: Fixed bug in 'SELECT 0 LIMIT 0' Fixed bug in 'SELECT SQL_CALC_FOUND_ROWS'
Diffstat (limited to 'myisam')
-rw-r--r--myisam/myisamchk.c101
1 files changed, 62 insertions, 39 deletions
diff --git a/myisam/myisamchk.c b/myisam/myisamchk.c
index 20aaaf6ac8e..60ffbaeccdb 100644
--- a/myisam/myisamchk.c
+++ b/myisam/myisamchk.c
@@ -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':
- check_param.tmpfile_createflag= O_RDWR | O_TRUNC;
- check_param.testflag|= T_FORCE_CREATE | T_UPDATE_STATE;
+ 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,61 +485,82 @@ get_one_option(int optid,
check_param.testflag|= T_MEDIUM; /* Medium check */
break;
case 'r': /* Repair table */
- check_param.testflag= (check_param.testflag & ~T_REP) | T_REP_BY_SORT;
+ 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':
- check_param.testflag= (check_param.testflag & ~T_REP_BY_SORT) | T_REP;
- check_param.force_sort=0;
- my_disable_async_io=1; /* More safety */
+ 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':
- check_param.testflag= (check_param.testflag & ~T_REP) | T_REP_BY_SORT;
- check_param.force_sort= 1;
+ 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++;
+ check_param.verbose++;
+ }
break;
case 'R': /* Sort records */
- old_testflag= check_param.testflag;
- check_param.testflag|= T_SORT_RECORDS;
- check_param.opt_sort_key= (uint) atoi(argument) - 1;
- if (check_param.opt_sort_key >= MI_MAX_KEY)
+ if (argument && *argument == '0')
+ check_param.testflag&= ~T_SORT_RECORDS;
+ else
{
- fprintf(stderr,
- "The value of the sort key is bigger than max key: %d.\n",
- MI_MAX_KEY);
- exit(1);
+ check_param.testflag|= T_SORT_RECORDS;
+ check_param.opt_sort_key= (uint) atoi(argument) - 1;
+ if (check_param.opt_sort_key >= MI_MAX_KEY)
+ {
+ fprintf(stderr,
+ "The value of the sort key is bigger than max key: %d.\n",
+ 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,7 +574,10 @@ get_one_option(int optid,
check_param.testflag|= T_UPDATE_STATE;
break;
case '#':
- DBUG_PUSH(argument ? argument : "d:t:o,/tmp/myisamchk.trace");
+ if (argument && *argument == '0')
+ DBUG_POP();
+ else
+ DBUG_PUSH(argument ? argument : "d:t:o,/tmp/myisamchk.trace");
break;
case 'V':
print_version();