diff --git a/client/mysql.cc b/client/mysql.cc index 09818ae27b3..cf5ee0f94d8 100644 --- a/client/mysql.cc +++ b/client/mysql.cc @@ -550,13 +550,13 @@ static struct my_option my_long_options[] = {"force", 'f', "Continue even if we get an sql error.", (gptr*) &ignore_errors, (gptr*) &ignore_errors, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, - {"no-named-commands", 'g', - "Named commands are disabled. Use \\* form only, or use named commands only in the beginning of a line ending with a semicolon (;) Since version 10.9 the client now starts with this option ENABLED by default! Disable with '-G'. Long format commands still work from the first line. WARNING: option deprecated; use --disable-named-commands instead.", - 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, {"named-commands", 'G', "Enable named commands. Named commands mean this program's internal commands; see mysql> help . When enabled, the named commands can be used from any line of the query, otherwise only from the first line, before an enter. Disable with --disable-named-commands. This option is disabled by default.", (gptr*) &named_cmds, (gptr*) &named_cmds, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, + {"no-named-commands", 'g', + "Named commands are disabled. Use \\* form only, or use named commands only in the beginning of a line ending with a semicolon (;) Since version 10.9 the client now starts with this option ENABLED by default! Disable with '-G'. Long format commands still work from the first line. WARNING: option deprecated; use --disable-named-commands instead.", + 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, {"ignore-spaces", 'i', "Ignore space after function names.", 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, {"local-infile", OPT_LOCAL_INFILE, "Enable/disable LOAD DATA LOCAL INFILE.", @@ -575,13 +575,6 @@ static struct my_option my_long_options[] = NO_ARG, 1, 0, 0, 0, 0, 0}, {"skip-line-numbers", 'L', "Don't write line number for errors. WARNING: -L is deprecated, use long version of this option instead.", 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, -#ifdef USE_POPEN - {"no-pager", OPT_NOPAGER, - "Disable pager and print to stdout. See interactive help (\\h) also. WARNING: option deprecated; use --disable-pager instead.", - 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, -#endif - {"no-tee", OPT_NOTEE, "Disable outfile. See interactive help (\\h) also. WARNING: option deprecated; use --disable-tee instead", 0, 0, 0, GET_NO_ARG, - NO_ARG, 0, 0, 0, 0, 0, 0}, {"unbuffered", 'n', "Flush buffer after each query.", (gptr*) &unbuffered, (gptr*) &unbuffered, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, {"column-names", OPT_COLUMN_NAMES, "Write column names in results.", @@ -601,8 +594,11 @@ static struct my_option my_long_options[] = 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, #ifdef USE_POPEN {"pager", OPT_PAGER, - "Pager to use to display results. If you don't supply an option the default pager is taken from your ENV variable PAGER. Valid pagers are less, more, cat [> filename], etc. See interactive help (\\h) also. This option does not work in batch mode.", + "Pager to use to display results. If you don't supply an option the default pager is taken from your ENV variable PAGER. Valid pagers are less, more, cat [> filename], etc. See interactive help (\\h) also. This option does not work in batch mode. Disable with --disable-pager. This option is disabled by default.", 0, 0, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0}, + {"no-pager", OPT_NOPAGER, + "Disable pager and print to stdout. See interactive help (\\h) also. WARNING: option deprecated; use --disable-pager instead.", + 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, #endif {"password", 'p', "Password to use when connecting to server. If password is not given it's asked from the tty.", @@ -643,8 +639,10 @@ static struct my_option my_long_options[] = {"debug-info", 'T', "Print some debug info at exit.", (gptr*) &info_flag, (gptr*) &info_flag, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, {"tee", OPT_TEE, - "Append everything into outfile. See interactive help (\\h) also. Does not work in batch mode.", + "Append everything into outfile. See interactive help (\\h) also. Does not work in batch mode. Disable with --disable-tee. This option is disabled by default.", 0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, + {"no-tee", OPT_NOTEE, "Disable outfile. See interactive help (\\h) also. WARNING: option deprecated; use --disable-tee instead", 0, 0, 0, GET_NO_ARG, + NO_ARG, 0, 0, 0, 0, 0, 0}, #ifndef DONT_ALLOW_USER_CHANGE {"user", 'u', "User for login if not current user.", (gptr*) ¤t_user, (gptr*) ¤t_user, 0, GET_STR_ALLOC, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, @@ -1725,7 +1723,14 @@ static int com_server_help(String *buffer __attribute__((unused)), if (help_arg[0] != '\'') { - (void) strxnmov(cmd_buf, sizeof(cmd_buf), "help '", help_arg, "'", NullS); + char *end_arg= strend(help_arg); + if(--end_arg) + { + while (my_isspace(charset_info,*end_arg)) + end_arg--; + *++end_arg= '\0'; + } + (void) strxnmov(cmd_buf, sizeof(cmd_buf), "help '", help_arg, "'", NullS); server_cmd= cmd_buf; } @@ -1811,9 +1816,13 @@ com_help(String *buffer __attribute__((unused)), { reg1 int i, j; char * help_arg= strchr(line,' '), buff[32], *end; - if (help_arg) - return com_server_help(buffer,line,help_arg+1); + { + while (my_isspace(charset_info,*help_arg)) + help_arg++; + if (*help_arg) + return com_server_help(buffer,line,help_arg); + } put_info("\nFor information about MySQL products and services, visit:\n" " http://www.mysql.com/\n" diff --git a/heap/hp_delete.c b/heap/hp_delete.c index 90e537081d3..266a9da6ca3 100644 --- a/heap/hp_delete.c +++ b/heap/hp_delete.c @@ -73,7 +73,10 @@ int hp_rb_delete_key(HP_INFO *info, register HP_KEYDEF *keyinfo, int res; if (flag) + { info->last_pos= NULL; /* For heap_rnext/heap_rprev */ + info->lastkey_len= 0; + } custom_arg.keyseg= keyinfo->seg; custom_arg.key_length= hp_rb_make_key(keyinfo, info->recbuf, record, recpos); diff --git a/mysql-test/r/bug20328.result b/mysql-test/r/bug20328.result new file mode 100644 index 00000000000..62955775ec4 --- /dev/null +++ b/mysql-test/r/bug20328.result @@ -0,0 +1,44 @@ +? (\?) Synonym for `help'. +clear (\c) Clear command. +connect (\r) Reconnect to the server. Optional arguments are db and host. +delimiter (\d) Set query delimiter. +edit (\e) Edit command with $EDITOR. +ego (\G) Send command to mysql server, display result vertically. +exit (\q) Exit mysql. Same as quit. +go (\g) Send command to mysql server. +help (\h) Display this help. +nopager (\n) Disable pager, print to stdout. +notee (\t) Don't write into outfile. +pager (\P) Set PAGER [to_pager]. Print the query results via PAGER. +print (\p) Print current command. +prompt (\R) Change your mysql prompt. +quit (\q) Quit mysql. +rehash (\#) Rebuild completion hash. +source (\.) Execute an SQL script file. Takes a file name as an argument. +status (\s) Get status information from the server. +system (\!) Execute a system shell command. +tee (\T) Set outfile [to_outfile]. Append everything into given outfile. +use (\u) Use another database. Takes database name as argument. +charset_name(\C) Switch to another charset. Might be needed for processing binlog. +? (\?) Synonym for `help'. +clear (\c) Clear command. +connect (\r) Reconnect to the server. Optional arguments are db and host. +delimiter (\d) Set query delimiter. +edit (\e) Edit command with $EDITOR. +ego (\G) Send command to mysql server, display result vertically. +exit (\q) Exit mysql. Same as quit. +go (\g) Send command to mysql server. +help (\h) Display this help. +nopager (\n) Disable pager, print to stdout. +notee (\t) Don't write into outfile. +pager (\P) Set PAGER [to_pager]. Print the query results via PAGER. +print (\p) Print current command. +prompt (\R) Change your mysql prompt. +quit (\q) Quit mysql. +rehash (\#) Rebuild completion hash. +source (\.) Execute an SQL script file. Takes a file name as an argument. +status (\s) Get status information from the server. +system (\!) Execute a system shell command. +tee (\T) Set outfile [to_outfile]. Append everything into given outfile. +use (\u) Use another database. Takes database name as argument. +charset_name(\C) Switch to another charset. Might be needed for processing binlog. diff --git a/mysql-test/r/grant2.result b/mysql-test/r/grant2.result index 85963705718..c047dc033c6 100644 --- a/mysql-test/r/grant2.result +++ b/mysql-test/r/grant2.result @@ -143,3 +143,13 @@ flush privileges; drop user mysqltest_3@host3; drop user mysqltest_1@host1, mysqltest_2@host2, mysqltest_4@host4, mysqltest_5@host5, mysqltest_6@host6, mysqltest_7@host7; +create database mysqltest_1; +grant select, insert, update on `mysqltest\_1`.* to mysqltest_1@localhost; +set sql_log_off = 1; +ERROR HY000: Access denied; you need the SUPER privilege for this operation +set sql_log_bin = 0; +ERROR HY000: Access denied; you need the SUPER privilege for this operation +delete from mysql.user where user like 'mysqltest\_1'; +delete from mysql.db where user like 'mysqltest\_1'; +drop database mysqltest_1; +flush privileges; diff --git a/mysql-test/r/heap_btree.result b/mysql-test/r/heap_btree.result index 5c60c97d674..91c3ec65a13 100644 --- a/mysql-test/r/heap_btree.result +++ b/mysql-test/r/heap_btree.result @@ -246,3 +246,38 @@ DELETE from t1 where a < 100; SELECT * from t1; a DROP TABLE t1; +create table t1(a int not null, key using btree(a)) engine=heap; +insert into t1 values (2), (2), (2), (1), (1), (3), (3), (3), (3); +select a from t1 where a > 2; +a +3 +3 +3 +3 +delete from t1 where a < 4; +select a from t1; +a +insert into t1 values (2), (2), (2), (1), (1), (3), (3), (3), (3); +select a from t1 where a > 4; +a +delete from t1 where a > 4; +select a from t1; +a +3 +3 +1 +3 +3 +1 +2 +2 +2 +select a from t1 where a > 3; +a +delete from t1 where a >= 2; +select a from t1; +a +1 +1 +drop table t1; +End of 4.1 tests diff --git a/mysql-test/r/mysql_client.result b/mysql-test/r/mysql_client.result index 87d09428ff6..00d7b6df3cf 100644 --- a/mysql-test/r/mysql_client.result +++ b/mysql-test/r/mysql_client.result @@ -2,3 +2,47 @@ 1 ERROR 1064 (42000) at line 3: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1 ERROR at line 1: USE must be followed by a database name +? (\?) Synonym for `help'. +clear (\c) Clear command. +connect (\r) Reconnect to the server. Optional arguments are db and host. +delimiter (\d) Set query delimiter. +edit (\e) Edit command with $EDITOR. +ego (\G) Send command to mysql server, display result vertically. +exit (\q) Exit mysql. Same as quit. +go (\g) Send command to mysql server. +help (\h) Display this help. +nopager (\n) Disable pager, print to stdout. +notee (\t) Don't write into outfile. +pager (\P) Set PAGER [to_pager]. Print the query results via PAGER. +print (\p) Print current command. +prompt (\R) Change your mysql prompt. +quit (\q) Quit mysql. +rehash (\#) Rebuild completion hash. +source (\.) Execute an SQL script file. Takes a file name as an argument. +status (\s) Get status information from the server. +system (\!) Execute a system shell command. +tee (\T) Set outfile [to_outfile]. Append everything into given outfile. +use (\u) Use another database. Takes database name as argument. +charset_name(\C) Switch to another charset. Might be needed for processing binlog. +? (\?) Synonym for `help'. +clear (\c) Clear command. +connect (\r) Reconnect to the server. Optional arguments are db and host. +delimiter (\d) Set query delimiter. +edit (\e) Edit command with $EDITOR. +ego (\G) Send command to mysql server, display result vertically. +exit (\q) Exit mysql. Same as quit. +go (\g) Send command to mysql server. +help (\h) Display this help. +nopager (\n) Disable pager, print to stdout. +notee (\t) Don't write into outfile. +pager (\P) Set PAGER [to_pager]. Print the query results via PAGER. +print (\p) Print current command. +prompt (\R) Change your mysql prompt. +quit (\q) Quit mysql. +rehash (\#) Rebuild completion hash. +source (\.) Execute an SQL script file. Takes a file name as an argument. +status (\s) Get status information from the server. +system (\!) Execute a system shell command. +tee (\T) Set outfile [to_outfile]. Append everything into given outfile. +use (\u) Use another database. Takes database name as argument. +charset_name(\C) Switch to another charset. Might be needed for processing binlog. diff --git a/mysql-test/t/bug20328.test b/mysql-test/t/bug20328.test new file mode 100644 index 00000000000..6ae4717de9c --- /dev/null +++ b/mysql-test/t/bug20328.test @@ -0,0 +1,9 @@ +# This test should work in embedded server after we fix mysqltest +-- source include/not_embedded.inc + +# +# Bug #20328: mysql client interprets commands in comments +# +--exec echo 'help' | $MYSQL +--exec echo 'help ' | $MYSQL + diff --git a/mysql-test/t/grant2.test b/mysql-test/t/grant2.test index 79ea7f70712..9da95cd42da 100644 --- a/mysql-test/t/grant2.test +++ b/mysql-test/t/grant2.test @@ -238,5 +238,22 @@ connect (con9,127.0.0.1,root,,test,$MASTER_MYPORT,); disconnect con9; connection default; +# +# Bug# 16180 - Setting SQL_LOG_OFF without SUPER privilege is silently ignored +# +create database mysqltest_1; +grant select, insert, update on `mysqltest\_1`.* to mysqltest_1@localhost; +connect (con10,localhost,mysqltest_1,,); +connection con10; +--error 1227 +set sql_log_off = 1; +--error 1227 +set sql_log_bin = 0; +disconnect con10; +connection default; +delete from mysql.user where user like 'mysqltest\_1'; +delete from mysql.db where user like 'mysqltest\_1'; +drop database mysqltest_1; +flush privileges; # End of 4.1 tests diff --git a/mysql-test/t/heap_btree.test b/mysql-test/t/heap_btree.test index aea9e9486e5..f510f97fe9b 100644 --- a/mysql-test/t/heap_btree.test +++ b/mysql-test/t/heap_btree.test @@ -164,4 +164,22 @@ DELETE from t1 where a < 100; SELECT * from t1; DROP TABLE t1; -# End of 4.1 tests +# +# Bug #9719: problem with delete +# + +create table t1(a int not null, key using btree(a)) engine=heap; +insert into t1 values (2), (2), (2), (1), (1), (3), (3), (3), (3); +select a from t1 where a > 2; +delete from t1 where a < 4; +select a from t1; +insert into t1 values (2), (2), (2), (1), (1), (3), (3), (3), (3); +select a from t1 where a > 4; +delete from t1 where a > 4; +select a from t1; +select a from t1 where a > 3; +delete from t1 where a >= 2; +select a from t1; +drop table t1; + +--echo End of 4.1 tests diff --git a/mysql-test/t/mysql_client.test b/mysql-test/t/mysql_client.test index e4b6658b631..9cdf5aea64b 100644 --- a/mysql-test/t/mysql_client.test +++ b/mysql-test/t/mysql_client.test @@ -27,3 +27,9 @@ # client comment recognized, but parameter missing => error --exec echo "use" > $MYSQLTEST_VARDIR/tmp/bug20432.sql --exec $MYSQL < $MYSQLTEST_VARDIR/tmp/bug20432.sql 2>&1 + +# +# Bug #20328: mysql client interprets commands in comments +# +--exec echo 'help' | $MYSQL +--exec echo 'help ' | $MYSQL diff --git a/scripts/fill_func_tables.sh b/scripts/fill_func_tables.sh index 459afee2fe1..b7bd3736392 100644 --- a/scripts/fill_func_tables.sh +++ b/scripts/fill_func_tables.sh @@ -1,7 +1,12 @@ -#!/usr/bin/perl +#!@PERL@ +# +# Copyright (C) 2003 MySQL AB +# For a more info consult the file COPYRIGHT distributed with this file. +# # fill_func_tables - parse ../Docs/manual.texi - -# Original version by vva +# +# Original version by Victor Vagin +# my $cat_name= ""; my $func_name= ""; diff --git a/scripts/mysql_install_db.sh b/scripts/mysql_install_db.sh index 5c2bca9a393..56a432db741 100644 --- a/scripts/mysql_install_db.sh +++ b/scripts/mysql_install_db.sh @@ -1,4 +1,3 @@ - #!/bin/sh # Copyright (C) 2002-2003 MySQL AB # For a more info consult the file COPYRIGHT distributed with this file. diff --git a/sql/set_var.cc b/sql/set_var.cc index a665a6dc3aa..1d994f1c98f 100644 --- a/sql/set_var.cc +++ b/sql/set_var.cc @@ -424,7 +424,8 @@ static sys_var_thd_bit sys_sql_big_tables("sql_big_tables", 0, static sys_var_thd_bit sys_big_selects("sql_big_selects", 0, set_option_bit, OPTION_BIG_SELECTS); -static sys_var_thd_bit sys_log_off("sql_log_off", 0, +static sys_var_thd_bit sys_log_off("sql_log_off", + check_log_update, set_option_bit, OPTION_LOG_OFF); static sys_var_thd_bit sys_log_update("sql_log_update",