HHH-11509 - Infomix limit handler support for offset
This commit is contained in:
parent
05a13b8b27
commit
51d9bbfc7c
|
@ -0,0 +1,16 @@
|
|||
package org.hibernate.dialect;
|
||||
|
||||
import org.hibernate.dialect.pagination.InformixLimitHandler;
|
||||
import org.hibernate.dialect.pagination.LimitHandler;
|
||||
|
||||
/**
|
||||
* Since version 10.00.xC3 Informix has limit/offset support which was introduced in July 2005.
|
||||
*/
|
||||
public class Informix10Dialect extends InformixDialect {
|
||||
|
||||
@Override
|
||||
public LimitHandler getLimitHandler() {
|
||||
return new InformixLimitHandler();
|
||||
}
|
||||
|
||||
}
|
|
@ -16,15 +16,11 @@ import org.hibernate.dialect.function.SQLFunctionTemplate;
|
|||
import org.hibernate.dialect.function.VarArgsSQLFunction;
|
||||
import org.hibernate.dialect.identity.IdentityColumnSupport;
|
||||
import org.hibernate.dialect.identity.InformixIdentityColumnSupport;
|
||||
import org.hibernate.dialect.pagination.AbstractLimitHandler;
|
||||
import org.hibernate.dialect.pagination.FirstLimitHandler;
|
||||
import org.hibernate.dialect.pagination.InformixLimitHandler;
|
||||
import org.hibernate.dialect.pagination.LegacyFirstLimitHandler;
|
||||
import org.hibernate.dialect.pagination.LimitHandler;
|
||||
import org.hibernate.dialect.pagination.LimitHelper;
|
||||
import org.hibernate.dialect.unique.InformixUniqueDelegate;
|
||||
import org.hibernate.dialect.unique.UniqueDelegate;
|
||||
import org.hibernate.engine.spi.RowSelection;
|
||||
import org.hibernate.exception.spi.TemplatedViolatedConstraintNameExtracter;
|
||||
import org.hibernate.exception.spi.ViolatedConstraintNameExtracter;
|
||||
import org.hibernate.hql.spi.id.IdTableSupportStandardImpl;
|
||||
|
@ -183,9 +179,12 @@ public class InformixDialect extends Dialect {
|
|||
|
||||
@Override
|
||||
public LimitHandler getLimitHandler() {
|
||||
return new InformixLimitHandler();
|
||||
if ( isLegacyLimitHandlerBehaviorEnabled() ) {
|
||||
return LegacyFirstLimitHandler.INSTANCE;
|
||||
}
|
||||
return FirstLimitHandler.INSTANCE;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean supportsLimit() {
|
||||
return true;
|
||||
|
@ -201,6 +200,17 @@ public class InformixDialect extends Dialect {
|
|||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getLimitString(String querySelect, int offset, int limit) {
|
||||
if ( offset > 0 ) {
|
||||
throw new UnsupportedOperationException( "query result offset is not supported" );
|
||||
}
|
||||
return new StringBuilder( querySelect.length() + 8 )
|
||||
.append( querySelect )
|
||||
.insert( querySelect.toLowerCase(Locale.ROOT).indexOf( "select" ) + 6, " first " + limit )
|
||||
.toString();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean supportsVariableLimit() {
|
||||
return false;
|
||||
|
|
Loading…
Reference in New Issue