|
|
Index Data > YAZ++ > YAZ++ User's Guide and Reference > ZOOM::record
A The class has this declaration:
class record {
public:
~record ();
enum syntax {
UNKNOWN, GRS1, SUTRS, USMARC, UKMARC, XML
};
record *clone () const;
syntax recsyn () const;
const char *render () const;
const char *rawdata () const;
};
Records returned from Z39.50 servers are encoded using a record
syntax: the various national MARC formats are commonly used for
bibliographic data, GRS-1 or XML for complex structured data, SUTRS
for simple human-readable text, etc. The
NoteBecause this interface uses an enumeration, it is difficult to extend to other record syntaxes - for example, DANMARC, the MARC variant widely used in Denmark. We might either grow the enumeration substantially, or change the interface to return either an integer or a string.
The simplest thing to do with a retrieved record is simply to
More sophisticated applications will want to deal with the raw data
themselves: the Perceptive readers will notice that there are no methods for access to individual fields within a record. That's because the different record syntaxes are so different that there is no even a uniform notion of what a field is across them all, let alone a sensible way to implement such a function. Fetch the raw data instead, and pick it apart ``by hand''.
The Usually that's what you want: it means that you can easily fetch a record, use it and forget all about it, like this:
resultSet rs(conn, query);
cout << rs.getRecord(0)->render();
But sometimes you want a
record *rec;
{
resultSet rs(conn, query);
rec = rs.getRecord(0)->clone();
// `rs' goes out of scope here, and is deleted
}
cout << rec->render();
delete rec;
|
|||
|
|
||||
| Copyright Index Data ApS 2008 | ||||