]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-3755 Fix query for MySQL
authorJulien Lancelot <julien.lancelot@gmail.com>
Mon, 29 Apr 2013 14:58:32 +0000 (16:58 +0200)
committerJulien Lancelot <julien.lancelot@gmail.com>
Mon, 29 Apr 2013 14:58:32 +0000 (16:58 +0200)
sonar-core/src/main/resources/org/sonar/core/issue/db/IssueMapper.xml
sonar-core/src/test/java/org/sonar/core/issue/db/IssueDaoTest.java

index 1bd983329b0b56b9d9910217ed7d10f5f3d09f5f..6af9a54713f6a3c249a9944a42be6b72357d08c3 100644 (file)
           <when test="_databaseId == 'mssql'">
             s.path LIKE rootsnapshots.path + CAST(rootsnapshots.id AS varchar(15)) + '.%'
           </when>
+          <when test="_databaseId == 'mysql'">
+            s.path LIKE concat(rootsnapshots.path, rootsnapshots.id, '.%')
+          </when>
           <otherwise>
             s.path LIKE rootsnapshots.path || rootsnapshots.id || '.%'
           </otherwise>
index 6330ce885cd66095351403fe13bccd0c410843b5..31814746935e48967d6f7a0e54696c8ec270dcda 100644 (file)
@@ -190,6 +190,15 @@ public class IssueDaoTest extends AbstractDaoTestCase {
     assertThat(issues).hasSize(2);
     assertThat(issues.get(0).getId()).isEqualTo(100);
     assertThat(issues.get(1).getId()).isEqualTo(101);
+
+    query = IssueQuery.builder().componentRoots(newArrayList("Filter.java")).build();
+    issues = newArrayList(dao.select(query));
+    assertThat(issues).hasSize(1);
+    assertThat(issues.get(0).getId()).isEqualTo(101);
+
+    query = IssueQuery.builder().componentRoots(newArrayList("not-found")).build();
+    issues = newArrayList(dao.select(query));
+    assertThat(issues).isEmpty();
   }
 
   @Test