From 346051923e61048b685150054f4457bd5681e2f1 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/blootbot@941 c11ca15a-4712-0410-83d8-924469b57eb5 --- src/dbi.pl | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/dbi.pl b/src/dbi.pl index 36f92a1..f556553 100644 --- a/src/dbi.pl +++ b/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.2