Bug 7567: (code cleanup) remove finish calls
"When all the data has been fetched from a SELECT statement, the driver will automatically call finish for you. So you should not call it explicitly except when you know that you've not fetched all the data from a statement handle and the handle won't be destroyed soon." (http://search.cpan.org/~timb/DBI-1.627/DBI.pm#finish) All the $sth variables were scoped within the functions, and would be destroyed immediately. Additionally, there was one after a SELECT, for only a single idnew, and so it was not necessary. TEST PLAN --------- 1) prove -v t/db_dependent/NewsChannels.t 2) apply patch 3) prove -v t/db_dependent/NewsChannels.t Signed-off-by: Chris Cormack <chris@bigballofwax.co.nz> ok 1 - use C4::NewsChannels; ok 2 - Successfully added the first dummy news item! ok 3 - Successfully added the second dummy news item! ok 4 - Successfully updated second dummy news item! ok 5 - Successfully tested get_opac_new id1! ok 6 - Successfully tested get_opac_new id2! ok 7 - Successfully tested get_opac_news! ok 8 - Successfully tested GetNewsToDisplay! Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com> Signed-off-by: Galen Charlton <gmc@esilibrary.com>
This commit is contained in:
parent
beb74124f2
commit
d3eaa62717
1 changed files with 0 additions and 4 deletions
|
@ -51,7 +51,6 @@ sub add_opac_new {
|
|||
my $dbh = C4::Context->dbh;
|
||||
my $sth = $dbh->prepare("INSERT INTO opac_news (title, new, lang, expirationdate, timestamp, number) VALUES (?,?,?,?,?,?)");
|
||||
$sth->execute($title, $new, $lang, $expirationdate, $timestamp, $number);
|
||||
$sth->finish;
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -69,7 +68,6 @@ sub upd_opac_new {
|
|||
WHERE idnew = ?
|
||||
");
|
||||
$sth->execute($title, $new, $lang, $expirationdate, $timestamp,$number,$idnew);
|
||||
$sth->finish;
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -79,7 +77,6 @@ sub del_opac_new {
|
|||
my $dbh = C4::Context->dbh;
|
||||
my $sth = $dbh->prepare("DELETE FROM opac_news WHERE idnew IN ($ids)");
|
||||
$sth->execute();
|
||||
$sth->finish;
|
||||
return 1;
|
||||
} else {
|
||||
return 0;
|
||||
|
@ -95,7 +92,6 @@ sub get_opac_new {
|
|||
$data->{$data->{'lang'}} = 1 if defined $data->{lang};
|
||||
$data->{expirationdate} = format_date($data->{expirationdate});
|
||||
$data->{timestamp} = format_date($data->{timestamp});
|
||||
$sth->finish;
|
||||
return $data;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue