YAZ
5.34.0
|
Retrieval utility. More...
#include <stddef.h>
#include <yaz/wrbuf.h>
#include <yaz/yconfig.h>
#include <yaz/oid_util.h>
#include <yaz/record_conv.h>
Go to the source code of this file.
Typedefs | |
typedef struct yaz_retrieval_struct * | yaz_retrieval_t |
Functions | |
yaz_retrieval_t | yaz_retrieval_create (void) |
void | yaz_retrieval_destroy (yaz_retrieval_t p) |
int | yaz_retrieval_configure (yaz_retrieval_t p, const xmlNode *node) |
int | yaz_retrieval_configure_t (yaz_retrieval_t p, const xmlNode *node, struct yaz_record_conv_type *types) |
int | yaz_retrieval_request (yaz_retrieval_t p, const char *schema, const Odr_oid *syntax, const char **match_schema, Odr_oid **match_syntax, yaz_record_conv_t *rc, const char **backend_schema, Odr_oid **backend_syntax) |
const char * | yaz_retrieval_get_error (yaz_retrieval_t p) |
void | yaz_retrieval_set_path (yaz_retrieval_t p, const char *path) |
Retrieval utility.
Definition in file retrieval.h.
typedef struct yaz_retrieval_struct* yaz_retrieval_t |
retrieval handle
Definition at line 45 of file retrieval.h.
int yaz_retrieval_configure | ( | yaz_retrieval_t | p, |
const xmlNode * | node | ||
) |
configures retrieval
p | retrieval handle |
node | xmlNode pointer (root element of XML config) |
0 | success |
-1 | failure |
On failure, call yaz_retrieval_get_error to get error string.
For retrieval:
<retrievalinfo> <retrieval syntax="usmarc" name="F"/> <retrieval syntax="usmarc" name="B"/> <retrieval syntax="xml" name="marcxml" identifier="info:srw/schema/1/marcxml-v1.1"> <backend syntax="usmarc" name="F"> <marc inputformat="marc" outputformat="marcxml" inputcharset="marc-8"/> </backend> </retrieval> <retrieval syntax="xml" name="dc"> <backend syntax="usmarc" name="F"> <marc inputformat="marc" outputformat="marcxml" inputcharset="marc-8"/> <xslt stylesheet="MARC21slim2DC.xsl"/> </backend> </retrieval> </retrievalinfo>
Definition at line 292 of file retrieval.c.
References yaz_retrieval_configure_t().
Referenced by xml_config_read().
int yaz_retrieval_configure_t | ( | yaz_retrieval_t | p, |
const xmlNode * | node, | ||
struct yaz_record_conv_type * | types | ||
) |
configures retrieval with user-defined conversion types
p | retrieval handle |
node | xmlNode pointer (root element of XML config) |
types | record conversion types |
0 | success |
-1 | failure |
On failure, use yaz_retrieval_get_error to get error string.
Definition at line 258 of file retrieval.c.
References conf_retrieval(), yaz_retrieval_struct::wr_error, wrbuf_printf(), and yaz_retrieval_reset().
Referenced by yaz_retrieval_configure().
yaz_retrieval_t yaz_retrieval_create | ( | void | ) |
creates retrieval handle
Definition at line 75 of file retrieval.c.
References yaz_retrieval_struct::list, yaz_retrieval_struct::nmem, yaz_retrieval_struct::odr, odr_createmem(), ODR_ENCODE, odr_getmem, yaz_retrieval_struct::path, yaz_retrieval_struct::wr_error, wrbuf_alloc(), xmalloc, and yaz_retrieval_reset().
Referenced by gfs_server_new().
void yaz_retrieval_destroy | ( | yaz_retrieval_t | p | ) |
destroys retrieval handle
p | retrieval handle |
Definition at line 87 of file retrieval.c.
References yaz_retrieval_struct::odr, odr_destroy(), yaz_retrieval_struct::path, yaz_retrieval_struct::wr_error, wrbuf_destroy(), xfree, and yaz_retrieval_reset().
const char* yaz_retrieval_get_error | ( | yaz_retrieval_t | p | ) |
returns error string (for last error)
p | record conversion handle |
Definition at line 402 of file retrieval.c.
References yaz_retrieval_struct::wr_error, and wrbuf_cstr().
Referenced by retrieve_fetch(), and xml_config_read().
int yaz_retrieval_request | ( | yaz_retrieval_t | p, |
const char * | schema, | ||
const Odr_oid * | syntax, | ||
const char ** | match_schema, | ||
Odr_oid ** | match_syntax, | ||
yaz_record_conv_t * | rc, | ||
const char ** | backend_schema, | ||
Odr_oid ** | backend_syntax | ||
) |
performs retrieval request based on schema and format
p | retrieval handle |
schema | record schema (SRU) / element set name (Z39.50) |
syntax | record syntax (format) |
match_schema | matched schema (if conversion was successful) |
match_syntax | matced syntax OID if conversion was successful) |
rc | record conversion reference (if conversion was successful) |
backend_schema | backend scchema (if conversion was successful) |
backend_syntax | backend syntax (if conversion was successful) |
0 | success, schema and syntax matches |
-1 | failure, use yaz_retrieval_get_error() for reason |
1 | schema does not match |
2 | syntax does not match |
3 | both match but not together |
Definition at line 297 of file retrieval.c.
References yaz_retrieval_elem::backend_name, yaz_retrieval_elem::backend_syntax, yaz_retrieval_elem::identifier, yaz_retrieval_struct::list, yaz_retrieval_elem::name, yaz_retrieval_elem::next, oid_oid_to_dotstring(), oid_oidcmp(), OID_STR_MAX, yaz_retrieval_elem::record_conv, yaz_retrieval_elem::split, yaz_retrieval_elem::syntax, yaz_retrieval_struct::wr_error, wrbuf_alloc(), wrbuf_cstr(), wrbuf_printf(), wrbuf_puts(), wrbuf_rewind(), wrbuf_write(), and yaz_match_glob2().
Referenced by retrieve_fetch().
void yaz_retrieval_set_path | ( | yaz_retrieval_t | p, |
const char * | path | ||
) |
set path for opening stylesheets etc.
p | record conversion handle |
path | file path (UNIX style with : / Windows with ;) |
Definition at line 407 of file retrieval.c.
References yaz_retrieval_struct::path, xfree, and xstrdup.
Referenced by xml_config_read().