]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-1091 Fix SQL for Oracle
authorEvgeny Mandrikov <mandrikov@gmail.com>
Mon, 12 Sep 2011 10:31:32 +0000 (14:31 +0400)
committerEvgeny Mandrikov <mandrikov@gmail.com>
Mon, 12 Sep 2011 10:34:41 +0000 (14:34 +0400)
Don't use 'resource' as table alias, because it's reserved word.

plugins/sonar-cpd-plugin/src/main/java/org/sonar/plugins/cpd/index/DbDuplicationsIndex.java

index a0a5529483b48f08c85fe908358bf16f81906505..9cff050f2adfd383f34f8ac82e16af44ce346460 100644 (file)
@@ -76,13 +76,13 @@ public class DbDuplicationsIndex {
     int resourceSnapshotId = getSnapshotIdFor(resource);
 
     // Order of columns is important - see code below!
-    String sql = "SELECT to_blocks.hash, resource.kee, to_blocks.index_in_file, to_blocks.start_line, to_blocks.end_line" +
-        " FROM duplications_index to_blocks, duplications_index from_blocks, snapshots snapshot, projects resource" +
+    String sql = "SELECT to_blocks.hash, res.kee, to_blocks.index_in_file, to_blocks.start_line, to_blocks.end_line" +
+        " FROM duplications_index to_blocks, duplications_index from_blocks, snapshots snapshot, projects res" +
         " WHERE from_blocks.snapshot_id = :resource_snapshot_id" +
         " AND to_blocks.hash = from_blocks.hash" +
         " AND to_blocks.snapshot_id = snapshot.id" +
         " AND snapshot.islast = :is_last" +
-        " AND snapshot.project_id = resource.id";
+        " AND snapshot.project_id = res.id";
     if (lastSnapshotId != null) {
       // Filter for blocks from previous snapshot of current project
       sql += " AND to_blocks.project_snapshot_id != :last_project_snapshot_id";