Changeset 4334 for trunk


Ignore:
Timestamp:
Nov 21, 2009, 8:52:50 PM (15 years ago)
Author:
nikrou
Message:

Feature 1255 : limit params in sql queries were in wrong order (LIMIT count OFFSET offset)

Location:
trunk
Files:
14 edited

Legend:

Unmodified
Added
Removed
  • trunk/admin/cat_perm.php

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

    r4331 r4334  
    475475  WHERE id IN ('.implode(',', $page['cat_elements_id']).')
    476476  '.$conf['order_by'].'
    477   LIMIT '.$page['start'].' OFFSET '.$page['nb_images'].'
    478 ;';
    479   //echo '<pre>'.$query.'</pre>';
     477  LIMIT '.$page['nb_images'].' OFFSET '.$page['start'].'
     478;';
    480479  $result = pwg_query($query);
    481480
    482481  // template thumbnail initialization
    483 
    484482  while ($row = pwg_db_fetch_assoc($result))
    485483  {
  • trunk/admin/element_set_unit.php

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

    r4331 r4334  
    598598  WHERE category_id = '.$category_id.'
    599599  ORDER BY '.DB_RANDOM_FUNCTION.'()
    600   LIMIT 0 OFFSET 1
     600  LIMIT 1
    601601;';
    602602    list($representative) = pwg_db_fetch_row(pwg_query($query));
  • trunk/admin/include/functions_history.inc.php

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

    r4331 r4334  
    177177  GROUP BY r.element_id
    178178  ORDER BY ' . $available_order_by[$order_by_index][1] .'
    179   LIMIT '.$start.' OFFSET '.$elements_per_page.'
     179  LIMIT '.$elements_per_page.' OFFSET '.$start.'
    180180;';
    181181
  • trunk/comments.php

    r4331 r4334  
    327327{
    328328  $query.= '
    329   LIMIT '.$start.' OFFSET '.$page['items_number'];
     329  LIMIT '.$page['items_number'].' OFFSET '.$start;
    330330}
    331331$query.= '
  • trunk/include/calendar_monthly.class.php

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

    r4325 r4334  
    106106    ).'
    107107  ORDER BY RAND()
    108   LIMIT 0,1
     108  LIMIT 1
    109109;';
    110110      $subresult = pwg_query($query);
     
    134134    ).'
    135135    ORDER BY RAND()
    136     LIMIT 0,1
     136    LIMIT 1
    137137  ;';
    138138      $subresult = pwg_query($query);
  • trunk/include/functions_notification.inc.php

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

    r4325 r4334  
    240240    $query .= '
    241241  ORDER BY counter DESC
    242   LIMIT 0,'.$max_tags;
     242  LIMIT '.$max_tags;
    243243  }
    244244  else
  • trunk/include/section_init.inc.php

    r3282 r4334  
    491491    '.$forbidden.'
    492492    '.$conf['order_by'].'
    493   LIMIT 0, '.$conf['top_number'].'
     493  LIMIT '.$conf['top_number'].'
    494494;';
    495495
     
    518518    '.$forbidden.'
    519519    '.$conf['order_by'].'
    520   LIMIT 0, '.$conf['top_number'].'
     520  LIMIT '.$conf['top_number'].'
    521521;';
    522522    $page = array_merge(
  • trunk/include/ws_functions.inc.php

    r4331 r4334  
    293293GROUP BY i.id
    294294'.$order_by.'
    295 LIMIT '.(int)($params['per_page']*$params['page']).' OFFSET '.(int)$params['per_page'];
     295LIMIT '.(int)$params['per_page'].' OFFSET '.(int)($params['per_page']*$params['page']);
    296296
    297297    $result = pwg_query($query);
     
    683683  WHERE '.$where_comments.'
    684684  ORDER BY date
    685   LIMIT '.(int)($params['comments_per_page']*$params['comments_page']).
    686     ' OFFSET '.(int)$params['comments_per_page'];
     685  LIMIT '.(int)$params['comments_per_page'].
     686    ' OFFSET '.(int)($params['comments_per_page']*$params['comments_page']);
    687687
    688688    $result = pwg_query($query);
     
    13991399    AND ', $where_clauses).'
    14001400'.$order_by.'
    1401 LIMIT '.(int)($params['per_page']*$params['page']).' OFFSET '.(int)$params['per_page'];
     1401LIMIT '.(int)$params['per_page'].' OFFSET '.(int)($params['per_page']*$params['page']);
    14021402
    14031403    $result = pwg_query($query);
  • trunk/random.php

    r3282 r4334  
    5353  ).'
    5454  ORDER BY RAND(NOW())
    55   LIMIT 0, '.min(50, $conf['top_number'],$user['nb_image_page']).'
     55  LIMIT '.min(50, $conf['top_number'],$user['nb_image_page']).'
    5656;';
    5757
Note: See TracChangeset for help on using the changeset viewer.