mirror of
https://git.savannah.gnu.org/git/parallel.git
synced 2024-11-22 22:17:54 +00:00
parallel: --sqlmaster +DBURL works with different commands.
This commit is contained in:
parent
84f4a855a5
commit
0d9812ddb4
35
src/parallel
35
src/parallel
|
@ -1259,7 +1259,7 @@ sub check_invalid_option_combinations {
|
||||||
|
|
||||||
sub init_globals {
|
sub init_globals {
|
||||||
# Defaults:
|
# Defaults:
|
||||||
$Global::version = 20170101;
|
$Global::version = 20170111;
|
||||||
$Global::progname = 'parallel';
|
$Global::progname = 'parallel';
|
||||||
$Global::infinity = 2**31;
|
$Global::infinity = 2**31;
|
||||||
$Global::debug = 0;
|
$Global::debug = 0;
|
||||||
|
@ -9197,6 +9197,38 @@ sub replaced {
|
||||||
# for each arg:
|
# for each arg:
|
||||||
# replace replacement strings with replacement in the word value
|
# replace replacement strings with replacement in the word value
|
||||||
# push to replace word value
|
# push to replace word value
|
||||||
|
|
||||||
|
if($opt::sqlworker) {
|
||||||
|
$perl_expressions_as_re =
|
||||||
|
join("|", map {s/^-?\d+//; "\Q$_\E"} keys %{$self->{'replacecount'}});
|
||||||
|
for my $arg (@$argref) {
|
||||||
|
my $val = $word;
|
||||||
|
# Replace {= perl expr =} with value for each arg
|
||||||
|
$val =~ s{\257<(-?\d+)?($perl_expressions_as_re)\257>}
|
||||||
|
{
|
||||||
|
if($1) {
|
||||||
|
# Positional replace
|
||||||
|
# Find the relevant arg and replace it
|
||||||
|
($argref->[$1 > 0 ? $1-1 : $n+$1] ? # If defined: replace
|
||||||
|
$argref->[$1 > 0 ? $1-1 : $n+$1]->
|
||||||
|
replace($2,$quote_arg,$self)
|
||||||
|
: "");
|
||||||
|
} else {
|
||||||
|
# Normal replace
|
||||||
|
$normal_replace ||= 1;
|
||||||
|
($arg ? $arg->replace($2,$quote_arg,$self) : "");
|
||||||
|
}
|
||||||
|
}gxe;
|
||||||
|
if($quote) {
|
||||||
|
CORE::push(@{$replace{::shell_quote_scalar($word)}},
|
||||||
|
::shell_quote_scalar($val));
|
||||||
|
} else {
|
||||||
|
CORE::push(@{$replace{$word}}, $val);
|
||||||
|
}
|
||||||
|
# No normal replacements => only run once
|
||||||
|
$normal_replace or last;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
$perl_expressions_as_re ||=
|
$perl_expressions_as_re ||=
|
||||||
join("|", map {s/^-?\d+//; "\Q$_\E"} keys %{$self->{'replacecount'}});
|
join("|", map {s/^-?\d+//; "\Q$_\E"} keys %{$self->{'replacecount'}});
|
||||||
for my $arg (@$argref) {
|
for my $arg (@$argref) {
|
||||||
|
@ -9227,6 +9259,7 @@ sub replaced {
|
||||||
$normal_replace or last;
|
$normal_replace or last;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
*Arg::arg = [];
|
*Arg::arg = [];
|
||||||
if($quote) {
|
if($quote) {
|
||||||
@target = ::shell_quote(@target);
|
@target = ::shell_quote(@target);
|
||||||
|
|
Loading…
Reference in a new issue