From c6b6e78fcb5e4e2133a78bcf439889054d929eb1 Mon Sep 17 00:00:00 2001 From: Alexandre Morignot <erdnaxeli@cervoi.se> Date: Sun, 29 Nov 2015 20:16:23 +0100 Subject: [PATCH] a specific id is a specific id, no matter the chan --- PlayBot/utils/id.pm | 32 +++++++------------------------- 1 file changed, 7 insertions(+), 25 deletions(-) diff --git a/PlayBot/utils/id.pm b/PlayBot/utils/id.pm index 465848e..429d124 100644 --- a/PlayBot/utils/id.pm +++ b/PlayBot/utils/id.pm @@ -84,32 +84,14 @@ sub _test_if_exists { my $sth; - # in query, we don't check chan - # this means that a user can indicate any id in query - if ($chan =~ /^#/) { - $sth = $dbh->prepare(' - SELECT content - FROM playbot_chan - WHERE content = ? - AND chan = ? - LIMIT 1 - '); - - $sth->execute($index, $chan) - or $log->error("Couldn't finish transaction: " . $dbh->errstr); - } else { - $sth = $dbh->prepare(' - SELECT content - FROM playbot_chan - WHERE content = ? - LIMIT 1 - '); - - $sth->execute($index) - or $log->error("Couldn't finish transaction: " . $dbh->errstr); - } + $sth = $dbh->prepare(' + SELECT content + FROM playbot_chan + WHERE content = ? + LIMIT 1 + '); - $sth->execute($index, $chan) + $sth->execute($index) or $log->error("Couldn't finish transaction: " . $dbh->errstr); my $content = $sth->fetch; -- GitLab