Example #1
0
 public void formatQuery(Sql sql) {
   Pager pager = sql.getContext().getPager();
   if (null != pager && pager.getPageNumber() > 0) {
     sql.setSourceSql(
         sql.getSourceSql()
             + String.format(" LIMIT %d OFFSET %d", pager.getPageSize(), pager.getOffset()));
   }
 }
Example #2
0
 public void formatQuery(Sql sql) {
   Pager pager = sql.getContext().getPager();
   if (null != pager && pager.getPageNumber() > 0) {
     String pre = "SELECT * FROM (SELECT ROW_NUMBER() OVER() AS ROWNUM, T.* FROM (";
     String last =
         String.format(
             ") T) AS A WHERE ROWNUM BETWEEN %d AND %d",
             pager.getOffset() + 1, pager.getOffset() + pager.getPageSize());
     sql.setSourceSql(pre + sql.getSourceSql() + last);
   }
 }