Package org.nutz.dao.pager

Examples of org.nutz.dao.pager.Pager


        if (null != pager && pager.getPageNumber() > 0)
            pojo.append(Pojos.Items.wrapf(" OFFSET %d ROWS FETCH NEXT %d ROW ONLY", pager.getOffset(), pager.getPageSize()));
    }
   
    public void formatQuery(Sql sql) {
        Pager pager = sql.getContext().getPager();
        // 需要进行分页
        if (null != pager && pager.getPageNumber() > 0)
            sql.setSourceSql(sql.getSourceSql() + String.format(" OFFSET %d ROWS FETCH NEXT %d ROW ONLY", pager.getOffset(), pager.getPageSize()));
    }
View Full Code Here


    public String getDatabaseType() {
        return DB.PSQL.name();
    }

    public void formatQuery(Pojo pojo) {
        Pager pager = pojo.getContext().getPager();
        // 需要进行分页
        if (null != pager && pager.getPageNumber() > 0)
            pojo.append(Pojos.Items.wrapf(    " LIMIT %d OFFSET %d",
                                            pager.getPageSize(),
                                            pager.getOffset()));
    }
View Full Code Here

                                            pager.getPageSize(),
                                            pager.getOffset()));
    }
   
    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()));
        }
    }
View Full Code Here

    public String getDatabaseType() {
        return DB.MYSQL.name();
    }

    public void formatQuery(Pojo pojo) {
        Pager pager = pojo.getContext().getPager();
        // 需要进行分页
        if (null != pager && pager.getPageNumber() > 0)
            pojo.append(Pojos.Items.wrapf(" LIMIT %d, %d",
                                          pager.getOffset(),
                                          pager.getPageSize()));
    }
View Full Code Here

                                          pager.getOffset(),
                                          pager.getPageSize()));
    }

    public void formatQuery(Sql sql) {
        Pager pager = sql.getContext().getPager();
        // 需要进行分页
        if (null != pager && pager.getPageNumber() > 0)
            sql.setSourceSql(sql.getSourceSql()
                             + String.format(" LIMIT %d, %d",
                                             pager.getOffset(),
                                             pager.getPageSize()));
    }
View Full Code Here

        }
        return super.evalFieldType(mf);
    }

    public void formatQuery(Pojo pojo) {
        Pager pager = pojo.getContext().getPager();
        if (null != pager && pager.getPageNumber() > 0) {
            // -----------------------------------------------------
            // TODO XXX 这个写法灰常暴力!!But , it works!!!! 期待更好的写法
            PItem pi = pojo.getItem(0);
            StringBuilder sb = new StringBuilder();
            pi.joinSql(pojo.getEntity(), sb);
            String str = sb.toString();
            if (str.trim().toLowerCase().startsWith("select")) {
                pojo.setItem(0, Pojos.Items.wrap(str.substring(6)));
            } else
                return;// 以免出错.
            pojo.insertFirst(Pojos.Items.wrapf(    "select * from(select row_number()over(order by __tc__)__rn__,* from(select top %d 0 __tc__, ",
                                                pager.getOffset() + pager.getPageSize()));
            pojo.append(Pojos.Items.wrapf(")t)tt where __rn__ > %d order by __rn__", pager.getOffset()));
        }
    }
View Full Code Here

        }
    }
   
    @Override
    public void formatQuery(Sql sql) {
        Pager pager = sql.getContext().getPager();
        // 需要进行分页
        if (null != pager && pager.getPageNumber() > 0) {
            // -----------------------------------------------------
            // TODO XXX 这个写法灰常暴力!!But , it works!!!! 期待更好的写法
            if (!sql.getSourceSql().toUpperCase().startsWith("SELECT "))
                return;// 以免出错.
            String xSql = sql.getSourceSql().substring(6);
            String pre = String.format(    "select * from(select row_number()over(order by __tc__)__rn__,* from(select top %d 0 __tc__, ",
                                                            pager.getOffset() + pager.getPageSize());
            String last = String.format(")t)tt where __rn__ > %d", pager.getOffset());
            sql.setSourceSql(pre + xSql + last);
        }
    }
View Full Code Here

  public String getDatabaseType() {
    return DB.GBASE.name();
  }

  public void formatQuery(Pojo pojo) {
    Pager pager = pojo.getContext().getPager();
    // 需要进行分页
    if (null != pager && pager.getPageNumber() > 0)
      pojo.append(Pojos.Items.wrapf(" LIMIT %d, %d", pager.getOffset(), pager.getPageSize()));
  }
View Full Code Here

    if (null != pager && pager.getPageNumber() > 0)
      pojo.append(Pojos.Items.wrapf(" LIMIT %d, %d", pager.getOffset(), pager.getPageSize()));
  }

  public void formatQuery(Sql sql) {
    Pager pager = sql.getContext().getPager();
    // 需要进行分页
    if (null != pager && pager.getPageNumber() > 0)
      sql.setSourceSql(sql.getSourceSql()
                + String.format(" LIMIT %d, %d",
                        pager.getOffset(),
                        pager.getPageSize()));
  }
View Full Code Here

        }
        return super.evalFieldType(mf);
    }

    public void formatQuery(Pojo pojo) {
        Pager pager = pojo.getContext().getPager();
        if (null != pager && pager.getPageNumber() > 0) {
            // See http://hsqldb.org/doc/guide/ch09.html#select-section
            pojo.append(Pojos.Items.wrapf(    " LIMIT %d offset %d",
                                            pager.getPageSize(),
                                            pager.getOffset()));
        }
    }
View Full Code Here

TOP

Related Classes of org.nutz.dao.pager.Pager

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.