@Test public void getLimitStringWithPlaceHolader() { String OFFSET = ":offset"; String LIMIT = ":limit"; Assert.assertEquals("select top :limit * from user", dialect.getLimitString("select * from user", 0,OFFSET, 0,LIMIT)); Assert.assertEquals("select top :limit * from user", dialect.getLimitString("select * from user", 0,OFFSET,12,LIMIT)); Assert.assertEquals("select limit :offset :limit * from user", dialect.getLimitString("select * from user", 12, OFFSET,0,LIMIT)); Assert.assertEquals("select limit :offset :limit * from user", dialect.getLimitString("select * from user", 12,OFFSET, 34,LIMIT)); }
public String getLimitString(String sql, int offset,String offsetPlaceholder, int limit, String limitPlaceholder) { boolean hasOffset = offset>0; return new StringBuffer( sql.length() + 10 ) .append( sql ) .insert( sql.toLowerCase().indexOf( "select" ) + 6, hasOffset ? " limit "+offsetPlaceholder+" "+limitPlaceholder : " top "+limitPlaceholder ) .toString(); }
HSQLDialect extends Dialect { public String getLimitString(String sql, int offset,String offsetPlaceholder, int limit, String limitPlaceholder) { boolean hasOffset = offset>0; return new StringBuffer( sql.length() + 10 ) .append( sql ) .insert( sql.toLowerCase().indexOf( "select" ) + 6, hasOffset ? " limit "+offsetPlaceholder+" "+limitPlaceholder : " top "+limitPlaceholder ) .toString(); } }
HSQLDialect extends Dialect { public String getLimitString(String sql, int offset,String offsetPlaceholder, int limit, String limitPlaceholder) { boolean hasOffset = offset>0; return new StringBuffer( sql.length() + 10 ) .append( sql ) .insert( sql.toLowerCase().indexOf( "select" ) + 6, hasOffset ? " limit "+offsetPlaceholder+" "+limitPlaceholder : " top "+limitPlaceholder ) .toString(); }  }
HSQLDialect extends Dialect { public String getLimitString(String sql, int offset,String offsetPlaceholder, int limit, String limitPlaceholder) { boolean hasOffset = offset>0; return new StringBuffer( sql.length() + 10 ) .append( sql ) .insert( sql.toLowerCase().indexOf( "select" ) + 6, hasOffset ? " limit "+offsetPlaceholder+" "+limitPlaceholder : " top "+limitPlaceholder ) .toString(); }  boolean supportsLimit(); boolean supportsLimitOffset(); String getLimitString(String sql, int offset,String offsetPlaceholder, int limit, String limitPlaceholder); }
HSQLDialect extends Dialect { public String getLimitString(String sql, int offset,String offsetPlaceholder, int limit, String limitPlaceholder) { boolean hasOffset = offset>0; return new StringBuffer( sql.length() + 10 ) .append( sql ) .insert( sql.toLowerCase().indexOf( "select" ) + 6, hasOffset ? " limit "+offsetPlaceholder+" "+limitPlaceholder : " top "+limitPlaceholder ) .toString(); }  boolean supportsLimit(); boolean supportsLimitOffset(); String getLimitString(String sql, int offset,String offsetPlaceholder, int limit, String limitPlaceholder);  }