mirror of
https://git.savannah.gnu.org/git/parallel.git
synced 2024-12-22 20:57:53 +00:00
sql: --list-tables for sqlite incl test.
This commit is contained in:
parent
17bbcfff1f
commit
8e8ffb898f
|
@ -208,6 +208,9 @@ available for download at: http://ftp.gnu.org/gnu/parallel/
|
|||
|
||||
New in this release:
|
||||
|
||||
* Parallel xz compression
|
||||
http://anthon.home.xs4all.nl/rants/2013/parallel_xz/
|
||||
|
||||
* Got CPUs to burn? Put 'em to work with GNU parallel
|
||||
http://baoilleach.blogspot.dk/2013/11/got-cpus-to-burn-put-em-to-work-with.html
|
||||
|
||||
|
|
13
src/parallel
13
src/parallel
|
@ -103,9 +103,13 @@ if($opt::header and not $opt::pipe) {
|
|||
}
|
||||
}
|
||||
|
||||
# Parallel check for all hosts are up
|
||||
#if(not $opt::plain and (@opt::sshlogin or @opt::sshloginfile)) {
|
||||
|
||||
if($opt::filter_hosts and (@opt::sshlogin or @opt::sshloginfile)) {
|
||||
# Parallel check all hosts are up. Remove hosts that are down
|
||||
filter_hosts();
|
||||
}
|
||||
|
||||
sub filter_hosts {
|
||||
my(@cores, @cpus, @maxline, @echo);
|
||||
while (my ($host, $sshlogin) = each %Global::host) {
|
||||
# The 'true' is used to get the $host out later
|
||||
|
@ -119,6 +123,11 @@ if($opt::filter_hosts and (@opt::sshlogin or @opt::sshloginfile)) {
|
|||
my ($fh, $tmpfile) = ::tempfile(SUFFIX => ".ssh");
|
||||
print $fh @cores, @cpus, @maxline, @echo;
|
||||
close $fh;
|
||||
# --timeout 5: Setting up an SSH connection and running a simple
|
||||
# command should never take > 5 sec.
|
||||
# --delay 0.1: If multiple sshlogins use the same proxy the delay
|
||||
# will make it less likely to overload the ssh daemon.
|
||||
# --retries 3: If the ssh daemon it overloaded, try 3 times
|
||||
my $cmd = "cat $tmpfile | $0 -j0 --timeout 5 -s 1000 --joblog - --plain --delay 0.1 --retries 3 --tag --tagstring {1} --colsep '\t' -k eval {2} 2>/dev/null";
|
||||
::debug($cmd."\n");
|
||||
open(my $host_fh, "-|", $cmd) || ::die_bug("parallel host check: $cmd");
|
||||
|
|
3
src/sql
3
src/sql
|
@ -556,7 +556,7 @@ $Global::Initfile && unlink $Global::Initfile;
|
|||
exit ($err);
|
||||
|
||||
sub parse_options {
|
||||
$Global::version = 20131122;
|
||||
$Global::version = 20131130;
|
||||
$Global::progname = 'sql';
|
||||
|
||||
# This must be done first as this may exec myself
|
||||
|
@ -783,6 +783,7 @@ sub tablelist {
|
|||
("mysql" => "show tables;",
|
||||
"postgresql" => '\dt',
|
||||
"oracle" => ("SELECT object_name FROM user_objects WHERE object_type = 'TABLE';"),
|
||||
"sqlite" => ".tables",
|
||||
"sqlite3" => ".tables",
|
||||
);
|
||||
if($statement{$dbdriver}) {
|
||||
|
|
BIN
src/sql.pdf
BIN
src/sql.pdf
Binary file not shown.
|
@ -7,6 +7,7 @@ for CMDSQL in sqlite sqlite3 ; do
|
|||
rm -f sqltest.$CMDSQL
|
||||
# create database & table
|
||||
sql $CMDSQL:///sqltest.$CMDSQL "CREATE TABLE foo(n INT, t TEXT);"
|
||||
sql --list-tables $CMDSQL:///sqltest.$CMDSQL
|
||||
file sqltest.$CMDSQL
|
||||
sql $CMDSQL:///sqltest.$CMDSQL "INSERT INTO foo VALUES(1,'Line 1');"
|
||||
sql $CMDSQL:///sqltest.$CMDSQL "INSERT INTO foo VALUES(2,'Line 2');"
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
### Test of sqlite
|
||||
Current command: sqlite
|
||||
foo
|
||||
sqltest.sqlite: SQLite 2.x database
|
||||
n|t
|
||||
1|Line 1
|
||||
|
@ -35,6 +36,7 @@ bytes
|
|||
bytes
|
||||
3072
|
||||
Current command: sqlite3
|
||||
foo
|
||||
sqltest.sqlite3: SQLite 3.x database
|
||||
n|t
|
||||
1|Line 1
|
||||
|
|
Loading…
Reference in a new issue