From 83dace46f7add4303a6164151e87c1fa975e7f0b Mon Sep 17 00:00:00 2001 From: timriker Date: Sat, 29 May 2004 06:57:35 +0000 Subject: [PATCH] use portable LIMIT <> OFFSET <> git-svn-id: https://svn.code.sf.net/p/infobot/code/trunk@941 c11ca15a-4712-0410-83d8-924469b57eb5 --- blootbot/src/dbi.pl | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) 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); -- 2.39.5