Commit eb053e70 authored by unknown's avatar unknown

Added documentation.


Docs/manual.texi:
  Added documentation about new pager and tee features in mysql
  client. Added an example about the vertical output.
client/mysql.cc:
  Small documentation changes.
parent c7ea0ab1
...@@ -27959,8 +27959,8 @@ Debug log. Default is 'd:t:o,/tmp/mysql.trace' ...@@ -27959,8 +27959,8 @@ Debug log. Default is 'd:t:o,/tmp/mysql.trace'
@item -D, --database=.. @item -D, --database=..
Database to use; This is mainly useful in the @code{my.cnf} file. Database to use; This is mainly useful in the @code{my.cnf} file.
@cindex default character set option @cindex default character set option
@item @item --default-character-set=...
--default-character-set=... Set the default character set. Set the default character set.
@cindex execute option @cindex execute option
@item -e, --execute=... @item -e, --execute=...
Execute command and quit. (Output like with --batch) Execute command and quit. (Output like with --batch)
...@@ -27995,6 +27995,12 @@ Produce HTML output. ...@@ -27995,6 +27995,12 @@ Produce HTML output.
@item -L, --skip-line-numbers @item -L, --skip-line-numbers
Don't write line number for errors. Useful when one want's to compare result Don't write line number for errors. Useful when one want's to compare result
files that includes error messages files that includes error messages
@cindex no pager option
@item --no-pager
Disable pager and print to stdout. See interactive help (\h) also.
@cindex no tee option
@item --no-tee
Disable outfile. See interactive help (\h) also.
@cindex unbuffered option. @cindex unbuffered option.
@item -n, --unbuffered @item -n, --unbuffered
Flush buffer after each query. Flush buffer after each query.
...@@ -28008,7 +28014,11 @@ Give a variable a value. @code{--help} lists variables. ...@@ -28008,7 +28014,11 @@ Give a variable a value. @code{--help} lists variables.
@item -o, --one-database @item -o, --one-database
Only update the default database. This is useful for skipping updates to Only update the default database. This is useful for skipping updates to
other database in the update log. other database in the update log.
@item @cindex pager option
@item --pager[=...]
Output type. Default is 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 works only in UNIX.
@cindex password option @cindex password option
@item -p[password], --password[=...] @item -p[password], --password[=...]
Password to use when connecting to server. If password is not given on Password to use when connecting to server. If password is not given on
...@@ -28034,6 +28044,10 @@ Socket file to use for connection. ...@@ -28034,6 +28044,10 @@ Socket file to use for connection.
Output in table format. This is default in non-batch mode. Output in table format. This is default in non-batch mode.
@item -T, --debug-info @item -T, --debug-info
Print some debug info at exit. Print some debug info at exit.
@cindex tee option
@item --tee=...
Append everything into outfile. See interactive help (\h) also. Does not
work in batch mode.
@cindex user option @cindex user option
@item -u, --user=# @item -u, --user=#
User for login if not current user. User for login if not current user.
...@@ -28061,21 +28075,27 @@ commands that it supports: ...@@ -28061,21 +28075,27 @@ commands that it supports:
mysql> help mysql> help
MySQL commands: MySQL commands:
help (\h) Display this text help (\h) Display this text.
? (\h) Synonym for `help' ? (\h) Synonym for `help'.
clear (\c) Clear command clear (\c) Clear command.
connect (\r) Reconnect to the server. Optional arguments are db and host connect (\r) Reconnect to the server. Optional arguments are db and host.
edit (\e) Edit command with $EDITOR edit (\e) Edit command with $EDITOR.
exit (\q) Exit mysql. Same as quit ego (\G) Send command to mysql server, display result vertically.
go (\g) Send command to mysql server exit (\q) Exit mysql. Same as quit.
ego (\G) Send command to mysql server; Display result vertically go (\g) Send command to mysql server.
print (\p) Print current command nopager (\n) Disable pager, print to stdout.
quit (\q) Quit mysql notee (\t) Don't write into outfile.
rehash (\#) Rebuild completion hash pager (\P) Set PAGER [to_pager]. Print the query results via PAGER.
source (\.) Execute a SQL script file. Takes a file name as an argument print (\p) Print current command.
status (\s) Get status information from the server quit (\q) Quit mysql.
use (\u) Use another database. Takes database name as argument rehash (\#) Rebuild completion hash.
@end example source (\.) Execute a SQL script file. Takes a file name as an argument.
status (\s) Get status information from the server.
tee (\T) Set outfile [to_outfile]. Append everything into given outfile.
use (\u) Use another database. Takes database name as argument.
@end example
From the above, pager only works in UNIX.
@cindex status command @cindex status command
The @code{status} command gives you some information about the The @code{status} command gives you some information about the
...@@ -28115,6 +28135,71 @@ All big results are automatically limited to @code{#select_limit#} rows. ...@@ -28115,6 +28135,71 @@ All big results are automatically limited to @code{#select_limit#} rows.
@code{#max_join_size} row combinations will be aborted. @code{#max_join_size} row combinations will be aborted.
@end itemize @end itemize
Some useful hints about the @code{mysql} client:
Some data is much more readable when displayed vertically, instead of
the usual horizontal box type output. For example longer text, which
includes new lines, is often much easier to be read with vertical
output.
@example
mysql> select * from mails where length(txt) < 300 limit 300,1\G
*************************** 1. row ***************************
msg_nro: 3068
date: 2000-03-01 23:29:50
time_zone: +0200
mail_from: Michael Widenius <monty@monty.pp.sci.fi>
reply: monty@mysql.com
mail_to: "Thimble Smith" <tim@mysql.com>
cc: mysql_all@mysql.com
sbj: UTF-8
txt: >>>>> "Thimble" == Thimble Smith <tim@mysql.com> writes:
Thimble> Hi. I think this is a good idea. Is anyone familiar with UTF-8
Thimble> or Unicode? Otherwise I'll put this on my TODO list and see what
Thimble> happens.
Yes, please do that.
Regards,
Monty
file: inbox-jani-1
hash: 190402944
1 row in set (0.09 sec)
mysql>
@end example
For logging, one can use the @code{tee} option. The @code{tee} can be
started with option @code{--tee=...}, or from the command line
interactively with command @code{tee}. All the data displayed on the
screen will also be appended into a given file. This can be very useful
for debugging purposes also. The @code{tee} can be disabled from the
command line with command @code{notee}. Executing @code{tee} again
starts logging again. Without a parameter the previous file will be
used. Note that @code{tee} will flush the results into the file after
each command, just before the command line appears again waiting for the
next command.
Browsing, or searching the results in the interactive mode in UNIX less,
more, or any other similar program, is now possible with option
@code{--pager[=...]}. Without argument, @code{mysql} client will look
for environment variable PAGER and set @code{pager} to that.
@code{pager} can be started from the interactive command line with
command @code{pager} and disabled with command @code{nopager}. The
command takes an argument optionally and the @code{pager} will be set to
that. Command @code{pager} can be called without an argument, but this
requires that the option @code{--pager} was used, or the @code{pager}
will default to stdout. @code{pager} works only in UNIX, since it uses
the popen() function, which doesn't exist in Windows. In Windows, the
@code{tee} option can be used instead, although it may not be as handy
as @code{pager} can be in some situations.
You can even combine the two functions above; have the @code{tee}
enabled, @code{pager} set to 'less' and you will be able to browse the
results in unix 'less' and still have everything appended into a file
the same time.
@cindex administration, server @cindex administration, server
@cindex server administration @cindex server administration
@cindex @code{mysladmn} @cindex @code{mysladmn}
...@@ -109,7 +109,7 @@ static HashTable ht; ...@@ -109,7 +109,7 @@ static HashTable ht;
enum enum_info_type { INFO_INFO,INFO_ERROR,INFO_RESULT}; enum enum_info_type { INFO_INFO,INFO_ERROR,INFO_RESULT};
typedef enum enum_info_type INFO_TYPE; typedef enum enum_info_type INFO_TYPE;
const char *VER="11.5"; const char *VER="11.6";
static MYSQL mysql; /* The connection */ static MYSQL mysql; /* The connection */
static bool info_flag=0,ignore_errors=0,wait_flag=0,quick=0, static bool info_flag=0,ignore_errors=0,wait_flag=0,quick=0,
...@@ -496,14 +496,12 @@ static void usage(int version) ...@@ -496,14 +496,12 @@ static void usage(int version)
Give a variable an value. --help lists variables.\n\ Give a variable an value. --help lists variables.\n\
-o, --one-database Only update the default database. This is useful\n\ -o, --one-database Only update the default database. This is useful\n\
for skipping updates to other database in the update\n\ for skipping updates to other database in the update\n\
log.\n\ log.\n");
--tee=... Append everything into outfile. See interactive help\n\
(\\h) also. Does not work in batch mode.\n");
#ifndef __WIN__ #ifndef __WIN__
printf("\ printf("\
--pager[=...] Output type. Default is your ENV variable PAGER.\n\ --pager[=...] Output type. Default is your ENV variable PAGER.\n\
Valid pagers are less, more, cat [> filename], etc.\n\ Valid pagers are less, more, cat [> filename], etc.\n\
See interactive help (\\h) also. This options does\n\ See interactive help (\\h) also. This option does\n\
not work in batch mode.\n"); not work in batch mode.\n");
#endif #endif
printf("\ printf("\
...@@ -524,7 +522,9 @@ static void usage(int version) ...@@ -524,7 +522,9 @@ static void usage(int version)
#include "sslopt-usage.h" #include "sslopt-usage.h"
printf("\ printf("\
-t --table Output in table format.\n\ -t --table Output in table format.\n\
-T, --debug-info Print some debug info at exit.\n"); -T, --debug-info Print some debug info at exit.\n\
--tee=... Append everything into outfile. See interactive help\n\
(\\h) also. Does not work in batch mode.\n");
#ifndef DONT_ALLOW_USER_CHANGE #ifndef DONT_ALLOW_USER_CHANGE
printf("\ printf("\
-u, --user=# User for login if not current user.\n"); -u, --user=# User for login if not current user.\n");
...@@ -1760,7 +1760,7 @@ com_pager(String *buffer, char *line __attribute__((unused))) ...@@ -1760,7 +1760,7 @@ com_pager(String *buffer, char *line __attribute__((unused)))
{ {
if (!strlen(default_pager)) if (!strlen(default_pager))
{ {
tee_fprintf(stdout, "Default pager wasn't available, using stdout.\n"); tee_fprintf(stdout, "Default pager wasn't set, using stdout.\n");
opt_nopager=1; opt_nopager=1;
strmov(pager, "stdout"); strmov(pager, "stdout");
PAGER= stdout; PAGER= stdout;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment