]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-3790 fix bug on H2 when column used in the order by are not in the select
authorJulien Lancelot <julien.lancelot@gmail.com>
Thu, 22 Nov 2012 13:15:17 +0000 (14:15 +0100)
committerJulien Lancelot <julien.lancelot@gmail.com>
Thu, 22 Nov 2012 13:15:17 +0000 (14:15 +0100)
sonar-server/src/main/webapp/WEB-INF/app/controllers/api/resources_controller.rb
sonar-server/src/main/webapp/WEB-INF/app/controllers/bulk_deletion_controller.rb
sonar-server/src/main/webapp/WEB-INF/app/controllers/search_controller.rb

index 174701c15c44c5dc4b99adad160a57e231069dee..2c53126195dc214b79e372556dfe08e426d3984f 100644 (file)
@@ -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<<qualifiers
     end
     indexes = 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 => [conditions.join(' and ')].concat(condition_values),
                                  :order => 'name_size')
 
index cee1eda2f04cc825c778984b79c04e66c9dbffec..a501282f0efdd275f3791acd940dfe35b6984f73 100644 (file)
@@ -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
       
index 90277e674deb769d02ffa1d3ba4ea648fc1886e6..848a1e18a9f1f517a366edfc3890db56582c6198 100644 (file)
@@ -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')