forked from extern/egroupware
bugfix: Select with LIMIT fail if FOR UPDATE is not after the LIMIT but before
This commit is contained in:
parent
a4b67d9f2b
commit
9b4814ba81
@ -473,10 +473,21 @@ class ADODB_mysql extends ADOConnection {
|
|||||||
// jason judge, see http://phplens.com/lens/lensforum/msgs.php?id=9220
|
// jason judge, see http://phplens.com/lens/lensforum/msgs.php?id=9220
|
||||||
if ($nrows < 0) $nrows = '18446744073709551615';
|
if ($nrows < 0) $nrows = '18446744073709551615';
|
||||||
|
|
||||||
|
//if the sql ends by a 'for update' it should be AFTER the LIMIT
|
||||||
|
$FORUPDATE = '';
|
||||||
|
//with PHP5 we could have used stripos and str_ireplace
|
||||||
|
if ( (strtoupper(substr($sql,-10))) == 'FOR UPDATE') {
|
||||||
|
$sql = substr($sql,0,(strlen($sql)-10));
|
||||||
|
$FORUPDATE = 'for update';
|
||||||
|
} elseif ( (strtoupper(substr($sql,-11))) == 'FOR UPDATE;') {
|
||||||
|
$sql = substr($sql,0,(strlen($sql)-11));
|
||||||
|
$FORUPDATE = 'for update';
|
||||||
|
}
|
||||||
|
|
||||||
if ($secs)
|
if ($secs)
|
||||||
$rs =& $this->CacheExecute($secs,$sql." LIMIT $offsetStr$nrows",$inputarr);
|
$rs =& $this->CacheExecute($secs,$sql." LIMIT $offsetStr$nrows $FORUPDATE",$inputarr);
|
||||||
else
|
else
|
||||||
$rs =& $this->Execute($sql." LIMIT $offsetStr$nrows",$inputarr);
|
$rs =& $this->Execute($sql." LIMIT $offsetStr$nrows $FORUPDATE",$inputarr);
|
||||||
return $rs;
|
return $rs;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user