aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/io
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/io')
-rwxr-xr-xsrc/main/java/io/trygvis/esper/testing/Util.java24
-rwxr-xr-xsrc/main/java/io/trygvis/esper/testing/core/db/PersonDao.java3
2 files changed, 16 insertions, 11 deletions
diff --git a/src/main/java/io/trygvis/esper/testing/Util.java b/src/main/java/io/trygvis/esper/testing/Util.java
index 6b9d1b6..68660c4 100755
--- a/src/main/java/io/trygvis/esper/testing/Util.java
+++ b/src/main/java/io/trygvis/esper/testing/Util.java
@@ -89,16 +89,20 @@ public class Util {
}
for (String s : allowed) {
- if (s.equals(input)) {
- if (buffer.length() == 0) {
- buffer.append(" ORDER BY ");
- } else {
- buffer.append(", ");
- }
- buffer.append(s);
- if (desc) {
- buffer.append(" DESC");
- }
+ if (!s.equals(input)) {
+ continue;
+ }
+
+ if (buffer.length() == 0) {
+ buffer.append(" ORDER BY ");
+ } else {
+ buffer.append(", ");
+ }
+
+ buffer.append(s);
+
+ if (desc) {
+ buffer.append(" DESC");
}
}
}
diff --git a/src/main/java/io/trygvis/esper/testing/core/db/PersonDao.java b/src/main/java/io/trygvis/esper/testing/core/db/PersonDao.java
index 58af119..8d74264 100755
--- a/src/main/java/io/trygvis/esper/testing/core/db/PersonDao.java
+++ b/src/main/java/io/trygvis/esper/testing/core/db/PersonDao.java
@@ -198,7 +198,8 @@ public class PersonDao {
sql += " AND level=?";
}
- sql += " ORDER BY created_date DESC";
+ sql += orderBy(page.orderBy, "name", "created_date");
+
sql += " LIMIT ? OFFSET ?";
try (PreparedStatement s = c.prepareStatement(sql)) {