Changeset 6511


Ignore:
Timestamp:
06/09/10 22:26:47 (10 years ago)
Author:
nikrou
Message:

Fix bug 1722 : PosgtreSQL wants all fields in select to be in Group by clause
or agregate function
Fix issue for lambda function (incorrect number of params)

merge from trunk.

Location:
branches/2.1/include
Files:
3 edited

Legend:

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

    r6410 r6511  
    514514// piwigo_users table. 
    515515$conf['users_table'] = $prefixeTable.'users'; 
     516 
     517// If you decide to use external authentication  
     518// change conf below by $conf['external_authentification'] = true; 
     519$conf['external_authentification'] = false; 
    516520 
    517521// Other tables can be changed, if you define associated constants 
  • branches/2.1/include/dblayer/functions_pgsql.inc.php

    r6342 r6511  
    315315      } 
    316316    } // foreach update 
    317   } // if mysql_ver or count<X 
     317  }  
    318318  else 
    319319  { 
     
    327327    mass_inserts($temporary_tablename, $all_fields, $datas); 
    328328    if ( $flags & MASS_UPDATES_SKIP_EMPTY ) 
    329       $func_set = create_function('$s, $t', 'return "$s = IFNULL(t2.$s, '.$tablename.'.$s)";'); 
     329      $func_set = create_function('$s', 'return "$s = NULLIF(t2.$s, '.$tablename.'.$s)";'); 
    330330    else 
    331331      $func_set = create_function('$s', 'return "$s = t2.$s";'); 
     
    344344        "\n    AND ", 
    345345        array_map( 
    346           create_function('$s, $t', 'return "'.$tablename.'.$s = t2.$s";'), 
     346          create_function('$s', 'return "'.$tablename.'.$s = t2.$s";'), 
    347347          $dbfields['primary'] 
    348348          ) 
     
    586586 
    587587// my_error returns (or send to standard output) the message concerning the 
    588 // error occured for the last mysql query. 
     588// error occured for the last pgsql query. 
    589589function my_error($header, $die) 
    590590{ 
  • branches/2.1/include/functions_user.inc.php

    r6364 r6511  
    291291  $row = pwg_db_fetch_assoc(pwg_query($query)); 
    292292 
    293   // retrieve additional user data 
     293  // retrieve user info 
    294294  $query = ' 
    295295SELECT 
    296     COUNT(1) AS counter, 
    297296    ui.*, 
    298297    uc.*, 
     
    301300    LEFT JOIN '.USER_CACHE_TABLE.' AS uc ON ui.user_id = uc.user_id 
    302301    LEFT JOIN '.THEMES_TABLE.' AS t ON t.id = ui.theme 
    303   WHERE ui.user_id = \''.$user_id.'\' 
     302  WHERE ui.user_id = '.$user_id.' 
     303;'; 
     304 
     305  $result = pwg_query($query); 
     306  $user_infos_row = pwg_db_fetch_assoc($result); 
     307 
     308  // retrieve additional user data ? 
     309  if ($conf['external_authentification']) 
     310  { 
     311    $query = ' 
     312SELECT 
     313    COUNT(1) AS counter, 
     314  FROM '.USER_INFOS_TABLE.' AS ui 
     315    LEFT JOIN '.USER_CACHE_TABLE.' AS uc ON ui.user_id = uc.user_id 
     316    LEFT JOIN '.THEMES_TABLE.' AS t ON t.id = ui.theme 
     317  WHERE ui.user_id = '.$user_id.' 
    304318  GROUP BY ui.user_id 
    305319;'; 
    306   $result = pwg_query($query); 
    307   $user_infos_row = pwg_db_fetch_assoc($result); 
    308   if (!isset($user_infos_row['counter']) or 0 == $user_infos_row['counter']) { 
    309     create_user_infos($user_id); 
     320    if (pwg_db_fetch_row(pwg_query($query))!=1) 
     321    { 
     322      create_user_infos($user_id); 
    310323     
    311     $result = pwg_query($query); 
    312     $user_infos_row = pwg_db_fetch_assoc($result); 
     324      $result = pwg_query($user_info_query); 
     325      $user_infos_row = pwg_db_fetch_assoc($result);       
     326    } 
    313327  } 
    314328 
Note: See TracChangeset for help on using the changeset viewer.