Skip to content
Extraits de code Groupes Projets
Valider 453d35da rédigé par Alexandre Morignot's avatar Alexandre Morignot
Parcourir les fichiers

utils::db::get now returns an hash ref instead of an array ref

parent 6ed30f89
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
......@@ -75,7 +75,7 @@ sub exec {
from playbot_tags
where id = ?
");
$sth->execute($content->[0]);
$sth->execute($content->{id});
my @tags;
while (my $data = $sth->fetch) {
......@@ -84,17 +84,9 @@ sub exec {
push @tags, $tag;
}
my %content_h;
$content_h{'id'} = $content->[0];
$content_h{'author'} = $content->[1];
$content_h{'title'} = $content->[2];
$content_h{'url'} = $content->[3];
$content_h{'duration'} = $content->[4];
$content_h{'external_id'} = $content->[5];
$content_h{'site'} = $content->[6];
$content_h{'tags'} = \@tags;
$content->{'tags'} = \@tags;
my $irc_msg = PlayBot::utils::print::print(\%content_h);
my $irc_msg = PlayBot::utils::print::print($content);
# if in query
if ($chan !~ /^#/) {
......@@ -114,12 +106,12 @@ sub exec {
VALUES (?,?,?)');
$log->error("Couldn't prepare querie; aborting") unless (defined $sth);
$sth->execute($content->[0], $chan, "PlayBot")
$sth->execute($content->{id}, $chan, "PlayBot")
or $log->error("Couldn't finish transaction: " . $dbh->errstr);
$dbh->commit();
return $content->[0];
return $content->{id};
}
......
......@@ -54,7 +54,17 @@ sub get {
# if id was precised, we (and so the user) know there is no more results
$self->_clean($chan) if ($query->id >= 0);
return $result;
return undef unless $result;
my %content;
$content{'id'} = $result->[0];
$content{'author'} = $result->[1];
$content{'title'} = $result->[2];
$content{'url'} = $result->[3];
$content{'duration'} = $result->[4];
$content{'external_id'} = $result->[5];
$content{'site'} = $result->[6];
return \%content;
}
sub get_rows {
......
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Terminez d'abord l'édition de ce message.
Veuillez vous inscrire ou vous pour commenter