summaryrefslogtreecommitdiff
path: root/client
diff options
context:
space:
mode:
authorunknown <jcole@ham.spaceapes.com>2000-08-30 03:05:13 +0000
committerunknown <jcole@ham.spaceapes.com>2000-08-30 03:05:13 +0000
commit1f340779b08777e73876d5f790c304c8b959fb85 (patch)
treef620b529658627cc03b59079025ea123345055f5 /client
parent542e7e5707483fc8eb1b11bc0e189531c6c55e19 (diff)
parenta6ec1f09b09f03652d6ab00b2a6632979825ffa3 (diff)
downloadmariadb-git-1f340779b08777e73876d5f790c304c8b959fb85.tar.gz
Merge jcole@work.mysql.com:/home/bk/mysql
into ham.spaceapes.com:/usr/home/jcole/bk/mysql Docs/manual.texi: Auto merged
Diffstat (limited to 'client')
-rw-r--r--client/mysql.cc33
-rw-r--r--client/mysqlimport.c3
2 files changed, 23 insertions, 13 deletions
diff --git a/client/mysql.cc b/client/mysql.cc
index 987f70dee5d..1353e0daeb8 100644
--- a/client/mysql.cc
+++ b/client/mysql.cc
@@ -114,7 +114,7 @@ static bool info_flag=0,ignore_errors=0,wait_flag=0,quick=0,
no_rehash=0,skip_updates=0,safe_updates=0,one_database=0,
opt_compress=0,
vertical=0,skip_line_numbers=0,skip_column_names=0,opt_html=0,
- no_named_cmds=0;
+ no_named_cmds=1; // we want this to be the default
static uint verbose=0,opt_silent=0,opt_mysql_port=0;
static my_string opt_mysql_unix_port=0;
static int connect_flag=CLIENT_INTERACTIVE;
@@ -160,7 +160,7 @@ typedef struct {
static COMMANDS commands[] = {
{ "help", 'h', com_help, 0, "Display this text" },
- { "?", 'h', com_help, 0, "Synonym for `help'" },
+ { "?", '?', com_help, 0, "Synonym for `help'" },
{ "clear", 'c', com_clear, 0, "Clear command"},
{ "connect",'r', com_connect,1,
"Reconnect to the server. Optional arguments are db and host" },
@@ -300,7 +300,7 @@ int main(int argc,char *argv[])
}
}
#endif
- sprintf(buff, "Type '%s' for help.\n", no_named_cmds ? "\\h" : "help");
+ sprintf(buff, "Type 'help;' or '\\h' for help.\n");
put_info(buff,INFO_INFO);
status.exit_status=read_lines(1); // read lines and execute them
mysql_end(0);
@@ -352,6 +352,7 @@ static struct option long_options[] =
{"database", required_argument, 0, 'D'},
{"debug-info", no_argument, 0, 'T'},
{"default-character-set", required_argument, 0, OPT_DEFAULT_CHARSET},
+ {"enable-named-commands", no_argument, 0, 'G'},
{"execute", required_argument, 0, 'e'},
{"force", no_argument, 0, 'f'},
{"help", no_argument, 0, '?'},
@@ -401,7 +402,7 @@ CHANGEABLE_VAR changeable_vars[] = {
static void usage(int version)
{
- printf("%s Ver 10.8 Distrib %s, for %s (%s)\n",
+ printf("%s Ver 10.11 Distrib %s, for %s (%s)\n",
my_progname, MYSQL_SERVER_VERSION, SYSTEM_TYPE, MACHINE_TYPE);
if (version)
return;
@@ -426,11 +427,18 @@ static void usage(int version)
-D, --database=.. Database to use.\n\
--default-character-set=...\n\
Set the default character set.\n\
+ -G, --enable-named-commands\n\
+ Named commands are enabled. Opposite to -g.\n\
-e, --execute=... Execute command and quit. (Output like with --batch)\n\
-E, --vertical Print the output of a query (rows) vertically.\n\
-f, --force Continue even if we get an sql error.\n\
-g, --no-named-commands\n\
- Named commands are disabled. Use \\* form only.\n\
+ Named commands are disabled. Use \\* form only, or\n\
+ use named commands only in the beginning of a line\n\
+ ending with a semicolon (;) Since version 10.9 the\n\
+ client now starts with this option ENABLED by\n\
+ default! Disable with '-G'. Long format commands\n\
+ still work from the first line.\n\
-i, --ignore-space Ignore space after function names.\n\
-h, --host=... Connect to host.\n\
-H, --html Produce HTML output.\n\
@@ -486,7 +494,7 @@ static int get_options(int argc, char **argv)
bool tty_password=0;
set_all_changeable_vars(changeable_vars);
- while ((c=getopt_long(argc,argv,"?ABCD:LfgHinNoqrstTUvVwWEe:h:O:P:S:u:#::p::",
+ while ((c=getopt_long(argc,argv,"?ABCD:LfgGHinNoqrstTUvVwWEe:h:O:P:S:u:#::p::",
long_options, &option_index)) != EOF)
{
switch(c) {
@@ -565,6 +573,7 @@ static int get_options(int argc, char **argv)
case 'E': vertical=1; break;
case 'w': wait_flag=1; break;
case 'A': no_rehash=1; break;
+ case 'G': no_named_cmds=0; break;
case 'g': no_named_cmds=1; break;
case 'H': opt_html=1; break;
case 'i': connect_flag|= CLIENT_IGNORE_SPACE; break;
@@ -682,12 +691,12 @@ static int read_lines(bool execute_commands)
if (!in_string && (line[0] == '#' ||
(line[0] == '-' && line[1] == '-') ||
line[0] == 0))
- continue; // Skipp comment lines
+ continue; // Skip comment lines
/* Check if line is a mysql command line */
/* (We want to allow help, print and clear anywhere at line start */
- if (execute_commands && !no_named_cmds && !in_string &&
- (com=find_command(line,0)))
+ if (execute_commands && (!no_named_cmds || glob_buffer.is_empty())
+ && !in_string && (com=find_command(line,0)))
{
if ((*com->func)(&glob_buffer,line) > 0)
break;
@@ -1171,11 +1180,13 @@ com_help (String *buffer __attribute__((unused)),
reg1 int i;
put_info("\nMySQL commands:",INFO_INFO);
+ if (no_named_cmds)
+ put_info("Note that all text commands must be first on line and end with ';'",INFO_INFO);
for (i = 0; commands[i].name; i++)
{
if (commands[i].func)
- printf("%s\t(\\%c)\t%s\n", commands[i].name,commands[i].cmd_char,
- commands[i].doc);
+ printf("%s\t(\\%c)\t%s\n", commands[i].name,
+ commands[i].cmd_char, commands[i].doc);
}
if (connected)
printf("\nConnection id: %ld (Can be used with mysqladmin kill)\n\n",
diff --git a/client/mysqlimport.c b/client/mysqlimport.c
index 0a69f18c176..596b68591b7 100644
--- a/client/mysqlimport.c
+++ b/client/mysqlimport.c
@@ -25,7 +25,7 @@
** * *
** *************************
*/
-#define IMPORT_VERSION "2.3"
+#define IMPORT_VERSION "2.4"
#include <global.h>
#include <my_sys.h>
@@ -514,7 +514,6 @@ int main(int argc, char **argv)
exitcode = error;
db_disconnect(current_host, sock);
my_free(password,MYF(MY_ALLOW_ZERO_PTR));
- my_free(current_user,MYF(MY_ALLOW_ZERO_PTR));
free_defaults(argv_to_free);
my_end(0);
return(exitcode);