sql: man-page uses consistent examples

This commit is contained in:
Ole Tange 2011-03-08 00:47:39 +01:00
parent 11b21d638c
commit 66c0168f4d
6 changed files with 38 additions and 50 deletions

20
configure vendored
View file

@ -1,6 +1,6 @@
#! /bin/sh #! /bin/sh
# Guess values for system-dependent variables and create Makefiles. # Guess values for system-dependent variables and create Makefiles.
# Generated by GNU Autoconf 2.67 for parallel 20110205. # Generated by GNU Autoconf 2.67 for parallel 20110308.
# #
# Report bugs to <bug-parallel@gnu.org>. # Report bugs to <bug-parallel@gnu.org>.
# #
@ -551,8 +551,8 @@ MAKEFLAGS=
# Identity of this package. # Identity of this package.
PACKAGE_NAME='parallel' PACKAGE_NAME='parallel'
PACKAGE_TARNAME='parallel' PACKAGE_TARNAME='parallel'
PACKAGE_VERSION='20110205' PACKAGE_VERSION='20110308'
PACKAGE_STRING='parallel 20110205' PACKAGE_STRING='parallel 20110308'
PACKAGE_BUGREPORT='bug-parallel@gnu.org' PACKAGE_BUGREPORT='bug-parallel@gnu.org'
PACKAGE_URL='' PACKAGE_URL=''
@ -1168,7 +1168,7 @@ if test "$ac_init_help" = "long"; then
# Omit some internal or obsolete options to make the list less imposing. # Omit some internal or obsolete options to make the list less imposing.
# This message is too long to be a string in the A/UX 3.1 sh. # This message is too long to be a string in the A/UX 3.1 sh.
cat <<_ACEOF cat <<_ACEOF
\`configure' configures parallel 20110205 to adapt to many kinds of systems. \`configure' configures parallel 20110308 to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]... Usage: $0 [OPTION]... [VAR=VALUE]...
@ -1234,7 +1234,7 @@ fi
if test -n "$ac_init_help"; then if test -n "$ac_init_help"; then
case $ac_init_help in case $ac_init_help in
short | recursive ) echo "Configuration of parallel 20110205:";; short | recursive ) echo "Configuration of parallel 20110308:";;
esac esac
cat <<\_ACEOF cat <<\_ACEOF
@ -1301,7 +1301,7 @@ fi
test -n "$ac_init_help" && exit $ac_status test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then if $ac_init_version; then
cat <<\_ACEOF cat <<\_ACEOF
parallel configure 20110205 parallel configure 20110308
generated by GNU Autoconf 2.67 generated by GNU Autoconf 2.67
Copyright (C) 2010 Free Software Foundation, Inc. Copyright (C) 2010 Free Software Foundation, Inc.
@ -1318,7 +1318,7 @@ cat >config.log <<_ACEOF
This file contains any messages produced by compilers while This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake. running configure, to aid debugging if configure makes a mistake.
It was created by parallel $as_me 20110205, which was It was created by parallel $as_me 20110308, which was
generated by GNU Autoconf 2.67. Invocation command line was generated by GNU Autoconf 2.67. Invocation command line was
$ $0 $@ $ $0 $@
@ -2133,7 +2133,7 @@ fi
# Define the identity of the package. # Define the identity of the package.
PACKAGE='parallel' PACKAGE='parallel'
VERSION='20110205' VERSION='20110308'
cat >>confdefs.h <<_ACEOF cat >>confdefs.h <<_ACEOF
@ -2684,7 +2684,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
# report actual input values of CONFIG_FILES etc. instead of their # report actual input values of CONFIG_FILES etc. instead of their
# values after options handling. # values after options handling.
ac_log=" ac_log="
This file was extended by parallel $as_me 20110205, which was This file was extended by parallel $as_me 20110308, which was
generated by GNU Autoconf 2.67. Invocation command line was generated by GNU Autoconf 2.67. Invocation command line was
CONFIG_FILES = $CONFIG_FILES CONFIG_FILES = $CONFIG_FILES
@ -2746,7 +2746,7 @@ _ACEOF
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
ac_cs_version="\\ ac_cs_version="\\
parallel config.status 20110205 parallel config.status 20110308
configured by $0, generated by GNU Autoconf 2.67, configured by $0, generated by GNU Autoconf 2.67,
with options \\"\$ac_cs_config\\" with options \\"\$ac_cs_config\\"

View file

@ -1,4 +1,4 @@
AC_INIT([parallel], [20110205], [bug-parallel@gnu.org]) AC_INIT([parallel], [20110308], [bug-parallel@gnu.org])
AM_INIT_AUTOMAKE([-Wall -Werror foreign]) AM_INIT_AUTOMAKE([-Wall -Werror foreign])
AC_CONFIG_HEADERS([config.h]) AC_CONFIG_HEADERS([config.h])
AC_CONFIG_FILES([ AC_CONFIG_FILES([

View file

@ -1,21 +1,5 @@
Use recsep as splitstring instead of match
my @vals = (split / /, $string)[0,2,5,7];
test if block size is too small to match a record sep in both -N mode and normal test if block size is too small to match a record sep in both -N mode and normal
--remove-rec-sep
test alternation with --recend 'a|b'
echo 12a34a45a6 | src/parallel -k --pipe --recend a -N1 --rrs 'echo -n "$PARALLEL_SEQ>"; cat; echo'
echo 12a34b45a6 | src/parallel -k --pipe --recend 'a|b' -N1 --rrs 'echo -n "$PARALLEL_SEQ>"; cat; echo'
echo 12a34b45a6 | src/parallel -k --pipe --recend 'b' -N1 --rrs 'echo -n "$PARALLEL_SEQ>"; cat; echo'
echo 12a34a45a6 | src/parallel -k --pipe --recend a --rrs 'echo -n "$PARALLEL_SEQ>"; cat; echo'
echo 12a34b45a6 | src/parallel -k --pipe --recend 'a|b' --rrs 'echo -n "$PARALLEL_SEQ>"; cat; echo'
echo 12a34b45a6 | src/parallel -k --pipe --recend 'b' --rrs 'echo -n "$PARALLEL_SEQ>"; cat; echo'
Example: Example:
Chop mbox into emails Chop mbox into emails
Parallel sort Parallel sort

View file

@ -138,7 +138,8 @@ cc:Peter Simons <simons@cryp.to>, Sandro Cazzaniga <kharec@mandriva.org>,
Rogério Brito <rbrito@ime.usp.br>, Jonathan Palardy <jonathan.palardy@gmail.com>, Rogério Brito <rbrito@ime.usp.br>, Jonathan Palardy <jonathan.palardy@gmail.com>,
Koen Vervloesem <koen@vervloesem.eu>, R. Tyler Croy <tyler@monkeypox.org>, Koen Vervloesem <koen@vervloesem.eu>, R. Tyler Croy <tyler@monkeypox.org>,
ryoichiro.suzuki@gmail.com,kerick@shiftedbit.net, ryoichiro.suzuki@gmail.com,kerick@shiftedbit.net,
Christian Faulhammer <fauli@gentoo.org>, Ryoichiro Suzuki <ryoichiro.suzuki@gmail.com> Christian Faulhammer <fauli@gentoo.org>, Ryoichiro Suzuki <ryoichiro.suzuki@gmail.com>,
Jesse Alama <jesse.alama@gmail.com>
Subject: GNU Parallel 2011XXXX released Subject: GNU Parallel 2011XXXX released
@ -166,6 +167,9 @@ New in this release:
but insert 0 arguments on the command line. Useful if you just want but insert 0 arguments on the command line. Useful if you just want
to run the same command with the same arguments a number of times. to run the same command with the same arguments a number of times.
* GNU Parallel is now in Fink. Thanks to Jesse Alama.
http://pdb.finkproject.org/pdb/package.php/parallel
* Opscode Cookbook for Chef. Thanks to Joshua Timberman. * Opscode Cookbook for Chef. Thanks to Joshua Timberman.
https://github.com/opscode/cookbooks/tree/master/gnu_parallel https://github.com/opscode/cookbooks/tree/master/gnu_parallel

View file

@ -381,7 +381,7 @@ sub get_options_from_array {
sub parse_options { sub parse_options {
# Returns: N/A # Returns: N/A
# Defaults: # Defaults:
$Global::version = 20110224; $Global::version = 20110301;
$Global::progname = 'parallel'; $Global::progname = 'parallel';
$Global::infinity = 2**31; $Global::infinity = 2**31;
$Global::debug = 0; $Global::debug = 0;

42
src/sql
View file

@ -39,16 +39,16 @@ See the section DBURL below.
The SQL commands to run. Each argument will have a newline The SQL commands to run. Each argument will have a newline
appended. appended.
Example: "SELECT 1+2;" "SELECT 'SQL';" Example: "SELECT * FROM foo;" "SELECT * FROM bar;"
If the arguments contain '\n' or '\x0a' this will be replaced with a If the arguments contain '\n' or '\x0a' this will be replaced with a
newline: newline:
Example: "SELECT 1+2;\n SELECT 'SQL';" Example: "SELECT * FROM foo;\n SELECT * FROM bar;"
If no commands are given SQL is read from the keyboard or STDIN. If no commands are given SQL is read from the keyboard or STDIN.
Example: echo 'SELECT 1+2;' | sql mysql:/// Example: echo 'SELECT * FROM foo;' | sql mysql:///
=item B<--db-size> =item B<--db-size>
@ -104,7 +104,7 @@ The string following -p will be given to the database connection
program as arguments. Multiple -p's will be joined with program as arguments. Multiple -p's will be joined with
space. Example: space. Example:
I<-p "-U username"> can also be written I<-p -U -p username>. I<-p "-U scott"> can also be written I<-p -U -p scott>.
=item B<-r> =item B<-r>
@ -153,7 +153,7 @@ GNU B<sql> can be called as a shebang (#!) command as the first line of a script
#!/usr/bin/sql -Y mysql:/// #!/usr/bin/sql -Y mysql:///
select * from users; SELECT * FROM foo;
For this to work B<--shebang> or B<-Y> must be set as the first option. For this to work B<--shebang> or B<-Y> must be set as the first option.
@ -169,12 +169,12 @@ http://tools.ietf.org/html/rfc3986#section-2.1 (E.g. a password
containing '/' would contain '%2F'). containing '/' would contain '%2F').
Examples: Examples:
mysql://user:pa55w0rd@mysqlserver/database mysql://scott:tiger@my.example.com/mydb
sql:oracle://scott:tiger@oracleserver/xe sql:oracle://scott:tiger@ora.example.com/xe
postgresql://user:pa55w0rd@pg.example.com/db postgresql://scott:tiger@pg.example.com/pgdb
pg:/// pg:///
sql:sqlite2:////tmp/db.sqlite?select * from foo; sql:sqlite2:////tmp/db.sqlite?SELECT * FROM foo;
sqlite3:///../db.sqlite3?select%20*%20from%20foo; sqlite3:///../db.sqlite3?SELECT%20*%20FROM%20foo;
Currently supported vendors: MySQL (mysql), MySQL with SSL (mysqls, Currently supported vendors: MySQL (mysql), MySQL with SSL (mysqls,
mysqlssl), Oracle (oracle, ora), PostgreSQL (postgresql, pg, pgsql, mysqlssl), Oracle (oracle, ora), PostgreSQL (postgresql, pg, pgsql,
@ -188,8 +188,8 @@ Aliases must start with ':' and are read from
Example of aliases: Example of aliases:
:myalias1 pg://user:pa55w0rd@pg.example.com/db :myalias1 pg://scott:tiger@pg.example.com/pgdb
:myalias2 ora://scott:tiger@ora1.example.com/xe :myalias2 ora://scott:tiger@ora.example.com/xe
# Short form of mysql://`whoami`:nopassword@localhost:3306/`whoami` # Short form of mysql://`whoami`:nopassword@localhost:3306/`whoami`
:myalias3 mysql:/// :myalias3 mysql:///
# Short form of mysql://`whoami`:nopassword@localhost:33333/mydb # Short form of mysql://`whoami`:nopassword@localhost:33333/mydb
@ -197,9 +197,9 @@ Example of aliases:
# Alias for an alias # Alias for an alias
:m :myalias4 :m :myalias4
# the sortest alias possible # the sortest alias possible
: sqlite2:////tmp/mydefault.sqlite : sqlite2:////tmp/db.sqlite
# Including an SQL query # Including an SQL query
:query sqlite:////tmp/file.sqlite?SELECT * FROM foo; :query sqlite:////tmp/db.sqlite?SELECT * FROM foo;
=head1 EXAMPLES =head1 EXAMPLES
@ -207,7 +207,7 @@ Example of aliases:
The most basic use of GNU B<sql> is to get an interactive prompt: The most basic use of GNU B<sql> is to get an interactive prompt:
B<sql sql:oracle://scott:tiger@oracleserver/xe> B<sql sql:oracle://scott:tiger@ora.example.com/xe>
If you have setup an alias you can do: If you have setup an alias you can do:
@ -218,16 +218,16 @@ B<sql :myora>
To run a query directly from the command line: To run a query directly from the command line:
B<sql :myalias "DELETE FROM users WHERE name LIKE '%tange%';"> B<sql :myalias "SELECT * FROM foo;">
Oracle requires newlines after each statement. This can be done like Oracle requires newlines after each statement. This can be done like
this: this:
B<sql :myora "SELECT 1 FROM dual;" "SELECT 2 FROM dual;"> B<sql :myora "SELECT * FROM foo;" "SELECT * FROM bar;">
Or this: Or this:
B<sql :myora "SELECT 1 FROM dual;\nSELECT 2 FROM dual;"> B<sql :myora "SELECT * FROM foo;\nSELECT * FROM bar;">
=head2 Copy a PostgreSQL database =head2 Copy a PostgreSQL database
@ -235,7 +235,7 @@ B<sql :myora "SELECT 1 FROM dual;\nSELECT 2 FROM dual;">
To copy a PostgreSQL database use pg_dump to generate the dump and GNU To copy a PostgreSQL database use pg_dump to generate the dump and GNU
B<sql> to import it: B<sql> to import it:
B<pg_dump my_database | sql pg://user:pass@pgserver/my_new_db> B<pg_dump pg_database | sql pg://scott:tiger@pg.example.com/pgdb>
=head2 Empty all tables in a MySQL database =head2 Empty all tables in a MySQL database
@ -263,7 +263,7 @@ UNIX-script. Create a script called I<demosql>:
B<#!/usr/bin/sql -Y mysql:///> B<#!/usr/bin/sql -Y mysql:///>
B<SELECT * FROM users;> B<SELECT * FROM foo;>
Then do: Then do:
@ -274,7 +274,7 @@ B<chmod 755 demosql; ./demosql>
Use GNU B<parallel>'s B<--colsep> to separate columns: Use GNU B<parallel>'s B<--colsep> to separate columns:
B<sql -s '\t' :mydburl 'SELECT * FROM bar;' | parallel --colsep '\t' do_stuff {4} {1}> B<sql -s '\t' :mydburl 'SELECT * FROM foo;' | parallel --colsep '\t' do_stuff {4} {1}>
=head2 Retry if the connection fails =head2 Retry if the connection fails