]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-8025 ddl changes must not be executed with a PreparedStatement
authorSébastien Lesaint <sebastien.lesaint@sonarsource.com>
Wed, 14 Sep 2016 09:23:42 +0000 (11:23 +0200)
committerSébastien Lesaint <sebastien.lesaint@sonarsource.com>
Fri, 16 Sep 2016 10:22:12 +0000 (12:22 +0200)
sonar-db/src/main/java/org/sonar/db/version/DdlChange.java

index 7d2606fc5632ccbbd68486490f1142060509bbdd..ffab3bb9fc5e47dbfa4d707dc4b9665f3ebcc253 100644 (file)
@@ -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();