From 6a5780a742414656a278a53813d65e47102b2310 Mon Sep 17 00:00:00 2001 From: Simon Brandhof Date: Mon, 23 Jan 2017 22:10:19 +0100 Subject: Add some missing jdbcType attributes to MyBatis mappers --- .../db/component/ComponentKeyUpdaterMapper.xml | 22 +++-- .../org/sonar/db/component/ComponentLinkMapper.xml | 21 ++-- .../org/sonar/db/component/ComponentMapper.xml | 107 +++++++++------------ .../org/sonar/db/component/SnapshotMapper.xml | 38 ++++---- 4 files changed, 90 insertions(+), 98 deletions(-) (limited to 'sonar-db') diff --git a/sonar-db/src/main/resources/org/sonar/db/component/ComponentKeyUpdaterMapper.xml b/sonar-db/src/main/resources/org/sonar/db/component/ComponentKeyUpdaterMapper.xml index 2a98c2cdad2..4514ad12014 100644 --- a/sonar-db/src/main/resources/org/sonar/db/component/ComponentKeyUpdaterMapper.xml +++ b/sonar-db/src/main/resources/org/sonar/db/component/ComponentKeyUpdaterMapper.xml @@ -16,25 +16,35 @@ update projects - set kee = #{key}, deprecated_kee = #{deprecatedKey} - where id = #{id} + set kee = #{key,jdbcType=VARCHAR}, deprecated_kee = #{deprecatedKey,jdbcType=VARCHAR} + where id = #{id,jdbcType=BIGINT} diff --git a/sonar-db/src/main/resources/org/sonar/db/component/ComponentLinkMapper.xml b/sonar-db/src/main/resources/org/sonar/db/component/ComponentLinkMapper.xml index d74de88a667..1b9ba17cba6 100644 --- a/sonar-db/src/main/resources/org/sonar/db/component/ComponentLinkMapper.xml +++ b/sonar-db/src/main/resources/org/sonar/db/component/ComponentLinkMapper.xml @@ -14,9 +14,7 @@ SELECT FROM project_links p - - AND p.component_uuid=#{uuid} - + where p.component_uuid=#{uuid,jdbcType=VARCHAR} ORDER BY p.id @@ -24,22 +22,19 @@ SELECT FROM project_links p - - AND p.component_uuid in + where + p.component_uuid in - #{uuid} + #{uuid,jdbcType=VARCHAR} - order by p.id - SELECT FROM project_links p - - p.id=#{id} - + where p.id=#{id,jdbcType=BIGINT} @@ -51,11 +46,11 @@ UPDATE project_links SET component_uuid=#{componentUuid,jdbcType=VARCHAR}, link_type=#{type,jdbcType=VARCHAR}, name=#{name,jdbcType=VARCHAR}, href=#{href,jdbcType=VARCHAR} - WHERE id=#{id} + WHERE id=#{id,jdbcType=BIGINT} - DELETE FROM project_links WHERE id=#{id} + DELETE FROM project_links WHERE id=#{id,jdbcType=BIGINT} diff --git a/sonar-db/src/main/resources/org/sonar/db/component/ComponentMapper.xml b/sonar-db/src/main/resources/org/sonar/db/component/ComponentMapper.xml index 2f4a42d2835..5813d2aca3b 100644 --- a/sonar-db/src/main/resources/org/sonar/db/component/ComponentMapper.xml +++ b/sonar-db/src/main/resources/org/sonar/db/component/ComponentMapper.xml @@ -32,26 +32,22 @@ FROM projects p where - p.kee=#{key} + p.kee=#{key,jdbcType=VARCHAR} @@ -149,12 +142,12 @@ and module.organization_uuid = p.organization_uuid and module.uuid = #{moduleUuid} and module.scope='PRJ' AND module.enabled = ${_true} - + where + p.scope = #{scope,jdbcType=VARCHAR} - p.enabled = ${_true} + and p.enabled = ${_true} - AND p.scope = #{scope} - AND + and p.module_uuid_path LIKE module.module_uuid_path + '%' @@ -166,7 +159,6 @@ p.module_uuid_path LIKE module.module_uuid_path || '%' - SELECT p.uuid as "uuid", p.project_uuid as "projectUuid" FROM projects p - + where - p.qualifier=#{qualifier} + p.qualifier=#{qualifier,jdbcType=VARCHAR} - @@ -414,7 +403,7 @@ left join snapshots s2 on s2.component_uuid = p.uuid and s2.status='P' where s2.id is null - and p.qualifier=#{qualifier} + and p.qualifier=#{qualifier,jdbcType=VARCHAR} and p.copy_component_uuid is null and ( @@ -432,7 +421,7 @@ p.enabled=${_true} and p.copy_component_uuid is null - and p.project_uuid=#{projectUuid} + and p.project_uuid=#{projectUuid,jdbcType=VARCHAR} @@ -522,7 +511,7 @@ b_path = #{bPath,jdbcType=VARCHAR}, b_qualifier = #{bQualifier,jdbcType=VARCHAR} where - uuid = #{uuid} + uuid = #{uuid,jdbcType=VARCHAR} @@ -540,7 +529,7 @@ b_path = path, b_qualifier = qualifier where - uuid in #{uuid} + uuid in #{uuid,jdbcType=VARCHAR} @@ -569,7 +558,7 @@ b_path = null, b_qualifier = null where - project_uuid = #{projectUuid} and + project_uuid = #{projectUuid,jdbcType=VARCHAR} and b_changed = ${_true} @@ -577,12 +566,12 @@ update projects set b_changed = ${_false} where - project_uuid = #{projectUuid} and + project_uuid = #{projectUuid,jdbcType=VARCHAR} and b_changed = ${_true} - DELETE FROM projects WHERE id=#{id} + DELETE FROM projects WHERE id=#{id,jdbcType=BIGINT} diff --git a/sonar-db/src/main/resources/org/sonar/db/component/SnapshotMapper.xml b/sonar-db/src/main/resources/org/sonar/db/component/SnapshotMapper.xml index 102c9497a51..1a2fa61ff2e 100644 --- a/sonar-db/src/main/resources/org/sonar/db/component/SnapshotMapper.xml +++ b/sonar-db/src/main/resources/org/sonar/db/component/SnapshotMapper.xml @@ -38,9 +38,7 @@ SELECT FROM snapshots s - - AND s.id=#{key} - + where s.id=#{key,jdbcType=BIGINT} @@ -63,7 +61,7 @@ WHERE s.uuid in - #{uuid} + #{uuid,jdbcType=VARCHAR} @@ -73,13 +71,13 @@ inner join projects p on s.component_uuid = p.project_uuid where s.islast=${_true} - and p.uuid = #{componentUuid} + and p.uuid = #{componentUuid,jdbcType=VARCHAR} @@ -98,23 +96,23 @@ FROM snapshots s - INNER JOIN projects p ON p.uuid=s.component_uuid AND p.enabled=${_true} AND s.component_uuid=#{query.componentUuid} + INNER JOIN projects p ON p.uuid=s.component_uuid AND p.enabled=${_true} AND s.component_uuid=#{query.componentUuid,jdbcType=VARCHAR} - AND s.status=#{query.status} + AND s.status=#{query.status,jdbcType=VARCHAR} - AND s.version=#{query.version} + AND s.version=#{query.version,jdbcType=VARCHAR} AND s.islast=#{query.isLast} - AND s.created_at>=#{query.createdAfter} + AND s.created_at>=#{query.createdAfter,jdbcType=BIGINT} - AND s.created_at<#{query.createdBefore} + AND s.created_at<#{query.createdBefore,jdbcType=BIGINT} @@ -137,7 +135,7 @@ FROM snapshots s INNER JOIN events e ON s.uuid = e.analysis_uuid AND e.name <> #{lastVersion} AND e.category='Version' - s.component_uuid=#{componentUuid} + s.component_uuid=#{componentUuid,jdbcType=VARCHAR} ORDER BY e.event_date DESC @@ -147,7 +145,7 @@ FROM snapshots s - s.component_uuid=#{componentUuid} + s.component_uuid=#{componentUuid,jdbcType=VARCHAR} ORDER BY s.created_at ASC @@ -157,9 +155,9 @@ FROM snapshots s - and s.component_uuid = #{componentUuid} + and s.component_uuid = #{componentUuid,jdbcType=VARCHAR} and s.status = 'P' - and s.created_at < #{date} + and s.created_at < #{date,jdbcType=BIGINT} order by created_at desc @@ -167,21 +165,21 @@ update snapshots set islast = ${_false} - where component_uuid = #{componentUuid} + where component_uuid = #{componentUuid,jdbcType=VARCHAR} and islast = ${_true} update snapshots set islast = ${_true}, status = 'P' - where uuid = #{analysisUuid} + where uuid = #{analysisUuid,jdbcType=VARCHAR} update snapshots set version = #{version, jdbcType=VARCHAR}, status = #{status, jdbcType=VARCHAR} - where uuid = #{uuid} + where uuid = #{uuid,jdbcType=VARCHAR} -- cgit v1.2.3