00001 /** 00002 * @file z3950ClientMS.c 00003 * 00004 */ 00005 00006 /*** Copyright (c), The Regents of the University of California *** 00007 *** For more information please refer to files in the COPYRIGHT directory ***/ 00008 00009 00010 #include "yaz/zoom.h" 00011 #include "rsApiHandler.h" 00012 #include "objMetaOpr.h" 00013 #include "z3950ClientMS.h" 00014 00015 00016 /** 00017 * \fn msiz3950Submit(msParam_t *serverName,msParam_t *query, msParam_t *recordSyntax, 00018 * msParam_t *outParam, ruleExecInfo_t *rei ) 00019 * 00020 * \brief Retrieves a record from a Z39.50 server 00021 * 00022 * \module Z3950 00023 * 00024 * \since after 2.4.1 00025 * 00026 * \author Rahul Deshmukh and Terrell Russell, SILS at UNC-Chapel Hill 00027 * \date Summer 2010 00028 * 00029 * \usage See clients/icommands/test/rules3.0/ 00030 * 00031 * \param[in] serverName - a STR_MS_T containing the name of the Z39.50 server 00032 * \param[in] query - a STR_MS_T containing the input query to the Z39.50 server 00033 * \param[in] recordSyntax - a STR_MS_T containing the preferred syntax for the returned record 00034 * \param[out] outParam - a STR_MS_T containing the retrieved record 00035 * \param[in,out] rei - The RuleExecInfo structure that is automatically 00036 * handled by the rule engine. The user does not include rei as a 00037 * parameter in the rule invocation. 00038 * 00039 * \DolVarDependence none 00040 * \DolVarModified none 00041 * \iCatAttrDependence none 00042 * \iCatAttrModified none 00043 * \sideeffect none 00044 * 00045 * \return integer 00046 * \retval 0 on success 00047 * \pre none 00048 * \post none 00049 * \sa none 00050 **/ 00051 00052 int 00053 msiz3950Submit(msParam_t *serverName,msParam_t *query, msParam_t *recordSyntax, msParam_t *outParam, ruleExecInfo_t *rei ) 00054 { 00055 00056 const char *rec; 00057 char *sName = serverName->inOutStruct ; 00058 char *zquery = query->inOutStruct; 00059 char *rSyntax = recordSyntax->inOutStruct; 00060 00061 ZOOM_connection z = ZOOM_connection_new (sName, 0); // 0 denotes port number 00062 ZOOM_resultset r; 00063 00064 ZOOM_connection_option_set(z, "preferredRecordSyntax", rSyntax); 00065 r = ZOOM_connection_search_pqf(z,zquery); 00066 00067 00068 rec = ZOOM_record_get (ZOOM_resultset_record (r, 0), "render", 0); 00069 00070 /* 00071 snprintf (outStr, MAX_NAME_LEN, "Here is the record: \n %s", rec); 00072 fillStrInMsParam (outParam, outStr); 00073 */ 00074 fillStrInMsParam (outParam, (char *)rec); 00075 00076 ZOOM_connection_destroy(z); 00077 00078 return 0; 00079 } 00080