diff --git a/lib/commands/get.pm b/lib/commands/get.pm index eb46c7e91f8572f53cd11950ee6c71178742453e..4eda4a3e54a52ffe45fb7946897c2d137132ffb0 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 3481efd699fe027f8bf101ab25a8e5e98398a59b..d3f25a942f3f8b88765ab346ed5104ca4e4ffb73 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,