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; ...@@ -7,7 +7,7 @@ our $irc;
sub exec { sub exec {
my ($nick, $id) = @_; 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) $sth->execute($nick)
or $log->error("Couldn't finish transaction: " . $dbh->errstr); or $log->error("Couldn't finish transaction: " . $dbh->errstr);
...@@ -15,7 +15,7 @@ sub exec { ...@@ -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."); $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 { 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]) $sth2->execute($id, $sth->fetch->[0])
or $log->error("Couldn't finish transaction: " . $dbh->errstr); or $log->error("Couldn't finish transaction: " . $dbh->errstr);
} }
......
...@@ -89,7 +89,7 @@ sub exec { ...@@ -89,7 +89,7 @@ sub exec {
$irc->yield(privmsg => $chan => $irc_msg); $irc->yield(privmsg => $chan => $irc_msg);
# we save the get like a post # we save the get like a post
$sth = $dbh->prepare_cached(' $sth = $dbh->prepare('
INSERT INTO playbot_chan (content, chan, sender_irc) INSERT INTO playbot_chan (content, chan, sender_irc)
VALUES (?,?,?)'); VALUES (?,?,?)');
$log->error("Couldn't prepare querie; aborting") unless (defined $sth); $log->error("Couldn't prepare querie; aborting") unless (defined $sth);
......
...@@ -9,7 +9,7 @@ sub exec { ...@@ -9,7 +9,7 @@ sub exec {
$time = 6 if (!$time); $time = 6 if (!$time);
$time *= ($unit eq 's') ? 1 : ($unit eq 'm') ? 60 : 3600; $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) { unless (defined $sth) {
$log->error("Couldn't prepare querie; aborting"); $log->error("Couldn't prepare querie; aborting");
return; return;
......
...@@ -17,7 +17,7 @@ sub addTag ...@@ -17,7 +17,7 @@ sub addTag
my $sth; 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); $log->error("Couldn't prepare querie; aborting") unless (defined $sth);
eval { eval {
......
...@@ -80,7 +80,7 @@ sub flux ...@@ -80,7 +80,7 @@ sub flux
my $date = strftime ("%Y-%m-%d", localtime(time - 3600*24)); my $date = strftime ("%Y-%m-%d", localtime(time - 3600*24));
foreach (@channels) { foreach (@channels) {
my $sth = $dbh->prepare_cached(' my $sth = $dbh->prepare('
SELECT COUNT(*) SELECT COUNT(*)
FROM playbot p FROM playbot p
JOIN playbot_chan pc ON p.id = pc.content JOIN playbot_chan pc ON p.id = pc.content
...@@ -103,7 +103,7 @@ sub later ...@@ -103,7 +103,7 @@ sub later
{ {
my ($nick, $id) = @_[ARG0,ARG1]; 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); $log->error("Couldn't prepare querie; aborting") unless (defined $sth);
$sth->execute($id) $sth->execute($id)
...@@ -116,7 +116,7 @@ sub later ...@@ -116,7 +116,7 @@ sub later
$irc->yield(privmsg => $nick => $donnees[0]); $irc->yield(privmsg => $nick => $donnees[0]);
# save the content in the history # save the content in the history
my $sth2 = $dbh->prepare_cached(' my $sth2 = $dbh->prepare('
INSERT INTO playbot_chan (content, chan, sender_irc) INSERT INTO playbot_chan (content, chan, sender_irc)
VALUES (?,?,?)'); VALUES (?,?,?)');
$log->error("Couldn't prepare querie; aborting") unless (defined $sth2); $log->error("Couldn't prepare querie; aborting") unless (defined $sth2);
...@@ -243,12 +243,12 @@ sub on_notice ...@@ -243,12 +243,12 @@ sub on_notice
$irc->yield(privmsg => $nickToVerify => "Il faut que ton pseudo soit enregistré auprès de NickServ"); $irc->yield(privmsg => $nickToVerify => "Il faut que ton pseudo soit enregistré auprès de NickServ");
} }
else { 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); $log->error("Counldn't prepare querie; aborting") unless (defined $sth);
$sth->execute($code); $sth->execute($code);
if ($sth->rows) { 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); $log->error("Couldn't prepare querie; aborting") unless (defined $sth);
$sth->execute($nickToVerify, $code) $sth->execute($nickToVerify, $code)
......
...@@ -66,7 +66,7 @@ sub parse { ...@@ -66,7 +66,7 @@ sub parse {
else { else {
# insertion de la vidéo dans la bdd # insertion de la vidéo dans la bdd
eval { eval {
my $sth = $dbh->prepare_cached(' my $sth = $dbh->prepare('
INSERT INTO playbot (type, url, sender, title, duration) INSERT INTO playbot (type, url, sender, title, duration)
VALUES (?,?,?,?,?)'); VALUES (?,?,?,?,?)');
$log->error("Couldn't prepare querie; aborting") unless (defined $sth); $log->error("Couldn't prepare querie; aborting") unless (defined $sth);
...@@ -89,7 +89,7 @@ sub parse { ...@@ -89,7 +89,7 @@ sub parse {
# on peut commiter. # on peut commiter.
$dbh->commit; $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); $log->error("Couldn't prepare querie; aborting") unless (defined $sth);
$sth->execute($content{'url'}) $sth->execute($content{'url'})
...@@ -99,7 +99,7 @@ sub parse { ...@@ -99,7 +99,7 @@ sub parse {
} }
# insertion du chan # insertion du chan
my $sth = $dbh->prepare_cached(' my $sth = $dbh->prepare('
INSERT INTO playbot_chan (content, chan, sender_irc) INSERT INTO playbot_chan (content, chan, sender_irc)
VALUES (?,?,?)'); VALUES (?,?,?)');
$log->error("Couldn't prepare querie; aborting") unless (defined $sth); $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