HHH-18180 Informix IF EXISTS clauses support

This commit is contained in:
Vladimír Kuruc 2024-05-29 12:31:06 +02:00 committed by Christian Beikov
parent f71a408df8
commit 8d01a705c1
2 changed files with 27 additions and 2 deletions

View File

@ -93,6 +93,7 @@ public class InformixDialect extends Dialect {
private final UniqueDelegate uniqueDelegate;
private final LimitHandler limitHandler;
private final SequenceSupport sequenceSupport;
private final StandardForeignKeyExporter foreignKeyExporter = new StandardForeignKeyExporter( this ) {
@Override
public String[] getSqlCreateStrings(
@ -137,6 +138,7 @@ public class InformixDialect extends Dialect {
//version 11 and above, parameters are supported
//but I have not tested this at all!
: new SkipFirstLimitHandler( getVersion().isSameOrAfter( 11 ) );
sequenceSupport = new InformixSequenceSupport( getVersion().isSameOrAfter( 11, 70 ) );
}
@Override
@ -399,7 +401,7 @@ public class InformixDialect extends Dialect {
@Override
public SequenceSupport getSequenceSupport() {
return InformixSequenceSupport.INSTANCE;
return sequenceSupport;
}
@Override
@ -417,6 +419,21 @@ public class InformixDialect extends Dialect {
return limitHandler;
}
@Override
public boolean supportsIfExistsBeforeTableName() {
return getVersion().isSameOrAfter( 11, 70 );
}
@Override
public boolean supportsIfExistsBeforeTypeName() {
return getVersion().isSameOrAfter( 11, 70 );
}
@Override
public boolean supportsIfExistsBeforeConstraintName() {
return getVersion().isSameOrAfter( 11, 70 );
}
@Override
public boolean supportsOrderByInSubquery() {
// This is just a guess

View File

@ -16,11 +16,19 @@ import org.hibernate.dialect.sequence.SequenceSupport;
*/
public final class InformixSequenceSupport extends NextvalSequenceSupport {
public static final SequenceSupport INSTANCE = new InformixSequenceSupport();
private boolean supportsIfExists = false;
public InformixSequenceSupport(boolean supportsIfExists){
this.supportsIfExists = supportsIfExists;
}
@Override
public String getFromDual() {
return " from informix.systables where tabid=1";
}
@Override
public String getDropSequenceString(String sequenceName) {
return "drop sequence " + ( supportsIfExists ? "if exists " : "" ) + sequenceName;
}
}