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 resultSets 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 connections, 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 ith 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 throws an exception.