- public Record getRecord(int index) throws ZoomException {
- SWIGTYPE_p_ZOOM_record_p record =
- yaz4jlib.ZOOM_resultset_record(resultSet, index);
- //may be out of range or unsupported syntax
+ /**
+ * Write option with a given name.
+ * @param name option name
+ * @param value option value
+ * @return result set (self) for chainability
+ */
+ public ResultSet option(String name, String value) {
+ yaz4jlib.ZOOM_resultset_option_set(resultSet, name, value);
+ return this;
+ }
+
+ public Record getRecord(long index) throws ZoomException {
+ SWIGTYPE_p_ZOOM_record_p record =
+ yaz4jlib.ZOOM_resultset_record(resultSet, index);
+ //may be out of range or unsupported syntax
+ if (record == null) {
+ return null;
+ }
+ int errorCode = yaz4jlib.ZOOM_record_error(record, null, null, null);
+ if (errorCode != 0) {
+ throw new ZoomException("Record excpetion, code " + errorCode);
+ }
+ return new Record(record, this);
+ }
+
+ public List<Record> getRecords(long start, int count) throws ZoomException {
+ List<Record> out = new ArrayList<Record>(count);
+ SWIGTYPE_p_p_ZOOM_record_p recs = yaz4jlib.new_zoomRecordArray(count);
+ yaz4jlib.ZOOM_resultset_records(resultSet, recs, start, count);
+ for (int i = 0; i < count; i++) {
+ SWIGTYPE_p_ZOOM_record_p record =
+ yaz4jlib.zoomRecordArray_getitem(recs, i);