diff options
author | Trygve Laugstøl <trygvis@inamo.no> | 2013-01-12 14:19:19 +0100 |
---|---|---|
committer | Trygve Laugstøl <trygvis@inamo.no> | 2013-01-12 14:21:32 +0100 |
commit | c2a5677a46f91696ec7748d7d1202fe5d5f685f7 (patch) | |
tree | 26f229f83c84170e160178215550875c457831e5 /src/main/java/io | |
parent | 19a0b028278652f3e48b2647ed71d8e7b9371939 (diff) | |
download | esper-testing-c2a5677a46f91696ec7748d7d1202fe5d5f685f7.tar.gz esper-testing-c2a5677a46f91696ec7748d7d1202fe5d5f685f7.tar.bz2 esper-testing-c2a5677a46f91696ec7748d7d1202fe5d5f685f7.tar.xz esper-testing-c2a5677a46f91696ec7748d7d1202fe5d5f685f7.zip |
o Sorting the badge list with newest first.
Diffstat (limited to 'src/main/java/io')
-rwxr-xr-x | src/main/java/io/trygvis/esper/testing/Util.java | 24 | ||||
-rwxr-xr-x | src/main/java/io/trygvis/esper/testing/core/db/PersonDao.java | 3 |
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)) { |