Whitespace fix
This commit is contained in:
parent
d04c541e7a
commit
939724a693
@ -97,8 +97,8 @@ public class MySQLRoutineDefinition extends AbstractRoutineDefinition {
|
||||
|
||||
private void init55() {
|
||||
|
||||
// [#742] In MySQL 5.5 and later, the INFORMATION_SCHEMA.PARAMETERS
|
||||
// table is available, which is much more reliable than mysql.proc
|
||||
// [#742] In MySQL 5.5 and later, the INFORMATION_SCHEMA.PARAMETERS
|
||||
// table is available, which is much more reliable than mysql.proc
|
||||
for (Record record : create()
|
||||
.select(
|
||||
Parameters.ORDINAL_POSITION,
|
||||
@ -158,9 +158,9 @@ public class MySQLRoutineDefinition extends AbstractRoutineDefinition {
|
||||
private void init54() {
|
||||
|
||||
// [#742] Before MySQL 5.5, the INFORMATION_SCHEMA.PARAMETERS table was
|
||||
// not yet available. Resort to mysql.proc and regex-pattern matching.
|
||||
// not yet available. Resort to mysql.proc and regex-pattern matching.
|
||||
|
||||
// [#738] Avoid matching commas that appear in types, for instance DECIMAL(2, 1)
|
||||
// [#738] Avoid matching commas that appear in types, for instance DECIMAL(2, 1)
|
||||
String[] split = params.split(",(?!\\s*\\d+\\s*\\))");
|
||||
|
||||
Matcher matcher = TYPE_PATTERN.matcher(returns);
|
||||
@ -216,7 +216,7 @@ public class MySQLRoutineDefinition extends AbstractRoutineDefinition {
|
||||
|
||||
private boolean is55() {
|
||||
|
||||
// Check if this is a MySQL 5.5 or later database
|
||||
// Check if this is a MySQL 5.5 or later database
|
||||
if (is55 == null) {
|
||||
try {
|
||||
create().selectOne().from(PARAMETERS).limit(1).fetchOne();
|
||||
|
||||
@ -67,39 +67,39 @@ public class MySQLTableDefinition extends AbstractTableDefinition {
|
||||
|
||||
public MySQLTableDefinition(SchemaDefinition schema, String name, String comment) {
|
||||
super(schema, name, comment);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ColumnDefinition> getElements0() throws SQLException {
|
||||
List<ColumnDefinition> result = new ArrayList<ColumnDefinition>();
|
||||
@Override
|
||||
public List<ColumnDefinition> getElements0() throws SQLException {
|
||||
List<ColumnDefinition> result = new ArrayList<ColumnDefinition>();
|
||||
|
||||
for (Record record : create().select(
|
||||
Columns.ORDINAL_POSITION,
|
||||
Columns.COLUMN_NAME,
|
||||
Columns.COLUMN_COMMENT,
|
||||
Columns.COLUMN_TYPE,
|
||||
Columns.DATA_TYPE,
|
||||
Columns.IS_NULLABLE,
|
||||
Columns.COLUMN_DEFAULT,
|
||||
Columns.CHARACTER_MAXIMUM_LENGTH,
|
||||
Columns.NUMERIC_PRECISION,
|
||||
Columns.NUMERIC_SCALE,
|
||||
Columns.EXTRA)
|
||||
.from(COLUMNS)
|
||||
.where(TABLE_SCHEMA.equal(getSchema().getName()))
|
||||
.and(TABLE_NAME.equal(getName()))
|
||||
.orderBy(ORDINAL_POSITION)) {
|
||||
for (Record record : create().select(
|
||||
Columns.ORDINAL_POSITION,
|
||||
Columns.COLUMN_NAME,
|
||||
Columns.COLUMN_COMMENT,
|
||||
Columns.COLUMN_TYPE,
|
||||
Columns.DATA_TYPE,
|
||||
Columns.IS_NULLABLE,
|
||||
Columns.COLUMN_DEFAULT,
|
||||
Columns.CHARACTER_MAXIMUM_LENGTH,
|
||||
Columns.NUMERIC_PRECISION,
|
||||
Columns.NUMERIC_SCALE,
|
||||
Columns.EXTRA)
|
||||
.from(COLUMNS)
|
||||
.where(TABLE_SCHEMA.equal(getSchema().getName()))
|
||||
.and(TABLE_NAME.equal(getName()))
|
||||
.orderBy(ORDINAL_POSITION)) {
|
||||
|
||||
String dataType = record.get(Columns.DATA_TYPE);
|
||||
String dataType = record.get(Columns.DATA_TYPE);
|
||||
|
||||
// [#519] Some types have unsigned versions
|
||||
if (getDatabase().supportsUnsignedTypes()) {
|
||||
if (asList("tinyint", "smallint", "mediumint", "int", "bigint").contains(dataType.toLowerCase())) {
|
||||
if (record.get(Columns.COLUMN_TYPE).toLowerCase().contains("unsigned")) {
|
||||
dataType += "unsigned";
|
||||
}
|
||||
}
|
||||
}
|
||||
// [#519] Some types have unsigned versions
|
||||
if (getDatabase().supportsUnsignedTypes()) {
|
||||
if (asList("tinyint", "smallint", "mediumint", "int", "bigint").contains(dataType.toLowerCase())) {
|
||||
if (record.get(Columns.COLUMN_TYPE).toLowerCase().contains("unsigned")) {
|
||||
dataType += "unsigned";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
DataTypeDefinition type = new DefaultDataTypeDefinition(
|
||||
getDatabase(),
|
||||
@ -113,18 +113,18 @@ public class MySQLTableDefinition extends AbstractTableDefinition {
|
||||
getName() + "_" + record.get(Columns.COLUMN_NAME)
|
||||
);
|
||||
|
||||
ColumnDefinition column = new DefaultColumnDefinition(
|
||||
getDatabase().getTable(getSchema(), getName()),
|
||||
record.get(Columns.COLUMN_NAME),
|
||||
record.get(Columns.ORDINAL_POSITION, int.class),
|
||||
type,
|
||||
"auto_increment".equalsIgnoreCase(record.get(Columns.EXTRA)),
|
||||
record.get(Columns.COLUMN_COMMENT)
|
||||
);
|
||||
ColumnDefinition column = new DefaultColumnDefinition(
|
||||
getDatabase().getTable(getSchema(), getName()),
|
||||
record.get(Columns.COLUMN_NAME),
|
||||
record.get(Columns.ORDINAL_POSITION, int.class),
|
||||
type,
|
||||
"auto_increment".equalsIgnoreCase(record.get(Columns.EXTRA)),
|
||||
record.get(Columns.COLUMN_COMMENT)
|
||||
);
|
||||
|
||||
result.add(column);
|
||||
}
|
||||
result.add(column);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user