diff options
author | Julien HENRY <julien.henry@sonarsource.com> | 2013-06-17 18:38:51 +0200 |
---|---|---|
committer | Julien HENRY <julien.henry@sonarsource.com> | 2013-06-19 17:38:34 +0200 |
commit | 861565e0491c53ffff1d8dbe5b28de9cf496fa90 (patch) | |
tree | a8e39def946f9a9d74a4ff320ce632b6bda12b33 /sonar-core | |
parent | 4703169603e6caa2e4779037e554af521a45e3e1 (diff) | |
download | sonarqube-861565e0491c53ffff1d8dbe5b28de9cf496fa90.tar.gz sonarqube-861565e0491c53ffff1d8dbe5b28de9cf496fa90.zip |
SONAR-4178 Add triggers on Oracle to emulate identity column
Diffstat (limited to 'sonar-core')
22 files changed, 15 insertions, 220 deletions
diff --git a/sonar-core/src/main/java/org/sonar/core/persistence/DatabaseVersion.java b/sonar-core/src/main/java/org/sonar/core/persistence/DatabaseVersion.java index f060ae68e59..85fb8a3f1ad 100644 --- a/sonar-core/src/main/java/org/sonar/core/persistence/DatabaseVersion.java +++ b/sonar-core/src/main/java/org/sonar/core/persistence/DatabaseVersion.java @@ -32,7 +32,7 @@ import java.util.List; */ public class DatabaseVersion implements BatchComponent, ServerComponent { - public static final int LAST_VERSION = 411; + public static final int LAST_VERSION = 412; public static enum Status { UP_TO_DATE, REQUIRES_UPGRADE, REQUIRES_DOWNGRADE, FRESH_INSTALL diff --git a/sonar-core/src/main/resources/org/sonar/core/dashboard/ActiveDashboardMapper.xml b/sonar-core/src/main/resources/org/sonar/core/dashboard/ActiveDashboardMapper.xml index 18085d74dad..c62f80dafd6 100644 --- a/sonar-core/src/main/resources/org/sonar/core/dashboard/ActiveDashboardMapper.xml +++ b/sonar-core/src/main/resources/org/sonar/core/dashboard/ActiveDashboardMapper.xml @@ -3,20 +3,11 @@ <mapper namespace="org.sonar.core.dashboard.ActiveDashboardMapper"> - <insert id="insert" parameterType="ActiveDashboard" useGeneratedKeys="true" keyProperty ="id"> + <insert id="insert" parameterType="ActiveDashboard" keyColumn="id" useGeneratedKeys="true" keyProperty ="id"> INSERT INTO active_dashboards (dashboard_id, user_id, order_index) VALUES (#{dashboardId}, #{userId}, #{orderIndex}) </insert> - <!-- Oracle --> - <insert id="insert" databaseId="oracle" parameterType="ActiveDashboard" keyColumn="id" useGeneratedKeys="true" keyProperty ="id"> - <selectKey order="BEFORE" resultType="Long" keyProperty="id" > - select active_dashboards_seq.NEXTVAL from DUAL - </selectKey> - INSERT INTO active_dashboards (id, dashboard_id, user_id, order_index) - VALUES (#{id}, #{dashboardId}, #{userId}, #{orderIndex}) - </insert> - <select id="selectMaxOrderIndexForNullUser" resultType="Integer"> SELECT MAX(order_index) FROM active_dashboards diff --git a/sonar-core/src/main/resources/org/sonar/core/dashboard/DashboardMapper.xml b/sonar-core/src/main/resources/org/sonar/core/dashboard/DashboardMapper.xml index b7ab9140f9f..deb4989bd6f 100644 --- a/sonar-core/src/main/resources/org/sonar/core/dashboard/DashboardMapper.xml +++ b/sonar-core/src/main/resources/org/sonar/core/dashboard/DashboardMapper.xml @@ -8,20 +8,10 @@ from dashboards WHERE name=#{id} and user_id is null </select> - <insert id="insert" parameterType="Dashboard" useGeneratedKeys="true" keyProperty="id"> + <insert id="insert" parameterType="Dashboard" keyColumn="id" useGeneratedKeys="true" keyProperty="id"> INSERT INTO dashboards (user_id, name, description, column_layout, shared, is_global, created_at, updated_at) VALUES (#{userId}, #{name}, #{description}, #{columnLayout}, #{shared}, #{global}, #{createdAt}, #{updatedAt}) </insert> - <!-- Oracle --> - <insert id="insert" databaseId="oracle" parameterType="Dashboard" keyColumn="id" useGeneratedKeys="true" keyProperty="id"> - <selectKey order="BEFORE" resultType="Long" keyProperty="id"> - select dashboards_seq.NEXTVAL from DUAL - </selectKey> - INSERT INTO dashboards (id, user_id, name, description, column_layout, shared, is_global, created_at, updated_at) - VALUES (#{id}, #{userId}, #{name}, #{description}, - #{columnLayout}, #{shared}, #{global}, #{createdAt}, #{updatedAt}) - </insert> - </mapper> diff --git a/sonar-core/src/main/resources/org/sonar/core/dashboard/WidgetMapper.xml b/sonar-core/src/main/resources/org/sonar/core/dashboard/WidgetMapper.xml index ee2b13ed999..07f2a323880 100644 --- a/sonar-core/src/main/resources/org/sonar/core/dashboard/WidgetMapper.xml +++ b/sonar-core/src/main/resources/org/sonar/core/dashboard/WidgetMapper.xml @@ -3,20 +3,10 @@ <mapper namespace="org.sonar.core.dashboard.WidgetMapper"> - <insert id="insert" parameterType="Widget" useGeneratedKeys="true" keyProperty ="id"> + <insert id="insert" parameterType="Widget" keyColumn="id" useGeneratedKeys="true" keyProperty ="id"> INSERT INTO widgets (dashboard_id, widget_key, name, description, column_index, row_index, configured, created_at, updated_at, resource_id) VALUES (#{dashboardId}, #{key}, #{name}, #{description}, #{columnIndex}, #{rowIndex}, #{configured}, #{createdAt}, #{updatedAt}, #{resourceId}) </insert> - <!-- Oracle --> - <insert id="insert" databaseId="oracle" parameterType="Widget" keyColumn="id" useGeneratedKeys="true" keyProperty ="id"> - <selectKey order="BEFORE" resultType="Long" keyProperty="id" > - select widgets_seq.NEXTVAL from DUAL - </selectKey> - INSERT INTO widgets (id, dashboard_id, widget_key, name, description, column_index, row_index, configured, created_at, updated_at, resource_id) - VALUES (#{id}, #{dashboardId}, #{key}, #{name}, #{description}, #{columnIndex}, - #{rowIndex}, #{configured}, #{createdAt}, #{updatedAt}, #{resourceId}) - </insert> - </mapper> diff --git a/sonar-core/src/main/resources/org/sonar/core/dashboard/WidgetPropertyMapper.xml b/sonar-core/src/main/resources/org/sonar/core/dashboard/WidgetPropertyMapper.xml index ed3cb3e960c..deb555dea0e 100644 --- a/sonar-core/src/main/resources/org/sonar/core/dashboard/WidgetPropertyMapper.xml +++ b/sonar-core/src/main/resources/org/sonar/core/dashboard/WidgetPropertyMapper.xml @@ -3,15 +3,9 @@ <mapper namespace="org.sonar.core.dashboard.WidgetPropertyMapper"> - <insert id="insert" parameterType="WidgetProperty" useGeneratedKeys="true" keyProperty="id"> + <insert id="insert" parameterType="WidgetProperty" keyColumn="id" useGeneratedKeys="true" keyProperty="id"> INSERT INTO widget_properties (widget_id, kee, text_value) VALUES (#{widgetId}, #{key}, #{value}) </insert> - <!-- Oracle --> - <insert id="insert" databaseId="oracle" parameterType="WidgetProperty" keyColumn="id" useGeneratedKeys="false" keyProperty="id"> - INSERT INTO widget_properties (id, widget_id, kee, text_value) - VALUES (widget_properties_seq.NEXTVAL, #{widgetId}, #{key}, #{value}) - </insert> - </mapper> diff --git a/sonar-core/src/main/resources/org/sonar/core/duplication/DuplicationMapper.xml b/sonar-core/src/main/resources/org/sonar/core/duplication/DuplicationMapper.xml index 4b87e975d42..5a97b824756 100644 --- a/sonar-core/src/main/resources/org/sonar/core/duplication/DuplicationMapper.xml +++ b/sonar-core/src/main/resources/org/sonar/core/duplication/DuplicationMapper.xml @@ -21,13 +21,4 @@ INSERT INTO duplications_index (snapshot_id, project_snapshot_id, hash, index_in_file, start_line, end_line) VALUES (#{snapshotId}, #{projectSnapshotId}, #{hash}, #{indexInFile}, #{startLine}, #{endLine}) </insert> - - <!-- Oracle --> - <insert id="batchInsert" databaseId="oracle" parameterType="DuplicationUnit" useGeneratedKeys="false"> - <selectKey order="BEFORE" resultType="Long" keyProperty="id"> - select duplications_index_seq.NEXTVAL from DUAL - </selectKey> - INSERT INTO duplications_index (id, snapshot_id, project_snapshot_id, hash, index_in_file, start_line, end_line) - VALUES (#{id}, #{snapshotId}, #{projectSnapshotId}, #{hash}, #{indexInFile}, #{startLine}, #{endLine}) - </insert> </mapper> diff --git a/sonar-core/src/main/resources/org/sonar/core/graph/jdbc/GraphDtoMapper.xml b/sonar-core/src/main/resources/org/sonar/core/graph/jdbc/GraphDtoMapper.xml index ee684f90ddf..c7416c87a63 100644 --- a/sonar-core/src/main/resources/org/sonar/core/graph/jdbc/GraphDtoMapper.xml +++ b/sonar-core/src/main/resources/org/sonar/core/graph/jdbc/GraphDtoMapper.xml @@ -25,16 +25,5 @@ #{data}, CURRENT_TIMESTAMP, CURRENT_TIMESTAMP) </insert> - <!-- Oracle --> - <insert id="insert" databaseId="oracle" parameterType="Graph" useGeneratedKeys="false" keyProperty="id"> - <selectKey order="BEFORE" resultType="Long" keyProperty="id"> - select graphs_seq.NEXTVAL from DUAL - </selectKey> - insert into graphs - (id, resource_id, snapshot_id, format, version, perspective, root_vertex_id, data, created_at, updated_at) - values ( - #{id}, #{resourceId}, #{snapshotId}, #{format}, #{version}, #{perspective}, #{rootVertexId}, - #{data}, CURRENT_TIMESTAMP, CURRENT_TIMESTAMP) - </insert> </mapper> diff --git a/sonar-core/src/main/resources/org/sonar/core/issue/db/ActionPlanMapper.xml b/sonar-core/src/main/resources/org/sonar/core/issue/db/ActionPlanMapper.xml index 663284e21ac..764141ca66b 100644 --- a/sonar-core/src/main/resources/org/sonar/core/issue/db/ActionPlanMapper.xml +++ b/sonar-core/src/main/resources/org/sonar/core/issue/db/ActionPlanMapper.xml @@ -18,20 +18,11 @@ p.kee as projectKey </sql> - <insert id="insert" parameterType="ActionPlanIssue" useGeneratedKeys="true" keyProperty="id"> + <insert id="insert" parameterType="ActionPlanIssue" keyColumn="id" useGeneratedKeys="true" keyProperty="id"> 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> - <!-- Oracle --> - <insert id="insert" databaseId="oracle" parameterType="ActionPlanIssue" keyColumn="id" useGeneratedKeys="true" keyProperty="id"> - <selectKey order="BEFORE" resultType="Long" keyProperty="id"> - select issues_seq.NEXTVAL from DUAL - </selectKey> - INSERT INTO action_plans (id, kee, name, description, user_login, project_id, status, deadline, created_at, updated_at) - VALUES (#{id}, #{kee}, #{name}, #{description}, #{userLogin}, #{projectId}, #{status}, #{deadLine}, #{createdAt}, #{updatedAt}) - </insert> - <update id="update" parameterType="ActionPlanIssue"> update action_plans set name=#{name}, diff --git a/sonar-core/src/main/resources/org/sonar/core/issue/db/IssueChangeMapper.xml b/sonar-core/src/main/resources/org/sonar/core/issue/db/IssueChangeMapper.xml index d9d778458a0..f09b9e4794e 100644 --- a/sonar-core/src/main/resources/org/sonar/core/issue/db/IssueChangeMapper.xml +++ b/sonar-core/src/main/resources/org/sonar/core/issue/db/IssueChangeMapper.xml @@ -20,16 +20,6 @@ VALUES (#{kee}, #{issueKey}, #{userLogin}, #{changeType}, #{changeData}, #{createdAt}, #{updatedAt}) </insert> - <!-- Oracle --> - <insert id="insert" databaseId="oracle" parameterType="IssueChange" keyColumn="id" useGeneratedKeys="false" - keyProperty="id"> - <selectKey order="BEFORE" resultType="Long" keyProperty="id"> - select issue_changes_seq.NEXTVAL from DUAL - </selectKey> - INSERT INTO issue_changes (id, kee, issue_key, user_login, change_type, change_data, created_at, updated_at) - VALUES (#{id}, #{kee}, #{issueKey}, #{userLogin}, #{changeType}, #{changeData}, #{createdAt}, #{updatedAt}) - </insert> - <delete id="delete" parameterType="string"> delete from issue_changes where kee=#{id} </delete> diff --git a/sonar-core/src/main/resources/org/sonar/core/issue/db/IssueFilterFavouriteMapper.xml b/sonar-core/src/main/resources/org/sonar/core/issue/db/IssueFilterFavouriteMapper.xml index 80c36ec8c09..f8aaa53f945 100644 --- a/sonar-core/src/main/resources/org/sonar/core/issue/db/IssueFilterFavouriteMapper.xml +++ b/sonar-core/src/main/resources/org/sonar/core/issue/db/IssueFilterFavouriteMapper.xml @@ -28,20 +28,11 @@ </where> </select> - <insert id="insert" parameterType="issueFilterFavourite" useGeneratedKeys="true" keyProperty="id"> + <insert id="insert" parameterType="issueFilterFavourite" keyColumn="id" useGeneratedKeys="true" keyProperty="id"> INSERT INTO issue_filter_favourites (user_login, issue_filter_id, created_at) VALUES (#{userLogin}, #{issueFilterId}, current_timestamp) </insert> - <!-- Oracle --> - <insert id="insert" databaseId="oracle" parameterType="issueFilterFavourite" keyColumn="id" useGeneratedKeys="true" keyProperty="id"> - <selectKey order="BEFORE" resultType="Long" keyProperty="id"> - select issue_filter_favourites_seq.NEXTVAL from DUAL - </selectKey> - INSERT INTO issue_filter_favourites (id, user_login, issue_filter_id, created_at) - VALUES (#{id},#{userLogin}, #{issueFilterId}, current_timestamp) - </insert> - <delete id="delete" parameterType="int"> delete from issue_filter_favourites where id=#{id} </delete> diff --git a/sonar-core/src/main/resources/org/sonar/core/issue/db/IssueFilterMapper.xml b/sonar-core/src/main/resources/org/sonar/core/issue/db/IssueFilterMapper.xml index a85abad3bbe..3e908084468 100644 --- a/sonar-core/src/main/resources/org/sonar/core/issue/db/IssueFilterMapper.xml +++ b/sonar-core/src/main/resources/org/sonar/core/issue/db/IssueFilterMapper.xml @@ -74,20 +74,11 @@ </where> </select> - <insert id="insert" parameterType="IssueFilter" useGeneratedKeys="true" keyProperty="id"> + <insert id="insert" parameterType="IssueFilter" keyColumn="id" useGeneratedKeys="true" keyProperty="id"> INSERT INTO issue_filters (name, user_login, shared, description, data, created_at, updated_at) VALUES (#{name}, #{userLogin}, #{shared}, #{description}, #{data}, #{createdAt}, #{updatedAt}) </insert> - <!-- Oracle --> - <insert id="insert" databaseId="oracle" parameterType="IssueFilter" keyColumn="id" useGeneratedKeys="true" keyProperty="id"> - <selectKey order="BEFORE" resultType="Long" keyProperty="id"> - select issue_filters_seq.NEXTVAL from DUAL - </selectKey> - INSERT INTO issue_filters (id, name, user_login, shared, description, data, created_at, updated_at) - VALUES (#{id}, #{name}, #{userLogin}, #{shared}, #{description}, #{data}, #{createdAt}, #{updatedAt}) - </insert> - <update id="update" parameterType="IssueFilter"> update issue_filters set name=#{name}, diff --git a/sonar-core/src/main/resources/org/sonar/core/issue/db/IssueMapper.xml b/sonar-core/src/main/resources/org/sonar/core/issue/db/IssueMapper.xml index 06fa350595e..505f9ce267e 100644 --- a/sonar-core/src/main/resources/org/sonar/core/issue/db/IssueMapper.xml +++ b/sonar-core/src/main/resources/org/sonar/core/issue/db/IssueMapper.xml @@ -70,22 +70,6 @@ #{issueUpdateDate}, #{issueCloseDate}, #{createdAt}, #{updatedAt}) </insert> - <!-- Oracle --> - <insert id="insert" databaseId="oracle" parameterType="Issue" keyColumn="id" useGeneratedKeys="false" - keyProperty="id"> - <selectKey order="BEFORE" resultType="Long" keyProperty="id"> - select issues_seq.NEXTVAL from DUAL - </selectKey> - INSERT INTO issues (id, kee, component_id, root_component_id, rule_id, action_plan_key, severity, manual_severity, - message, line, effort_to_fix, status, - resolution, checksum, reporter, assignee, author_login, issue_attributes, issue_creation_date, issue_update_date, - issue_close_date, created_at, updated_at) - VALUES (#{id}, #{kee}, #{componentId}, #{rootComponentId}, #{ruleId}, #{actionPlanKey}, #{severity}, #{manualSeverity}, - #{message}, #{line}, #{effortToFix}, #{status}, - #{resolution}, #{checksum}, #{reporter}, #{assignee}, #{authorLogin}, #{issueAttributes}, #{issueCreationDate}, - #{issueUpdateDate}, #{issueCloseDate}, #{createdAt}, #{updatedAt}) - </insert> - <!-- IMPORTANT - invariant columns can't be updated. See IssueDto#toDtoForUpdate() --> diff --git a/sonar-core/src/main/resources/org/sonar/core/measure/MeasureFilterMapper.xml b/sonar-core/src/main/resources/org/sonar/core/measure/MeasureFilterMapper.xml index 713fc15f2e4..425b8cc07bd 100644 --- a/sonar-core/src/main/resources/org/sonar/core/measure/MeasureFilterMapper.xml +++ b/sonar-core/src/main/resources/org/sonar/core/measure/MeasureFilterMapper.xml @@ -8,18 +8,9 @@ from measure_filters WHERE user_id is null and name=#{id} </select> - <insert id="insert" parameterType="MeasureFilter" useGeneratedKeys="true" keyProperty="id"> + <insert id="insert" parameterType="MeasureFilter" keyColumn="id" useGeneratedKeys="true" keyProperty="id"> INSERT INTO measure_filters (name, user_id, shared, description, data, created_at, updated_at) VALUES (#{name}, #{userId}, #{shared}, #{description}, #{data}, #{createdAt}, #{updatedAt}) </insert> - <!-- Oracle --> - <insert id="insert" databaseId="oracle" parameterType="MeasureFilter" keyColumn="id" useGeneratedKeys="true" keyProperty="id"> - <selectKey order="BEFORE" resultType="Long" keyProperty="id"> - select measure_filters_seq.NEXTVAL from DUAL - </selectKey> - INSERT INTO measure_filters (id, name, user_id, shared, description, data, created_at, updated_at) - VALUES (#{id}, #{name}, #{userId}, #{shared}, #{description}, #{data}, #{createdAt}, #{updatedAt}) - </insert> - </mapper> diff --git a/sonar-core/src/main/resources/org/sonar/core/persistence/SemaphoreMapper.xml b/sonar-core/src/main/resources/org/sonar/core/persistence/SemaphoreMapper.xml index 4b9fbb134f4..81ed974e32f 100644 --- a/sonar-core/src/main/resources/org/sonar/core/persistence/SemaphoreMapper.xml +++ b/sonar-core/src/main/resources/org/sonar/core/persistence/SemaphoreMapper.xml @@ -8,14 +8,6 @@ VALUES (#{name}, #{checksum}, current_timestamp, current_timestamp, #{lockedAt}) </insert> - <insert id="initialize" databaseId="oracle" parameterType="map" useGeneratedKeys="false"> - <selectKey order="BEFORE" resultType="Long" keyProperty="id"> - select semaphores_seq.NEXTVAL from DUAL - </selectKey> - INSERT INTO semaphores (id, name, checksum, created_at, updated_at, locked_at) - VALUES (#{id}, #{name}, #{checksum}, current_timestamp, current_timestamp, #{lockedAt}) - </insert> - <select id="now" resultType="Date"> select current_timestamp </select> diff --git a/sonar-core/src/main/resources/org/sonar/core/persistence/rows-h2.sql b/sonar-core/src/main/resources/org/sonar/core/persistence/rows-h2.sql index 47f7780a0f8..1d75faef1a7 100644 --- a/sonar-core/src/main/resources/org/sonar/core/persistence/rows-h2.sql +++ b/sonar-core/src/main/resources/org/sonar/core/persistence/rows-h2.sql @@ -171,6 +171,7 @@ INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('404'); INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('405'); INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('410'); INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('411'); +INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('412'); INSERT INTO USERS(ID, LOGIN, NAME, EMAIL, CRYPTED_PASSWORD, SALT, CREATED_AT, UPDATED_AT, REMEMBER_TOKEN, REMEMBER_TOKEN_EXPIRES_AT) VALUES (1, 'admin', 'Administrator', '', 'a373a0e667abb2604c1fd571eb4ad47fe8cc0878', '48bc4b0d93179b5103fd3885ea9119498e9d161b', '2011-09-26 22:27:48.0', '2011-09-26 22:27:48.0', null, null); ALTER TABLE USERS ALTER COLUMN ID RESTART WITH 2; diff --git a/sonar-core/src/main/resources/org/sonar/core/properties/PropertiesMapper.xml b/sonar-core/src/main/resources/org/sonar/core/properties/PropertiesMapper.xml index be5da6887f2..d12932595ab 100644 --- a/sonar-core/src/main/resources/org/sonar/core/properties/PropertiesMapper.xml +++ b/sonar-core/src/main/resources/org/sonar/core/properties/PropertiesMapper.xml @@ -73,15 +73,6 @@ VALUES (#{key}, #{resourceId}, #{userId}, #{value}) </insert> - <!-- Oracle --> - <insert id="insert" databaseId="oracle" parameterType="Property" useGeneratedKeys="false"> - <selectKey order="BEFORE" resultType="Long" keyProperty="id"> - select properties_seq.NEXTVAL from DUAL - </selectKey> - INSERT INTO properties (id, prop_key, resource_id, user_id, text_value) - VALUES (#{id}, #{key}, #{resourceId}, #{userId}, #{value}) - </insert> - <delete id="deleteGlobalProperty" parameterType="string"> delete from properties where prop_key=#{id} and resource_id is null and user_id is null </delete> diff --git a/sonar-core/src/main/resources/org/sonar/core/resource/ResourceIndexerMapper.xml b/sonar-core/src/main/resources/org/sonar/core/resource/ResourceIndexerMapper.xml index 51fdfe17d1a..91c494daa4a 100644 --- a/sonar-core/src/main/resources/org/sonar/core/resource/ResourceIndexerMapper.xml +++ b/sonar-core/src/main/resources/org/sonar/core/resource/ResourceIndexerMapper.xml @@ -65,15 +65,5 @@ #{resourceId}, #{rootProjectId}, #{qualifier}) </insert> - <!-- Oracle --> - <insert id="insert" databaseId="oracle" parameterType="ResourceIndex" useGeneratedKeys="false"> - <selectKey order="BEFORE" resultType="Long" keyProperty="id"> - select resource_index_seq.NEXTVAL from DUAL - </selectKey> - insert into resource_index (id, kee, position, name_size, resource_id, root_project_id, qualifier) - values (#{id}, #{key}, #{position}, #{nameSize}, - #{resourceId}, #{rootProjectId}, #{qualifier}) - </insert> - </mapper> diff --git a/sonar-core/src/main/resources/org/sonar/core/resource/ResourceMapper.xml b/sonar-core/src/main/resources/org/sonar/core/resource/ResourceMapper.xml index 394c9d56b73..3a19fe43730 100644 --- a/sonar-core/src/main/resources/org/sonar/core/resource/ResourceMapper.xml +++ b/sonar-core/src/main/resources/org/sonar/core/resource/ResourceMapper.xml @@ -167,7 +167,7 @@ </where> </sql> - <insert id="insert" parameterType="Resource" useGeneratedKeys="true" keyProperty="id"> + <insert id="insert" parameterType="Resource" keyColumn="id" useGeneratedKeys="true" keyProperty="id"> insert into projects (name, long_name, description, scope, qualifier, kee, language, root_id, copy_resource_id, person_id, enabled, created_at) values ( @@ -177,20 +177,6 @@ ) </insert> - <!-- Oracle --> - <insert id="insert" databaseId="oracle" parameterType="Resource" useGeneratedKeys="true" keyProperty="id"> - <selectKey order="BEFORE" resultType="Long" keyProperty="id"> - select projects_seq.NEXTVAL from DUAL - </selectKey> - insert into projects - (id, name, long_name, description, scope, qualifier, kee, language, root_id, copy_resource_id, person_id, enabled, created_at) - values ( - #{id}, #{name}, #{longName}, #{description}, #{scope}, #{qualifier}, - #{key}, #{language}, #{rootId}, #{copyResourceId}, - #{personId}, #{enabled}, #{createdAt} - ) - </insert> - <update id="update" parameterType="Resource"> update projects set name=#{name}, long_name=#{longName}, description=#{description}, scope=#{scope}, qualifier=#{qualifier}, kee=#{key}, diff --git a/sonar-core/src/main/resources/org/sonar/core/source/jdbc/SnapshotDataMapper.xml b/sonar-core/src/main/resources/org/sonar/core/source/jdbc/SnapshotDataMapper.xml index 6d92b6fb878..f6474ea516c 100644 --- a/sonar-core/src/main/resources/org/sonar/core/source/jdbc/SnapshotDataMapper.xml +++ b/sonar-core/src/main/resources/org/sonar/core/source/jdbc/SnapshotDataMapper.xml @@ -19,16 +19,5 @@ values ( #{resourceId}, #{snapshotId}, #{data}, #{dataType}, CURRENT_TIMESTAMP, CURRENT_TIMESTAMP) </insert> - - <!-- Oracle --> - <insert id="insert" databaseId="oracle" parameterType="SnapshotData" useGeneratedKeys="false" keyProperty="id"> - <selectKey order="BEFORE" resultType="Long" keyProperty="id"> - select snapshot_data_seq.NEXTVAL from DUAL - </selectKey> - insert into snapshot_data - (id, resource_id, snapshot_id, snapshot_data, data_type, created_at, updated_at) - values ( - #{id}, #{resourceId}, #{snapshotId}, #{data}, #{dataType}, CURRENT_TIMESTAMP, CURRENT_TIMESTAMP) - </insert> </mapper> diff --git a/sonar-core/src/main/resources/org/sonar/core/template/LoadedTemplateMapper.xml b/sonar-core/src/main/resources/org/sonar/core/template/LoadedTemplateMapper.xml index 5b6862e541b..e946a81ba99 100644 --- a/sonar-core/src/main/resources/org/sonar/core/template/LoadedTemplateMapper.xml +++ b/sonar-core/src/main/resources/org/sonar/core/template/LoadedTemplateMapper.xml @@ -15,18 +15,9 @@ WHERE kee = #{key} AND template_type = #{type} </select> - <insert id="insert" parameterType="LoadedTemplate" useGeneratedKeys="true" keyProperty="id"> + <insert id="insert" parameterType="LoadedTemplate" keyColumn="id" useGeneratedKeys="true" keyProperty="id"> INSERT INTO loaded_templates (kee, template_type) VALUES (#{key}, #{type}) </insert> - <!-- Oracle --> - <insert id="insert" databaseId="oracle" parameterType="LoadedTemplate" keyColumn="id" useGeneratedKeys="true" keyProperty="id"> - <selectKey order="BEFORE" resultType="Long" keyProperty="id"> - select loaded_templates_seq.NEXTVAL from DUAL - </selectKey> - INSERT INTO loaded_templates (id, kee, template_type) - VALUES (#{id}, #{key}, #{type}) - </insert> - </mapper> diff --git a/sonar-core/src/main/resources/org/sonar/core/user/AuthorMapper.xml b/sonar-core/src/main/resources/org/sonar/core/user/AuthorMapper.xml index 4071f72247b..fbb92585f10 100644 --- a/sonar-core/src/main/resources/org/sonar/core/user/AuthorMapper.xml +++ b/sonar-core/src/main/resources/org/sonar/core/user/AuthorMapper.xml @@ -13,20 +13,10 @@ FROM authors WHERE person_id=#{id} </select> - <insert id="insert" parameterType="Author" useGeneratedKeys="true" keyProperty="id"> + <insert id="insert" parameterType="Author" keyColumn="id" useGeneratedKeys="true" keyProperty="id"> INSERT INTO authors (person_id, login, created_at, updated_at) VALUES (#{personId}, #{login}, #{createdAt}, #{updatedAt}) </insert> - <!-- Oracle --> - <insert id="insert" databaseId="oracle" parameterType="Author" useGeneratedKeys="true" keyProperty="id"> - <selectKey order="BEFORE" resultType="Long" keyProperty="id"> - select authors_seq.NEXTVAL from DUAL - </selectKey> - INSERT INTO authors (id, person_id, login, created_at, updated_at) - VALUES (#{id}, #{personId}, #{login}, - #{createdAt}, #{updatedAt}) - </insert> - </mapper> diff --git a/sonar-core/src/main/resources/org/sonar/core/user/RoleMapper.xml b/sonar-core/src/main/resources/org/sonar/core/user/RoleMapper.xml index bbef4611eed..d230d2899a8 100644 --- a/sonar-core/src/main/resources/org/sonar/core/user/RoleMapper.xml +++ b/sonar-core/src/main/resources/org/sonar/core/user/RoleMapper.xml @@ -3,34 +3,16 @@ <mapper namespace="org.sonar.core.user.RoleMapper"> - <insert id="insertGroupRole" parameterType="GroupRole" useGeneratedKeys="true" keyProperty="id"> + <insert id="insertGroupRole" parameterType="GroupRole" keyColumn="id" useGeneratedKeys="true" keyProperty="id"> INSERT INTO group_roles (group_id, resource_id, role) VALUES (#{groupId}, #{resourceId}, #{role}) </insert> - <!-- Oracle --> - <insert id="insertGroupRole" databaseId="oracle" parameterType="GroupRole" useGeneratedKeys="true" keyProperty="id"> - <selectKey order="BEFORE" resultType="Long" keyProperty="id"> - select group_roles_seq.NEXTVAL from DUAL - </selectKey> - INSERT INTO group_roles (id, group_id, resource_id, role) - VALUES (#{id}, #{groupId}, #{resourceId}, #{role}) - </insert> - - <insert id="insertUserRole" parameterType="UserRole" useGeneratedKeys="true" keyProperty="id"> + <insert id="insertUserRole" parameterType="UserRole" keyColumn="id" useGeneratedKeys="true" keyProperty="id"> INSERT INTO user_roles (user_id, resource_id, role) VALUES (#{userId}, #{resourceId}, #{role}) </insert> - <!-- Oracle --> - <insert id="insertUserRole" databaseId="oracle" parameterType="UserRole" useGeneratedKeys="true" keyProperty="id"> - <selectKey order="BEFORE" resultType="Long" keyProperty="id"> - select user_roles_seq.NEXTVAL from DUAL - </selectKey> - INSERT INTO user_roles (id, user_id, resource_id, role) - VALUES (#{id}, #{userId}, #{resourceId}, #{role}) - </insert> - <delete id="deleteGroupRole" parameterType="map"> delete from group_roles where resource_id=#{resourceId} and role=#{role} <choose> |