3 import org.yaz4j.exception.ZoomException;
4 import org.yaz4j.jni.SWIGTYPE_p_ZOOM_record_p;
5 import org.yaz4j.jni.SWIGTYPE_p_ZOOM_resultset_p;
6 import org.yaz4j.jni.yaz4jlib;
8 public class ResultSet {
10 private Connection conn;
11 private SWIGTYPE_p_ZOOM_resultset_p resultSet;
12 private long size = 0;
13 private boolean disposed = false;
15 ResultSet(SWIGTYPE_p_ZOOM_resultset_p resultSet, Connection conn) {
16 this.resultSet = resultSet;
17 size = yaz4jlib.ZOOM_resultset_size(this.resultSet);
22 public void finalize() {
27 * Read option by name.
28 * @param name option name
29 * @return option value
31 public String option(String name) {
32 return yaz4jlib.ZOOM_resultset_option_get(resultSet, name);
36 * Write option with a given name.
37 * @param name option name
38 * @param value option value
39 * @return result set (self) for chainability
41 public ResultSet option(String name, String value) {
42 yaz4jlib.ZOOM_resultset_option_set(resultSet, name, value);
46 public Record getRecord(int index) throws ZoomException {
47 SWIGTYPE_p_ZOOM_record_p record =
48 yaz4jlib.ZOOM_resultset_record(resultSet, index);
49 //may be out of range or unsupported syntax
53 int errorCode = yaz4jlib.ZOOM_record_error(record, null, null, null);
54 if (errorCode != 0) throw new ZoomException("Record excpetion, code " + errorCode);
55 return new Record(record, this);
58 public long getHitCount() {
64 yaz4jlib.ZOOM_resultset_destroy(resultSet);