From: Jakub Skoczen Date: Tue, 18 May 2010 09:29:55 +0000 (+0200) Subject: Add ResultSet#sort X-Git-Tag: v1.3~29 X-Git-Url: http://sru.miketaylor.org.uk/cgi-bin?a=commitdiff_plain;h=80fe126a86a610466bdc4089f10e17fd3e683d44;p=yaz4j-moved-to-github.git Add ResultSet#sort --- diff --git a/src/main/java/org/yaz4j/ResultSet.java b/src/main/java/org/yaz4j/ResultSet.java index 766b998..aef52f6 100644 --- a/src/main/java/org/yaz4j/ResultSet.java +++ b/src/main/java/org/yaz4j/ResultSet.java @@ -104,6 +104,12 @@ public class ResultSet implements Iterable { }; } + public ResultSet sort(String type, String spec) throws ZoomException { + int ret = yaz4jlib.ZOOM_resultset_sort1(resultSet, type, spec); + if (ret != 0) throw new ZoomException("Sorting resultset failed"); + return this; + } + public long getHitCount() { return size; } diff --git a/src/test/org/yaz4j/ConnectionTest.java b/src/test/org/yaz4j/ConnectionTest.java index e577707..ca3d01c 100644 --- a/src/test/org/yaz4j/ConnectionTest.java +++ b/src/test/org/yaz4j/ConnectionTest.java @@ -35,6 +35,8 @@ public class ConnectionTest { System.out.println("Got "+i+" record of type "+r.getSyntax()); i++; } + System.out.println("Try sorting them..."); + s.sort("yaz", "1=4 >i 1=21 >s"); } catch (ZoomException ze) { fail(ze.getMessage()); } finally {