Changeset 4331 for trunk/include


Ignore:
Timestamp:
Nov 21, 2009, 1:15:22 PM (14 years ago)
Author:
nikrou
Message:

Feature 1255 : improve sql
Replace in queries LIMIT N,M by LIMIT N OFFSET M

Location:
trunk/include
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/calendar_monthly.class.php

    r4325 r4331  
    349349    $query.= '
    350350  ORDER BY RAND()
    351   LIMIT 0,1';
     351  LIMIT 0 OFFSET 1';
    352352    unset ( $page['chronology_date'][CDAY] );
    353353
  • trunk/include/functions_notification.inc.php

    r4325 r4331  
    445445  GROUP BY date_available
    446446  ORDER BY date_available DESC
    447   LIMIT 0,'.$max_dates.'
     447  LIMIT 0 OFFSET '.$max_dates.'
    448448;';
    449449  $result = pwg_query($query);
     
    465465    AND tn_ext IS NOT NULL
    466466  ORDER BY RAND(NOW())
    467   LIMIT 0,'.$max_elements.'
     467  LIMIT 0 OFFSET '.$max_elements.'
    468468;';
    469469      $dates[$i]['elements'] = array();
     
    485485  GROUP BY category_id
    486486  ORDER BY img_count DESC
    487   LIMIT 0,'.$max_cats.'
     487  LIMIT 0 OFFSET '.$max_cats.'
    488488;';
    489489      $dates[$i]['categories'] = array();
  • trunk/include/picture_comment.inc.php

    r4325 r4331  
    137137$validated_clause.'
    138138  ORDER BY date ASC
    139   LIMIT '.$page['start'].', '.$conf['nb_comment_page'].'
     139  LIMIT '.$page['start'].' OFFSET '.$conf['nb_comment_page'].'
    140140;';
    141141    $result = pwg_query( $query );
  • trunk/include/ws_functions.inc.php

    r4325 r4331  
    293293GROUP BY i.id
    294294'.$order_by.'
    295 LIMIT '.(int)($params['per_page']*$params['page']).','.(int)$params['per_page'];
     295LIMIT '.(int)($params['per_page']*$params['page']).' OFFSET '.(int)$params['per_page'];
    296296
    297297    $result = pwg_query($query);
     
    684684  ORDER BY date
    685685  LIMIT '.(int)($params['comments_per_page']*$params['comments_page']).
    686     ','.(int)$params['comments_per_page'];
     686    ' OFFSET '.(int)$params['comments_per_page'];
    687687
    688688    $result = pwg_query($query);
     
    13991399    AND ', $where_clauses).'
    14001400'.$order_by.'
    1401 LIMIT '.(int)($params['per_page']*$params['page']).','.(int)$params['per_page'];
     1401LIMIT '.(int)($params['per_page']*$params['page']).' OFFSET '.(int)$params['per_page'];
    14021402
    14031403    $result = pwg_query($query);
Note: See TracChangeset for help on using the changeset viewer.