From 052c3d2d90f492354037c338f5186dce87430c9f Mon Sep 17 00:00:00 2001 From: =?utf8?q?S=C3=A9bastien=20Lesaint?= Date: Wed, 14 Sep 2016 11:23:42 +0200 Subject: [PATCH] SONAR-8025 ddl changes must not be executed with a PreparedStatement --- sonar-db/src/main/java/org/sonar/db/version/DdlChange.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/sonar-db/src/main/java/org/sonar/db/version/DdlChange.java b/sonar-db/src/main/java/org/sonar/db/version/DdlChange.java index 7d2606fc563..ffab3bb9fc5 100644 --- a/sonar-db/src/main/java/org/sonar/db/version/DdlChange.java +++ b/sonar-db/src/main/java/org/sonar/db/version/DdlChange.java @@ -21,6 +21,7 @@ package org.sonar.db.version; import java.sql.Connection; import java.sql.SQLException; +import java.sql.Statement; import java.util.List; import java.util.regex.Pattern; import org.apache.commons.dbutils.DbUtils; @@ -78,8 +79,9 @@ public abstract class DdlChange implements MigrationStep { } public void execute(String original, String sql, int errorCount) throws SQLException { - try { - UpsertImpl.create(writeConnection, sql).execute().commit(); + try (Statement stmt = writeConnection.createStatement()) { + stmt.execute(sql); + writeConnection.commit(); } catch (SQLException e) { if (errorCount < ERROR_HANDLING_THRESHOLD) { String message = e.getMessage(); -- 2.39.5