diff options
author | Simon Brandhof <simon.brandhof@sonarsource.com> | 2017-02-11 18:44:40 +0100 |
---|---|---|
committer | Simon Brandhof <simon.brandhof@sonarsource.com> | 2017-02-11 18:52:12 +0100 |
commit | 4ea41ebcacbf159db6e62318b53896ebeb5bfd38 (patch) | |
tree | fd89443708c1c9d58b6c7e446f9599f953688a8a /sonar-db/src | |
parent | 5f172d40d5f1de51fdf937d8b711e9fb3a677030 (diff) | |
download | sonarqube-4ea41ebcacbf159db6e62318b53896ebeb5bfd38.tar.gz sonarqube-4ea41ebcacbf159db6e62318b53896ebeb5bfd38.zip |
Add missing jdbcType attributes in MyBatis mappers
Diffstat (limited to 'sonar-db/src')
12 files changed, 64 insertions, 79 deletions
diff --git a/sonar-db/src/main/resources/org/sonar/db/activity/ActivityMapper.xml b/sonar-db/src/main/resources/org/sonar/db/activity/ActivityMapper.xml deleted file mode 100644 index 63084a23551..00000000000 --- a/sonar-db/src/main/resources/org/sonar/db/activity/ActivityMapper.xml +++ /dev/null @@ -1,15 +0,0 @@ -<?xml version="1.0" encoding="UTF-8" ?> -<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> - -<mapper namespace="org.sonar.db.activity.ActivityMapper"> - - <insert id="insert" parameterType="Activity" useGeneratedKeys="false"> - insert into activities - (created_at, log_key, log_type, log_action, user_login, data_field, log_message, profile_key) - values (#{createdAt,jdbcType=TIMESTAMP}, #{key,jdbcType=VARCHAR}, #{type,jdbcType=VARCHAR}, - #{action,jdbcType=VARCHAR}, - #{author,jdbcType=VARCHAR}, #{data,jdbcType=VARCHAR}, #{message,jdbcType=VARCHAR}, #{profileKey, jdbcType=VARCHAR}) - </insert> - -</mapper> - diff --git a/sonar-db/src/main/resources/org/sonar/db/ce/CeActivityMapper.xml b/sonar-db/src/main/resources/org/sonar/db/ce/CeActivityMapper.xml index c4226b8efb2..bac934d732f 100644 --- a/sonar-db/src/main/resources/org/sonar/db/ce/CeActivityMapper.xml +++ b/sonar-db/src/main/resources/org/sonar/db/ce/CeActivityMapper.xml @@ -41,7 +41,7 @@ ca.error_stacktrace as errorStacktrace from ce_activity ca left outer join ce_scanner_context csc on ca.uuid = csc.task_uuid - where ca.uuid=#{uuid} + where ca.uuid=#{uuid,jdbcType=VARCHAR} </select> <select id="selectByQuery" parameterType="map" resultType="org.sonar.db.ce.CeActivityDto"> @@ -84,23 +84,23 @@ <if test="query.componentUuids != null and query.componentUuids.size()>0"> and ca.component_uuid in <foreach collection="query.componentUuids" open="(" close=")" item="cUuid" separator=","> - #{cUuid} + #{cUuid,jdbcType=VARCHAR} </foreach> </if> <if test="query.statuses != null and !query.statuses.isEmpty()"> and ca.status in <foreach collection="query.statuses" open="(" close=")" item="status" separator=","> - #{status} + #{status,jdbcType=VARCHAR} </foreach> </if> <if test="query.type != null"> - and ca.task_type=#{query.type} + and ca.task_type=#{query.type,jdbcType=VARCHAR} </if> <if test="query.minSubmittedAt != null"> - and ca.submitted_at >= #{query.minSubmittedAt} + and ca.submitted_at >= #{query.minSubmittedAt,jdbcType=BIGINT} </if> <if test="query.maxExecutedAt != null"> - and ca.executed_at <= #{query.maxExecutedAt} + and ca.executed_at <= #{query.maxExecutedAt,jdbcType=BIGINT} </if> </where> </sql> @@ -120,10 +120,10 @@ from ce_activity where - status=#{status} + status=#{status,jdbcType=VARCHAR} and is_last=${_true} <if test="componentUuid!=null"> - and component_uuid=#{componentUuid} + and component_uuid=#{componentUuid,jdbcType=VARCHAR} </if> </select> @@ -170,7 +170,7 @@ update ce_activity set is_last=${_false}, updated_at=#{updatedAt,jdbcType=BIGINT} - where is_last=${_true} and is_last_key=#{isLastKey} + where is_last=${_true} and is_last_key=#{isLastKey,jdbcType=VARCHAR} </update> <delete id="deleteByUuids" parameterType="string"> @@ -179,7 +179,7 @@ where uuid in <foreach collection="uuids" open="(" close=")" item="uuid" separator=","> - #{uuid} + #{uuid,jdbcType=VARCHAR} </foreach> </delete> </mapper> diff --git a/sonar-db/src/main/resources/org/sonar/db/ce/CeQueueMapper.xml b/sonar-db/src/main/resources/org/sonar/db/ce/CeQueueMapper.xml index e3d71cc85ac..ebd64ab82ea 100644 --- a/sonar-db/src/main/resources/org/sonar/db/ce/CeQueueMapper.xml +++ b/sonar-db/src/main/resources/org/sonar/db/ce/CeQueueMapper.xml @@ -26,15 +26,15 @@ select <include refid="columns"/> from ce_queue cq - where cq.uuid=#{uuid} + where cq.uuid=#{uuid,jdbcType=VARCHAR} </select> <select id="countByStatusAndComponentUuid" parameterType="map" resultType="int"> select count(1) from ce_queue - where status=#{status} + where status=#{status,jdbcType=VARCHAR} <if test="componentUuid!=null"> - and component_uuid=#{componentUuid} + and component_uuid=#{componentUuid,jdbcType=VARCHAR} </if> </select> @@ -46,7 +46,7 @@ select <include refid="columns"/> from ce_queue cq - where cq.component_uuid=#{componentUuid} + where cq.component_uuid=#{componentUuid,jdbcType=VARCHAR} <include refid="orderByDateAndId"/> </select> @@ -75,20 +75,20 @@ <if test="query.componentUuids != null and query.componentUuids.size()>0"> and cq.component_uuid in <foreach collection="query.componentUuids" open="(" close=")" item="cUuid" separator=","> - #{cUuid} + #{cUuid,jdbcType=VARCHAR} </foreach> </if> <if test="query.statuses != null"> and cq.status in <foreach collection="query.statuses" open="(" close=")" item="status" separator=","> - #{status} + #{status,jdbcType=VARCHAR} </foreach> </if> <if test="query.type != null"> - and cq.task_type=#{query.type} + and cq.task_type=#{query.type,jdbcType=VARCHAR} </if> <if test="query.minSubmittedAt != null"> - and cq.created_at >= #{query.minSubmittedAt} + and cq.created_at >= #{query.minSubmittedAt,jdbcType=BIGINT} </if> </where> </sql> @@ -131,11 +131,11 @@ set status=#{newStatus,jdbcType=VARCHAR}, started_at=#{startedAt,jdbcType=BIGINT}, updated_at=#{updatedAt,jdbcType=BIGINT} - where uuid=#{uuid} and status=#{oldStatus} + where uuid=#{uuid,jdbcType=VARCHAR} and status=#{oldStatus,jdbcType=VARCHAR} </update> <delete id="deleteByUuid"> - delete from ce_queue where uuid=#{uuid} + delete from ce_queue where uuid=#{uuid,jdbcType=VARCHAR} </delete> </mapper> diff --git a/sonar-db/src/main/resources/org/sonar/db/ce/CeScannerContextMapper.xml b/sonar-db/src/main/resources/org/sonar/db/ce/CeScannerContextMapper.xml index f9ff2523926..f7f3ff50e94 100644 --- a/sonar-db/src/main/resources/org/sonar/db/ce/CeScannerContextMapper.xml +++ b/sonar-db/src/main/resources/org/sonar/db/ce/CeScannerContextMapper.xml @@ -5,7 +5,7 @@ <delete id="deleteByUuids" parameterType="String"> delete from ce_scanner_context - where task_uuid in <foreach collection="uuids" open="(" close=")" item="uuid" separator=",">#{uuid}</foreach> + where task_uuid in <foreach collection="uuids" open="(" close=")" item="uuid" separator=",">#{uuid,jdbcType=VARCHAR}</foreach> </delete> </mapper> diff --git a/sonar-db/src/main/resources/org/sonar/db/ce/CeTaskInputMapper.xml b/sonar-db/src/main/resources/org/sonar/db/ce/CeTaskInputMapper.xml index 1ece2ba8eab..141055f933c 100644 --- a/sonar-db/src/main/resources/org/sonar/db/ce/CeTaskInputMapper.xml +++ b/sonar-db/src/main/resources/org/sonar/db/ce/CeTaskInputMapper.xml @@ -12,7 +12,7 @@ <delete id="deleteByUuids" parameterType="String"> delete from ce_task_input - where task_uuid in <foreach collection="uuids" open="(" close=")" item="uuid" separator=",">#{uuid}</foreach> + where task_uuid in <foreach collection="uuids" open="(" close=")" item="uuid" separator=",">#{uuid,jdbcType=VARCHAR}</foreach> </delete> </mapper> diff --git a/sonar-db/src/main/resources/org/sonar/db/component/ResourceMapper.xml b/sonar-db/src/main/resources/org/sonar/db/component/ResourceMapper.xml index f6488d64de7..b736637bd9f 100644 --- a/sonar-db/src/main/resources/org/sonar/db/component/ResourceMapper.xml +++ b/sonar-db/src/main/resources/org/sonar/db/component/ResourceMapper.xml @@ -5,7 +5,7 @@ <update id="updateAuthorizationDate" parameterType="map"> update projects set authorization_updated_at=#{authorizationDate} - where id=#{projectId} + where id=#{projectId,jdbcType=BIGINT} </update> </mapper> diff --git a/sonar-db/src/main/resources/org/sonar/db/duplication/DuplicationMapper.xml b/sonar-db/src/main/resources/org/sonar/db/duplication/DuplicationMapper.xml index 1597543164e..6249a27e77f 100644 --- a/sonar-db/src/main/resources/org/sonar/db/duplication/DuplicationMapper.xml +++ b/sonar-db/src/main/resources/org/sonar/db/duplication/DuplicationMapper.xml @@ -19,9 +19,9 @@ AND file_component.enabled=${_true} <where> AND duplication_block.hash in - <foreach collection="hashes" open="(" close=")" item="hash" separator=",">#{hash}</foreach> + <foreach collection="hashes" open="(" close=")" item="hash" separator=",">#{hash,jdbcType=VARCHAR}</foreach> <if test="analysisUuid != null"> - AND duplication_block.analysis_uuid <> #{analysisUuid} + AND duplication_block.analysis_uuid <> #{analysisUuid,jdbcType=VARCHAR} </if> </where> </select> diff --git a/sonar-db/src/main/resources/org/sonar/db/issue/IssueChangeMapper.xml b/sonar-db/src/main/resources/org/sonar/db/issue/IssueChangeMapper.xml index 96caa141092..04a9104f5f0 100644 --- a/sonar-db/src/main/resources/org/sonar/db/issue/IssueChangeMapper.xml +++ b/sonar-db/src/main/resources/org/sonar/db/issue/IssueChangeMapper.xml @@ -29,16 +29,16 @@ </delete> <update id="update" parameterType="map"> - update issue_changes set change_data=#{changeData}, updated_at=#{updatedAt} where kee=#{kee} + update issue_changes set change_data=#{changeData}, updated_at=#{updatedAt,jdbcType=BIGINT} where kee=#{kee,jdbcType=VARCHAR} </update> <select id="selectByIssuesAndType" parameterType="map" resultType="IssueChange"> select <include refid="issueChangeColumns"/> from issue_changes c - where c.change_type=#{changeType} and c.issue_key in + where c.change_type=#{changeType,jdbcType=VARCHAR} and c.issue_key in <foreach collection="issueKeys" open="(" close=")" item="key" separator=","> - #{key} + #{key,jdbcType=VARCHAR} </foreach> order by c.created_at </select> @@ -47,14 +47,14 @@ select <include refid="issueChangeColumns"/> from issue_changes c - where c.change_type=#{changeType} and c.kee=#{key} + where c.change_type=#{changeType,jdbcType=VARCHAR} and c.kee=#{key,jdbcType=VARCHAR} </select> <select id="selectByIssue" parameterType="string" resultType="IssueChange"> select <include refid="issueChangeColumns"/> from issue_changes c - where c.issue_key=#{id} + where c.issue_key=#{id,jdbcType=VARCHAR} order by created_at asc </select> @@ -63,8 +63,8 @@ <include refid="issueChangeColumns"/> from issue_changes c inner join issues i on i.kee = c.issue_key - where i.component_uuid=#{componentUuid} - and c.change_type=#{changeType} + where i.component_uuid=#{componentUuid,jdbcType=VARCHAR} + and c.change_type=#{changeType,jdbcType=VARCHAR} and i.status <> 'CLOSED' </select> </mapper> diff --git a/sonar-db/src/main/resources/org/sonar/db/issue/IssueMapper.xml b/sonar-db/src/main/resources/org/sonar/db/issue/IssueMapper.xml index 909ba71449f..c1d551b8e26 100644 --- a/sonar-db/src/main/resources/org/sonar/db/issue/IssueMapper.xml +++ b/sonar-db/src/main/resources/org/sonar/db/issue/IssueMapper.xml @@ -147,7 +147,7 @@ inner join rules r on r.id=i.rule_id inner join projects p on p.uuid=i.component_uuid inner join projects root on root.uuid=i.project_uuid - where i.kee=#{kee} + where i.kee=#{kee,jdbcType=VARCHAR} </select> <select id="selectNonClosedByComponentUuid" parameterType="String" resultType="Issue"> @@ -158,14 +158,14 @@ inner join projects p on p.uuid=i.component_uuid inner join projects root on root.uuid=i.project_uuid where - i.component_uuid=#{componentUuid} and + i.component_uuid=#{componentUuid,jdbcType=VARCHAR} and i.status <> 'CLOSED' </select> <select id="selectComponentUuidsOfOpenIssuesForProjectUuid" parameterType="string" resultType="string"> select distinct(i.component_uuid) from issues i - where i.project_uuid=#{projectUuid} and i.status <> 'CLOSED' + where i.project_uuid=#{projectUuid,jdbcType=VARCHAR} and i.status <> 'CLOSED' </select> <select id="selectByKeys" parameterType="map" resultType="Issue"> @@ -177,7 +177,7 @@ inner join projects root on root.uuid=i.project_uuid where i.kee in <foreach collection="list" open="(" close=")" item="key" separator=","> - #{key} + #{key,jdbcType=VARCHAR} </foreach> </select> </mapper> diff --git a/sonar-db/src/main/resources/org/sonar/db/measure/MeasureMapper.xml b/sonar-db/src/main/resources/org/sonar/db/measure/MeasureMapper.xml index 24028b375d5..7db0a207c83 100644 --- a/sonar-db/src/main/resources/org/sonar/db/measure/MeasureMapper.xml +++ b/sonar-db/src/main/resources/org/sonar/db/measure/MeasureMapper.xml @@ -29,7 +29,7 @@ and analysis.component_uuid=pm.component_uuid and analysis.component_uuid in <foreach item="projectUuid" collection="query.getProjectUuids()" open="(" separator="," close=")"> - #{projectUuid} + #{projectUuid,jdbcType=VARCHAR} </foreach> </select> @@ -38,10 +38,10 @@ <include refid="selectByQueryCommonJoins"/> where <include refid="selectByQueryCommonFilters"/> - and analysis.component_uuid=#{query.projectUuid} + and analysis.component_uuid=#{query.projectUuid,jdbcType=VARCHAR} and pm.component_uuid in <foreach item="componentUuid" collection="query.getComponentUuids()" open="(" separator="," close=")"> - #{componentUuid} + #{componentUuid,jdbcType=VARCHAR} </foreach> </select> @@ -52,7 +52,7 @@ and p.uuid=pm.component_uuid where <include refid="selectByQueryCommonFilters"/> - and pm.component_uuid=#{query.componentUuid} + and pm.component_uuid=#{query.componentUuid,jdbcType=VARCHAR} </select> <sql id="selectByQueryCommonJoins"> @@ -67,7 +67,7 @@ analysis.islast=${_true} </if> <if test="query.getAnalysisUuid() != null"> - analysis.uuid = #{query.analysisUuid} + analysis.uuid = #{query.analysisUuid,jdbcType=VARCHAR} </if> <if test="query.getMetricIds() != null"> and pm.metric_id in @@ -76,12 +76,12 @@ <if test="query.getMetricKeys() != null"> and m.name in <foreach item="metricKey" collection="query.getMetricKeys()" open="(" separator="," close=")"> - #{metricKey} + #{metricKey,jdbcType=VARCHAR} </foreach> </if> <choose> <when test="query.getPersonId() != null"> - and pm.person_id = #{query.personId} + and pm.person_id = #{query.personId,jdbcType=BIGINT} </when> <otherwise> and pm.person_id is null @@ -115,7 +115,7 @@ </if> <choose> <when test="query.getPersonId() != null"> - and pm.person_id = #{query.personId} + and pm.person_id = #{query.personId,jdbcType=BIGINT} </when> <otherwise> and pm.person_id is null @@ -129,8 +129,8 @@ from project_measures pm inner join snapshots analysis on analysis.uuid = pm.analysis_uuid where - pm.component_uuid = #{componentUuid} - and analysis.uuid = #{analysisUuid} + pm.component_uuid = #{componentUuid,jdbcType=VARCHAR} + and analysis.uuid = #{analysisUuid,jdbcType=VARCHAR} and pm.metric_id in <foreach item="metricId" collection="metricIds" open="(" separator="," close=")">#{metricId}</foreach> and pm.person_id is null </select> @@ -158,7 +158,7 @@ from project_measures pm, snapshots s, projects p where - pm.person_id=#{developerId} + pm.person_id=#{developerId,jdbcType=BIGINT} and pm.metric_id in <foreach item="metricId" collection="metricIds" open="(" separator="," close=")"> #{metricId} diff --git a/sonar-db/src/main/resources/org/sonar/db/property/InternalPropertiesMapper.xml b/sonar-db/src/main/resources/org/sonar/db/property/InternalPropertiesMapper.xml index 33de81df5e6..2431e1b5514 100644 --- a/sonar-db/src/main/resources/org/sonar/db/property/InternalPropertiesMapper.xml +++ b/sonar-db/src/main/resources/org/sonar/db/property/InternalPropertiesMapper.xml @@ -11,7 +11,7 @@ from internal_properties where - kee = #{key} + kee = #{key,jdbcType=VARCHAR} </select> <select id="selectAsClob" parameterType="map" resultType="InternalProperty"> @@ -22,7 +22,7 @@ from internal_properties where - kee = #{key} + kee = #{key,jdbcType=VARCHAR} </select> <insert id="insertAsEmpty" parameterType="Map" useGeneratedKeys="false"> @@ -31,7 +31,7 @@ kee, is_empty, created_at ) VALUES ( - #{key}, ${_true}, #{createdAt} + #{key,jdbcType=VARCHAR}, ${_true}, #{createdAt,jdbcType=BIGINT} ) </insert> @@ -44,10 +44,10 @@ created_at ) VALUES ( - #{key}, + #{key,jdbcType=VARCHAR}, ${_false}, - #{value}, - #{createdAt} + #{value,jdbcType=VARCHAR}, + #{createdAt,jdbcType=BIGINT} ) </insert> @@ -60,17 +60,17 @@ created_at ) VALUES ( - #{key}, + #{key,jdbcType=VARCHAR}, ${_false}, - #{value}, - #{createdAt} + #{value,jdbcType=VARCHAR}, + #{createdAt,jdbcType=BIGINT} ) </insert> <delete id="deleteByKey" parameterType="String"> delete from internal_properties where - kee=#{key} + kee=#{key,jdbcType=VARCHAR} </delete> diff --git a/sonar-db/src/main/resources/org/sonar/db/property/PropertiesMapper.xml b/sonar-db/src/main/resources/org/sonar/db/property/PropertiesMapper.xml index 517eb1c324e..8feebbb8c7c 100644 --- a/sonar-db/src/main/resources/org/sonar/db/property/PropertiesMapper.xml +++ b/sonar-db/src/main/resources/org/sonar/db/property/PropertiesMapper.xml @@ -13,7 +13,7 @@ <choose> <when test="projectUuid == null"> where - p.prop_key = #{notifKey} + p.prop_key = #{notifKey,jdbcType=VARCHAR} and p.text_value = 'true' and p.resource_id is null </when> @@ -21,9 +21,9 @@ inner join projects c on c.id=p.resource_id where - p.prop_key = #{notifKey} + p.prop_key = #{notifKey,jdbcType=VARCHAR} and p.text_value = 'true' - and c.uuid = #{projectUuid} + and c.uuid = #{projectUuid,jdbcType=VARCHAR} and p.resource_id is not null </otherwise> </choose> @@ -37,10 +37,10 @@ inner join users u on p.user_id = u.id <if test="componentKey != null"> - left outer join projects p1 on p.resource_id=p1.id and p1.kee=#{componentKey} + left outer join projects p1 on p.resource_id=p1.id and p1.kee=#{componentKey,jdbcType=VARCHAR} </if> where - p.prop_key = #{propKey} + p.prop_key = #{propKey,jdbcType=VARCHAR} and p.text_value like 'true' and ( p.resource_id is null @@ -78,7 +78,7 @@ where p.resource_id=r.id and p.user_id is null - and r.kee=#{resourceKey} + and r.kee=#{resourceKey,jdbcType=VARCHAR} </select> <select id="selectDescendantModuleProperties" parameterType="String" resultType="ScrapProperty"> @@ -109,7 +109,7 @@ and p.user_id is null </if> <if test="userId != null"> - and p.user_id=#{userId} + and p.user_id=#{userId,jdbcType=INTEGER} </if> </select> |