Changeset 6653


Ignore:
Timestamp:
Jul 3, 2010, 2:16:12 PM (10 years ago)
Author:
nikrou
Message:

Bug 1754 fixed : The keyword AS is mandatory for alias in PostgreSQL queries
Merge from trunk

Location:
branches/2.1/include
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • branches/2.1/include/functions_notification.inc.php

    r6598 r6653  
    477477  $query = '
    478478SELECT date_available,
    479       COUNT(DISTINCT id) nb_elements,
    480       COUNT(DISTINCT category_id) nb_cats
     479      COUNT(DISTINCT id) AS nb_elements,
     480      COUNT(DISTINCT category_id) AS nb_cats
    481481  FROM '.IMAGES_TABLE.' i INNER JOIN '.IMAGE_CATEGORY_TABLE.' AS ic ON id=image_id
    482482  '.$where_sql.'
     
    516516    {// get some categories ...
    517517      $query = '
    518 SELECT c.uppercats, COUNT(DISTINCT i.id) img_count
     518SELECT c.uppercats, COUNT(DISTINCT i.id) AS img_count
    519519  FROM '.IMAGES_TABLE.' i INNER JOIN '.IMAGE_CATEGORY_TABLE.' AS ic ON i.id=image_id
    520520    INNER JOIN '.CATEGORIES_TABLE.' c ON c.id=category_id
  • branches/2.1/include/functions_tag.inc.php

    r6364 r6653  
    3737  // we can find top fatter tags among reachable images
    3838  $query = '
    39 SELECT tag_id, COUNT(DISTINCT(it.image_id)) counter
     39SELECT tag_id, COUNT(DISTINCT(it.image_id)) AS counter
    4040  FROM '.IMAGE_CATEGORY_TABLE.' ic
    4141    INNER JOIN '.IMAGE_TAG_TABLE.' it ON ic.image_id=it.image_id'.get_sql_condition_FandF
     
    224224  }
    225225  $query = '
    226 SELECT t.*, count(*) counter
     226SELECT t.*, count(*) AS counter
    227227  FROM '.IMAGE_TAG_TABLE.'
    228228    INNER JOIN '.TAGS_TABLE.' t ON tag_id = id
  • branches/2.1/include/functions_user.inc.php

    r6511 r6653  
    679679function get_computed_categories($userdata, $filter_days=null)
    680680{
    681   $query = 'SELECT c.id cat_id, global_rank';
     681  $query = 'SELECT c.id AS cat_id, global_rank';
    682682  // Count by date_available to avoid count null
    683683  $query .= ',
    684   MAX(date_available) date_last, COUNT(date_available) nb_images
     684  MAX(date_available) AS date_last, COUNT(date_available) AS nb_images
    685685FROM '.CATEGORIES_TABLE.' as c
    686686  LEFT JOIN '.IMAGE_CATEGORY_TABLE.' AS ic ON ic.category_id = c.id
  • branches/2.1/include/ws_functions.inc.php

    r6501 r6653  
    286286
    287287    $query = '
    288 SELECT i.*, GROUP_CONCAT(category_id) cat_ids
     288SELECT i.*, GROUP_CONCAT(category_id) AS cat_ids
    289289  FROM '.IMAGES_TABLE.' i
    290290    INNER JOIN '.IMAGE_CATEGORY_TABLE.' ON i.id=image_id
     
    694694
    695695  $query = '
    696 SELECT COUNT(id) nb_comments
     696SELECT COUNT(id) AS nb_comments
    697697  FROM '.COMMENTS_TABLE.'
    698698  WHERE '.$where_comments;
     
    14551455    {
    14561456      $query = '
    1457 SELECT image_id, GROUP_CONCAT(tag_id) tag_ids
     1457SELECT image_id, GROUP_CONCAT(tag_id) AS tag_ids
    14581458  FROM '.IMAGE_TAG_TABLE.'
    14591459  WHERE tag_id IN ('.implode(',',$tag_ids).')
Note: See TracChangeset for help on using the changeset viewer.