diff options
author | Simon Brandhof <simon.brandhof@sonarsource.com> | 2018-10-17 22:45:41 +0200 |
---|---|---|
committer | SonarTech <sonartech@sonarsource.com> | 2018-10-18 20:20:55 +0200 |
commit | bee3ce3d74bc9143c56a3aeb68dcbb4ba3d06513 (patch) | |
tree | 3fc42d200fe28fe12a9934ba72c3505bf1f6cf6d /server/sonar-db-core/src | |
parent | 36d1270ef32ec03387908867ff4cf4e3e1164d14 (diff) | |
download | sonarqube-bee3ce3d74bc9143c56a3aeb68dcbb4ba3d06513.tar.gz sonarqube-bee3ce3d74bc9143c56a3aeb68dcbb4ba3d06513.zip |
Fix bugs, mainly about type casts
Diffstat (limited to 'server/sonar-db-core/src')
-rw-r--r-- | server/sonar-db-core/src/main/java/org/sonar/db/DatabaseUtils.java | 23 |
1 files changed, 0 insertions, 23 deletions
diff --git a/server/sonar-db-core/src/main/java/org/sonar/db/DatabaseUtils.java b/server/sonar-db-core/src/main/java/org/sonar/db/DatabaseUtils.java index 79ba984c3fe..1df8194edf7 100644 --- a/server/sonar-db-core/src/main/java/org/sonar/db/DatabaseUtils.java +++ b/server/sonar-db-core/src/main/java/org/sonar/db/DatabaseUtils.java @@ -170,29 +170,6 @@ public class DatabaseUtils { } /** - * Partition by 1000 elements a list of input and execute a consumer on each part. - * - * The goal is to prevent issue with ORACLE when there's more than 1000 elements in a 'in ('X', 'Y', ...)' - * and with MsSQL when there's more than 2000 parameters in a query - * - * @param inputs the whole list of elements to be partitioned - * @param sqlCaller a {@link Function} which calls the SQL update/delete and returns the number of updated/deleted rows. - * @param partitionSizeManipulations the function that computes the number of usages of a partition, for example - * {@code partitionSize -> partitionSize / 2} when the partition of elements - * in used twice in the SQL request. - * @return the total number of updated/deleted rows (computed as the sum of the values returned by {@code sqlCaller}). - */ - public static <INPUT extends Comparable<INPUT>> int executeLargeUpdates(Collection<INPUT> inputs, Function<List<INPUT>, Integer> sqlCaller, - IntFunction<Integer> partitionSizeManipulations) { - Iterable<List<INPUT>> partitions = toUniqueAndSortedPartitions(inputs, partitionSizeManipulations); - Integer res = 0; - for (List<INPUT> partition : partitions) { - res += sqlCaller.apply(partition); - } - return res; - } - - /** * Ensure values {@code inputs} are unique (which avoids useless arguments) and sorted before creating the partition. */ public static <INPUT extends Comparable<INPUT>> Iterable<List<INPUT>> toUniqueAndSortedPartitions(Collection<INPUT> inputs) { |