sql: Added --verbose.

This commit is contained in:
Ole Tange 2014-05-22 14:25:57 +02:00
parent 7a018602da
commit b7b5725f6d

11
src/sql
View file

@ -152,6 +152,13 @@ when called with B<--shebang>).
Size of tables. Show the size of the tables in the database. Size of tables. Show the size of the tables in the database.
=item B<--verbose>
=item B<-v>
Print which command is sent.
=item B<--version> =item B<--version>
=item B<-V> =item B<-V>
@ -533,6 +540,7 @@ if($dburl{'query'}) {
do { do {
if(@ARGV) { if(@ARGV) {
$::opt_debug and print "$batch_command\n"; $::opt_debug and print "$batch_command\n";
$::opt_verbose and print "$batch_command\n";
open(M,"| $batch_command") || die("mysql/psql/sqlplus not in path"); open(M,"| $batch_command") || die("mysql/psql/sqlplus not in path");
for(@ARGV) { for(@ARGV) {
s/\\n/\n/g; s/\\n/\n/g;
@ -542,9 +550,11 @@ do {
close M; close M;
} elsif (is_stdin_terminal()) { } elsif (is_stdin_terminal()) {
$::opt_debug and print "$interactive_command\n"; $::opt_debug and print "$interactive_command\n";
$::opt_verbose and print "$interactive_command\n";
system("$interactive_command"); system("$interactive_command");
} else { } else {
$::opt_debug and print "$batch_command\n"; $::opt_debug and print "$batch_command\n";
$::opt_verbose and print "$batch_command\n";
system("$batch_command"); system("$batch_command");
} }
$err = $?>>8; $err = $?>>8;
@ -593,6 +603,7 @@ sub parse_options {
# GNU requirements # GNU requirements
"help|h" => \$::opt_help, "help|h" => \$::opt_help,
"version|V" => \$::opt_version, "version|V" => \$::opt_version,
"verbose|v" => \$::opt_verbose,
) || die_usage(); ) || die_usage();
if(defined $::opt_help) { die_usage(); } if(defined $::opt_help) { die_usage(); }