aboutsummaryrefslogtreecommitdiffstats
path: root/sonar-db
diff options
context:
space:
mode:
authorSébastien Lesaint <sebastien.lesaint@sonarsource.com>2016-09-14 14:39:32 +0200
committerSébastien Lesaint <sebastien.lesaint@sonarsource.com>2016-09-16 12:22:12 +0200
commit30e733d5f62a5d7352e79c7c26514af7846f6c3c (patch)
tree3ba2bdf265af7d2c7f3ddb606c5b4c2c05e9aa2e /sonar-db
parent166761387ba04c6065c66678dbcbb9b56798a2b3 (diff)
downloadsonarqube-30e733d5f62a5d7352e79c7c26514af7846f6c3c.tar.gz
sonarqube-30e733d5f62a5d7352e79c7c26514af7846f6c3c.zip
SONAR-8025 minor internal refacto of CreateTableBuilder
Diffstat (limited to 'sonar-db')
-rw-r--r--sonar-db/src/main/java/org/sonar/db/version/CreateTableBuilder.java28
1 files changed, 14 insertions, 14 deletions
diff --git a/sonar-db/src/main/java/org/sonar/db/version/CreateTableBuilder.java b/sonar-db/src/main/java/org/sonar/db/version/CreateTableBuilder.java
index 6884ca7de0d..f5087f3764e 100644
--- a/sonar-db/src/main/java/org/sonar/db/version/CreateTableBuilder.java
+++ b/sonar-db/src/main/java/org/sonar/db/version/CreateTableBuilder.java
@@ -110,23 +110,23 @@ public class CreateTableBuilder {
StringBuilder res = new StringBuilder("CREATE TABLE ");
res.append(tableName);
res.append(" (");
- addPkColumns(res);
- addColumns(res, dialect, columnDefs);
- addPkConstraint(res);
+ appendPkColumns(res);
+ appendColumns(res, dialect, columnDefs);
+ appendPkConstraint(res);
res.append(')');
- addLOBStorageClause(res, dialect, columnDefs);
- addCollationClause(res, dialect);
+ appendLOBStorageClause(res, dialect, columnDefs);
+ appendCollationClause(res, dialect);
return res.toString();
}
- private void addPkColumns(StringBuilder res) {
- addColumns(res, dialect, pkColumnDefs);
+ private void appendPkColumns(StringBuilder res) {
+ appendColumns(res, dialect, pkColumnDefs);
if (!pkColumnDefs.isEmpty() && !columnDefs.isEmpty()) {
res.append(',');
}
}
- private void addColumns(StringBuilder res, Dialect dialect, List<ColumnDef> columnDefs) {
+ private void appendColumns(StringBuilder res, Dialect dialect, List<ColumnDef> columnDefs) {
if (columnDefs.isEmpty()) {
return;
}
@@ -196,20 +196,20 @@ public class CreateTableBuilder {
}
}
- private void addPkConstraint(StringBuilder res) {
+ private void appendPkConstraint(StringBuilder res) {
if (pkColumnDefs.isEmpty()) {
return;
}
res.append(", ");
res.append("CONSTRAINT ");
- addPkConstraintName(res);
+ appendPkConstraintName(res);
res.append(" PRIMARY KEY ");
res.append('(');
appendColumnNames(res, pkColumnDefs);
res.append(')');
}
- private void addPkConstraintName(StringBuilder res) {
+ private void appendPkConstraintName(StringBuilder res) {
if (pkConstraintName == null) {
res.append("pk_").append(tableName);
} else {
@@ -227,7 +227,7 @@ public class CreateTableBuilder {
}
}
- private void addLOBStorageClause(StringBuilder res, Dialect dialect, List<ColumnDef> columnDefs) {
+ private static void appendLOBStorageClause(StringBuilder res, Dialect dialect, List<ColumnDef> columnDefs) {
if (!Oracle.ID.equals(dialect.getId())) {
return;
}
@@ -243,7 +243,7 @@ public class CreateTableBuilder {
}
}
- private static void addCollationClause(StringBuilder res, Dialect dialect) {
+ private static void appendCollationClause(StringBuilder res, Dialect dialect) {
if (MySql.ID.equals(dialect.getId())) {
res.append(" ENGINE=InnoDB CHARACTER SET utf8 COLLATE utf8_bin");
}
@@ -258,7 +258,7 @@ public class CreateTableBuilder {
.flatMap(columnDef -> of(createSequenceFor(tableName), createTriggerFor(tableName)));
}
- private String createSequenceFor(String tableName) {
+ private static String createSequenceFor(String tableName) {
return "CREATE SEQUENCE " + tableName + "_seq START WITH 1 INCREMENT BY 1";
}