mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-12-26 16:48:49 +01:00
fixed problems pointed out by Janosch Machowinski <scotch-AT-tzi.de>
This commit is contained in:
parent
cbff451d7e
commit
1e9b08d510
@ -209,7 +209,7 @@
|
||||
}
|
||||
if (!isset($value['cat_app'])) $value['cat_app'] = $app; // if no cat_app set, use the app from the get_rows func
|
||||
|
||||
$max = $GLOBALS['egw_info']['user']['preferences']['common']['maxmatchs'];
|
||||
$max = (int)$GLOBALS['egw_info']['user']['preferences']['common']['maxmatchs'];
|
||||
$row_options = array();
|
||||
foreach(array(5,12,25,50,100,200,500,999) as $n)
|
||||
{
|
||||
@ -226,7 +226,7 @@
|
||||
if (!isset($value['num_rows'])) $value['num_rows'] = $max;
|
||||
if ($value['num_rows'] != $max)
|
||||
{
|
||||
$GLOBALS['egw_info']['user']['preferences']['common']['maxmatchs'] = $max = $value['num_rows'];
|
||||
$GLOBALS['egw_info']['user']['preferences']['common']['maxmatchs'] = $max = (int)$value['num_rows'];
|
||||
}
|
||||
if (!$value['no_columnselection'])
|
||||
{
|
||||
@ -590,7 +590,8 @@
|
||||
{
|
||||
$loop = true; // num_rows changed
|
||||
}
|
||||
$max = $value['num_rows'] ? $value['num_rows'] : $GLOBALS['egw_info']['user']['preferences']['common']['maxmatchs'];
|
||||
$value['num_rows'] = (int) $value['num_rows'];
|
||||
$max = $value['num_rows'] ? $value['num_rows'] : (int)$GLOBALS['egw_info']['user']['preferences']['common']['maxmatchs'];
|
||||
|
||||
|
||||
if(strpos($value['search'],'xjxquery')) {
|
||||
|
@ -1108,7 +1108,7 @@
|
||||
// access includes ties in result
|
||||
if ($isaccess) {
|
||||
$sql = preg_replace(
|
||||
'/(^\s*select\s+(distinctrow|distinct)?)/i','\\1 '.$this->hasTop.' '.$nrows.' ',$sql);
|
||||
'/(^\s*select\s+(distinctrow|distinct)?)/i','\\1 '.$this->hasTop.' '.(int)$nrows.' ',$sql);
|
||||
|
||||
if ($secs2cache>0) {
|
||||
$ret =& $this->CacheExecute($secs2cache, $sql,$inputarr);
|
||||
@ -1118,10 +1118,10 @@
|
||||
return $ret; // PHP5 fix
|
||||
} else if ($ismssql){
|
||||
$sql = preg_replace(
|
||||
'/(^\s*select\s+(distinctrow|distinct)?)/i','\\1 '.$this->hasTop.' '.$nrows.' ',$sql);
|
||||
'/(^\s*select\s+(distinctrow|distinct)?)/i','\\1 '.$this->hasTop.' '.(int)$nrows.' ',$sql);
|
||||
} else {
|
||||
$sql = preg_replace(
|
||||
'/(^\s*select\s)/i','\\1 '.$this->hasTop.' '.$nrows.' ',$sql);
|
||||
'/(^\s*select\s)/i','\\1 '.$this->hasTop.' '.(int)$nrows.' ',$sql);
|
||||
}
|
||||
} else {
|
||||
$nn = $nrows + $offset;
|
||||
@ -1151,7 +1151,7 @@
|
||||
}
|
||||
$ADODB_COUNTRECS = $savec;
|
||||
if ($rs && !$rs->EOF) {
|
||||
$rs =& $this->_rs2rs($rs,$nrows,$offset);
|
||||
$rs =& $this->_rs2rs($rs,(int)$nrows,(int)$offset);
|
||||
}
|
||||
//print_r($rs);
|
||||
return $rs;
|
||||
@ -3874,4 +3874,4 @@
|
||||
}
|
||||
|
||||
} // defined
|
||||
?>
|
||||
?>
|
||||
|
@ -469,10 +469,11 @@ class ADODB_mysql extends ADOConnection {
|
||||
// parameters use PostgreSQL convention, not MySQL
|
||||
function &SelectLimit($sql,$nrows=-1,$offset=-1,$inputarr=false,$secs=0)
|
||||
{
|
||||
$offsetStr =($offset>=0) ? "$offset," : '';
|
||||
// jason judge, see http://phplens.com/lens/lensforum/msgs.php?id=9220
|
||||
if ($nrows < 0) $nrows = '18446744073709551615';
|
||||
|
||||
$offsetStr = (($offset>=0) ? (int)$offset.',' : '').(int)$nrows;
|
||||
|
||||
//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
|
||||
@ -485,9 +486,9 @@ class ADODB_mysql extends ADOConnection {
|
||||
}
|
||||
|
||||
if ($secs)
|
||||
$rs =& $this->CacheExecute($secs,$sql." LIMIT $offsetStr$nrows $FORUPDATE",$inputarr);
|
||||
$rs =& $this->CacheExecute($secs,$sql.' LIMIT '.$offsetStr.' '.$FORUPDATE,$inputarr);
|
||||
else
|
||||
$rs =& $this->Execute($sql." LIMIT $offsetStr$nrows $FORUPDATE",$inputarr);
|
||||
$rs =& $this->Execute($sql.' LIMIT '.$offsetStr.' '.$FORUPDATE,$inputarr);
|
||||
return $rs;
|
||||
}
|
||||
|
||||
|
@ -35,12 +35,12 @@ class ADODB_postgres7 extends ADODB_postgres64 {
|
||||
// which makes obsolete the LIMIT limit,offset syntax
|
||||
function &SelectLimit($sql,$nrows=-1,$offset=-1,$inputarr=false,$secs2cache=0)
|
||||
{
|
||||
$offsetStr = ($offset >= 0) ? " OFFSET $offset" : '';
|
||||
$limitStr = ($nrows >= 0) ? " LIMIT $nrows" : '';
|
||||
$offsetStr = ($offset >= 0) ? ' OFFSET '.(int)$offset : '';
|
||||
$limitStr = ($nrows >= 0) ? ' LIMIT '.(int)$nrows : '';
|
||||
if ($secs2cache)
|
||||
$rs =& $this->CacheExecute($secs2cache,$sql."$limitStr$offsetStr",$inputarr);
|
||||
$rs =& $this->CacheExecute($secs2cache,$sql.$limitStr.$offsetStr,$inputarr);
|
||||
else
|
||||
$rs =& $this->Execute($sql."$limitStr$offsetStr",$inputarr);
|
||||
$rs =& $this->Execute($sql.$limitStr.$offsetStr,$inputarr);
|
||||
|
||||
return $rs;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user