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

no more prepare_cached

parent 950aa6ef
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
......@@ -7,7 +7,7 @@ our $irc;
sub exec {
my ($nick, $id) = @_;
my $sth = $dbh->prepare_cached('SELECT user FROM playbot_codes WHERE nick = ?');
my $sth = $dbh->prepare('SELECT user FROM playbot_codes WHERE nick = ?');
$sth->execute($nick)
or $log->error("Couldn't finish transaction: " . $dbh->errstr);
......@@ -15,7 +15,7 @@ sub exec {
$irc->yield(privmsg => $nick => "Ce nick n'est associé à aucun login arise. Va sur http://nightiies.iiens.net/links/fav pour obtenir ton code personel.");
}
else {
my $sth2 = $dbh->prepare_cached('INSERT INTO playbot_fav (id, user) VALUES (?, ?)');
my $sth2 = $dbh->prepare('INSERT INTO playbot_fav (id, user) VALUES (?, ?)');
$sth2->execute($id, $sth->fetch->[0])
or $log->error("Couldn't finish transaction: " . $dbh->errstr);
}
......
......@@ -89,7 +89,7 @@ sub exec {
$irc->yield(privmsg => $chan => $irc_msg);
# we save the get like a post
$sth = $dbh->prepare_cached('
$sth = $dbh->prepare('
INSERT INTO playbot_chan (content, chan, sender_irc)
VALUES (?,?,?)');
$log->error("Couldn't prepare querie; aborting") unless (defined $sth);
......
......@@ -9,7 +9,7 @@ sub exec {
$time = 6 if (!$time);
$time *= ($unit eq 's') ? 1 : ($unit eq 'm') ? 60 : 3600;
my $sth = $dbh->prepare_cached('INSERT INTO playbot_later (content, nick, date) VALUES (?, ?, ?)');
my $sth = $dbh->prepare('INSERT INTO playbot_later (content, nick, date) VALUES (?, ?, ?)');
unless (defined $sth) {
$log->error("Couldn't prepare querie; aborting");
return;
......
......@@ -17,7 +17,7 @@ sub addTag
my $sth;
$sth = $dbh->prepare_cached('INSERT INTO playbot_tags (id, tag) VALUES (?, ?)');
$sth = $dbh->prepare('INSERT INTO playbot_tags (id, tag) VALUES (?, ?)');
$log->error("Couldn't prepare querie; aborting") unless (defined $sth);
eval {
......
......@@ -80,7 +80,7 @@ sub flux
my $date = strftime ("%Y-%m-%d", localtime(time - 3600*24));
foreach (@channels) {
my $sth = $dbh->prepare_cached('
my $sth = $dbh->prepare('
SELECT COUNT(*)
FROM playbot p
JOIN playbot_chan pc ON p.id = pc.content
......@@ -103,7 +103,7 @@ sub later
{
my ($nick, $id) = @_[ARG0,ARG1];
my $sth = $dbh->prepare_cached('SELECT url, sender, title FROM playbot WHERE id = ?');
my $sth = $dbh->prepare('SELECT url, sender, title FROM playbot WHERE id = ?');
$log->error("Couldn't prepare querie; aborting") unless (defined $sth);
$sth->execute($id)
......@@ -116,7 +116,7 @@ sub later
$irc->yield(privmsg => $nick => $donnees[0]);
# save the content in the history
my $sth2 = $dbh->prepare_cached('
my $sth2 = $dbh->prepare('
INSERT INTO playbot_chan (content, chan, sender_irc)
VALUES (?,?,?)');
$log->error("Couldn't prepare querie; aborting") unless (defined $sth2);
......@@ -243,12 +243,12 @@ sub on_notice
$irc->yield(privmsg => $nickToVerify => "Il faut que ton pseudo soit enregistré auprès de NickServ");
}
else {
my $sth = $dbh->prepare_cached('SELECT user FROM playbot_codes WHERE code = ?');
my $sth = $dbh->prepare('SELECT user FROM playbot_codes WHERE code = ?');
$log->error("Counldn't prepare querie; aborting") unless (defined $sth);
$sth->execute($code);
if ($sth->rows) {
my $sth = $dbh->prepare_cached('UPDATE playbot_codes SET nick = ? WHERE code = ?');
my $sth = $dbh->prepare('UPDATE playbot_codes SET nick = ? WHERE code = ?');
$log->error("Couldn't prepare querie; aborting") unless (defined $sth);
$sth->execute($nickToVerify, $code)
......
......@@ -66,7 +66,7 @@ sub parse {
else {
# insertion de la vidéo dans la bdd
eval {
my $sth = $dbh->prepare_cached('
my $sth = $dbh->prepare('
INSERT INTO playbot (type, url, sender, title, duration)
VALUES (?,?,?,?,?)');
$log->error("Couldn't prepare querie; aborting") unless (defined $sth);
......@@ -89,7 +89,7 @@ sub parse {
# on peut commiter.
$dbh->commit;
my $sth = $dbh->prepare_cached('SELECT id FROM playbot WHERE url = ?');
my $sth = $dbh->prepare('SELECT id FROM playbot WHERE url = ?');
$log->error("Couldn't prepare querie; aborting") unless (defined $sth);
$sth->execute($content{'url'})
......@@ -99,7 +99,7 @@ sub parse {
}
# insertion du chan
my $sth = $dbh->prepare_cached('
my $sth = $dbh->prepare('
INSERT INTO playbot_chan (content, chan, sender_irc)
VALUES (?,?,?)');
$log->error("Couldn't prepare querie; aborting") unless (defined $sth);
......
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Veuillez vous inscrire ou vous pour commenter