import org.apache.commons.dbutils.DbUtils;
import org.sonar.core.persistence.Database;
-import org.sonar.core.persistence.dialect.MySql;
import java.sql.Connection;
import java.sql.PreparedStatement;
static SelectImpl create(Database db, Connection connection, String sql) throws SQLException {
PreparedStatement pstmt = connection.prepareStatement(sql, ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY);
- if (db.getDialect().getId().equals(MySql.ID)) {
- pstmt.setFetchSize(Integer.MIN_VALUE);
- } else {
- pstmt.setFetchSize(1000);
- }
+ pstmt.setFetchSize(db.getDialect().getScrollDefaultFetchSize());
return new SelectImpl(pstmt);
}
}
values (#{key}, #{createdAt}, #{updatedAt})
</insert>
- <select id="selectAfterDate" resultType="fake" resultSetType="FORWARD_ONLY" fetchSize="200">
+ <select id="selectAfterDate" resultType="fake" fetchSize="${_scrollFetchSize}" resultSetType="FORWARD_ONLY">
select
<include refid="selectColumns"/>
from fake f
*/
String getValidationQuery();
+ /**
+ * Fetch size to be used when scrolling large result sets.
+ *
+ * @since 5.0
+ */
int getScrollDefaultFetchSize();
}
<result property="updatedAt" column="updatedAt" javaType="java.util.Date"/>
</resultMap>
- <select id="selectAfterDate" parameterType="map" resultMap="resultMap">
+ <select id="selectAfterDate" parameterType="map" resultMap="resultMap"
+ fetchSize="${_scrollFetchSize}" resultSetType="FORWARD_ONLY">
SELECT
project_authorization.project as "project",
project_authorization.login as "permissionUser",
where i.kee=#{kee}
</select>
- <select id="selectAfterDate" resultType="Issue"
- fetchSize="${_scrollFetchSize}" resultSetType="FORWARD_ONLY">
+ <select id="selectAfterDate" resultType="Issue" fetchSize="${_scrollFetchSize}" resultSetType="FORWARD_ONLY">
select
<include refid="issueColumns"/>
from issues i
LEFT JOIN active_rules active_rule_parent ON active_rule_parent.profile_id=profile_parent.id AND a.rule_id=active_rule_parent.rule_id
</sql>
- <select id="selectAfterDate" parameterType="Date" resultType="ActiveRule" resultSetType="FORWARD_ONLY">
+ <select id="selectAfterDate" parameterType="Date" resultType="ActiveRule"
+ fetchSize="${_scrollFetchSize}" resultSetType="FORWARD_ONLY">
select
<include refid="activeRuleKeyColumns"/>
from active_rules a
from rules r
</select>
- <select id="selectAfterDate" resultType="Rule" resultSetType="FORWARD_ONLY" fetchSize="200">
+ <select id="selectAfterDate" resultType="Rule" fetchSize="${_scrollFetchSize}" resultSetType="FORWARD_ONLY">
select
<include refid="selectColumns"/>
from rules r