public Collect <Hashtable> page(int pagesize) { Db c = new Db(getName()); HashtableUtil.extend(true, c.mOption, mOption); // 总长度 long count = c.count(); Collect <Hashtable> result = new Collect <Hashtable>(count, pagesize); this.limit(result.firstRow, result.listRows); builder.setPage(true); selectCollect(result); builder.setPage(false); return(result); }
protected void selectCollect(Collect <Hashtable> collect) { if (collect == null) { throw new NullReferenceException("collect 列不能为Null"); } string sql = builder.buildSelect(); PDO pdo = new PDO(); ResultSet resultSet = pdo.query(sql); while (resultSet.hasNext()) { collect.Add(resultSet.fetch()); } resultSet.Dispose(); pdo.Dispose(); }