MAN page from Mandrake Other mysql-DBI-perl-bin-1.825-1.i386.rpm
PMYSQL
Section: User Contributed Perl Documentation (1)
Updated: perl 5.004, patch 04
Index NAME
pmsql, pmysql - interactive shells with readline for msql and mysql
SYNOPSIS
pmsql [-h host] [database]or
pmysql [-h host] [database]
DESCRIPTION
pmsql and pmysql let you talk to a running msql or mysql daemon sendingeither SQL queries or relshow (mysqlshow) commands. The output isformatted much in the same way as by the msql or mysql monitor (see below),the msqlexport command and the relshow (mysqlshow) program, which arecoming with msql or mysql. The additional capability is a connection to areadline interface (if available) and a pipe to your favorite pager.Additionally you may switch between hosts and databases within one sessionand you don't have to type the nasty
\g or
; (a trailing
\g,
\q,and
\p will be ignored).
If a command starts with one of the following reserved words, it'streated specially, otherwise it is passed on verbatim to the mSQLor mysql daemon. Output from the daemon is piped to your pager specified byeither the PMSQL_PAGER (PMYSQL_PAGER) or the PAGER environment variable. Ifboth are undefined, the PATH is searched for either ``less'' or ``more'' and thefirst program found is taken. If no pager can be determined, or your pagervariable contains the word stdout, the program writes to unfiltered STDOUT.
- ?
- print usage summary and current host and database
- da[tabase] database
- Set default database to ``database''
- e[scape]
- Set the escape character which is used when fancy mode is off.Defaults to ".
- f[ancy] on|off
- Set the output format of SELECT commands, default is on. A value ofoff will create output suitable for export to other database systems.The non-fancy output format is configurable with the commands escape,quote and separator, the default is well suited for import intoMicrosoft Ecxel.
- ho[st] host
- Set default host to ``host''
- q[uit]
- Leave pmsql or pymsql
- quo[te]
- Set the quote character which is used when fancy mode is off.Defaults to ".
- re[lshow] [-h host] [database] [table] [index]
- Describe databases or tables in the same way as done by the relshow(mysqlshow) program. If host or database are specified, the defaultsare set to these values. The prameter index is only supported formSQL-2.0.
- s[eparator]
- Set the quote character which is used when fancy mode is off.Defaults to ,.
- ! EXPR
- Eval the EXPR in perl
Global Variable
The global variable $Q is used for the statement handle of thecurrent query. You can use this variable in eval statements.
There's no global variable for the database connection, because weconnect to the database for each command separately.
Completion
pmsql and pmysql come with some basic completion definitions that arefar from being perfect. Completion means, you can use the TAB characterto run some lookup routines on the current host or database and use theresults to save a few keystrokes.
The completion mechanism is very basic, and I'm not intending torefine it in the near future. Feel free to implement your ownrefinements and let me know, if you have something better than what wehave here.
BUGS
pmsql and pmysql are not an msql and mysql clones. If you use it assuch for bulk uploads into the database, you will notice an enourmousdisadvantage in performance. The reason is that pmsql and pmysqlintentionally disconnect from the database after every query.
SEE ALSO
You need a readline package installed to get the advantage of areadline interface. If you don't have it, you won't be able to use thearrow keys in a meaningful manner. Term::ReadKey and Term::ReadLine donot come with the perl distribution but are available from CPAN (see
http://www.perl.com/CPAN).See Msql, Mysql, Term::ReadKey, Term::ReadLine.
Index
- NAME
- SYNOPSIS
- DESCRIPTION
- BUGS
- SEE ALSO
This document was created byman2html,using the manual pages.