]> git.donarmstrong.com Git - infobot.git/commitdiff
use portable LIMIT <> OFFSET <>
authortimriker <timriker@c11ca15a-4712-0410-83d8-924469b57eb5>
Sat, 29 May 2004 06:57:35 +0000 (06:57 +0000)
committertimriker <timriker@c11ca15a-4712-0410-83d8-924469b57eb5>
Sat, 29 May 2004 06:57:35 +0000 (06:57 +0000)
git-svn-id: https://svn.code.sf.net/p/infobot/code/trunk/blootbot@941 c11ca15a-4712-0410-83d8-924469b57eb5

src/dbi.pl

index 36f92a19a280b14a0ab6a6cf5d32753570120a09..f5565539924fc0eefa1dc70711de4be974384f72 100644 (file)
@@ -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);