All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.ebean.config.dbplatform.BasicSqlAnsiLimiter Maven / Gradle / Ivy

There is a newer version: 15.8.0
Show newest version
package io.ebean.config.dbplatform;

/**
 * Adds ANSI based OFFSET FETCH NEXT clauses to a SQL query.
 */
public class BasicSqlAnsiLimiter implements BasicSqlLimiter {

  @Override
  public String limit(String dbSql, int firstRow, int maxRows) {
    StringBuilder sb = new StringBuilder(50 + dbSql.length());
    sb.append(dbSql);
    if (firstRow > 0) {
      sb.append(" offset ").append(firstRow).append(" rows");
    }
    if (maxRows > 0) {
      sb.append(" fetch next ").append(maxRows).append(" rows only");
    }
    return sb.toString();
  }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy