mirror of
https://github.com/ebean-orm/ebean.git
synced 2026-11-19 23:02:24 +00:00
Removed 'lowerTableName' and 'lowerColumnName'
This commit is contained in:
1 parent
5eb790e54d
commit
a8ad93823a
9 files changed
+15
-93
No files matched your search
+4
-18
@@ -204,7 +204,7 @@ public class BaseTableDdl implements TableDdl {
|
||||
public void generate(DdlWrite writer, CreateTable createTable) {
|
||||
reset();
|
||||
|
||||
String tableName = lowerTableName(createTable.getName());
|
||||
String tableName = createTable.getName();
|
||||
List<Column> columns = createTable.getColumn();
|
||||
List<Column> pk = determinePrimaryKeyColumns(columns);
|
||||
|
||||
@@ -398,7 +398,7 @@ public class BaseTableDdl implements TableDdl {
|
||||
|
||||
protected void writeForeignKey(DdlWrite writer, WriteForeignKey request) {
|
||||
DdlBuffer fkeyBuffer = writer.applyForeignKeys();
|
||||
String tableName = lowerTableName(request.table());
|
||||
String tableName = request.table();
|
||||
if (request.indexName() != null) {
|
||||
// no matching unique constraint so add the index
|
||||
fkeyBuffer.appendStatement(platformDdl.createIndex(new WriteCreateIndex(request.indexName(), tableName, request.cols(), false)));
|
||||
@@ -423,7 +423,7 @@ public class BaseTableDdl implements TableDdl {
|
||||
if (i > 0) {
|
||||
buffer.append(",");
|
||||
}
|
||||
buffer.append(lowerColumnName(columns[i].trim()));
|
||||
buffer.append(columns[i].trim());
|
||||
}
|
||||
buffer.append(")");
|
||||
}
|
||||
@@ -490,7 +490,7 @@ public class BaseTableDdl implements TableDdl {
|
||||
buffer.append(",").newLine();
|
||||
buffer.append(" constraint ").append(uqName).append(" unique ");
|
||||
buffer.append("(");
|
||||
buffer.append(lowerColumnName(column.getName()));
|
||||
buffer.append(column.getName());
|
||||
buffer.append(")");
|
||||
}
|
||||
|
||||
@@ -514,20 +514,6 @@ public class BaseTableDdl implements TableDdl {
|
||||
return cols;
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert the table lower case.
|
||||
*/
|
||||
protected String lowerTableName(String name) {
|
||||
return naming.lowerTableName(name);
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert the column name to lower case.
|
||||
*/
|
||||
protected String lowerColumnName(String name) {
|
||||
return naming.lowerColumnName(name);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the list of columns that make the primary key.
|
||||
*/
|
||||
|
||||
+3
-2
@@ -95,9 +95,10 @@ public class DB2Ddl extends PlatformDdl {
|
||||
.append("begin\n")
|
||||
.append("if exists (select constname from syscat.tabconst where tabschema = current_schema and constname = '")
|
||||
.append(maxConstraintName(constraintName).toUpperCase())
|
||||
.append("' and tabname = '").append(lowerTableName(tableName).toUpperCase()).append("') then\n")
|
||||
|
||||
.append(" prepare stmt from 'alter table ").append(lowerTableName(tableName))
|
||||
.append("' and tabname = '").append(naming.normaliseTable(tableName).toUpperCase()).append("') then\n")
|
||||
|
||||
.append(" prepare stmt from 'alter table ").append(tableName)
|
||||
.append(" drop constraint ").append(maxConstraintName(constraintName)).append("';\n")
|
||||
|
||||
.append(" execute stmt;\n")
|
||||
|
||||
+1
-1
@@ -120,7 +120,7 @@ public class Db2HistoryDdl implements PlatformHistoryDdl {
|
||||
protected void writeColumnDefinition(DdlBuffer buffer, String columnName, String type, boolean isNotNull) {
|
||||
|
||||
String platformType = platformDdl.convert(type);
|
||||
buffer.append(" ").append(platformDdl.lowerColumnName(columnName));
|
||||
buffer.append(" ").append(columnName);
|
||||
buffer.append(" ").append(platformType);
|
||||
if (isNotNull) {
|
||||
buffer.append(" not null");
|
||||
|
||||
+1
-1
@@ -195,7 +195,7 @@ public abstract class DbTriggerBasedHistoryDdl implements PlatformHistoryDdl {
|
||||
|
||||
String platformType = platformDdl.convert(type);
|
||||
buffer.append(" ");
|
||||
buffer.append(platformDdl.lowerColumnName(columnName), 29);
|
||||
buffer.append(columnName, 29);
|
||||
buffer.append(platformType);
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -112,7 +112,7 @@ public class HanaHistoryDdl implements PlatformHistoryDdl {
|
||||
boolean isNotNull, String generated) {
|
||||
|
||||
String platformType = platformDdl.convert(type);
|
||||
buffer.append(" ").append(platformDdl.lowerColumnName(columnName));
|
||||
buffer.append(" ").append(columnName);
|
||||
buffer.append(" ").append(platformType);
|
||||
if (defaultValue != null) {
|
||||
buffer.append(" default ").append(defaultValue);
|
||||
|
||||
+5
-25
@@ -258,7 +258,7 @@ public class PlatformDdl {
|
||||
}
|
||||
|
||||
buffer.append(" ");
|
||||
buffer.append(lowerColumnName(column.getName()), 29);
|
||||
buffer.append(column.getName(), 29);
|
||||
buffer.append(columnDefn);
|
||||
if (!Boolean.TRUE.equals(column.isPrimaryKey())) {
|
||||
String defaultValue = convertDefaultValue(column.getDefaultValue());
|
||||
@@ -435,7 +435,7 @@ public class PlatformDdl {
|
||||
StringBuilder buffer = new StringBuilder(90);
|
||||
buffer.append("foreign key");
|
||||
appendColumns(request.cols(), buffer);
|
||||
buffer.append(" references ").append(lowerTableName(request.refTable()));
|
||||
buffer.append(" references ").append(request.refTable());
|
||||
appendColumns(request.refCols(), buffer);
|
||||
appendForeignKeySuffix(request, buffer);
|
||||
return buffer.toString();
|
||||
@@ -448,13 +448,13 @@ public class PlatformDdl {
|
||||
|
||||
StringBuilder buffer = new StringBuilder(90);
|
||||
buffer
|
||||
.append("alter table ").append(lowerTableName(request.table()))
|
||||
.append("alter table ").append(request.table())
|
||||
.append(" add constraint ").append(maxConstraintName(request.fkName()))
|
||||
.append(" foreign key");
|
||||
appendColumns(request.cols(), buffer);
|
||||
buffer
|
||||
.append(" references ")
|
||||
.append(lowerTableName(request.refTable()));
|
||||
.append(request.refTable());
|
||||
appendColumns(request.refCols(), buffer);
|
||||
appendForeignKeySuffix(request, buffer);
|
||||
if (options.isForeignKeySkipCheck()) {
|
||||
@@ -665,31 +665,11 @@ public class PlatformDdl {
|
||||
if (i > 0) {
|
||||
buffer.append(",");
|
||||
}
|
||||
buffer.append(lowerColumnName(columns[i].trim()));
|
||||
buffer.append(columns[i].trim());
|
||||
}
|
||||
buffer.append(")");
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert the table to lower case.
|
||||
* <p>
|
||||
* Override as desired. Generally lower case with underscore is a good cross database
|
||||
* choice for column/table names.
|
||||
*/
|
||||
protected String lowerTableName(String name) {
|
||||
return naming.lowerTableName(name);
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert the column name to lower case.
|
||||
* <p>
|
||||
* Override as desired. Generally lower case with underscore is a good cross database
|
||||
* choice for column/table names.
|
||||
*/
|
||||
protected String lowerColumnName(String name) {
|
||||
return naming.lowerColumnName(name);
|
||||
}
|
||||
|
||||
public DatabasePlatform getPlatform() {
|
||||
return platform;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user