import org.sonar.db.ce.CeTaskCharacteristicMapper;
import org.sonar.db.ce.CeTaskInputMapper;
import org.sonar.db.ce.CeTaskMessageMapper;
+import org.sonar.db.common.Common;
import org.sonar.db.component.AnalysisPropertiesMapper;
import org.sonar.db.component.AnalysisPropertyValuePerProject;
import org.sonar.db.component.ApplicationProjectsMapper;
UserPermissionMapper.class,
UserTokenMapper.class,
WebhookMapper.class,
- WebhookDeliveryMapper.class
+ WebhookDeliveryMapper.class,
+ Common.class
};
confBuilder.loadMappers(mappers);
confExtensions.stream()
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2023 SonarSource SA
+ * mailto:info AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+package org.sonar.db.common;
+
+public interface Common {
+
+}
--- /dev/null
+/*
+ * SonarQube
+ * Copyright (C) 2009-2023 SonarSource SA
+ * mailto:info AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+@ParametersAreNonnullByDefault
+package org.sonar.db.common;
+
+import javax.annotation.ParametersAreNonnullByDefault;
where
a.created_at >= #{start} and a.created_at < #{end}
order by created_at asc
- offset #{pagination.offset,jdbcType=INTEGER} rows fetch next #{pagination.pageSize,jdbcType=INTEGER} rows only
+ <include refid="org.sonar.db.common.Common.pagination"/>
</select>
<insert id="insert" parameterType="Map" useGeneratedKeys="false">
<sql id="sqlSelectByQuery">
<include refid="sqlSelectByQueryWithoutPagination"/>
order by ca.created_at desc, uuid desc
- offset #{pagination.offset,jdbcType=INTEGER} rows fetch next #{pagination.pageSize,jdbcType=INTEGER} rows only
+ <include refid="org.sonar.db.common.Common.pagination"/>
</sql>
<select id="countByQuery" parameterType="map" resultType="int">
<include refid="columns"/>
<include refid="sqlSelectByQuery"/>
<include refid="orderByDescDateAndUuid"/>
- <include refid="pagination"/>
+ <include refid="org.sonar.db.common.Common.pagination"/>
</select>
- <sql id="pagination">
- offset #{pagination.offset,jdbcType=INTEGER} rows fetch next #{pagination.pageSize,jdbcType=INTEGER} rows only
- </sql>
-
<select id="countByQuery" resultType="int">
select
count(1)
select cq.uuid as ceTaskUuid, cq.created_at as createdAt
<include refid="sqlSelectEligibleForPeek"/>
<include refid="orderBySelectEligibleForPeek"/>
- offset #{pagination.offset,jdbcType=INTEGER} rows fetch next #{pagination.pageSize,jdbcType=INTEGER} rows only
+ <include refid="org.sonar.db.common.Common.pagination"/>
</select>
<sql id="columnsSelectEligibleForPeek">
--- /dev/null
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "mybatis-3-mapper.dtd">
+
+<mapper namespace="org.sonar.db.common.Common">
+
+ <sql id="pagination">
+ offset #{pagination.offset,jdbcType=INTEGER} rows fetch next #{pagination.pageSize,jdbcType=INTEGER} rows only
+ </sql>
+
+</mapper>
+
<include refid="componentColumns"/>
<include refid="sqlSelectByQuery"/>
ORDER BY LOWER(p.name), p.name, p.created_at
- offset #{pagination.offset,jdbcType=INTEGER} rows fetch next #{pagination.pageSize,jdbcType=INTEGER} rows only
+ <include refid="org.sonar.db.common.Common.pagination"/>
</select>
<select id="countByQuery" resultType="int">
and s.status = #{status,jdbcType=VARCHAR}
</where>
ORDER BY s.created_at ASC
- <include refid="pagination"/>
+ <include refid="org.sonar.db.common.Common.pagination"/>
</select>
- <sql id="pagination">
- offset #{pagination.offset,jdbcType=INTEGER} rows fetch next #{pagination.pageSize,jdbcType=INTEGER} rows only
- </sql>
-
<select id="selectSnapshotBefore" resultType="ViewsSnapshot">
SELECT
<include refid="viewsSnapshotColumns" />
</foreach>
</if>
order by i.kee
- offset #{pagination.offset,jdbcType=INTEGER} rows fetch next #{pagination.pageSize,jdbcType=INTEGER} rows only
+ <include refid="org.sonar.db.common.Common.pagination"/>
</select>
<select id="selectIssueKeysByComponentUuidAndChangedSinceDate" parameterType="map" resultType="string">
</foreach>
</if>
order by i.kee
- offset #{pagination.offset,jdbcType=INTEGER} rows fetch next #{pagination.pageSize,jdbcType=INTEGER} rows only
+ <include refid="org.sonar.db.common.Common.pagination"/>
</select>
<select id="selectByComponentUuidPaginated" parameterType="map" resultMap="issueResultMap">
left outer join rules_default_impacts rdi on r.uuid = rdi.rule_uuid
where i.project_uuid=#{componentUuid,jdbcType=VARCHAR}
order by i.issue_creation_date ASC
- offset #{pagination.offset,jdbcType=INTEGER} rows fetch next #{pagination.pageSize,jdbcType=INTEGER} rows only
+ <include refid="org.sonar.db.common.Common.pagination"/>
</select>
<sql id="selectByBranchColumns">
<!-- order by clause is required if using offset rows fetch next on MSSQL Database -->
order by (select null)
</if>
- offset #{pagination.offset,jdbcType=INTEGER} rows fetch next #{pagination.pageSize,jdbcType=INTEGER} rows only
+ <include refid="org.sonar.db.common.Common.pagination"/>
</select>
</mapper>
m.enabled=${_true}
</where>
ORDER BY UPPER(m.short_name), m.short_name
- offset #{pagination.offset,jdbcType=INTEGER} rows fetch next #{pagination.pageSize,jdbcType=INTEGER} rows only
+ <include refid="org.sonar.db.common.Common.pagination"/>
</select>
<select id="countEnabled" resultType="Integer">
<include refid="groupsByQuery"/>
group by sub.name, lower(sub.name), sub.groupUuid
order by case when (count(sub.permission) > 0) then 1 else 2 end asc, lower(sub.name), sub.name, sub.groupUuid
- <include refid="pagination"/>
+ <include refid="org.sonar.db.common.Common.pagination"/>
</select>
- <sql id="pagination">
- offset #{pagination.offset,jdbcType=INTEGER} rows fetch next #{pagination.pageSize,jdbcType=INTEGER} rows only
- </sql>
-
<select id="countGroupsByQuery" parameterType="map" resultType="int">
select count(1)
from (
<include refid="userLoginsByQueryAndTemplate"/>
group by u.login, u.name
order by case when (count(ptu.permission_reference) > 0) then 1 else 2 end asc, u.name
- <include refid="pagination"/>
+ <include refid="org.sonar.db.common.Common.pagination"/>
</select>
<select id="countUserLoginsByQueryAndTemplate" parameterType="map" resultType="int">
<include refid="groupNamesByQueryAndTemplate"/>
group by groups.name, lower(groups.name), groups.group_uuid
order by case when (count(groups.permission) > 0) then 1 else 2 end asc, lower(groups.name), groups.name, groups.group_uuid
- <include refid="pagination"/>
+ <include refid="org.sonar.db.common.Common.pagination"/>
</select>
<select id="countGroupNamesByQueryAndTemplate" parameterType="map" resultType="int">
<include refid="groupNamesByQueryAndTemplate"/>) g
</select>
- <sql id="pagination">
- offset #{pagination.offset,jdbcType=INTEGER} rows fetch next #{pagination.pageSize,jdbcType=INTEGER} rows only
- </sql>
-
<sql id="groupNamesByQueryAndTemplate">
FROM
(SELECT
#{uuid,jdbcType=VARCHAR}
</foreach>
order by p.name, uuid desc
- offset #{pagination.offset,jdbcType=INTEGER} rows fetch next #{pagination.pageSize,jdbcType=INTEGER} rows only
+ <include refid="org.sonar.db.common.Common.pagination"/>
</select>
<select id="selectProjectsByKeys" resultType="Project">
SELECT g.uuid as groupUuid, g.name as name, qggp.uuid as uuid
<include refid="sqlSelectByQuery"/>
ORDER BY g.name ASC
- offset #{pagination.offset,jdbcType=INTEGER} rows fetch next #{pagination.pageSize,jdbcType=INTEGER} rows only
+ <include refid="org.sonar.db.common.Common.pagination"/>
</select>
<select id="countByQuery" resultType="int">
SELECT u.uuid as userUuid, u.name as name, qup.uuid as uuid
<include refid="sqlSelectByQuery"/>
ORDER BY u.name ASC
- offset #{pagination.offset,jdbcType=INTEGER} rows fetch next #{pagination.pageSize,jdbcType=INTEGER} rows only
+ <include refid="org.sonar.db.common.Common.pagination"/>
</select>
<sql id="sqlSelectByQuery">
SELECT g.uuid as groupUuid, g.name as name, qeg.uuid as uuid
<include refid="sqlSelectByQuery"/>
ORDER BY g.name ASC
- offset #{pagination.offset,jdbcType=INTEGER} rows fetch next #{pagination.pageSize,jdbcType=INTEGER} rows only
+ <include refid="org.sonar.db.common.Common.pagination"/>
</select>
<sql id="sqlSelectByQuery">
SELECT u.uuid as userUuid, u.name as name, qeu.uuid as uuid
<include refid="sqlSelectByQuery"/>
ORDER BY u.name ASC
- offset #{pagination.offset,jdbcType=INTEGER} rows fetch next #{pagination.pageSize,jdbcType=INTEGER} rows only
+ <include refid="org.sonar.db.common.Common.pagination"/>
</select>
<sql id="sqlSelectByQuery">
where g.name = #{query.displayName,jdbcType=VARCHAR}
</if>
order by s.scim_uuid asc
- <include refid="pagination"/>
+ <include refid="org.sonar.db.common.Common.pagination"/>
</select>
- <sql id="pagination">
- offset #{pagination.offset,jdbcType=INTEGER} rows fetch next #{pagination.pageSize,jdbcType=INTEGER} rows only
- </sql>
-
<select id="countScimGroups" resultType="int">
select count(1)
from scim_groups s
<include refid="scimUsersColumns"/>
<include refid="sqlSelectByQuery"/>
order by s.scim_uuid asc
- <include refid="pagination"/>
+ <include refid="org.sonar.db.common.Common.pagination"/>
</select>
- <sql id="pagination">
- offset #{pagination.offset,jdbcType=INTEGER} rows fetch next #{pagination.pageSize,jdbcType=INTEGER} rows only
- </sql>
-
<select id="countScimUsers" parameterType="map" resultType="int">
select count(1)
<include refid="sqlSelectByQuery"/>
from groups g
<include refid="searchByQueryWhereClause"/>
order by upper(g.name)
- <include refid="pagination"/>
+ <include refid="org.sonar.db.common.Common.pagination"/>
</select>
- <sql id="pagination">
- offset #{pagination.offset,jdbcType=INTEGER} rows fetch next #{pagination.pageSize,jdbcType=INTEGER} rows only
- </sql>
-
<select id="countByQuery" parameterType="map" resultType="int">
select count(1)
from groups g
SELECT g.uuid as uuid, g.name as name, g.description as description, gu.user_uuid as userUuid
<include refid="commonClauses"/>
ORDER BY g.name
- offset #{pagination.offset,jdbcType=INTEGER} rows fetch next #{pagination.pageSize,jdbcType=INTEGER} rows only
+ <include refid="org.sonar.db.common.Common.pagination"/>
</select>
<select id="countGroups" parameterType="map" resultType="int">
SELECT u.uuid as uuid, u.login as login, u.name as name, gu.group_uuid as groupUuid
<include refid="userCommonClauses"/>
ORDER BY u.name ASC
- offset #{pagination.offset,jdbcType=INTEGER} rows fetch next #{pagination.pageSize,jdbcType=INTEGER} rows only
+ <include refid="org.sonar.db.common.Common.pagination"/>
</select>
<select id="countMembers" parameterType="map" resultType="int">
<include refid="selectFromUsersAndJoinScmAccounts"/>
<include refid="searchByQueryWhereClause"/>
ORDER BY u.login
- offset #{pagination.offset,jdbcType=INTEGER} rows fetch next #{pagination.pageSize,jdbcType=INTEGER} rows only
+ <include refid="org.sonar.db.common.Common.pagination"/>
</select>
<select id="countByQuery" parameterType="map" resultType="int">
from webhook_deliveries
where webhook_uuid = #{webhookUuid,jdbcType=VARCHAR}
order by created_at desc
- offset #{pagination.offset,jdbcType=INTEGER} rows fetch next #{pagination.pageSize,jdbcType=INTEGER} rows only
+ <include refid="org.sonar.db.common.Common.pagination"/>
</select>
<select id="countByProjectUuid" parameterType="String" resultType="int">
from webhook_deliveries
where project_uuid = #{projectUuid,jdbcType=VARCHAR}
order by created_at desc
- offset #{pagination.offset,jdbcType=INTEGER} rows fetch next #{pagination.pageSize,jdbcType=INTEGER} rows only
+ <include refid="org.sonar.db.common.Common.pagination"/>
</select>
<select id="selectOrderedByCeTaskUuid" resultType="org.sonar.db.webhook.WebhookDeliveryLiteDto">
from webhook_deliveries
where ce_task_uuid = #{ceTaskUuid,jdbcType=VARCHAR}
order by created_at desc
- offset #{pagination.offset,jdbcType=INTEGER} rows fetch next #{pagination.pageSize,jdbcType=INTEGER} rows only
+ <include refid="org.sonar.db.common.Common.pagination"/>
</select>
<select id="countByCeTaskUuid" parameterType="String" resultType="int">