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);
- pstmt.setFetchSize(1000);
+ if (db.getDialect().getId().equals(MySql.ID)) {
+ pstmt.setFetchSize(Integer.MIN_VALUE);
+ } else {
+ pstmt.setFetchSize(1000);
+ }
return new SelectImpl(pstmt);
}
}
#----- MySQL 5.x
-#sonar.jdbc.url=jdbc:mysql://localhost:3306/sonar?useUnicode=true&characterEncoding=utf8&rewriteBatchedStatements=true&useConfigs=maxPerformance&useCursorFetch=true
+#sonar.jdbc.url=jdbc:mysql://localhost:3306/sonar?useUnicode=true&characterEncoding=utf8&rewriteBatchedStatements=true&useConfigs=maxPerformance
#----- Oracle 10g/11g
if (Provider.mysql.equals(provider)) {
checkRequiredParameter(url, "useUnicode=true");
checkRequiredParameter(url, "characterEncoding=utf8");
- checkRequiredParameter(url, "useCursorFetch=true");
checkRecommendedParameter(url, "rewriteBatchedStatements=true");
checkRecommendedParameter(url, "useConfigs=maxPerformance");
}
// minimal -> ok
settings.checkUrlParameters(JdbcSettings.Provider.mysql,
- "jdbc:mysql://localhost:3306/sonar?useUnicode=true&characterEncoding=utf8&useCursorFetch=true");
+ "jdbc:mysql://localhost:3306/sonar?useUnicode=true&characterEncoding=utf8");
// full -> ok
settings.checkUrlParameters(JdbcSettings.Provider.mysql,
- "jdbc:mysql://localhost:3306/sonar?useUnicode=true&characterEncoding=utf8&rewriteBatchedStatements=true&useConfigs=maxPerformance&useCursorFetch=true");
+ "jdbc:mysql://localhost:3306/sonar?useUnicode=true&characterEncoding=utf8&rewriteBatchedStatements=true&useConfigs=maxPerformance");
// missing required -> ko
try {