]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-10116 Fix insert of LOB in batch statements of migrations
authorSimon Brandhof <simon.brandhof@sonarsource.com>
Tue, 5 Dec 2017 09:08:42 +0000 (10:08 +0100)
committerSimon Brandhof <simon.brandhof@sonarsource.com>
Tue, 5 Dec 2017 09:38:11 +0000 (10:38 +0100)
server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/step/BaseSqlStatement.java
server/sonar-db-migration/src/main/java/org/sonar/server/platform/db/migration/version/v70/PopulateLiveMeasures.java

index ebb62540d0bf5386aa3aac327879dcb5463720f3..9b6cffcde153566f4bb42991f093061378cb53b1 100644 (file)
@@ -19,7 +19,6 @@
  */
 package org.sonar.server.platform.db.migration.step;
 
-import java.io.ByteArrayInputStream;
 import java.sql.PreparedStatement;
 import java.sql.SQLException;
 import java.sql.Timestamp;
@@ -82,7 +81,7 @@ class BaseSqlStatement<CHILD extends SqlStatement> implements SqlStatement<CHILD
     if (value == null) {
       pstmt.setNull(columnIndex, Types.BINARY);
     } else {
-      pstmt.setBinaryStream(columnIndex, new ByteArrayInputStream(value));
+      pstmt.setBytes(columnIndex, value);
     }
     return (CHILD) this;
   }
index 1d226fca4f1789befb0b5657219ed12994a40ada..a7945be15d17fc95fdfada9fab53fe2ccdbc222a 100644 (file)
@@ -60,7 +60,7 @@ public class PopulateLiveMeasures extends DataChange {
       update.setString(3, row.getString(2));
       update.setInt(4, row.getInt(3));
       update.setDouble(5, row.getNullableDouble(4));
-      update.setString(6, row.getString(5));
+      update.setString(6, row.getNullableString(5));
       update.setDouble(7, row.getNullableDouble(6));
       update.setBytes(8, row.getNullableBytes(7));
       update.setLong(9, now);