@Test public void getLimitString() { Assert.assertEquals("select top 0 * from user", dialect.getLimitString("select * from user", 0, 0)); Assert.assertEquals("select top 12 * from user", dialect.getLimitString("select * from user", 0, 12)); Assert.assertEquals("select limit 12 0 * from user", dialect.getLimitString("select * from user", 12, 0)); Assert.assertEquals("select limit 12 34 * from user", dialect.getLimitString("select * from user", 12, 34)); }
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);  }