From: timriker Date: Sat, 29 May 2004 06:57:35 +0000 (+0000) Subject: use portable LIMIT <> OFFSET <> X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=83dace46f7add4303a6164151e87c1fa975e7f0b;p=infobot.git use portable LIMIT <> OFFSET <> git-svn-id: https://svn.code.sf.net/p/infobot/code/trunk@941 c11ca15a-4712-0410-83d8-924469b57eb5 --- diff --git a/blootbot/src/dbi.pl b/blootbot/src/dbi.pl index 36f92a1..f556553 100644 --- a/blootbot/src/dbi.pl +++ b/blootbot/src/dbi.pl @@ -515,10 +515,7 @@ sub sumKey { sub randKey { my ($table, $select) = @_; my $rand = int(rand(&countKeys($table) - 1)); - my $query = "SELECT $select FROM $table LIMIT $rand,1"; - if ($param{DBType} =~ /^pg/i) { - $query =~ s/$rand,1/1,$rand/; - } + my $query = "SELECT $select FROM $table LIMIT 1 OFFSET $rand"; my $sth = $dbh->prepare($query); &SQLDebug($query);