From 33407b16d86aa53e6a2154d202e49481df86fbea Mon Sep 17 00:00:00 2001 From: Alexandre Morignot <erdnaxeli@cervoi.se> Date: Thu, 5 Feb 2015 17:32:20 +0100 Subject: [PATCH] utils::db::get_session() becomes utils::db::get_new_session() --- lib/commands/get.pm | 6 +++--- lib/utils/db.pm | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/commands/get.pm b/lib/commands/get.pm index eb46c7e..4eda4a3 100644 --- a/lib/commands/get.pm +++ b/lib/commands/get.pm @@ -30,7 +30,7 @@ sub exec { my @words = ($msg =~ /(?:^| )([^#\s]+)/g); if (not defined $last_req or $msg ne $last_req) { - my $dbh = utils::db::get_session; + my $dbh = utils::db::get_new_session; my @words_param; foreach (@words) { @@ -129,7 +129,7 @@ sub exec { # this is specific to the mysql driver $rows = $sth->rows; - my $sth2 = utils::db::get_session()->prepare("select tag + my $sth2 = utils::db::get_new_session()->prepare("select tag from playbot_tags where id = ? "); @@ -157,7 +157,7 @@ sub exec { $irc->yield(privmsg => $chan => $irc_msg); # we save the get like a post - $sth2 = utils::db::get_session()->prepare_cached(' + $sth2 = utils::db::get_new_session()->prepare_cached(' INSERT INTO playbot_chan (content, chan, sender_irc) VALUES (?,?,?)'); $log->error("Couldn't prepare querie; aborting") unless (defined $sth2); diff --git a/lib/utils/db.pm b/lib/utils/db.pm index 3481efd..d3f25a9 100644 --- a/lib/utils/db.pm +++ b/lib/utils/db.pm @@ -19,7 +19,7 @@ BEGIN { } -sub get_session { +sub get_new_session { my $dbh = DBI->connect('DBI:mysql:'.$conf->{'bdd'}.';host='.$conf->{'host'}, $conf->{'user'}, $conf->{'passwd'}, { PrintError => 0, AutoCommit => 1, -- GitLab