Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Field "total_rows" is handled as "long" instead of "int" #242

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions org.ektorp/src/main/java/org/ektorp/Page.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@

public class Page<T> implements Iterable<T> {

private final int totalSize;
private final long totalSize;
private final int pageSize;
private final PageRequest previousPageRequest;
private final PageRequest nextPageRequest;

private final List<T> rows;

public Page(List<T> rows, int totalSize, int pageSize, PageRequest previousPageRequest, PageRequest nextPageRequest) {
public Page(List<T> rows, long totalSize, int pageSize, PageRequest previousPageRequest, PageRequest nextPageRequest) {
this.rows = rows;
this.totalSize = totalSize;
this.pageSize = pageSize;
Expand Down Expand Up @@ -49,7 +49,7 @@ public boolean isHasPrevious() {
/**
* @return the total number of items across all pages
*/
public int getTotalSize() {
public long getTotalSize() {
return totalSize;
}
/**
Expand Down
6 changes: 3 additions & 3 deletions org.ektorp/src/main/java/org/ektorp/ViewResult.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public class ViewResult implements Iterable<ViewResult.Row>, Serializable {
private static final String TOTAL_ROWS_FIELD_NAME = "total_rows";
private static final String UPDATE_SEQ = "update_seq";
private static final long serialVersionUID = 4750290767933801714L;
private int totalRows = -1;
private long totalRows = -1;
private int offset = -1;
private String updateSeq;

Expand All @@ -33,7 +33,7 @@ public ViewResult(JsonNode resultNode, boolean ignoreNotFound) {
Assert.notNull(resultNode, "resultNode may not be null");
Assert.isTrue(resultNode.findPath("rows").isArray(), "result must contain 'rows' field of array type");
if (resultNode.get(TOTAL_ROWS_FIELD_NAME) != null) {
totalRows = resultNode.get(TOTAL_ROWS_FIELD_NAME).intValue();
totalRows = resultNode.get(TOTAL_ROWS_FIELD_NAME).longValue();
}
if (resultNode.get(OFFSET_FIELD_NAME) != null) {
offset = resultNode.get(OFFSET_FIELD_NAME).intValue();
Expand Down Expand Up @@ -76,7 +76,7 @@ void setOffset(int offset) {
*
* @return -1 if result did not contain a total_rows field
*/
public int getTotalRows() {
public long getTotalRows() {
return totalRows;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public class QueryResultParser<T> {
private static final String OFFSET_FIELD_NAME = "offset";
private static final String UPDATE_SEQUENCE_NAME = "update_seq";

private int totalRows = -1;
private long totalRows = -1;
private long offset = -1;
private List<T> rows;
private Long updateSequence;
Expand Down Expand Up @@ -74,7 +74,7 @@ private void parseResult(JsonParser jp) throws IOException {
if (OFFSET_FIELD_NAME.equals(currentName)) {
offset = jp.getLongValue();
} else if (TOTAL_ROWS_FIELD_NAME.equals(currentName)) {
totalRows = jp.getIntValue();
totalRows = jp.getLongValue();
} else if (ROWS_FIELD_NAME.equals(currentName)) {
rows = new ArrayList<T>();
parseRows(jp);
Expand Down Expand Up @@ -165,7 +165,7 @@ private boolean ignoreError(String error) {
return ignoreNotFound && NOT_FOUND_ERROR.equals(error);
}

public int getTotalRows() {
public long getTotalRows() {
return totalRows;
}

Expand Down