CVS: blootbot/src dbi.pl,1.27,1.28
Brought to you by:
timriker
From: Tim R. <tim...@us...> - 2004-05-29 06:57:48
|
Update of /cvsroot/blootbot/blootbot/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9686/src Modified Files: dbi.pl Log Message: use portable LIMIT <> OFFSET <> Index: dbi.pl =================================================================== RCS file: /cvsroot/blootbot/blootbot/src/dbi.pl,v retrieving revision 1.27 retrieving revision 1.28 diff -u -r1.27 -r1.28 --- dbi.pl 29 May 2004 06:51:57 -0000 1.27 +++ dbi.pl 29 May 2004 06:57:35 -0000 1.28 @@ -515,10 +515,7 @@ 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); |