From: Julien Lancelot Date: Thu, 22 Nov 2012 13:15:17 +0000 (+0100) Subject: SONAR-3790 fix bug on H2 when column used in the order by are not in the select X-Git-Tag: 3.4~299 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=14c0820b0d6ad74cb686fc98faed0e1b3a4263f9;p=sonarqube.git SONAR-3790 fix bug on H2 when column used in the order by are not in the select --- diff --git a/sonar-server/src/main/webapp/WEB-INF/app/controllers/api/resources_controller.rb b/sonar-server/src/main/webapp/WEB-INF/app/controllers/api/resources_controller.rb index 174701c15c4..2c53126195d 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/controllers/api/resources_controller.rb +++ b/sonar-server/src/main/webapp/WEB-INF/app/controllers/api/resources_controller.rb @@ -20,6 +20,7 @@ class Api::ResourcesController < Api::ApiController # since version 3.3 + # Exemple : /api/resources/search?s=sonar def search search_text = params[:s]||'' page=(params[:p] ? params[:p].to_i : 1) @@ -45,7 +46,7 @@ class Api::ResourcesController < Api::ApiController condition_values< 'distinct(resource_id),root_project_id,qualifier', # optimization to not load unused columns like 'kee' + :select => 'distinct(resource_id),root_project_id,qualifier,name_size', # optimization to not load unused columns like 'kee' :conditions => [conditions.join(' and ')].concat(condition_values), :order => 'name_size') diff --git a/sonar-server/src/main/webapp/WEB-INF/app/controllers/bulk_deletion_controller.rb b/sonar-server/src/main/webapp/WEB-INF/app/controllers/bulk_deletion_controller.rb index cee1eda2f04..a501282f0ef 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/controllers/bulk_deletion_controller.rb +++ b/sonar-server/src/main/webapp/WEB-INF/app/controllers/bulk_deletion_controller.rb @@ -47,7 +47,7 @@ class BulkDeletionController < ApplicationController end resource_ids = ResourceIndex.find(:all, - :select => 'distinct(resource_id)', + :select => 'distinct(resource_id),name_size', :conditions => [conditions, values], :order => 'name_size').map {|rid| rid.resource_id}.uniq diff --git a/sonar-server/src/main/webapp/WEB-INF/app/controllers/search_controller.rb b/sonar-server/src/main/webapp/WEB-INF/app/controllers/search_controller.rb index 90277e674de..848a1e18a9f 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/controllers/search_controller.rb +++ b/sonar-server/src/main/webapp/WEB-INF/app/controllers/search_controller.rb @@ -33,7 +33,7 @@ class SearchController < ApplicationController key = search.downcase results = ResourceIndex.find(:all, - :select => 'distinct(resource_id),root_project_id,qualifier', # optimization to not load unused columns like 'kee' + :select => 'distinct(resource_id),root_project_id,qualifier,name_size', # optimization to not load unused columns like 'kee' :conditions => ["kee like ?", key + '%'], :order => 'name_size')