зеркало из https://github.com/mozilla/pjs.git
Propagate the results out of the 'row' function correctly again -- the wantarray context isn't maintained inside a try block, unfortunately
This commit is contained in:
Родитель
c30ca82777
Коммит
ac03050fbd
|
@ -59,8 +59,9 @@ sub rowsAffected {
|
||||||
sub row {
|
sub row {
|
||||||
my $self = shift;
|
my $self = shift;
|
||||||
$self->assert($self->executed, 1, 'Tried to fetch data from an unexecuted statement');
|
$self->assert($self->executed, 1, 'Tried to fetch data from an unexecuted statement');
|
||||||
|
my $wantarray = wantarray; # to propagate it into the try block below
|
||||||
my @result = try {
|
my @result = try {
|
||||||
if (wantarray) {
|
if ($wantarray) {
|
||||||
return $self->handle->fetchrow_array();
|
return $self->handle->fetchrow_array();
|
||||||
} else {
|
} else {
|
||||||
my $array = $self->handle->fetchrow_arrayref();
|
my $array = $self->handle->fetchrow_arrayref();
|
||||||
|
@ -84,7 +85,7 @@ sub row {
|
||||||
raise $exception;
|
raise $exception;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
return @result;
|
return $wantarray ? @result : $result[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
sub rows {
|
sub rows {
|
||||||
|
|
Загрузка…
Ссылка в новой задаче