Changeset 4331 for trunk/admin


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

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

Location:
trunk/admin
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/admin/cat_perm.php

    r4325 r4331  
    6060  FROM '.CATEGORIES_TABLE.'
    6161  WHERE status = \'private\'
    62   LIMIT 0,1
     62  LIMIT 0 OFFSET 1
    6363;';
    6464
  • trunk/admin/element_set_global.php

    r4325 r4331  
    475475  WHERE id IN ('.implode(',', $page['cat_elements_id']).')
    476476  '.$conf['order_by'].'
    477   LIMIT '.$page['start'].', '.$page['nb_images'].'
     477  LIMIT '.$page['start'].' OFFSET '.$page['nb_images'].'
    478478;';
    479479  //echo '<pre>'.$query.'</pre>';
  • trunk/admin/element_set_unit.php

    r4325 r4331  
    197197  WHERE id IN ('.implode(',', $page['cat_elements_id']).')
    198198  '.$conf['order_by'].'
    199   LIMIT '.$page['start'].', '.$page['nb_images'].'
     199  LIMIT '.$page['start'].' OFFSET '.$page['nb_images'].'
    200200;';
    201201  $result = pwg_query($query);
  • trunk/admin/include/functions.php

    r4325 r4331  
    597597  FROM '.IMAGE_CATEGORY_TABLE.'
    598598  WHERE category_id = '.$category_id.'
    599   ORDER BY RAND()
    600   LIMIT 0,1
     599  ORDER BY '.DB_RANDOM_FUNCTION.'()
     600  LIMIT 0 OFFSET 1
    601601;';
    602602    list($representative) = pwg_db_fetch_row(pwg_query($query));
  • trunk/admin/include/functions_history.inc.php

    r4325 r4331  
    162162;';
    163163
    164   // LIMIT '.$page['start'].', '.$conf['nb_logs_page'].'
     164  // LIMIT '.$page['start'].' OFFSET '.$conf['nb_logs_page'].'
    165165
    166166  $result = pwg_query($query);
  • trunk/admin/rating.php

    r4325 r4331  
    177177  GROUP BY r.element_id
    178178  ORDER BY ' . $available_order_by[$order_by_index][1] .'
    179   LIMIT '.$start.','.$elements_per_page.'
     179  LIMIT '.$start.' OFFSET '.$elements_per_page.'
    180180;';
    181181
Note: See TracChangeset for help on using the changeset viewer.