3 ZOOM_connection_errcode(c)
4 ZOOM_connection_errmsg(c)
5 ZOOM_connection_addinfo(c)
6 ZOOM_connection_addinfo(c)
7 ZOOM_connection_diagset(c);
8 ZOOM_connection_save_apdu_wrbuf
10 ZOOM_resultset_record_immediate(s, pos)
11 ZOOM_resultset_cache_reset(r)
12 ZOOM_options_set_callback(opt, function, handle)
13 ZOOM_options_create_with_parent2(parent1, parent2)
14 ZOOM_options_getl(opt, name, len)
15 ZOOM_options_setl(opt, name, value, len)
16 ZOOM_options_get_bool(opt, name, defa)
17 ZOOM_options_get_int(opt, name, defa)
18 ZOOM_options_set_int(opt, name, value)
19 ZOOM_query_cql2rpn(ZOOM_query s, const char *str, ZOOM_connection conn)
21 <chapter id="zoom"><title>ZOOM</title>
23 &zoom; is an acronym for 'Z39.50 Object-Orientation Model' and is
24 an initiative started by Mike Taylor (Mike is from the UK, which
25 explains the peculiar name of the model). The goal of &zoom; is to
26 provide a common Z39.50 client API not bound to a particular
27 programming language or toolkit.
31 From YAZ version 2.1.12, <ulink url="&url.sru;">SRU</ulink> is supported.
32 You can make SRU ZOOM connections by specifying scheme
33 <literal>http://</literal> for the hostname for a connection.
34 The dialect of SRU used is specified by the value of the
35 connection's <literal>sru</literal> option, which may be SRU over
36 HTTP GET (<literal>get</literal>),
37 SRU over HTTP POST (<literal>post</literal>), (SRU over
38 SOAP) (<literal>soap</literal>) or <literal>SOLR</literal>
39 (<ulink url="&url.solr;">SOLR</ulink> Web Service).
40 Using the facility for embedding options in target strings, a
41 connection can be forced to use SRU rather the SRW (the default) by
42 prefixing the target string with <literal>sru=get,</literal>, like this:
43 <literal>sru=get,http://sru.miketaylor.org.uk:80/sru.pl</literal>
46 <ulink url="&url.solr;">SOLR</ulink> protocol support was added to
47 YAZ in version 4.1.0, as a dialect of a SRU protocol, since both are
51 The lack of a simple Z39.50 client API for &yaz; has become more
52 and more apparent over time. So when the first &zoom; specification
54 an implementation for &yaz; was quickly developed. For the first time, it is
55 now as easy (or easier!) to develop clients than servers with &yaz;. This
56 chapter describes the &zoom; C binding. Before going further, please
57 reconsider whether C is the right programming language for the job.
58 There are other language bindings available for &yaz;, and still
60 are in active development. See the
61 <ulink url="&url.zoom;">ZOOM web-site</ulink> for
66 In order to fully understand this chapter you should read and
67 try the example programs <literal>zoomtst1.c</literal>,
68 <literal>zoomtst2.c</literal>, .. in the <literal>zoom</literal>
73 The C language misses features found in object oriented languages
74 such as C++, Java, etc. For example, you'll have to manually,
75 destroy all objects you create, even though you may think of them as
76 temporary. Most objects has a <literal>_create</literal> - and a
77 <literal>_destroy</literal> variant.
78 All objects are in fact pointers to internal stuff, but you don't see
79 that because of typedefs. All destroy methods should gracefully ignore a
80 <literal>NULL</literal> pointer.
83 In each of the sections below you'll find a sub section called
84 protocol behavior, that describes how the API maps to the Z39.50
87 <sect1 id="zoom-connections"><title>Connections</title>
89 <para>The Connection object is a session with a target.
92 #include <yaz/zoom.h>
94 ZOOM_connection ZOOM_connection_new(const char *host, int portnum);
96 ZOOM_connection ZOOM_connection_create(ZOOM_options options);
98 void ZOOM_connection_connect(ZOOM_connection c, const char *host,
100 void ZOOM_connection_destroy(ZOOM_connection c);
103 Connection objects are created with either function
104 <function>ZOOM_connection_new</function> or
105 <function>ZOOM_connection_create</function>.
106 The former creates and automatically attempts to establish a network
107 connection with the target. The latter doesn't establish
108 a connection immediately, thus allowing you to specify options
109 before establishing network connection using the function
110 <function>ZOOM_connection_connect</function>.
111 If the port number, <literal>portnum</literal>, is zero, the
112 <literal>host</literal> is consulted for a port specification.
113 If no port is given, 210 is used. A colon denotes the beginning of
114 a port number in the host string. If the host string includes a
115 slash, the following part specifies a database for the connection.
118 You can prefix the host with a scheme followed by colon. The
119 default scheme is <literal>tcp</literal> (Z39.50 protocol).
120 The scheme <literal>http</literal> selects SRU/get over HTTP by default,
121 but can overridded to use SRU/post, SRW and the SOLR protocol.
124 You can prefix the scheme-qualified host-string with one or more
126 <literal><parameter>key</parameter>=<parameter>value</parameter></literal>
127 sequences, each of which represents an option to be set into the
128 connection structure <emphasis>before</emphasis> the
129 protocol-level connection is forged and the initialization
130 handshake takes place. This facility can be used to provide
131 authentication credentials, as in host-strings such as:
132 <literal>user=admin,password=halfAm4n,tcp:localhost:8017/db</literal>
135 Connection objects should be destroyed using the function
136 <function>ZOOM_connection_destroy</function>.
139 void ZOOM_connection_option_set(ZOOM_connection c,
140 const char *key, const char *val);
142 void ZOOM_connection_option_setl(ZOOM_connection c,
144 const char *val, int len);
146 const char *ZOOM_connection_option_get(ZOOM_connection c,
148 const char *ZOOM_connection_option_getl(ZOOM_connection c,
153 The functions <function>ZOOM_connection_option_set</function> and
154 <function>ZOOM_connection_option_setl</function> allows you to
155 set an option given by <parameter>key</parameter> to the value
156 <parameter>value</parameter> for the connection.
157 For <function>ZOOM_connection_option_set</function>, the
158 value is assumed to be a 0-terminated string. Function
159 <function>ZOOM_connection_option_setl</function> specifies a
160 value of a certain size (len).
163 Functions <function>ZOOM_connection_option_get</function> and
164 <function>ZOOM_connection_option_getl</function> returns
165 the value for an option given by <parameter>key</parameter>.
167 <table id="zoom-connection-options" frame="top">
168 <title>ZOOM Connection Options</title>
170 <colspec colwidth="4*" colname="name"></colspec>
171 <colspec colwidth="7*" colname="description"></colspec>
172 <colspec colwidth="3*" colname="default"></colspec>
175 <entry>Option</entry>
176 <entry>Description</entry>
177 <entry>Default</entry>
182 implementationName</entry><entry>Name of Your client
183 </entry><entry>none</entry></row>
185 user</entry><entry>Authentication user name
186 </entry><entry>none</entry></row>
188 group</entry><entry>Authentication group name
189 </entry><entry>none</entry></row>
191 password</entry><entry>Authentication password.
192 </entry><entry>none</entry></row>
194 host</entry><entry>Target host. This setting is "read-only".
195 It's automatically set internally when connecting to a target.
196 </entry><entry>none</entry></row>
198 proxy</entry><entry>Proxy host. If set, the logical host
199 is encoded in the otherInfo area of the Z39.50 Init PDU
200 with OID 1.2.840.10003.10.1000.81.1.
201 </entry><entry>none</entry></row>
203 clientIP</entry><entry>Client IP. If set, is
204 encoded in the otherInfo area of a Z39.50 PDU with OID
205 1.2.840.10003.10.1000.81.3. Holds the original IP addreses
206 of a client. Is used of ZOOM is used in a gateway of some sort.
207 </entry><entry>none</entry></row>
209 async</entry><entry>If true (1) the connection operates in
210 asynchronous operation which means that all calls are non-blocking
212 <link linkend="zoom.events"><function>ZOOM_event</function></link>.
213 </entry><entry>0</entry></row>
215 maximumRecordSize</entry><entry> Maximum size of single record.
216 </entry><entry>1 MB</entry></row>
218 preferredMessageSize</entry><entry> Maximum size of multiple records.
219 </entry><entry>1 MB</entry></row>
221 lang</entry><entry> Language for negotiation.
222 </entry><entry>none</entry></row>
224 charset</entry><entry> Character set for negotiation.
225 </entry><entry>none</entry></row>
227 serverImplementationId</entry><entry>
228 Implementation ID of server. (The old targetImplementationId
229 option is also supported for the benefit of old applications.)
230 </entry><entry>none</entry></row>
232 targetImplementationName</entry><entry>
233 Implementation Name of server. (The old
234 targetImplementationName option is also supported for the
235 benefit of old applications.)
236 </entry><entry>none</entry></row>
238 serverImplementationVersion</entry><entry>
239 Implementation Version of server. (the old
240 targetImplementationVersion option is also supported for the
241 benefit of old applications.)
242 </entry><entry>none</entry></row>
244 databaseName</entry><entry>One or more database names
245 separated by character plus (<literal>+</literal>), which to
246 be used by subsequent search requests on this Connection.
247 </entry><entry>Default</entry></row>
249 piggyback</entry><entry>True (1) if piggyback should be
250 used in searches; false (0) if not.
251 </entry><entry>1</entry></row>
253 smallSetUpperBound</entry><entry>If hits is less than or equal to this
254 value, then target will return all records using small element set name
255 </entry><entry>0</entry></row>
257 largeSetLowerBound</entry><entry>If hits is greater than this
258 value, the target will return no records.
259 </entry><entry>1</entry></row>
261 mediumSetPresentNumber</entry><entry>This value represents
262 the number of records to be returned as part of a search when when
263 hits is less than or equal to large set lower bound and if hits
264 is greater than small set upper bound.
265 </entry><entry>0</entry></row>
267 smallSetElementSetName</entry><entry>
268 The element set name to be used for small result sets.
269 </entry><entry>none</entry></row>
271 mediumSetElementSetName</entry><entry>
272 The element set name to be for medium-sized result sets.
273 </entry><entry>none</entry></row>
275 init_opt_search, init_opt_present, init_opt_delSet, etc.</entry><entry>
276 After a successful Init, these options may be interrogated to
277 discover whether the server claims to support the specified
279 </entry><entry>none</entry></row>
281 <entry>sru</entry><entry>
282 SRU/SOLR transport type. Must be either <literal>soap</literal>,
283 <literal>get</literal>, <literal>post</literal>, or
284 <literal>solr</literal>.
285 </entry><entry>soap</entry></row>
287 sru_version</entry><entry>
288 SRU/SRW version. Should be <literal>1.1</literal>, or
289 <literal>1.2</literal>. This is , prior to connect, the version
290 to offer (highest version). And following connect (in fact
291 first operation), holds the negotiated version with the server
292 (same or lower version).
293 </entry><entry>1.2</entry></row>
295 facets</entry><entry>
296 A FacetList is comma-separated list of facet, which is defined
297 as <literal>AttributeList</literal> and a optional FacetTerm
298 (a Term and a frequency). On request the terms is missing.
299 On response the the list contains the terms that the target
301 </entry><entry>none</entry></row>
303 apdulog</entry><entry>
304 If set to a true value such as "1", a log of low-level
305 protocol packets is emitted on standard error stream. This
306 can be very useful for debugging.
307 </entry><entry>0</entry></row>
309 saveAPDU</entry><entry>
310 If set to a true value such as "1", a log of low-level
311 protocol packets is saved. The log can be retrieved by reading
312 option APDU. Setting saveAPDU always has the side effect of
313 resetting the currently saved log. This setting is
314 <emphasis>write-only</emphasis>. If read, NULL will be returned.
315 It is only recognized in
316 <function>ZOOM_connection_option_set</function>.
317 </entry><entry>0</entry></row>
320 Returns the log of protocol packets. Will be empty if logging
321 is not enabled (see saveAPDU above). This setting is
322 <emphasis>read-only</emphasis>. It is only recognized if used
323 in call to <function>ZOOM_connection_option_get</function> or
324 <function>ZOOM_connection_option_getl</function>.
325 </entry><entry></entry></row>
330 If either option <literal>lang</literal> or <literal>charset</literal>
332 <ulink url="&url.z39.50.charneg;">
333 Character Set and Language Negotiation</ulink> is in effect.
336 int ZOOM_connection_error(ZOOM_connection c, const char **cp,
337 const char **addinfo);
338 int ZOOM_connection_error_x(ZOOM_connection c, const char **cp,
339 const char **addinfo, const char **dset);
342 Function <function>ZOOM_connection_error</function> checks for
343 errors for the last operation(s) performed. The function returns
344 zero if no errors occurred; non-zero otherwise indicating the error.
345 Pointers <parameter>cp</parameter> and <parameter>addinfo</parameter>
346 holds messages for the error and additional-info if passed as
347 non-<literal>NULL</literal>. Function
348 <function>ZOOM_connection_error_x</function> is an extended version
349 of <function>ZOOM_connection_error</function> that is capable of
350 returning name of diagnostic set in <parameter>dset</parameter>.
352 <sect2 id="zoom-connection-z39.50">
353 <title>Z39.50 Protocol behavior</title>
355 The calls <function>ZOOM_connection_new</function> and
356 <function>ZOOM_connection_connect</function> establishes a TCP/IP
357 connection and sends an Initialize Request to the target if
358 possible. In addition, the calls waits for an Initialize Response
359 from the target and the result is inspected (OK or rejected).
362 If <literal>proxy</literal> is set then the client will establish
363 a TCP/IP connection with the peer as specified by the
364 <literal>proxy</literal> host and the hostname as part of the
365 connect calls will be set as part of the Initialize Request.
366 The proxy server will then "forward" the PDU's transparently
367 to the target behind the proxy.
370 For the authentication parameters, if option <literal>user</literal>
371 is set and both options <literal>group</literal> and
372 <literal>pass</literal> are unset, then Open style
373 authentication is used (Version 2/3) in which case the username
374 is usually followed by a slash, then by a password.
375 If either <literal>group</literal>
376 or <literal>pass</literal> is set then idPass authentication
377 (Version 3 only) is used. If none of the options are set, no
378 authentication parameters are set as part of the Initialize Request
382 When option <literal>async</literal> is 1, it really means that
383 all network operations are postponed (and queued) until the
384 function <literal>ZOOM_event</literal> is invoked. When doing so
385 it doesn't make sense to check for errors after
386 <literal>ZOOM_connection_new</literal> is called since that
387 operation "connecting - and init" is still incomplete and the
388 API cannot tell the outcome (yet).
391 <sect2 id="zoom.sru.init.behavior">
392 <title>SRU/SOLR Protocol behavior</title>
394 The HTTP based protocols (SRU, SRW, SOLR) doesn't feature an Inititialize Request, so
395 the connection phase merely establishes a TCP/IP connection
396 with the SOAP service.
398 <para>Most of the ZOOM connection options do not
399 affect SRU/SOLR and they are ignored. However, future versions
400 of &yaz; might honor <literal>implementationName</literal> and
401 put that as part of User-Agent header for HTTP requests.
404 The <literal>charset</literal> is used in the Content-Type header
409 <sect1 id="zoom.query"><title>Queries</title>
411 Query objects represents queries.
414 ZOOM_query ZOOM_query_create(void);
416 void ZOOM_query_destroy(ZOOM_query q);
418 int ZOOM_query_prefix(ZOOM_query q, const char *str);
420 int ZOOM_query_cql(ZOOM_query s, const char *str);
422 int ZOOM_query_sortby(ZOOM_query q, const char *criteria);
424 int ZOOM_query_sortby2(ZOOM_query q, const char *strategy,
425 const char *criteria);
428 Create query objects using <function>ZOOM_query_create</function>
429 and destroy them by calling <function>ZOOM_query_destroy</function>.
430 RPN-queries can be specified in <link linkend="PQF">PQF</link>
431 notation by using the
432 function <function>ZOOM_query_prefix</function>.
433 The <function>ZOOM_query_cql</function> specifies a CQL
434 query to be sent to the server/target.
435 More query types will be added in future versions of &yaz;, such as
436 <link linkend="CCL">CCL</link> to RPN-mapping, native CCL query,
437 etc. In addition to a search, a sort criteria may be set. Function
438 <function>ZOOM_query_sortby</function> enables Z39.50 sorting and
439 it takes sort criteria using the same string notation as
440 yaz-client's <link linkend="sortspec">sort command</link>.
442 <para id="zoom.query.sortby2">
443 <function>ZOOM_query_sortby2</function> is similar to
444 <function>ZOOM_query_sortby</function> but allows a strategy for
445 sorting. The reason for the strategy parameter is that some
446 protocols offers multiple ways of performing sorting.
447 For example, Z39.50 has the standard sort, which is performed after
448 search on an existing result set.
449 It's also possible to use CQL in Z39.50 as the query type and use
450 CQL's SORTBY keyword. Finally, Index Data's
451 Zebra server also allows sorting to be specified as part of RPN (Type 7).
453 <table id="zoom-sort-strategy" frame="top">
454 <title>ZOOM sort strategy</title>
456 <colspec colwidth="2*" colname="name"/>
457 <colspec colwidth="5*" colname="description"/>
461 <entry>Description</entry>
466 <entry>z39.50</entry><entry>Z39.50 resultset sort</entry>
469 <entry>type7</entry><entry>Sorting embedded in RPN(Type-7)</entry>
472 <entry>cql</entry><entry>CQL SORTBY</entry>
475 <entry>sru11</entry><entry>SRU sortKeys parameter</entry>
478 <entry>solr</entry><entry>Solr sort</entry>
481 <entry>embed</entry><entry>type7 for Z39.50, cql for SRU,
482 solr for Solr protocol</entry>
488 <sect1 id="zoom.resultsets"><title>Result sets</title>
490 The result set object is a container for records returned from
494 ZOOM_resultset ZOOM_connection_search(ZOOM_connection, ZOOM_query q);
496 ZOOM_resultset ZOOM_connection_search_pqf(ZOOM_connection c,
498 void ZOOM_resultset_destroy(ZOOM_resultset r);
501 Function <function>ZOOM_connection_search</function> creates
502 a result set given a connection and query.
503 Destroy a result set by calling
504 <function>ZOOM_resultset_destroy</function>.
505 Simple clients may using PQF only may use function
506 <function>ZOOM_connection_search_pqf</function> in which case
507 creating query objects is not necessary.
510 void ZOOM_resultset_option_set(ZOOM_resultset r,
511 const char *key, const char *val);
513 const char *ZOOM_resultset_option_get(ZOOM_resultset r, const char *key);
515 size_t ZOOM_resultset_size(ZOOM_resultset r);
518 Functions <function>ZOOM_resultset_options_set</function> and
519 <function>ZOOM_resultset_get</function> sets and gets an option
520 for a result set similar to <function>ZOOM_connection_option_get</function>
521 and <function>ZOOM_connection_option_set</function>.
524 The number of hits also called result-count is returned by
525 function <function>ZOOM_resultset_size</function>.
527 <table id="zoom.resultset.options"
528 frame="top"><title>ZOOM Result set Options</title>
530 <colspec colwidth="4*" colname="name"></colspec>
531 <colspec colwidth="7*" colname="description"></colspec>
532 <colspec colwidth="2*" colname="default"></colspec>
535 <entry>Option</entry>
536 <entry>Description</entry>
537 <entry>Default</entry>
542 start</entry><entry>Offset of first record to be
543 retrieved from target. First record has offset 0 unlike the
544 protocol specifications where first record has position 1.
545 This option affects ZOOM_resultset_search and
546 ZOOM_resultset_search_pqf and must be set before any of
547 these functions are invoked. If a range of
548 records must be fetched manually after search,
549 function ZOOM_resultset_records should be used.
550 </entry><entry>0</entry></row>
552 count</entry><entry>Number of records to be retrieved.
553 This option affects ZOOM_resultset_search and
554 ZOOM_resultset_search_pqf and must be set before any of
555 these functions are invoked.
556 </entry><entry>0</entry></row>
558 presentChunk</entry><entry>The number of records to be
559 requested from the server in each chunk (present request). The
560 value 0 means to request all the records in a single chunk.
561 (The old <literal>step</literal>
562 option is also supported for the benefit of old applications.)
563 </entry><entry>0</entry></row>
565 elementSetName</entry><entry>Element-Set name of records.
566 Most targets should honor element set name <literal>B</literal>
567 and <literal>F</literal> for brief and full respectively.
568 </entry><entry>none</entry></row>
570 preferredRecordSyntax</entry><entry>Preferred Syntax, such as
571 <literal>USMARC</literal>, <literal>SUTRS</literal>, etc.
572 </entry><entry>none</entry></row>
574 schema</entry><entry>Schema for retrieval, such as
575 <literal>Gils-schema</literal>, <literal>Geo-schema</literal>, etc.
576 </entry><entry>none</entry></row>
578 setname</entry><entry>Name of Result Set (Result Set ID).
579 If this option isn't set, the ZOOM module will automatically
580 allocate a result set name.
581 </entry><entry>default</entry></row>
583 rpnCharset</entry><entry>Character set for RPN terms.
584 If this is set, ZOOM C will assume that the ZOOM application is
585 running UTF-8. Terms in RPN queries are then converted to the
586 rpnCharset. If this is unset, ZOOM C will not assume any encoding
587 of RPN terms and no conversion is performed.
588 </entry><entry>none</entry></row>
593 For servers that support Search Info report, the following
594 options may be read using <function>ZOOM_resultset_get</function>.
595 This detailed information is read after a successful search has
599 This information is a list of of items, where each item is
600 information about a term or subquery. All items in the list
602 <literal>SearchResult.</literal><replaceable>no</replaceable>
603 where no presents the item number (0=first, 1=second).
604 Read <literal>searchresult.size</literal> to determine the
607 <table id="zoom.search.info.report.options"
608 frame="top"><title>Search Info Report Options</title>
610 <colspec colwidth="4*" colname="name"></colspec>
611 <colspec colwidth="7*" colname="description"></colspec>
614 <entry>Option</entry>
615 <entry>Description</entry>
620 <entry>searchresult.size</entry>
622 number of search result entries. This option is-nonexistant
623 if no entries are returned by the server.
627 <entry>searchresult.<replaceable>no</replaceable>.id</entry>
628 <entry>sub query ID</entry>
631 <entry>searchresult.<replaceable>no</replaceable>.count</entry>
632 <entry>result count for item (number of hits)</entry>
635 <entry>searchresult.<replaceable>no</replaceable>.subquery.term</entry>
636 <entry>subquery term</entry>
640 searchresult.<replaceable>no</replaceable>.interpretation.term
642 <entry>interpretation term</entry>
646 searchresult.<replaceable>no</replaceable>.recommendation.term
648 <entry>recommendation term</entry>
654 <sect2 id="zoom.z3950.resultset.sort">
655 <title>Z39.50 Result-set Sort</title>
657 void ZOOM_resultset_sort(ZOOM_resultset r,
658 const char *sort_type, const char *sort_spec);
660 int ZOOM_resultset_sort1(ZOOM_resultset r,
661 const char *sort_type, const char *sort_spec);
664 <function>ZOOM_resultset_sort</function> and
665 <function>ZOOM_resultset_sort1</function> both sort an existing
666 result-set. The sort_type parameter is not use. Set it to "yaz".
667 The sort_spec is same notation as ZOOM_query_sortby and identical
668 to that offered by yaz-client's
669 <link linkend="sortspec">sort command</link>.
672 These functions only work for Z39.50. Use the more generic utility
673 <link linkend="zoom.query.sortby2">
674 <function>ZOOM_query_sortby2</function></link>
675 for other protocols (and even Z39.50).
678 <sect2 id="zoom.z3950.resultset.behavior">
679 <title>Z39.50 Protocol behavior</title>
681 The creation of a result set involves at least a SearchRequest
682 - SearchResponse protocol handshake. Following that, if a sort
683 criteria was specified as part of the query, a SortRequest -
684 SortResponse handshake takes place. Note that it is necessary to
685 perform sorting before any retrieval takes place, so no records will
686 be returned from the target as part of the SearchResponse because these
687 would be unsorted. Hence, piggyback is disabled when sort criteria
688 are set. Following Search - and a possible sort - Retrieval takes
689 place - as one or more Present Requests/Response pairs being
693 The API allows for two different modes for retrieval. A high level
694 mode which is somewhat more powerful and a low level one.
695 The low level is enabled when searching on a Connection object
696 for which the settings
697 <literal>smallSetUpperBound</literal>,
698 <literal>mediumSetPresentNumber</literal> and
699 <literal>largeSetLowerBound</literal> are set. The low level mode
700 thus allows you to precisely set how records are returned as part
701 of a search response as offered by the Z39.50 protocol.
702 Since the client may be retrieving records as part of the
703 search response, this mode doesn't work well if sorting is used.
706 The high-level mode allows you to fetch a range of records from
707 the result set with a given start offset. When you use this mode
708 the client will automatically use piggyback if that is possible
709 with the target and perform one or more present requests as needed.
710 Even if the target returns fewer records as part of a present response
711 because of a record size limit, etc. the client will repeat sending
712 present requests. As an example, if option <literal>start</literal>
713 is 0 (default) and <literal>count</literal> is 4, and
714 <literal>piggyback</literal> is 1 (default) and no sorting criteria
715 is specified, then the client will attempt to retrieve the 4
716 records as part the search response (using piggyback). On the other
717 hand, if either <literal>start</literal> is positive or if
718 a sorting criteria is set, or if <literal>piggyback</literal>
719 is 0, then the client will not perform piggyback but send Present
723 If either of the options <literal>mediumSetElementSetName</literal> and
724 <literal>smallSetElementSetName</literal> are unset, the value
725 of option <literal>elementSetName</literal> is used for piggyback
726 searches. This means that for the high-level mode you only have
727 to specify one elementSetName option rather than three.
730 <sect2 id="zoom.sru.resultset.behavior">
731 <title>SRU Protocol behavior</title>
733 Current version of &yaz; does not take advantage of a result set id
734 returned by the SRU server. Future versions might do, however.
735 Since, the ZOOM driver does not save result set IDs any
736 present (retrieval) is transformed to a SRU SearchRetrieveRequest
737 with same query but, possibly, different offsets.
740 Option <literal>schema</literal> specifies SRU schema
741 for retrieval. However, options <literal>elementSetName</literal> and
742 <literal>preferredRecordSyntax</literal> are ignored.
745 Options <literal>start</literal> and <literal>count</literal>
746 are supported by SRU.
747 The remaining options
748 <literal>piggyback</literal>,
749 <literal>smallSetUpperBound</literal>,
750 <literal>largeSetLowerBound</literal>,
751 <literal>mediumSetPresentNumber</literal>,
752 <literal>mediumSetElementSetName</literal>,
753 <literal>smallSetElementSetName</literal> are
757 SRU supports CQL queries, <emphasis>not</emphasis> PQF.
758 If PQF is used, however, the PQF query is transferred anyway
759 using non-standard element <literal>pQuery</literal> in
760 SRU SearchRetrieveRequest.
763 SOLR queries has to be done in SOLR query format.
766 Unfortunately, SRU or SOLR does not define a database setting. Hence,
767 <literal>databaseName</literal> is unsupported and ignored.
768 However, the path part in host parameter for functions
769 <function>ZOOM_connecton_new</function> and
770 <function>ZOOM_connection_connect</function> acts as a
771 database (at least for the &yaz; SRU server).
775 <sect1 id="zoom.records"><title>Records</title>
777 A record object is a retrieval record on the client side -
778 created from result sets.
781 void ZOOM_resultset_records(ZOOM_resultset r,
783 size_t start, size_t count);
784 ZOOM_record ZOOM_resultset_record(ZOOM_resultset s, size_t pos);
786 const char *ZOOM_record_get(ZOOM_record rec, const char *type,
789 int ZOOM_record_error(ZOOM_record rec, const char **msg,
790 const char **addinfo, const char **diagset);
792 ZOOM_record ZOOM_record_clone(ZOOM_record rec);
794 void ZOOM_record_destroy(ZOOM_record rec);
797 References to temporary records are returned by functions
798 <function>ZOOM_resultset_records</function> or
799 <function>ZOOM_resultset_record</function>.
802 If a persistent reference to a record is desired
803 <function>ZOOM_record_clone</function> should be used.
804 It returns a record reference that should be destroyed
805 by a call to <function>ZOOM_record_destroy</function>.
808 A single record is returned by function
809 <function>ZOOM_resultset_record</function> that takes a
810 position as argument. First record has position zero.
811 If no record could be obtained <literal>NULL</literal> is returned.
814 Error information for a record can be checked with
815 <function>ZOOM_record_error</function> which returns non-zero
816 (error code) if record is in error, called <emphasis>Surrogate
817 Diagnostics</emphasis> in Z39.50.
820 Function <function>ZOOM_resultset_records</function> retrieves
821 a number of records from a result set. Parameter <literal>start</literal>
822 and <literal>count</literal> specifies the range of records to
823 be returned. Upon completion array
824 <literal>recs[0], ..recs[count-1]</literal>
825 holds record objects for the records. The array of records
826 <literal>recs</literal> should be allocated prior the call
827 <function>ZOOM_resultset_records</function>. Note that for those
828 records that couldn't be retrieved from the target
829 <literal>recs[ ..]</literal> is set to <literal>NULL</literal>.
831 <para id="zoom.record.get">
832 In order to extract information about a single record,
833 <function>ZOOM_record_get</function> is provided. The
834 function returns a pointer to certain record information. The
835 nature (type) of the pointer depends on the parameter,
836 <parameter>type</parameter>.
839 The <parameter>type</parameter> is a string of the format:
842 <replaceable>format</replaceable>[;charset=<replaceable>from</replaceable>[/<replaceable>opacfrom</replaceable>][,<replaceable>to</replaceable>]][;format=<replaceable>v</replaceable>]
845 where <replaceable>format</replaceable> specifies the format of the
846 returned record, <replaceable>from</replaceable>
847 specifies the character set of the record in its original form
848 (as returned by the server), <replaceable>to</replaceable> specifies
849 the output (returned)
850 character set encoding.
851 If <replaceable>to</replaceable> is omitted UTF-8 is assumed.
852 If charset is not given, then no character set conversion takes place.
855 <para>OPAC records may be returned in a different
856 set from the bibliographic MARC record. If this is this the case,
857 <replaceable>opacfrom</replaceable> should be set to the character set
858 of the OPAC record part.
862 Specifying the OPAC record character set requires YAZ 4.1.5 or later.
866 The format argument controls whether record data should be XML
867 pretty-printed (post process operation).
868 It is enabled only if format value <replaceable>v</replaceable> is
869 <literal>1</literal> and the record content is XML well-formed.
872 In addition, for certain types, the length
873 <literal>len</literal> passed will be set to the size in bytes of
874 the returned information.
877 The following are the supported values for <replaceable>form</replaceable>.
879 <varlistentry><term><literal>database</literal></term>
880 <listitem><para>Database of record is returned
881 as a C null-terminated string. Return type
882 <literal>const char *</literal>.
885 <varlistentry><term><literal>syntax</literal></term>
886 <listitem><para>The transfer syntax of the record is returned
887 as a C null-terminated string containing the symbolic name of
888 the record syntax, e.g. <literal>Usmarc</literal>. Return type
890 <literal>const char *</literal>.
893 <varlistentry><term><literal>schema</literal></term>
894 <listitem><para>The schema of the record is returned
895 as a C null-terminated string. Return type is
896 <literal>const char *</literal>.
899 <varlistentry><term><literal>render</literal></term>
900 <listitem><para>The record is returned in a display friendly
901 format. Upon completion buffer is returned
902 (type <literal>const char *</literal>) and length is stored in
903 <literal>*len</literal>.
906 <varlistentry><term><literal>raw</literal></term>
907 <listitem><para>The record is returned in the internal
908 YAZ specific format. For GRS-1, Explain, and others, the
909 raw data is returned as type
910 <literal>Z_External *</literal> which is just the type for
911 the member <literal>retrievalRecord</literal> in
912 type <literal>NamePlusRecord</literal>.
913 For SUTRS and octet aligned record (including all MARCs) the
914 octet buffer is returned and the length of the buffer.
917 <varlistentry><term><literal>xml</literal></term>
918 <listitem><para>The record is returned in XML if possible.
919 SRU, SOLR and Z39.50 records with transfer syntax XML are
920 returned verbatim. MARC records are returned in
921 <ulink url="&url.marcxml;">
924 (converted from ISO2709 to MARCXML by YAZ).
925 OPAC records are also converted to XML and the
926 bibliographic record is converted to MARCXML (when possible).
927 GRS-1 records are not supported for this form.
928 Upon completion, the XML buffer is returned
929 (type <literal>const char *</literal>) and length is stored in
930 <literal>*len</literal>.
933 <varlistentry><term><literal>opac</literal></term>
934 <listitem><para>OPAC information for record is returned in XML
935 if an OPAC record is present at the position given. If no
936 OPAC record is present, a NULL pointer is returned.
939 <varlistentry><term><literal>txml</literal></term>
940 <listitem><para>The record is returned in TurboMARC if possible.
941 SRU and Z39.50 records with transfer syntax XML are
942 returned verbatim. MARC records are returned in
943 <link linkend="tools.turbomarc">
946 (converted from ISO2709 to TurboMARC by YAZ).
947 Upon completion, the XML buffer is returned
948 (type <literal>const char *</literal>) and length is stored in
949 <literal>*len</literal>.
956 <ulink url="&url.marc21;">MARC21</ulink>
958 <ulink url="&url.marc8;">MARC-8</ulink>
959 character set encoding.
960 An application that wishes to display in Latin-1 would use
962 render; charset=marc8,iso-8859-1
965 <sect2 id="zoom.z3950.record.behavior">
966 <title>Z39.50 Protocol behavior</title>
968 The functions <function>ZOOM_resultset_record</function> and
969 <function>ZOOM_resultset_records</function> inspects the client-side
970 record cache. Records not found in cache are fetched using
972 The functions may block (and perform network I/O) - even though option
973 <literal>async</literal> is 1, because they return records objects.
974 (and there's no way to return records objects without retrieving them!).
977 There is a trick, however, in the usage of function
978 <function>ZOOM_resultset_records</function> that allows for
979 delayed retrieval (and makes it non-blocking). By using
980 a null pointer for <parameter>recs</parameter> you're indicating
981 you're not interested in getting records objects
982 <emphasis>now</emphasis>.
985 <sect2 id="zoom.sru.record.behavior">
986 <title>SRU/SOLR Protocol behavior</title>
988 The ZOOM driver for SRU/SOLR treats records returned by a SRU/SOLR server
989 as if they where Z39.50 records with transfer syntax XML and
990 no element set name or database name.
994 <sect1 id="zoom.facets"><title>Facets</title>
996 Facets operations is not part of the official ZOOM specification, but
997 is an Index Data extension for YAZ-based Z39.50 targets or
998 <ulink url="&url.solr;">SOLR</ulink> targets.
999 In case the target can and is requested to return facets, using a
1000 result set the ZOOM client can request one or all facet fields.
1001 Using a facet field the client can request the term count and then
1002 interate over the terms.
1005 ZOOM_facet_field *ZOOM_resultset_facets(ZOOM_resultset r);
1007 const char ** ZOOM_resultset_facets_names(ZOOM_resultset r);
1009 ZOOM_facet_field ZOOM_resultset_get_facet_field(ZOOM_resultset r,
1010 const char *facet_name);
1012 ZOOM_facet_field ZOOM_resultset_get_facet_field_by_index(ZOOM_resultset r,
1015 size_t ZOOM_resultset_facets_size(ZOOM_resultset r);
1017 const char *ZOOM_facet_field_name(ZOOM_facet_field facet_field);
1019 size_t ZOOM_facet_field_term_count(ZOOM_facet_field facet_field);
1021 const char *ZOOM_facet_field_get_term(ZOOM_facet_field facet_field,
1022 size_t idx, int *freq);
1025 References to temporary structures are returned by all functions.
1026 They are only valid as long the Result set is valid.
1027 <function>ZOOM_resultset_get_facet_field</function> or
1028 <function>ZOOM_resultset_get_facet_field_by_index</function>.
1029 <function>ZOOM_resultset_facets</function>.
1030 <function>ZOOM_resultset_facets_names</function>.
1031 <function>ZOOM_facet_field_name</function>.
1032 <function>ZOOM_facet_field_get_term</function>.
1034 <para id="zoom.resultset.get_facet_field">
1035 A single Facet field is returned by function
1036 <function>ZOOM_resultset_get_facet_field</function> or
1037 <function>ZOOM_resultset_get_facet_field_by_index</function> that takes
1038 a result set and facet name or positive index respectively. First
1039 facet has position zero. If no facet could be obtained (invalid name
1040 or index out of bounds) <literal>NULL</literal> is returned.
1042 <para id="zoom.resultset.facets">
1043 An array of facets field can be returned by
1044 <function>ZOOM_resultset_facets</function>. The length of the array is
1045 given by <function>ZOOM_resultset_facets_size</function>. The array is
1046 zero-based and last entry will be at
1047 <function>ZOOM_resultset_facets_size(result_set)</function>-1.
1049 <para id="zoom.resultset.facets_names">
1050 It is possible to interate over facets by name, by calling
1051 <function>ZOOM_resultset_facets_names</function>.
1052 This will return an const array of char * where each string can be used
1053 as parameter for <function>ZOOM_resultset_get_facet_field</function>.
1056 Function <function>ZOOM_facet_field_name</function> gets the request
1057 facet name from a returned facet field.
1060 Function <function>ZOOM_facet_field_get_term</function> returns the
1061 idx'th term and term count for a facet field.
1062 Idx must between 0 and
1063 <function>ZOOM_facet_field_term_count</function>-1, otherwise the
1064 returned reference will be <literal>NULL</literal>. On a valid idx, the
1065 value of the freq reference will be the term count.
1066 The <literal>freq</literal> parameter must be valid pointer to integer.
1069 <sect1 id="zoom.scan"><title>Scan</title>
1071 This section describes an interface for Scan. Scan is not an
1072 official part of the ZOOM model yet. The result of a scan operation
1073 is the <literal>ZOOM_scanset</literal> which is a set of terms
1074 returned by a target.
1078 The Scan interface is supported for both Z39.50, SRU (and SOLR?).
1082 ZOOM_scanset ZOOM_connection_scan(ZOOM_connection c,
1083 const char *startpqf);
1085 ZOOM_scanset ZOOM_connection_scan1(ZOOM_connection c,
1088 size_t ZOOM_scanset_size(ZOOM_scanset scan);
1090 const char *ZOOM_scanset_term(ZOOM_scanset scan, size_t pos,
1091 size_t *occ, size_t *len);
1093 const char *ZOOM_scanset_display_term(ZOOM_scanset scan, size_t pos,
1094 size_t *occ, size_t *len);
1096 void ZOOM_scanset_destroy(ZOOM_scanset scan);
1098 const char *ZOOM_scanset_option_get(ZOOM_scanset scan,
1101 void ZOOM_scanset_option_set(ZOOM_scanset scan, const char *key,
1105 The scan set is created by function
1106 <function>ZOOM_connection_scan</function> which performs a scan
1107 operation on the connection using the specified
1108 <parameter>startpqf</parameter>.
1109 If the operation was successful, the size of the scan set can be
1110 retrieved by a call to <function>ZOOM_scanset_size</function>.
1111 Like result sets, the items are numbered 0,..size-1.
1112 To obtain information about a particular scan term, call function
1113 <function>ZOOM_scanset_term</function>. This function takes
1114 a scan set offset <literal>pos</literal> and returns a pointer
1115 to a <emphasis>raw term</emphasis> or <literal>NULL</literal> if
1117 If present, the <literal>occ</literal> and <literal>len</literal>
1118 are set to the number of occurrences and the length
1119 of the actual term respectively.
1120 <function>ZOOM_scanset_display_term</function> is similar to
1121 <function>ZOOM_scanset_term</function> except that it returns
1122 the <emphasis>display term</emphasis> rather than the raw term.
1123 In a few cases, the term is different from display term. Always
1124 use the display term for display and the raw term for subsequent
1125 scan operations (to get more terms, next scan result, etc).
1128 A scan set may be freed by a call to function
1129 <function>ZOOM_scanset_destroy</function>.
1130 Functions <function>ZOOM_scanset_option_get</function> and
1131 <function>ZOOM_scanset_option_set</function> retrieves and sets
1132 an option respectively.
1136 The <parameter>startpqf</parameter> is a subset of PQF, namely
1137 the Attributes+Term part. Multiple <literal>@attr</literal> can
1138 be used. For example to scan in title (complete) phrases:
1140 @attr 1=4 @attr 6=2 "science o"
1145 The <function>ZOOM_connecton_scan1</function> is a newer and
1146 more generic alternative to <function>ZOOM_connection_scan</function>
1147 which allows to use both CQL and PQF for Scan.
1150 <table frame="top" id="zoom.scanset.options">
1151 <title>ZOOM Scan Set Options</title>
1153 <colspec colwidth="4*" colname="name"></colspec>
1154 <colspec colwidth="7*" colname="description"></colspec>
1155 <colspec colwidth="2*" colname="default"></colspec>
1158 <entry>Option</entry>
1159 <entry>Description</entry>
1160 <entry>Default</entry>
1165 number</entry><entry>Number of Scan Terms requested in next scan.
1166 After scan it holds the actual number of terms returned.
1167 </entry><entry>20</entry></row>
1169 position</entry><entry>Preferred Position of term in response
1170 in next scan; actual position after completion of scan.
1171 </entry><entry>1</entry></row>
1173 stepSize</entry><entry>Step Size
1174 </entry><entry>0</entry></row>
1176 scanStatus</entry><entry>An integer indicating the Scan Status
1178 </entry><entry>0</entry></row>
1180 rpnCharset</entry><entry>Character set for RPN terms.
1181 If this is set, ZOOM C will assume that the ZOOM application is
1182 running UTF-8. Terms in RPN queries are then converted to the
1183 rpnCharset. If this is unset, ZOOM C will not assume any encoding
1184 of RPN terms and no conversion is performed.
1185 </entry><entry>none</entry></row>
1191 <sect1 id="zoom.extendedservices"><title>Extended Services</title>
1193 ZOOM offers an interface to a subset of the Z39.50 extended services
1194 as well as a few privately defined ones:
1199 Z39.50 Item Order (ILL).
1200 See <xref linkend="zoom.item.order"/>.
1205 Record Update. This allows a client to insert, modify or delete
1207 See <xref linkend="zoom.record.update"/>.
1212 Database Create. This a non-standard feature. Allows a client
1213 to create a database.
1214 See <xref linkend="zoom.database.create"/>.
1219 Database Drop. This a non-standard feature. Allows a client
1220 to delete/drop a database.
1221 See <xref linkend="zoom.database.drop"/>.
1226 Commit operation. This a non-standard feature. Allows a client
1227 to commit operations.
1228 See <xref linkend="zoom.commit"/>.
1231 <!-- all the ILL PDU options should go here too -->
1234 To create an extended service operation a <literal>ZOOM_package</literal>
1235 must be created. The operation is a five step operation. The
1236 package is created, package is configured by means of options,
1237 the package is send, result is inspected (by means of options),
1238 the package is destroyed.
1241 ZOOM_package ZOOM_connection_package(ZOOM_connection c,
1242 ZOOM_options options);
1244 const char *ZOOM_package_option_get(ZOOM_package p,
1246 void ZOOM_package_option_set(ZOOM_package p, const char *key,
1248 void ZOOM_package_send(ZOOM_package p, const char *type);
1250 void ZOOM_package_destroy(ZOOM_package p);
1253 The <function>ZOOM_connection_package</function> creates a
1254 package for the connection given using the options specified.
1257 Functions <function>ZOOM_package_option_get</function> and
1258 <function>ZOOM_package_option_set</function> gets and sets
1262 <function>ZOOM_package_send</function> sends
1263 the package the via connection specified in
1264 <function>ZOOM_connection_package</function>.
1265 The <parameter>type</parameter> specifies the actual extended service
1266 package type to be sent.
1269 <table frame="top" id="zoom.extendedservices.options">
1270 <title>Extended Service Common Options</title>
1272 <colspec colwidth="4*" colname="name"></colspec>
1273 <colspec colwidth="7*" colname="description"></colspec>
1274 <colspec colwidth="3*" colname="default"></colspec>
1277 <entry>Option</entry>
1278 <entry>Description</entry>
1279 <entry>Default</entry>
1284 <entry>package-name</entry>
1285 <entry>Extended Service Request package name. Must be specified
1286 as part of a request</entry>
1290 <entry>user-id</entry>
1291 <entry>User ID of Extended Service Package. Is a request option</entry>
1295 <entry>function</entry>
1297 Function of package - one of <literal>create</literal>,
1298 <literal>delete</literal>, <literal>modify</literal>. Is
1301 <entry><literal>create</literal></entry>
1304 <entry>waitAction</entry>
1306 Wait action for package. Possible values:
1307 <literal>wait</literal>, <literal>waitIfPossible</literal>,
1308 <literal>dontWait</literal> or <literal>dontReturnPackage</literal>.
1310 <entry><literal>waitIfPossible</literal></entry>
1313 <entry>targetReference</entry>
1315 Target Reference. This is part of the response as returned
1316 by the server. Read it after a successful operation.
1318 <entry><literal>none</literal></entry>
1324 <sect2 id="zoom.item.order"><title>Item Order</title>
1326 For Item Order, type must be set to <literal>itemorder</literal> in
1327 <function>ZOOM_package_send</function>.
1330 <table frame="top" id="zoom.item.order.options">
1331 <title>Item Order Options</title>
1333 <colspec colwidth="4*" colname="name"></colspec>
1334 <colspec colwidth="7*" colname="description"></colspec>
1335 <colspec colwidth="3*" colname="default"></colspec>
1338 <entry>Option</entry>
1339 <entry>Description</entry>
1340 <entry>Default</entry>
1345 <entry>contact-name</entry>
1346 <entry>ILL contact name</entry>
1350 <entry>contact-phone</entry>
1351 <entry>ILL contact phone</entry>
1355 <entry>contact-email</entry>
1356 <entry>ILL contact email</entry>
1360 <entry>itemorder-item</entry>
1361 <entry>Position for item (record) requested. An integer</entry>
1370 <sect2 id="zoom.record.update"><title>Record Update</title>
1372 For Record Update, type must be set to <literal>update</literal> in
1373 <function>ZOOM_package_send</function>.
1376 <table frame="top" id="zoom.record.update.options">
1377 <title>Record Update Options</title>
1379 <colspec colwidth="4*" colname="name"></colspec>
1380 <colspec colwidth="7*" colname="description"></colspec>
1381 <colspec colwidth="3*" colname="default"></colspec>
1384 <entry>Option</entry>
1385 <entry>Description</entry>
1386 <entry>Default</entry>
1391 <entry>action</entry>
1393 The update action. One of
1394 <literal>specialUpdate</literal>,
1395 <literal>recordInsert</literal>,
1396 <literal>recordReplace</literal>,
1397 <literal>recordDelete</literal>,
1398 <literal>elementUpdate</literal>.
1400 <entry><literal>specialUpdate (recordInsert for updateVersion=1 which does not support specialUpdate)</literal></entry>
1403 <entry>recordIdOpaque</entry>
1404 <entry>Opaque Record ID</entry>
1408 <entry>recordIdNumber</entry>
1409 <entry>Record ID number</entry>
1413 <entry>record</entry>
1414 <entry>The record itself</entry>
1418 <entry>recordOpaque</entry>
1419 <entry>Specifies an opaque record which is
1420 encoded as an ASN.1 ANY type with the OID as tiven by option
1421 <literal>syntax</literal> (see below).
1422 Option <literal>recordOpaque</literal> is an alternative
1423 to record - and <literal>record</literal> option (above) is
1424 ignored if recordOpaque is set. This option is only available in
1425 YAZ 3.0.35 and later and is meant to facilitate Updates with
1431 <entry>syntax</entry>
1432 <entry>The record syntax (transfer syntax). Is a string that
1433 is a known record syntax.
1435 <entry>no syntax</entry>
1438 <entry>databaseName</entry>
1439 <entry>Database from connection object</entry>
1440 <entry>Default</entry>
1443 <entry>correlationInfo.note</entry>
1444 <entry>Correlation Info Note (string)</entry>
1448 <entry>correlationInfo.id</entry>
1449 <entry>Correlation Info ID (integer)</entry>
1453 <entry>elementSetName</entry>
1454 <entry>Element Set for Record</entry>
1458 <entry>updateVersion</entry>
1459 <entry>Record Update version which holds one of the values
1460 1, 2 or 3. Each version has a distinct OID:
1462 (<ulink url="&url.z39.50.extupdate1;">first version</ulink>) ,
1464 (second version) and
1465 1.2.840.10003.9.5.1.1
1466 (<ulink url="&url.z39.50.extupdate3;">third and
1467 newest version</ulink>).
1477 <sect2 id="zoom.database.create"><title>Database Create</title>
1479 For Database Create, type must be set to <literal>create</literal> in
1480 <function>ZOOM_package_send</function>.
1483 <table frame="top" id="zoom.database.create.options">
1484 <title>Database Create Options</title>
1486 <colspec colwidth="4*" colname="name"></colspec>
1487 <colspec colwidth="7*" colname="description"></colspec>
1488 <colspec colwidth="3*" colname="default"></colspec>
1491 <entry>Option</entry>
1492 <entry>Description</entry>
1493 <entry>Default</entry>
1498 <entry>databaseName</entry>
1499 <entry>Database from connection object</entry>
1500 <entry>Default</entry>
1507 <sect2 id="zoom.database.drop"><title>Database Drop</title>
1509 For Database Drop, type must be set to <literal>drop</literal> in
1510 <function>ZOOM_package_send</function>.
1513 <table frame="top" id="zoom.database.drop.options">
1514 <title>Database Drop Options</title>
1516 <colspec colwidth="4*" colname="name"></colspec>
1517 <colspec colwidth="7*" colname="description"></colspec>
1518 <colspec colwidth="3*" colname="default"></colspec>
1521 <entry>Option</entry>
1522 <entry>Description</entry>
1523 <entry>Default</entry>
1528 <entry>databaseName</entry>
1529 <entry>Database from connection object</entry>
1530 <entry>Default</entry>
1537 <sect2 id="zoom.commit"><title>Commit Operation</title>
1539 For Commit, type must be set to <literal>commit</literal> in
1540 <function>ZOOM_package_send</function>.
1544 <sect2 id="zoom.extended.services.behavior">
1545 <title>Protocol behavior</title>
1547 All the extended services are Z39.50-only.
1551 The database create, drop and commit services are privately defined
1553 Refer to <filename>esadmin.asn</filename> in YAZ for the ASN.1
1560 <sect1 id="zoom.options"><title>Options</title>
1562 Most &zoom; objects provide a way to specify options to change behavior.
1563 From an implementation point of view a set of options is just like
1564 an associative array / hash.
1567 ZOOM_options ZOOM_options_create(void);
1569 ZOOM_options ZOOM_options_create_with_parent(ZOOM_options parent);
1571 void ZOOM_options_destroy(ZOOM_options opt);
1574 const char *ZOOM_options_get(ZOOM_options opt, const char *name);
1576 void ZOOM_options_set(ZOOM_options opt, const char *name,
1580 typedef const char *(*ZOOM_options_callback)
1581 (void *handle, const char *name);
1583 ZOOM_options_callback
1584 ZOOM_options_set_callback(ZOOM_options opt,
1585 ZOOM_options_callback c,
1589 <sect1 id="zoom.events"><title>Events</title>
1591 If you're developing non-blocking applications, you have to deal
1595 int ZOOM_event(int no, ZOOM_connection *cs);
1598 The <function>ZOOM_event</function> executes pending events for
1599 a number of connections. Supply the number of connections in
1600 <literal>no</literal> and an array of connections in
1601 <literal>cs</literal> (<literal>cs[0] ... cs[no-1]</literal>).
1602 A pending event could be a sending a search, receiving a response,
1604 When an event has occurred for one of the connections, this function
1605 returns a positive integer <literal>n</literal> denoting that an event
1606 occurred for connection <literal>cs[n-1]</literal>.
1607 When no events are pending for the connections, a value of zero is
1609 To ensure that all outstanding requests are performed call this function
1610 repeatedly until zero is returned.
1613 If <function>ZOOM_event</function> returns and returns non-zero, the
1614 last event that occurred can be expected.
1617 int ZOOM_connection_last_event(ZOOM_connection cs);
1620 <function>ZOOM_connection_last_event</function> returns an event type
1621 (integer) for the last event.
1624 <table frame="top" id="zoom.event.ids">
1625 <title>ZOOM Event IDs</title>
1627 <colspec colwidth="4*" colname="name"></colspec>
1628 <colspec colwidth="7*" colname="description"></colspec>
1631 <entry>Event</entry>
1632 <entry>Description</entry>
1637 <entry>ZOOM_EVENT_NONE</entry>
1638 <entry>No event has occurred</entry>
1641 <entry>ZOOM_EVENT_CONNECT</entry>
1642 <entry>TCP/IP connect has initiated</entry>
1645 <entry>ZOOM_EVENT_SEND_DATA</entry>
1646 <entry>Data has been transmitted (sending)</entry>
1649 <entry>ZOOM_EVENT_RECV_DATA</entry>
1650 <entry>Data has been received)</entry>
1653 <entry>ZOOM_EVENT_TIMEOUT</entry>
1654 <entry>Timeout</entry>
1657 <entry>ZOOM_EVENT_UNKNOWN</entry>
1658 <entry>Unknown event</entry>
1661 <entry>ZOOM_EVENT_SEND_APDU</entry>
1662 <entry>An APDU has been transmitted (sending)</entry>
1665 <entry>ZOOM_EVENT_RECV_APDU</entry>
1666 <entry>An APDU has been received</entry>
1669 <entry>ZOOM_EVENT_RECV_RECORD</entry>
1670 <entry>A result-set record has been received</entry>
1673 <entry>ZOOM_EVENT_RECV_SEARCH</entry>
1674 <entry>A search result been received</entry>
1682 <!-- Keep this comment at the end of the file
1687 sgml-minimize-attributes:nil
1688 sgml-always-quote-attributes:t
1691 sgml-parent-document: "yaz.xml"
1692 sgml-local-catalogs: nil
1693 sgml-namecase-general:t