]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-8094 remove create table on Oracle with SECUREFILE clause 1265/head
authorSébastien Lesaint <sebastien.lesaint@sonarsource.com>
Mon, 19 Sep 2016 12:37:13 +0000 (14:37 +0200)
committerSébastien Lesaint <sebastien.lesaint@sonarsource.com>
Mon, 19 Sep 2016 13:27:32 +0000 (15:27 +0200)
sonar-db/src/main/java/org/sonar/db/version/CreateTableBuilder.java
sonar-db/src/test/java/org/sonar/db/version/CreateTableBuilderTest.java

index f5087f3764e81637ac09ed0311ecc8dad149a9f9..955106533af7d0daef8743fb327ca1fe9d07ef12 100644 (file)
@@ -114,7 +114,6 @@ public class CreateTableBuilder {
     appendColumns(res, dialect, columnDefs);
     appendPkConstraint(res);
     res.append(')');
-    appendLOBStorageClause(res, dialect, columnDefs);
     appendCollationClause(res, dialect);
     return res.toString();
   }
@@ -227,22 +226,6 @@ public class CreateTableBuilder {
     }
   }
 
-  private static void appendLOBStorageClause(StringBuilder res, Dialect dialect, List<ColumnDef> columnDefs) {
-    if (!Oracle.ID.equals(dialect.getId())) {
-      return;
-    }
-
-    List<ColumnDef> clobColumnDefs = columnDefs.stream()
-      .filter(columnDef -> columnDef instanceof ClobColumnDef || columnDef instanceof BlobColumnDef)
-      .collect(Collectors.toList());
-    if (!clobColumnDefs.isEmpty()) {
-      res.append(" LOB (");
-      appendColumnNames(res, clobColumnDefs);
-      res.append(')');
-      res.append(" STORE AS SECUREFILE (RETENTION NONE NOCACHE NOLOGGING)");
-    }
-  }
-
   private static void appendCollationClause(StringBuilder res, Dialect dialect) {
     if (MySql.ID.equals(dialect.getId())) {
       res.append(" ENGINE=InnoDB CHARACTER SET utf8 COLLATE utf8_bin");
index 710c9823bcfb4d6bdb3a630793cae93ede5065fd..2b11ff4eb89ff82f022f42650c9a7b20f22e2a6d 100644 (file)
@@ -509,60 +509,6 @@ public class CreateTableBuilderTest {
       });
   }
 
-  @Test
-  public void builds_adds_LOB_storage_clause_on_Oracle_for_CLOB_column() {
-    List<String> stmts = new CreateTableBuilder(ORACLE, TABLE_NAME)
-      .addColumn(newClobColumnDefBuilder().setColumnName("clob_1").setIsNullable(false).build())
-      .build();
-    assertThat(stmts).hasSize(1);
-
-    assertThat(stmts.iterator().next()).isEqualTo(
-      "CREATE TABLE " + TABLE_NAME + " (" +
-        "clob_1 CLOB NOT NULL)" +
-        " LOB (clob_1) STORE AS SECUREFILE (RETENTION NONE NOCACHE NOLOGGING)");
-  }
-
-  @Test
-  public void builds_adds_LOB_storage_clause_on_Oracle_for_BLOB_column() {
-    List<String> stmts = new CreateTableBuilder(ORACLE, TABLE_NAME)
-      .addColumn(newBlobColumnDefBuilder().setColumnName("blob_1").setIsNullable(false).build())
-      .build();
-    assertThat(stmts).hasSize(1);
-
-    assertThat(stmts.iterator().next()).isEqualTo(
-      "CREATE TABLE " + TABLE_NAME + " (" +
-        "blob_1 BLOB NOT NULL)" +
-        " LOB (blob_1) STORE AS SECUREFILE (RETENTION NONE NOCACHE NOLOGGING)");
-  }
-
-  @Test
-  public void build_does_not_add_LOB_storage_clause_for_CLOB_column_for_other_than_Oracle() {
-    Arrays.stream(ALL_DIALECTS)
-      .filter(dialect -> dialect != ORACLE)
-      .forEach(dialect -> {
-        List<String> stmts = new CreateTableBuilder(dialect, TABLE_NAME)
-          .addColumn(newClobColumnDefBuilder().setColumnName("clob_1").setIsNullable(false).build())
-          .build();
-        assertThat(stmts).hasSize(1);
-
-        assertThat(stmts.iterator().next()).doesNotContain("STORE AS SECUREFILE");
-      });
-  }
-
-  @Test
-  public void build_does_not_add_LOB_storage_clause_for_BLOB_column_for_other_than_Oracle() {
-    Arrays.stream(ALL_DIALECTS)
-      .filter(dialect -> dialect != ORACLE)
-      .forEach(dialect -> {
-        List<String> stmts = new CreateTableBuilder(dialect, TABLE_NAME)
-          .addColumn(newBlobColumnDefBuilder().setColumnName("blob_1").setIsNullable(false).build())
-          .build();
-        assertThat(stmts).hasSize(1);
-
-        assertThat(stmts.iterator().next()).doesNotContain("STORE AS SECUREFILE");
-      });
-  }
-
   private static String bigIntSqlType(Dialect dialect) {
     return Oracle.ID.equals(dialect.getId()) ? "NUMBER (38)" : "BIGINT";
   }