1
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN""http://www.w3.org/TR/html4/loose.dtd">
8
CONTENT="Modular DocBook HTML Stylesheet Version 1.79"><LINK
10
TITLE="YAZ++ User's Guide and Reference"
11
HREF="yazpp.html"><LINK
14
HREF="zoom.html"><LINK
16
TITLE="ZOOM::resultSet"
17
HREF="zoom-resultset.html"><LINK
19
TITLE="ZOOM::exception and subclasses"
20
HREF="zoom-exception.html"><LINK
23
HREF="common/style1.css"></HEAD
34
SUMMARY="Header navigation table"
43
>YAZ++ User's Guide and Reference</TH
51
HREF="zoom-resultset.html"
59
>Chapter 3. ZOOM-C++</TD
65
HREF="zoom-exception.html"
89
> object represents a chunk of data
93
> returned from a server.
96
> The class has this declaration:
100
> class record {
104
UNKNOWN, GRS1, SUTRS, USMARC, UKMARC, XML
106
record *clone () const;
107
syntax recsyn () const;
108
const char *render () const;
109
const char *rawdata () const;
113
> Records returned from Z39.50 servers are encoded using a record
114
syntax: the various national MARC formats are commonly used for
115
bibliographic data, GRS-1 or XML for complex structured data, SUTRS
116
for simple human-readable text, etc. The
120
> enumeration specifies constants
121
representing common record syntaxes, and the
125
> method returns the value corresponding
126
to the record-syntax of the record on which it is invoked.
135
Because this interface uses an enumeration, it is difficult to
136
extend to other record syntaxes - for example, DANMARC, the MARC
137
variant widely used in Denmark. We might either grow the
138
enumeration substantially, or change the interface to return
139
either an integer or a string.
146
> The simplest thing to do with a retrieved record is simply to
150
> it. This returns a human-readable, but
151
not necessarily very pretty, representation of the contents of the
152
record. This is useful primarily for testing and debugging, since
153
the application has no control over how the record appears.
154
(The application must <SPAN
164
> the returned string - it is ``owned'' by
168
> More sophisticated applications will want to deal with the raw data
173
Its format will vary depending on the record syntax: SUTRS, MARC
174
and XML records are returned ``as is'', and GRS-1 records as a
175
pointer to their top-level node, which is a
179
> structure as defined in the
182
><yaz/z-grs.h></TT
184
(The application must <SPAN
194
> the returned data - it is ``owned'' by
198
> Perceptive readers will notice that there are no methods for access
199
to individual fields within a record. That's because the different
200
record syntaxes are so different that there is no even a uniform
201
notion of what a field is across them all, let alone a sensible way
202
to implement such a function. Fetch the raw data instead, and pick
203
it apart ``by hand''.
211
>Memory Management</A
217
> objects returned from
220
>resultSet::getRecord()</TT
221
> are ``owned'' by the
222
result set object: that means that the application is not
230
> is automatically deallocated when the
241
> Usually that's what you want: it means that you can easily fetch a
242
record, use it and forget all about it, like this:
245
CLASS="programlisting"
246
> resultSet rs(conn, query);
247
cout << rs.getRecord(0)->render();
250
> But sometimes you want a <TT
254
the lifetime of the <TT
258
fetched. In this case, the <TT
262
be used to make an autonomous copy. The application must
266
> it when it doesn't need it any longer:
269
CLASS="programlisting"
272
resultSet rs(conn, query);
273
rec = rs.getRecord(0)->clone();
274
// `rs' goes out of scope here, and is deleted
276
cout << rec->render();
294
HREF="http://zoom.z3950.org/api/zoom-1.3.html#3.5"
296
>Section 3.5 (Record) of the ZOOM Abstract API</A
303
HREF="http://www.indexdata.dk/yaz/doc/zoom.records.tkl"
305
>The Records section of the ZOOM-C documentation</A
317
SUMMARY="Footer navigation table"
328
HREF="zoom-resultset.html"
346
HREF="zoom-exception.html"
b'\\ No newline at end of file'