Browse Source

Bug 7567: (follow-up) construct values clause in SQL statement more idiomatically

To test:

[1] Verify that prove -v t/db_dependent/NewsChannels.t passes

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
3.16.x
Galen Charlton 10 years ago
parent
commit
c095003b86
  1. 4
      C4/NewsChannels.pm

4
C4/NewsChannels.pm

@ -61,9 +61,9 @@ sub add_opac_new {
if ($href_entry) {
my @fields = keys %{$href_entry};
my @values = values %{$href_entry};
my $field_string = join ',',@fields;
my $field_string = join ',', @fields;
$field_string = $field_string // q{};
my $values_string = '?,' x ($#fields) . '?';
my $values_string = join(',', map { '?' } @fields);
my $dbh = C4::Context->dbh;
my $sth = $dbh->prepare("INSERT INTO opac_news ( $field_string ) VALUES ( $values_string )");
$sth->execute(@values);

Loading…
Cancel
Save