Cleanup: Remove some unnecessary preprocessor whitespace
This commit is contained in:
parent
3933ad94ee
commit
eaadafa8bf
@ -591,7 +591,7 @@ public interface AlterTableStep {
|
||||
* Add a <code>DROP PRIMARY KEY</code> clause to the <code>ALTER TABLE</code>
|
||||
* statement.
|
||||
*/
|
||||
@Support({ H2, HSQLDB, MARIADB, MYSQL })
|
||||
@Support({ H2, HSQLDB, MARIADB, MYSQL })
|
||||
AlterTableFinalStep dropPrimaryKey();
|
||||
|
||||
/**
|
||||
|
||||
@ -1599,7 +1599,7 @@ abstract class AbstractResultQuery<R extends Record> extends AbstractQuery imple
|
||||
private final boolean hasLimit1() {
|
||||
if (this instanceof SelectQueryImpl) {
|
||||
Limit l = ((SelectQueryImpl) this).getLimit();
|
||||
return !l.withTies() && l.limitOne();
|
||||
return !l.withTies() && l.limitOne();
|
||||
}
|
||||
|
||||
return false;
|
||||
|
||||
@ -352,7 +352,7 @@ public abstract class AbstractRoutine<T> extends AbstractNamed implements Routin
|
||||
// [#4254] In PostgreSQL, there are only functions, no procedures. Some
|
||||
// functions cannot be called using a CallableStatement, e.g. those with
|
||||
// DEFAULT parameters
|
||||
if ( family == POSTGRES) {
|
||||
if ( family == POSTGRES) {
|
||||
return executeSelectFromPOSTGRES();
|
||||
}
|
||||
|
||||
@ -1788,7 +1788,7 @@ public abstract class AbstractRoutine<T> extends AbstractNamed implements Routin
|
||||
continue;
|
||||
|
||||
// Disambiguate overloaded function signatures
|
||||
if ( family == POSTGRES)
|
||||
if ( family == POSTGRES)
|
||||
|
||||
// [#4920] In case there are any unnamed parameters, we mustn't
|
||||
if (hasUnnamedParameters())
|
||||
|
||||
@ -900,7 +900,7 @@ final class AlterTableImpl extends AbstractRowCountQuery implements
|
||||
(renameConstraint != null && family == HSQLDB)
|
||||
|| (renameColumn != null && SUPPORT_RENAME_COLUMN.contains(family));
|
||||
boolean renameTable = renameTo != null && SUPPORT_RENAME_TABLE.contains(family);
|
||||
boolean renameObject = renameTo != null && (false );
|
||||
boolean renameObject = renameTo != null && (false);
|
||||
|
||||
if (!omitAlterTable) {
|
||||
ctx.start(ALTER_TABLE_TABLE)
|
||||
@ -1041,7 +1041,7 @@ final class AlterTableImpl extends AbstractRowCountQuery implements
|
||||
.qualify(qualify);
|
||||
else
|
||||
ctx.qualify(false)
|
||||
.visit( K_RENAME_CONSTRAINT).sql(' ')
|
||||
.visit( K_RENAME_CONSTRAINT).sql(' ')
|
||||
.visit(renameConstraint)
|
||||
.formatSeparator()
|
||||
.visit(K_TO).sql(' ')
|
||||
@ -1053,8 +1053,8 @@ final class AlterTableImpl extends AbstractRowCountQuery implements
|
||||
}
|
||||
else if (add != null) {
|
||||
boolean multiAdd = REQUIRE_REPEAT_ADD_ON_MULTI_ALTER.contains(ctx.family());
|
||||
boolean parens = !multiAdd ;
|
||||
boolean comma = true ;
|
||||
boolean parens = !multiAdd;
|
||||
boolean comma = true;
|
||||
|
||||
ctx.start(ALTER_TABLE_ADD)
|
||||
.visit(K_ADD)
|
||||
|
||||
@ -92,7 +92,7 @@ final class Array<T> extends AbstractField<T[]> {
|
||||
.visit(fields)
|
||||
.sql(']');
|
||||
|
||||
if (fields.fields.length == 0 && ( ctx.family() == POSTGRES))
|
||||
if (fields.fields.length == 0 && ( ctx.family() == POSTGRES))
|
||||
ctx.sql("::").visit(K_INT).sql("[]");
|
||||
|
||||
break;
|
||||
|
||||
@ -188,7 +188,7 @@ implements
|
||||
else {
|
||||
boolean qualify = ctx.qualify();
|
||||
|
||||
if (getQualifiedName() != AbstractName.NO_NAME ) {
|
||||
if (getQualifiedName() != AbstractName.NO_NAME) {
|
||||
ctx.visit(K_CONSTRAINT)
|
||||
.sql(' ')
|
||||
.visit(getUnqualifiedName())
|
||||
|
||||
@ -276,7 +276,7 @@ final class CreateIndexImpl extends AbstractRowCountQuery implements
|
||||
|
||||
|
||||
;
|
||||
boolean supportsFieldsBeforeTable = false ;
|
||||
boolean supportsFieldsBeforeTable = false;
|
||||
|
||||
QueryPartList<QueryPart> list = new QueryPartList<>();
|
||||
if (fields != null)
|
||||
|
||||
@ -215,8 +215,8 @@ final class CreateViewImpl<R extends Record> extends AbstractRowCountQuery imple
|
||||
|
||||
// [#2059] MemSQL doesn't support column aliases at the view level
|
||||
boolean rename = f != null && f.length > 0;
|
||||
boolean renameSupported = true ;
|
||||
boolean replaceSupported = false ;
|
||||
boolean renameSupported = true;
|
||||
boolean replaceSupported = false;
|
||||
|
||||
|
||||
|
||||
|
||||
@ -680,7 +680,7 @@ public class DefaultBinding<T, U> implements Binding<T, U> {
|
||||
// [#1130] TODO type can be null for ARRAY types, etc.
|
||||
// [#7351] UUID data types need to be cast too
|
||||
// [#7242] JSON(B) data types need to be cast too
|
||||
else if (( POSTGRES == family) &&
|
||||
else if (( POSTGRES == family) &&
|
||||
(sqlDataType == null ||
|
||||
(!sqlDataType.isTemporal()
|
||||
&& sqlDataType != SQLDataType.UUID
|
||||
@ -700,7 +700,7 @@ public class DefaultBinding<T, U> implements Binding<T, U> {
|
||||
|
||||
|
||||
// [#7379] Most databases cannot cast a bind variable to an enum type
|
||||
else if ( POSTGRES != family && EnumType.class.isAssignableFrom(type))
|
||||
else if ( POSTGRES != family && EnumType.class.isAssignableFrom(type))
|
||||
sqlCast(ctx, converted, Tools.emulateEnumType((DataType<EnumType>) dataType), dataType.length(), dataType.precision(), dataType.scale());
|
||||
|
||||
// In all other cases, the bind variable can be cast normally
|
||||
@ -987,7 +987,7 @@ public class DefaultBinding<T, U> implements Binding<T, U> {
|
||||
ctx.render().sql(')');
|
||||
}
|
||||
|
||||
else if ( ctx.family() == POSTGRES) {
|
||||
else if ( ctx.family() == POSTGRES) {
|
||||
|
||||
// [#8933] In some cases, we cannot derive the cast type from
|
||||
// array type directly
|
||||
@ -1013,7 +1013,7 @@ public class DefaultBinding<T, U> implements Binding<T, U> {
|
||||
ctx.render().sql(']');
|
||||
|
||||
// [#3214] Some PostgreSQL array type literals need explicit casting
|
||||
if (( ctx.family() == POSTGRES) && EnumType.class.isAssignableFrom(type.getComponentType()))
|
||||
if (( ctx.family() == POSTGRES) && EnumType.class.isAssignableFrom(type.getComponentType()))
|
||||
DefaultEnumTypeBinding.pgRenderEnumCast(ctx.render(), type);
|
||||
}
|
||||
}
|
||||
@ -1783,7 +1783,7 @@ public class DefaultBinding<T, U> implements Binding<T, U> {
|
||||
|
||||
|
||||
|
||||
else if ( ctx.family() == POSTGRES)
|
||||
else if ( ctx.family() == POSTGRES)
|
||||
ctx.render()
|
||||
.sql("E'")
|
||||
.sql(PostgresUtils.toPGString(value))
|
||||
@ -2122,7 +2122,7 @@ public class DefaultBinding<T, U> implements Binding<T, U> {
|
||||
final void set0(BindingSetStatementContext<U> ctx, DayToSecond value) throws SQLException {
|
||||
|
||||
// [#566] Interval data types are best bound as Strings
|
||||
if ( ctx.family() == POSTGRES)
|
||||
if ( ctx.family() == POSTGRES)
|
||||
ctx.statement().setObject(ctx.index(), toPGInterval(value));
|
||||
else
|
||||
ctx.statement().setString(ctx.index(), value.toString());
|
||||
@ -2135,7 +2135,7 @@ public class DefaultBinding<T, U> implements Binding<T, U> {
|
||||
|
||||
@Override
|
||||
final DayToSecond get0(BindingGetResultSetContext<U> ctx) throws SQLException {
|
||||
if ( ctx.family() == POSTGRES) {
|
||||
if ( ctx.family() == POSTGRES) {
|
||||
Object object = ctx.resultSet().getObject(ctx.index());
|
||||
return object == null ? null : PostgresUtils.toDayToSecond(object);
|
||||
}
|
||||
@ -2147,7 +2147,7 @@ public class DefaultBinding<T, U> implements Binding<T, U> {
|
||||
|
||||
@Override
|
||||
final DayToSecond get0(BindingGetStatementContext<U> ctx) throws SQLException {
|
||||
if ( ctx.family() == POSTGRES) {
|
||||
if ( ctx.family() == POSTGRES) {
|
||||
Object object = ctx.statement().getObject(ctx.index());
|
||||
return object == null ? null : PostgresUtils.toDayToSecond(object);
|
||||
}
|
||||
@ -2185,7 +2185,7 @@ public class DefaultBinding<T, U> implements Binding<T, U> {
|
||||
|
||||
// [#5249] [#6912] [#8063] Special inlining of special floating point values
|
||||
if (value.isNaN())
|
||||
if ( ctx.family() == POSTGRES)
|
||||
if ( ctx.family() == POSTGRES)
|
||||
ctx.render().visit(inline("NaN")).sql("::float8");
|
||||
else if (ctx.family() == HSQLDB)
|
||||
ctx.render().visit(sqrt(inline(-1)));
|
||||
@ -2262,7 +2262,7 @@ public class DefaultBinding<T, U> implements Binding<T, U> {
|
||||
super.sqlBind0(ctx, value);
|
||||
|
||||
// Postgres needs explicit casting for enum (array) types
|
||||
if ( ctx.family() == POSTGRES)
|
||||
if ( ctx.family() == POSTGRES)
|
||||
pgRenderEnumCast(ctx.render(), type);
|
||||
}
|
||||
|
||||
@ -2358,7 +2358,7 @@ public class DefaultBinding<T, U> implements Binding<T, U> {
|
||||
|
||||
// [#5249] [#6912] [#8063] Special inlining of special floating point values
|
||||
if (value.isNaN())
|
||||
if ( ctx.family() == POSTGRES)
|
||||
if ( ctx.family() == POSTGRES)
|
||||
ctx.render().visit(inline("NaN")).sql("::float4");
|
||||
else if (ctx.family() == HSQLDB)
|
||||
ctx.render().visit(sqrt(inline(-1)));
|
||||
@ -3171,13 +3171,13 @@ public class DefaultBinding<T, U> implements Binding<T, U> {
|
||||
void sqlBind0(BindingSQLContext<U> ctx, Record value) throws SQLException {
|
||||
super.sqlBind0(ctx, value);
|
||||
|
||||
if (( ctx.family() == POSTGRES) && value != null)
|
||||
if (( ctx.family() == POSTGRES) && value != null)
|
||||
pgRenderRecordCast(ctx.render(), value);
|
||||
}
|
||||
|
||||
@Override
|
||||
final void sqlInline0(BindingSQLContext<U> ctx, Record value) throws SQLException {
|
||||
if ( ctx.family() == POSTGRES) {
|
||||
if ( ctx.family() == POSTGRES) {
|
||||
ctx.render().visit(inline(PostgresUtils.toPGString(value)));
|
||||
pgRenderRecordCast(ctx.render(), value);
|
||||
}
|
||||
@ -3200,7 +3200,7 @@ public class DefaultBinding<T, U> implements Binding<T, U> {
|
||||
|
||||
@Override
|
||||
final void set0(BindingSetStatementContext<U> ctx, Record value) throws SQLException {
|
||||
if (( ctx.family() == POSTGRES) && value != null)
|
||||
if (( ctx.family() == POSTGRES) && value != null)
|
||||
ctx.statement().setString(ctx.index(), PostgresUtils.toPGString(value));
|
||||
else
|
||||
ctx.statement().setObject(ctx.index(), value);
|
||||
|
||||
@ -859,7 +859,7 @@ public class DefaultDataType<T> implements DataType<T> {
|
||||
result = TYPES_BY_NAME[SQLDialect.DEFAULT.ordinal()].get(normalised);
|
||||
|
||||
// [#4065] PostgreSQL reports array types as _typename, e.g. _varchar
|
||||
if (result == null && ( family == POSTGRES) && normalised.charAt(0) == '_')
|
||||
if (result == null && ( family == POSTGRES) && normalised.charAt(0) == '_')
|
||||
result = getDataType(dialect, normalised.substring(1)).getArrayDataType();
|
||||
|
||||
// [#6466] HSQLDB reports array types as XYZARRAY
|
||||
|
||||
@ -202,7 +202,7 @@ final class DeleteQueryImpl<R extends Record> extends AbstractDMLQuery<R> implem
|
||||
|
||||
|
||||
// [#2059] MemSQL does not support DELETE ... ORDER BY
|
||||
if (limit != null && NO_SUPPORT_LIMIT.contains(ctx.family()) ) {
|
||||
if (limit != null && NO_SUPPORT_LIMIT.contains(ctx.family())) {
|
||||
Field<?>[] keyFields =
|
||||
table().getKeys().isEmpty()
|
||||
? new Field[] { table().rowid() }
|
||||
|
||||
@ -111,7 +111,7 @@ final class FieldMapsForInsert extends AbstractQueryPart {
|
||||
|
||||
|
||||
|
||||
else if (rows == 1 ) {
|
||||
else if (rows == 1) {
|
||||
ctx.formatSeparator()
|
||||
.start(INSERT_VALUES)
|
||||
.visit(K_VALUES)
|
||||
@ -245,9 +245,9 @@ final class FieldMapsForInsert extends AbstractQueryPart {
|
||||
|
||||
final void toSQL92Values(Context<?> ctx, boolean emulateBulkInsertReturning) {
|
||||
boolean indent = (values.size() > 1);
|
||||
boolean castFirstRowNumericValues = false ;
|
||||
boolean castFirstRowNumericValues = false;
|
||||
|
||||
for (int row = 0; row < rows ; row++) {
|
||||
for (int row = 0; row < rows; row++) {
|
||||
if (row > 0)
|
||||
ctx.sql(", ");
|
||||
|
||||
|
||||
@ -246,10 +246,10 @@ class Function<T> extends AbstractField<T> implements
|
||||
|
||||
|
||||
|
||||
else if (term == MODE && ( ctx.family() == H2 || ctx.family() == POSTGRES)) {
|
||||
else if (term == MODE && ( ctx.family() == H2 || ctx.family() == POSTGRES)) {
|
||||
ctx.visit(mode().withinGroupOrderBy(DSL.field("{0}", arguments.get(0))));
|
||||
}
|
||||
else if (term == MEDIAN && ( ctx.family() == POSTGRES)) {
|
||||
else if (term == MEDIAN && ( ctx.family() == POSTGRES)) {
|
||||
Field<?>[] fields = new Field[arguments.size()];
|
||||
for (int i = 0; i < fields.length; i++)
|
||||
fields[i] = DSL.field("{0}", arguments.get(i));
|
||||
@ -572,7 +572,7 @@ class Function<T> extends AbstractField<T> implements
|
||||
ctx.visit(K_DISTINCT);
|
||||
|
||||
// [#2883] PostgreSQL can use the DISTINCT keyword with formal row value expressions.
|
||||
if (( ctx.family() == POSTGRES) && args.size() > 1)
|
||||
if (( ctx.family() == POSTGRES) && args.size() > 1)
|
||||
ctx.sql('(');
|
||||
else
|
||||
ctx.sql(' ');
|
||||
@ -593,7 +593,7 @@ class Function<T> extends AbstractField<T> implements
|
||||
}
|
||||
|
||||
if (distinct)
|
||||
if (( ctx.family() == POSTGRES) && args.size() > 1)
|
||||
if (( ctx.family() == POSTGRES) && args.size() > 1)
|
||||
ctx.sql(')');
|
||||
|
||||
if (ctx.family() != H2) {
|
||||
|
||||
@ -315,7 +315,7 @@ final class Limit extends AbstractQueryPart {
|
||||
private final void acceptStandard(Context<?> ctx, CastMode castMode) {
|
||||
ctx.castMode(NEVER);
|
||||
|
||||
if ( !offsetZero())
|
||||
if ( !offsetZero())
|
||||
ctx.formatSeparator()
|
||||
.visit(K_OFFSET)
|
||||
.sql(' ').visit(offsetOrZero)
|
||||
|
||||
@ -1510,7 +1510,7 @@ implements
|
||||
|
||||
|
||||
|
||||
boolean onParentheses = false ;
|
||||
boolean onParentheses = false;
|
||||
ctx.end(MERGE_USING)
|
||||
.formatSeparator()
|
||||
.start(MERGE_ON)
|
||||
|
||||
@ -10543,7 +10543,7 @@ final class ParserImpl implements Parser {
|
||||
}
|
||||
|
||||
final class ParserContext {
|
||||
private static final boolean PRO_EDITION = false ;
|
||||
private static final boolean PRO_EDITION = false;
|
||||
|
||||
final DSLContext dsl;
|
||||
final Meta meta;
|
||||
|
||||
@ -2288,7 +2288,7 @@ final class Tools {
|
||||
|
||||
// [#6704] PostgreSQL supports additional quoted string literals, which we must skip: E'...'
|
||||
else if ((sqlChars[i] == 'e' || sqlChars[i] == 'E')
|
||||
&& ( ctx.family() == POSTGRES)
|
||||
&& ( ctx.family() == POSTGRES)
|
||||
&& i + 1 < sqlChars.length
|
||||
&& sqlChars[i + 1] == '\'') {
|
||||
|
||||
|
||||
@ -201,7 +201,7 @@ public class UDTImpl<R extends UDTRecord<R>> extends AbstractNamed implements UD
|
||||
|
||||
@Override
|
||||
public final boolean isSQLUsable() {
|
||||
return true ;
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@ -585,7 +585,7 @@ final class UpdateQueryImpl<R extends Record> extends AbstractStoreQuery<R> impl
|
||||
|
||||
// [#6763] Incompatible change in PostgreSQL 10 requires ROW() constructor for
|
||||
// single-degree rows. Let's just always render it, here.
|
||||
if (ctx.family() == POSTGRES )
|
||||
if (ctx.family() == POSTGRES)
|
||||
ctx.visit(K_ROW).sql(" ");
|
||||
|
||||
ctx.visit(multiValue);
|
||||
@ -650,7 +650,7 @@ final class UpdateQueryImpl<R extends Record> extends AbstractStoreQuery<R> impl
|
||||
}
|
||||
|
||||
// [#2059] MemSQL does not support UPDATE ... ORDER BY
|
||||
if (limit != null && NO_SUPPORT_LIMIT.contains(ctx.family()) ) {
|
||||
if (limit != null && NO_SUPPORT_LIMIT.contains(ctx.family())) {
|
||||
Field<?>[] keyFields =
|
||||
table().getKeys().isEmpty()
|
||||
? new Field[] { table().rowid() }
|
||||
|
||||
Loading…
Reference in New Issue
Block a user