ZOOM::resultSet

YAZ++ User's Guide and Reference
Prev | Chapter 2. ZOOM-C++ | Next

# `ZOOM::resultSet`

A `ZOOM::resultSet` object represents a set of records identified by a query that has been executed against a particular connection. The sole purpose of both `connection` and `query` objects is that they can be used to create new `resultSet`s - that is, to perform a search on the server on the remote end of the connection.

The class has this declaration:

        class resultSet {
        public:
          resultSet (connection &c, const query &q);
          ~resultSet ();
          const char *option (const char *key) const;
          const char *option (const char *key, const char *val);
          size_t size () const;
          const record *getRecord (size_t i) const;
        };

New `resultSet`s are created by the constructor, which is passed a `connection`, indicating the server on which the search is to be performed, and a `query`, indicating what search to perform. If the search fails - for example, because the query uses attributes that the server doesn't implement - then an `exception` is thrown.

Like `connection`s, `resultSet` objects can carry name-value options. The special options which affect ZOOM-C++'s behaviour are the same as those for ZOOM-C and are described in its documentation (link below). In particular, the `preferredRecordSyntax` option may be set to a string such as ``USMARC'', ``SUTRS'' etc. to indicate what the format in which records should be retrieved; and the `elementSetName` option indicates whether brief records (``B''), full records (``F'') or some other composition should be used.

The `size()` method returns the number of records in the result set. Zero is a legitimate value: a search that finds no records is not the same as a search that fails.

Finally, the `getRecord` method returns the `i`th record from the result set, where `i` is zero-based: that is, legitmate values range from zero up to one less than the result-set size. If the method fails, for example because the requested record is out of range, it `throw`s an `exception`.

## References

- Section 3.4 (Result Set) of the ZOOM Abstract API

- The Result Sets section of the ZOOM-C documentation

Prev | Home | Next
`ZOOM::query` and subclasses | Up | `ZOOM::record`