]> source.dussan.org Git - sonarqube.git/commitdiff
Use MyBatis lang="raw" to speed-up xml parsing when possible
authorSimon Brandhof <simon.brandhof@sonarsource.com>
Thu, 12 Jun 2014 22:36:54 +0000 (00:36 +0200)
committerSimon Brandhof <simon.brandhof@sonarsource.com>
Thu, 12 Jun 2014 22:36:54 +0000 (00:36 +0200)
21 files changed:
sonar-core/src/main/java/org/sonar/core/issue/db/IssueFilterDao.java
sonar-core/src/main/java/org/sonar/core/issue/db/IssueFilterFavouriteDao.java
sonar-core/src/main/java/org/sonar/core/issue/db/IssueFilterFavouriteMapper.java
sonar-core/src/main/java/org/sonar/core/issue/db/IssueFilterMapper.java
sonar-core/src/main/java/org/sonar/core/notification/db/NotificationQueueMapper.java
sonar-core/src/main/java/org/sonar/core/permission/PermissionTemplateMapper.java
sonar-core/src/main/resources/org/sonar/core/issue/db/ActionPlanMapper.xml
sonar-core/src/main/resources/org/sonar/core/issue/db/IssueChangeMapper.xml
sonar-core/src/main/resources/org/sonar/core/issue/db/IssueFilterFavouriteMapper.xml
sonar-core/src/main/resources/org/sonar/core/issue/db/IssueFilterMapper.xml
sonar-core/src/main/resources/org/sonar/core/issue/db/IssueMapper.xml
sonar-core/src/main/resources/org/sonar/core/log/db/LogMapper.xml
sonar-core/src/main/resources/org/sonar/core/measure/db/MeasureFilterMapper.xml
sonar-core/src/main/resources/org/sonar/core/notification/db/NotificationQueueMapper.xml
sonar-core/src/main/resources/org/sonar/core/permission/PermissionTemplateMapper.xml
sonar-core/src/main/resources/org/sonar/core/persistence/SchemaMigrationMapper.xml
sonar-core/src/main/resources/org/sonar/core/persistence/SemaphoreMapper.xml
sonar-core/src/main/resources/org/sonar/core/rule/RuleMapper.xml
sonar-core/src/main/resources/org/sonar/core/technicaldebt/db/CharacteristicMapper.xml
sonar-core/src/main/resources/org/sonar/core/user/AuthorMapper.xml
sonar-core/src/main/resources/org/sonar/core/user/RoleMapper.xml

index a2d9d443353b144af8679070cc430d25124694da..1548dc84444d29f3b5fc030a1ff10a51ddb94dc1 100644 (file)
@@ -41,7 +41,7 @@ public class IssueFilterDao implements BatchComponent, ServerComponent {
   }
 
   @CheckForNull
-  public IssueFilterDto selectById(Long id) {
+  public IssueFilterDto selectById(long id) {
     SqlSession session = mybatis.openSession(false);
     try {
       session.getMapper(IssueFilterMapper.class);
@@ -98,7 +98,7 @@ public class IssueFilterDao implements BatchComponent, ServerComponent {
     }
   }
 
-  public void delete(Long id) {
+  public void delete(long id) {
     SqlSession session = mybatis.openSession(false);
     try {
       getMapper(session).delete(id);
index 3221b4ff31e7f3b8e22f5a292aa6d2fab2eb3520..7f3705ce56732bb8a3030c180ca75ac59a40c6ba 100644 (file)
@@ -38,7 +38,7 @@ public class IssueFilterFavouriteDao implements BatchComponent, ServerComponent
     this.mybatis = mybatis;
   }
 
-  public IssueFilterFavouriteDto selectById(Long id) {
+  public IssueFilterFavouriteDto selectById(long id) {
     SqlSession session = mybatis.openSession(false);
     try {
       return getMapper(session).selectById(id);
@@ -47,7 +47,7 @@ public class IssueFilterFavouriteDao implements BatchComponent, ServerComponent
     }
   }
 
-  public List<IssueFilterFavouriteDto> selectByFilterId(Long filterId) {
+  public List<IssueFilterFavouriteDto> selectByFilterId(long filterId) {
     SqlSession session = mybatis.openSession(false);
     try {
       return getMapper(session).selectByFilterId(filterId);
@@ -66,7 +66,7 @@ public class IssueFilterFavouriteDao implements BatchComponent, ServerComponent
     }
   }
 
-  public void delete(Long id) {
+  public void delete(long id) {
     SqlSession session = mybatis.openSession(false);
     try {
       getMapper(session).delete(id);
@@ -76,7 +76,7 @@ public class IssueFilterFavouriteDao implements BatchComponent, ServerComponent
     }
   }
 
-  public void deleteByFilterId(Long filterId) {
+  public void deleteByFilterId(long filterId) {
     SqlSession session = mybatis.openSession(false);
     try {
       getMapper(session).deleteByFilterId(filterId);
index 351bb5ef012d042fdc31cdefd9419916f79e0424..33c93150a1bcdb47d6ece60756b8d3fcc843eb80 100644 (file)
@@ -31,13 +31,13 @@ import java.util.List;
 public interface IssueFilterFavouriteMapper {
 
   @CheckForNull
-  IssueFilterFavouriteDto selectById(Long id);
+  IssueFilterFavouriteDto selectById(long id);
 
-  List<IssueFilterFavouriteDto> selectByFilterId(@Param("filterId") Long filterId);
+  List<IssueFilterFavouriteDto> selectByFilterId(@Param("filterId") long filterId);
 
   void insert(IssueFilterFavouriteDto filterFavourite);
 
-  void delete(Long id);
+  void delete(long id);
 
-  void deleteByFilterId(Long filterId);
+  void deleteByFilterId(long filterId);
 }
index 9cb2c41bd5f31c568fb1964fc5ec86fb274c68e8..fd0479f4132ad6c7af9fed63e577b589c53b709a 100644 (file)
@@ -29,7 +29,7 @@ import java.util.List;
 public interface IssueFilterMapper {
 
   @CheckForNull
-  IssueFilterDto selectById(Long id);
+  IssueFilterDto selectById(long id);
 
   List<IssueFilterDto> selectByUser(String user);
 
@@ -41,5 +41,5 @@ public interface IssueFilterMapper {
 
   void update(IssueFilterDto filter);
 
-  void delete(Long id);
+  void delete(long id);
 }
index d39e1783af992709cd1feef7e36540887fd012d1..fedab33c8d5c2c4737c7a0da4d6eadb99bd806fb 100644 (file)
@@ -29,7 +29,7 @@ public interface NotificationQueueMapper {
 
   void insert(NotificationQueueDto actionPlanDto);
 
-  void delete(Long id);
+  void delete(long id);
 
   List<NotificationQueueDto> findOldest(int count);
 
index e3f3d2651cd9c85b728a8df796bf9dfbd71f8f25..63c2b7b9ff5567bcac67d503ce39447a7b150ea3 100644 (file)
@@ -29,11 +29,11 @@ public interface PermissionTemplateMapper {
 
   void update(PermissionTemplateDto permissionTemplate);
 
-  void delete(Long templateId);
+  void delete(long templateId);
 
-  void deleteUsersPermissions(Long templateId);
+  void deleteUsersPermissions(long templateId);
 
-  void deleteGroupsPermissions(Long templateId);
+  void deleteGroupsPermissions(long templateId);
 
   PermissionTemplateDto selectByKey(String templateKey);
 
index d203185ed6cdf53221c2af075247543cac96c5fe..a41db485e484e7ee3a193face715e345704729a2 100644 (file)
@@ -18,7 +18,7 @@
     p.kee as projectKey
   </sql>
 
-  <insert id="insert" parameterType="ActionPlanIssue" keyColumn="id" useGeneratedKeys="true" keyProperty="id">
+  <insert id="insert" parameterType="ActionPlanIssue" keyColumn="id" useGeneratedKeys="true" keyProperty="id" lang="raw">
     INSERT INTO action_plans (kee, name, description, user_login, project_id, status, deadline, created_at, updated_at)
     VALUES (#{kee}, #{name}, #{description}, #{userLogin}, #{projectId}, #{status}, #{deadLine}, #{createdAt}, #{updatedAt})
   </insert>
@@ -80,4 +80,4 @@
     </where>
   </select>
 
-</mapper>
\ No newline at end of file
+</mapper>
index c17d5f04f4bd3d6acb7f64a9ace7a94d4d00afb3..6cda9b308e5a2586d2fda82cb520085e03ad75b5 100644 (file)
     c.issue_change_creation_date as issueChangeCreationDate
   </sql>
 
-  <insert id="insert" parameterType="IssueChange" useGeneratedKeys="false" keyProperty="id">
+  <insert id="insert" parameterType="IssueChange" useGeneratedKeys="false" keyProperty="id" lang="raw">
     INSERT INTO issue_changes (kee, issue_key, user_login, change_type, change_data, created_at, updated_at, issue_change_creation_date)
     VALUES (#{kee}, #{issueKey}, #{userLogin}, #{changeType}, #{changeData}, #{createdAt}, #{updatedAt}, #{issueChangeCreationDate})
   </insert>
 
-  <delete id="delete" parameterType="string">
+  <delete id="delete" parameterType="string" lang="raw">
     delete from issue_changes where kee=#{id}
   </delete>
 
-  <update id="update" parameterType="map">
+  <update id="update" parameterType="map" lang="raw">
     update issue_changes set change_data=#{changeData}, updated_at=#{updatedAt} where kee=#{kee}
   </update>
 
index 15d9b8d92638b88739dd81a65dab363164a5992c..dc774b63048dfa2d9c1b17aa74abb506e7bbe1f0 100644 (file)
   <select id="selectById" parameterType="long" resultType="issueFilterFavourite">
     select <include refid="issueFilterFavouriteColumns"/>
     from issue_filter_favourites filter_favourites
-    <where>
-      filter_favourites.id=#{id}
-    </where>
+    where filter_favourites.id=#{id}
   </select>
 
   <select id="selectByFilterId" parameterType="long" resultType="issueFilterFavourite">
     select <include refid="issueFilterFavouriteColumns"/>
     from issue_filter_favourites filter_favourites
-    <where>
-      filter_favourites.issue_filter_id=#{filterId}
-    </where>
+    where filter_favourites.issue_filter_id=#{filterId}
   </select>
 
   <insert id="insert" parameterType="issueFilterFavourite" keyColumn="id" useGeneratedKeys="true" keyProperty="id">
     VALUES (#{userLogin}, #{issueFilterId}, current_timestamp)
   </insert>
 
-  <delete id="delete" parameterType="int">
+  <delete id="delete" parameterType="long" lang="raw">
     delete from issue_filter_favourites where id=#{id}
   </delete>
 
-  <delete id="deleteByFilterId" parameterType="int">
+  <delete id="deleteByFilterId" parameterType="long" lang="raw">
     delete from issue_filter_favourites where issue_filter_id=#{issueFilterId}
   </delete>
 
index 954c7af61f07ed8c806d6a160ce5708db6572232..2f2cf4980b2ecdbc11eed2008c0f6a1e6fff00a9 100644 (file)
   <select id="selectById" parameterType="long" resultType="IssueFilter">
     select <include refid="issueFilterColumns"/>
     from issue_filters filters
-    <where>
-      filters.id=#{id}
-    </where>
+    where filters.id=#{id}
   </select>
 
   <select id="selectByUser" parameterType="String" resultType="IssueFilter">
     select <include refid="issueFilterColumns"/>
     from issue_filters filters
-    <where>
-      filters.user_login=#{user}
-    </where>
+    where filters.user_login=#{user}
   </select>
 
   <select id="selectFavoriteFiltersByUser" parameterType="String" resultType="IssueFilter">
     select <include refid="issueFilterColumns"/>
     from issue_filters filters
     inner join issue_filter_favourites fav on fav.issue_filter_id = filters.id
-    <where>
-      fav.user_login=#{user}
-    </where>
+    where fav.user_login=#{user}
   </select>
 
   <select id="selectSharedFilters" parameterType="String" resultType="IssueFilter">
     select <include refid="issueFilterColumns"/>
     from issue_filters filters
-    <where>
-      and filters.shared=${_true}
-    </where>
+    where filters.shared=${_true}
   </select>
 
-  <insert id="insert" parameterType="IssueFilter" keyColumn="id" useGeneratedKeys="true" keyProperty="id">
+  <insert id="insert" parameterType="IssueFilter" keyColumn="id" useGeneratedKeys="true" keyProperty="id" lang="raw">
     INSERT INTO issue_filters (name, user_login, shared, description, data, created_at, updated_at)
     VALUES (#{name}, #{userLogin}, #{shared}, #{description}, #{data}, #{createdAt}, #{updatedAt})
   </insert>
 
-  <update id="update" parameterType="IssueFilter">
+  <update id="update" parameterType="IssueFilter" lang="raw">
     update issue_filters set
     name=#{name},
     shared=#{shared},
@@ -64,7 +56,7 @@
     where id=#{id}
   </update>
 
-  <delete id="delete" parameterType="int">
+  <delete id="delete" parameterType="long" lang="raw">
     delete from issue_filters where id=#{id}
   </delete>
 
index 6d7a4f2401f0e109b35e8292986decd6a8da7431..2c4ef44b0416e82c2b6368afb94604d70246e6fe 100644 (file)
@@ -60,7 +60,7 @@
     </if>
   </sql>
 
-  <insert id="insert" parameterType="Issue" useGeneratedKeys="false" keyProperty="id">
+  <insert id="insert" parameterType="Issue" useGeneratedKeys="false" keyProperty="id" lang="raw">
     INSERT INTO issues (kee, component_id, root_component_id, rule_id, action_plan_key, severity, manual_severity,
     message, line, effort_to_fix, technical_debt, status,
     resolution, checksum, reporter, assignee, author_login, issue_attributes, issue_creation_date, issue_update_date,
@@ -74,7 +74,7 @@
   <!--
     IMPORTANT - invariant columns can't be updated. See IssueDto#toDtoForUpdate()
   -->
-  <update id="update" parameterType="Issue">
+  <update id="update" parameterType="Issue" lang="raw">
     update issues set
     action_plan_key=#{actionPlanKey},
     severity=#{severity},
   <!--
    IMPORTANT - invariant columns can't be updated. See IssueDto#toDtoForUpdate()
  -->
-  <update id="updateIfBeforeSelectedDate" parameterType="Issue">
+  <update id="updateIfBeforeSelectedDate" parameterType="Issue" lang="raw">
     update issues set
     action_plan_key=#{actionPlanKey},
     severity=#{severity},
     inner join rules r on r.id=i.rule_id
     inner join projects p on p.id=i.component_id
     inner join projects root on root.id=i.root_component_id
-    <where>
-      and i.kee=#{kee}
-    </where>
+    where i.kee=#{kee}
   </select>
 
-  <select id="selectNonClosedIssuesByModule" parameterType="int" resultType="Issue">
+  <select id="selectNonClosedIssuesByModule" parameterType="int" resultType="Issue" lang="raw">
     select
       i.id,
       i.kee as kee,
     inner join (select p.id,p.kee from projects p where (p.root_id=#{id} and p.qualifier &lt;&gt; 'BRC') or (p.id=#{id})) p on p.id=i.component_id
     inner join rules r on r.id=i.rule_id
     left outer join projects root on root.id=i.root_component_id
-    <where>
-      and i.status &lt;&gt; 'CLOSED'
-    </where>
+    where i.status &lt;&gt; 'CLOSED'
   </select>
 
   <select id="selectByIds" parameterType="map" resultType="Issue">
     inner join rules r on r.id=i.rule_id
     inner join projects p on p.id=i.component_id
     inner join projects root on root.id=i.root_component_id
-    <where>
-      and i.id in
+    where i.id in
       <foreach collection="list" open="(" close=")" item="id" separator=",">
         #{id}
       </foreach>
-    </where>
   </select>
 
   <select id="selectIssues" parameterType="map" resultType="Issue">
     FROM issues i
     INNER JOIN projects p on p.id=i.component_id
     INNER JOIN rules r on r.id=i.rule_id
-    <where>
-      AND p.kee=#{componentKey}
+    WHERE
+      p.kee=#{componentKey}
       AND i.resolution IS NULL
       <if test="createdAt != null">
         AND i.issue_creation_date &gt;= #{createdAt}
       </if>
-    </where>
   </select>
 
   <select id="findSeveritiesByComponent" parameterType="String" resultType="String">
     FROM issues i
     INNER JOIN projects on projects.id=i.component_id
     INNER JOIN rules on rules.id=i.rule_id
-    <where>
-      AND projects.kee=#{componentKey}
+    WHERE
+      projects.kee=#{componentKey}
       AND i.resolution IS NULL
       <if test="createdAt != null">
         AND i.issue_creation_date &gt;= #{createdAt}
       </if>
-    </where>
   </select>
 
 </mapper>
index 983a37252eb02942d74d4d8cb84640e47cff4261..a2e7db66719056e302c9781603829ed234830bef 100644 (file)
@@ -2,28 +2,28 @@
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 
 <mapper namespace="org.sonar.core.log.db.LogMapper">
-    <insert id="insert" parameterType="Log" useGeneratedKeys="false">
-        insert into logs
-      (created_at, log_type,execution_time_field,user_login,data_field, log_message)
-      values (#{createdAt}, #{type}, #{executionTime}, #{author}, #{data}, #{message})
-    </insert>
 
-    <select id="selectByKey" parameterType="map" resultType="Log">
-      SELECT
-      l.created_at as "createdAt",
-      l.log_type as "type",
-        l.execution_time_field as "executionTime",
-        l.user_login as "author",
-      l.data_field as "data",
-      l.log_message as "message"
-      FROM logs l
-      WHERE l.created_at=#{key.createdAt}
-        AND l.user_login=#{key.author}
-      AND l.log_type=#{key.type}
+  <insert id="insert" parameterType="Log" useGeneratedKeys="false" lang="raw">
+    insert into logs
+    (created_at, log_type,execution_time_field,user_login,data_field, log_message)
+    values (#{createdAt}, #{type}, #{executionTime}, #{author}, #{data}, #{message})
+  </insert>
 
-    </select>
+  <select id="selectByKey" parameterType="map" resultType="Log" lang="raw">
+    SELECT
+    l.created_at as "createdAt",
+    l.log_type as "type",
+    l.execution_time_field as "executionTime",
+    l.user_login as "author",
+    l.data_field as "data",
+    l.log_message as "message"
+    FROM logs l
+    WHERE l.created_at=#{key.createdAt}
+    AND l.user_login=#{key.author}
+    AND l.log_type=#{key.type}
+  </select>
 
-  <select id="selectAll" parameterType="map" resultType="Log">
+  <select id="selectAll" parameterType="map" resultType="Log" lang="raw">
     SELECT
     l.created_at as "createdAt",
     l.log_type as "type",
index b2803b634207038110f09407303b65e94124e631..6a762f01ffd55e7b5769203c63528c090805f4e7 100644 (file)
@@ -3,12 +3,12 @@
 
 <mapper namespace="org.sonar.core.measure.db.MeasureFilterMapper">
 
-  <select id="findSystemFilterByName" parameterType="string" resultType="MeasureFilter">
+  <select id="findSystemFilterByName" parameterType="string" resultType="MeasureFilter" lang="raw">
     select id, name, user_id as "userId", shared, description, data, created_at as "createdAt", updated_at as "updatedAt"
     from measure_filters WHERE user_id is null and name=#{id}
   </select>
 
-  <insert id="insert" parameterType="MeasureFilter" keyColumn="id" useGeneratedKeys="true" keyProperty="id">
+  <insert id="insert" parameterType="MeasureFilter" keyColumn="id" useGeneratedKeys="true" keyProperty="id" lang="raw">
     INSERT INTO measure_filters (name, user_id, shared, description, data, created_at, updated_at)
     VALUES (#{name}, #{userId}, #{shared}, #{description}, #{data}, #{createdAt}, #{updatedAt})
   </insert>
index 4d95fc707a9e4f0c61c9546c299d9055ce366333..ce373be41060d59a555714e13d7080854af88266 100644 (file)
@@ -4,20 +4,20 @@
 
 <mapper namespace="org.sonar.core.notification.db.NotificationQueueMapper">
 
-  <insert id="insert" parameterType="NotificationQueue" useGeneratedKeys="false">
+  <insert id="insert" parameterType="NotificationQueue" useGeneratedKeys="false" lang="raw">
     INSERT INTO notifications (data)
     VALUES (#{data})
   </insert>
 
-  <delete id="delete" parameterType="long">
+  <delete id="delete" parameterType="long" lang="raw">
     delete from notifications where id=#{id}
   </delete>
 
-  <select id="count" resultType="long">
+  <select id="count" resultType="long" lang="raw">
     select count(*) from notifications
   </select>
 
-  <select id="findOldest" parameterType="int" resultType="NotificationQueue">
+  <select id="findOldest" parameterType="int" resultType="NotificationQueue" lang="raw">
     select id, data
     from notifications
     order by id asc
   </select>
 
   <!-- SQL Server -->
-  <select id="findOldest" parameterType="int" resultType="NotificationQueue" databaseId="mssql">
+  <select id="findOldest" parameterType="int" resultType="NotificationQueue" databaseId="mssql" lang="raw">
     select top (#{count}) id, data
     from notifications
     order by id asc
   </select>
 
   <!-- Oracle -->
-  <select id="findOldest" parameterType="int" resultType="NotificationQueue" databaseId="oracle">
+  <select id="findOldest" parameterType="int" resultType="NotificationQueue" databaseId="oracle" lang="raw">
     select * from (select
       id, data
       from notifications
index f472ec10ae2a53039917c90f657d3c01e80bb0fe..70c9ffb08e083a002a729d6215ccd5de6cb6d0ad 100644 (file)
@@ -3,45 +3,45 @@
 
 <mapper namespace="org.sonar.core.permission.PermissionTemplateMapper">
 
-  <insert id="insert" parameterType="PermissionTemplate" keyColumn="id" useGeneratedKeys="true" keyProperty="id">
+  <insert id="insert" parameterType="PermissionTemplate" keyColumn="id" useGeneratedKeys="true" keyProperty="id" lang="raw">
     INSERT INTO permission_templates (name, kee, description, key_pattern, created_at, updated_at)
     VALUES (#{name}, #{kee}, #{description}, #{keyPattern}, #{createdAt}, #{updatedAt})
   </insert>
 
-  <update id="update" parameterType="PermissionTemplate">
+  <update id="update" parameterType="PermissionTemplate" lang="raw">
     UPDATE permission_templates
     SET name = #{name}, description = #{description}, key_pattern = #{keyPattern}, updated_at = #{updatedAt}
     WHERE id = #{id}
   </update>
 
-  <delete id="delete" parameterType="Long">
+  <delete id="delete" parameterType="long" lang="raw">
     DELETE FROM permission_templates
     WHERE id = #{templateId}
   </delete>
 
-  <delete id="deleteUsersPermissions" parameterType="Long">
+  <delete id="deleteUsersPermissions" parameterType="long" lang="raw">
     DELETE FROM perm_templates_users
     WHERE template_id = #{templateId}
   </delete>
 
-  <delete id="deleteGroupsPermissions" parameterType="Long">
+  <delete id="deleteGroupsPermissions" parameterType="long" lang="raw">
     DELETE FROM perm_templates_groups
     WHERE template_id = #{templateId}
   </delete>
 
-  <insert id="insertUserPermission" parameterType="PermissionTemplateUser">
+  <insert id="insertUserPermission" parameterType="PermissionTemplateUser" lang="raw">
     INSERT INTO perm_templates_users (template_id, user_id, permission_reference, created_at, updated_at)
     VALUES (#{templateId}, #{userId}, #{permission}, #{createdAt}, #{updatedAt})
   </insert>
 
-  <delete id="deleteUserPermission" parameterType="PermissionTemplateUser">
+  <delete id="deleteUserPermission" parameterType="PermissionTemplateUser" lang="raw">
     DELETE FROM perm_templates_users
     WHERE template_id = #{templateId}
     AND user_id = #{userId}
     AND permission_reference = #{permission}
   </delete>
 
-  <insert id="insertGroupPermission" parameterType="PermissionTemplateGroup">
+  <insert id="insertGroupPermission" parameterType="PermissionTemplateGroup" lang="raw">
     INSERT INTO perm_templates_groups (template_id, group_id, permission_reference, created_at, updated_at)
     VALUES (#{templateId}, #{groupId}, #{permission}, #{createdAt}, #{updatedAt})
   </insert>
     ORDER BY groups.name
   </select>
 
-  <select id="selectByKey" parameterType="String" resultType="PermissionTemplate">
+  <select id="selectByKey" parameterType="String" resultType="PermissionTemplate" lang="raw">
     SELECT id, name, kee, description, key_pattern AS keyPattern, created_at AS createdAt, updated_at AS updatedAt
     FROM permission_templates
     WHERE kee = #{kee}
   </select>
 
-  <select id="selectAllPermissionTemplates" resultType="PermissionTemplate">
+  <select id="selectAllPermissionTemplates" resultType="PermissionTemplate" lang="raw">
     SELECT id, name, kee, description, key_pattern AS keyPattern, created_at AS createdAt, updated_at AS updatedAt
     FROM permission_templates
   </select>
 
-  <select id="selectTemplateUsersPermissions" parameterType="String" resultMap="fullPermissionsTemplateResult">
+  <select id="selectTemplateUsersPermissions" parameterType="String" resultMap="fullPermissionsTemplateResult" lang="raw">
     SELECT  pt.id AS template_id,
             pt.name AS template_name,
             pt.description AS template_description,
     WHERE pt.kee = #{templateKey}
   </select>
 
-  <select id="selectTemplateGroupsPermissions" parameterType="String" resultMap="fullPermissionsTemplateResult">
+  <select id="selectTemplateGroupsPermissions" parameterType="String" resultMap="fullPermissionsTemplateResult" lang="raw">
     SELECT  pt.id AS template_id,
             pt.name AS template_name,
             pt.description AS template_description,
index 2181a80d067c64d139f2f5874ad826d657b1eb4e..be1da205bec0f6f908df91a4ab0ca9c6d5cbfcf0 100644 (file)
@@ -3,7 +3,7 @@
 
 <mapper namespace="org.sonar.core.persistence.SchemaMigrationMapper">
 
-  <select id="selectVersions" resultType="int">
+  <select id="selectVersions" resultType="int" lang="raw">
     select * from schema_migrations
   </select>
 
index 81ed974e32fb200f4e1cdc9465d95633dc3248af..f4efc01f9851c24941e42077f8b96ef772b32fc7 100644 (file)
@@ -3,16 +3,16 @@
 
 <mapper namespace="org.sonar.core.persistence.SemaphoreMapper">
 
-  <insert id="initialize" parameterType="map" useGeneratedKeys="false">
+  <insert id="initialize" parameterType="map" useGeneratedKeys="false" lang="raw">
     INSERT INTO semaphores (name, checksum, created_at, updated_at, locked_at)
     VALUES (#{name}, #{checksum}, current_timestamp, current_timestamp, #{lockedAt})
   </insert>
 
-  <select id="now" resultType="Date">
+  <select id="now" resultType="Date" lang="raw">
     select current_timestamp
   </select>
 
-  <select id="now" databaseId="oracle" resultType="Date">
+  <select id="now" databaseId="oracle" resultType="Date" lang="raw">
     select current_timestamp from dual
   </select>
 
     </if>
   </update>
 
-  <delete id="release" parameterType="String">
+  <delete id="release" parameterType="String" lang="raw">
     delete from semaphores where name=#{id}
   </delete>
 
-  <select id="selectSemaphore" parameterType="String" resultType="Semaphore">
-    select s.id, s.name as name, s.locked_at as lockedAt, s.created_at as createdAt, s.updated_at as updatedAt from semaphores s where s.name=#{name}
+  <select id="selectSemaphore" parameterType="String" resultType="Semaphore" lang="raw">
+    select s.id, s.name as name, s.locked_at as lockedAt, s.created_at as createdAt, s.updated_at as updatedAt
+    from semaphores s where s.name=#{name}
   </select>
 
-  <update id="update" parameterType="String">
+  <update id="update" parameterType="String" lang="raw">
     update semaphores
     set updated_at = current_timestamp
     where name=#{name}
index b95f1b268d544b9e4f3c5a2659d2ec213bf73672..7d6ef5dbc1bb3fd2907b7c4ff8a3836c4a5770e1 100644 (file)
 
   <select id="selectEnablesAndNonManual" resultType="Rule">
     select <include refid="selectColumns"/> from rules r
-    <where>
-      and r.status != 'REMOVED'
-      and r.plugin_name != 'manual'
-    </where>
+    where r.status != 'REMOVED' and r.plugin_name != 'manual'
   </select>
 
   <select id="selectById" parameterType="Integer" resultType="Rule">
@@ -65,9 +62,7 @@
 
   <select id="selectBySubCharacteristicId" resultType="Rule">
     select <include refid="selectColumns"/> from rules r
-    <where>
-      and (r.characteristic_id=#{subCharacteristicId} or r.default_characteristic_id=#{subCharacteristicId})
-    </where>
+    where (r.characteristic_id=#{subCharacteristicId} or r.default_characteristic_id=#{subCharacteristicId})
   </select>
 
   <update id="update" parameterType="Rule">
     #{noteUpdatedAt}, #{createdAt}, #{updatedAt})
   </insert>
 
-  <delete id="deleteParams" parameterType="Integer" >
+  <delete id="deleteParams" parameterType="Integer" lang="raw">
     delete from active_rule_parameters where rules_parameter_id=#{id}
   </delete>
 
   <select id="selectParamByRuleAndKey" resultType="RuleParam">
     SELECT <include refid="paramColumns"/>
     FROM rules_parameters p
-    <where>
-      AND p.rule_id=#{ruleId}
-      AND p.name=#{key}
-    </where>
+    WHERE p.rule_id=#{ruleId} AND p.name=#{key}
   </select>
 
-  <delete id="deleteParameter" parameterType="Integer">
+  <delete id="deleteParameter" parameterType="Integer" lang="raw">
     delete from rules_parameters where id=#{id}
   </delete>
 
-  <insert id="insertParameter" parameterType="RuleParam" keyColumn="id" useGeneratedKeys="true" keyProperty="id">
+  <insert id="insertParameter" parameterType="RuleParam" keyColumn="id" useGeneratedKeys="true" keyProperty="id" lang="raw">
     INSERT INTO rules_parameters (rule_id, name, param_type, default_value, description)
     VALUES (#{ruleId}, #{name}, #{type}, #{defaultValue}, #{description})
   </insert>
 
-  <update id="updateParameter" parameterType="RuleParam">
+  <update id="updateParameter" parameterType="RuleParam" lang="raw">
     UPDATE rules_parameters SET
       name=#{name},
       param_type=#{type},
     WHERE id=#{id}
   </update>
 
-  <select id="selectKeysOfRulesUpdatedSince" resultType="map">
+  <select id="selectKeysOfRulesUpdatedSince" resultType="map" lang="raw">
     SELECT r.plugin_name as "repoField", r.plugin_rule_key as "ruleField"
     FROM rules r
     WHERE r.updated_at IS NULL or r.updated_at &gt;= #{id}
index abce63863736527608d95d00d49a2348cd74ed8c..152832e036680158535f0ce0b64750f3d34af01e 100644 (file)
@@ -18,9 +18,7 @@
   <select id="selectEnabledCharacteristics" parameterType="map" resultType="Characteristic">
     select <include refid="characteristicColumns"/>
     from characteristics c
-    <where>
-      and c.enabled=${_true}
-    </where>
+    where c.enabled=${_true}
   </select>
 
   <select id="selectCharacteristics" parameterType="map" resultType="Characteristic">
@@ -97,7 +95,7 @@
     VALUES (#{kee}, #{name}, #{parentId}, #{characteristicOrder}, #{enabled}, #{createdAt}, #{updatedAt})
   </insert>
 
-  <update id="update" parameterType="Characteristic">
+  <update id="update" parameterType="Characteristic" lang="raw">
     update characteristics set
     name=#{name},
     parent_id=#{parentId},
     where id=#{id}
   </update>
 
-  <select id="selectDeprecatedRequirements" resultType="RequirementMigration">
+  <select id="selectDeprecatedRequirements" resultType="RequirementMigration" lang="raw">
     select id as "id",
     parent_id as "parentId",
     root_id as "rootId",
     where rule_id IS NOT NULL
   </select>
 
-  <delete id="deleteRequirementsFromCharacteristicsTable">
+  <delete id="deleteRequirementsFromCharacteristicsTable" lang="raw">
     DELETE FROM characteristics WHERE rule_id IS NOT NULL
   </delete>
 </mapper>
index fbb92585f1080cd602e63415ccb34c9b341de2a2..1a347fa53dd5a2ffc61fdf7e6b18ab8e6a930e0b 100644 (file)
@@ -3,17 +3,17 @@
 
 <mapper namespace="org.sonar.core.user.AuthorMapper">
 
-  <select id="selectByLogin" parameterType="string" resultType="Author">
+  <select id="selectByLogin" parameterType="string" resultType="Author" lang="raw">
     SELECT id, person_id AS personId, login, created_at AS createdAt, updated_at AS updatedAt
     FROM authors WHERE login=#{id}
   </select>
 
-  <select id="countDeveloperLogins" parameterType="long" resultType="int">
+  <select id="countDeveloperLogins" parameterType="long" resultType="int" lang="raw">
     SELECT count(id)
     FROM authors WHERE person_id=#{id}
   </select>
 
-  <insert id="insert" parameterType="Author" keyColumn="id" useGeneratedKeys="true" keyProperty="id">
+  <insert id="insert" parameterType="Author" keyColumn="id" useGeneratedKeys="true" keyProperty="id" lang="raw">
     INSERT INTO authors (person_id, login, created_at, updated_at)
     VALUES (#{personId}, #{login},
     #{createdAt}, #{updatedAt})
index 6587141c772095d8b4648064a5726249fa92412d..8d81b2ccc524258d6b63f2ae5347c7ac077c6571 100644 (file)
     </where>
   </select>
 
-  <insert id="insertGroupRole" parameterType="GroupRole" keyColumn="id" useGeneratedKeys="true" keyProperty="id">
+  <insert id="insertGroupRole" parameterType="GroupRole" keyColumn="id" useGeneratedKeys="true" keyProperty="id" lang="raw">
     INSERT INTO group_roles (group_id, resource_id, role)
     VALUES (#{groupId}, #{resourceId}, #{role})
   </insert>
 
-  <insert id="insertUserRole" parameterType="UserRole" keyColumn="id" useGeneratedKeys="true" keyProperty="id">
+  <insert id="insertUserRole" parameterType="UserRole" keyColumn="id" useGeneratedKeys="true" keyProperty="id" lang="raw">
     INSERT INTO user_roles (user_id, resource_id, role)
     VALUES (#{userId}, #{resourceId}, #{role})
   </insert>