* Copyright (c) 1995-2002, Index Data
* See the file LICENSE for details.
*
- * $Id: client.c,v 1.164 2002-08-29 21:35:38 ja7 Exp $
+ * $Id: client.c,v 1.166 2002-09-02 13:59:07 adam Exp $
*/
#include <stdio.h>
char setstring[100];
Z_RPNQuery *RPNquery;
Odr_oct ccl_query;
+ YAZ_PQF_Parser pqf_parser;
if (queryType == QueryType_CCL2RPN)
{
{
case QueryType_Prefix:
query.which = Z_Query_type_1;
- RPNquery = p_query_rpn (out, protocol, arg);
+ pqf_parser = yaz_pqf_create ();
+ RPNquery = yaz_pqf_parse (pqf_parser, out, arg);
if (!RPNquery)
{
- printf("Prefix query error\n");
+ const char *pqf_msg;
+ size_t off;
+ int code = yaz_pqf_error (pqf_parser, &pqf_msg, &off);
+ printf("%*s^\n", off+4, "");
+ printf("Prefix query error: %s (code %d)\n", pqf_msg, code);
+
+ yaz_pqf_destroy (pqf_parser);
return 0;
}
+ yaz_pqf_destroy (pqf_parser);
query.u.type_1 = RPNquery;
break;
case QueryType_CCL:
{
Z_APDU *apdu = zget_APDU(out, Z_APDU_scanRequest);
Z_ScanRequest *req = apdu->u.scanRequest;
- int use_rpn = 1;
int oid[OID_SIZE];
if (queryType == QueryType_CCL2RPN)
printf("CCL ERROR: %s\n", ccl_err_msg(error));
return -1;
}
- use_rpn = 0;
bib1.proto = PROTO_Z3950;
bib1.oclass = CLASS_ATTSET;
bib1.value = VAL_BIB1;
}
ccl_rpn_delete (rpn);
}
- if (use_rpn && !(req->termListAndStartPoint =
- p_query_scan(out, protocol, &req->attributeSet, query)))
+ else
{
- printf("Prefix query error\n");
- return -1;
+ YAZ_PQF_Parser pqf_parser = yaz_pqf_create ();
+
+ if (!(req->termListAndStartPoint =
+ yaz_pqf_scan(pqf_parser, out, &req->attributeSet, query)))
+ {
+ const char *pqf_msg;
+ size_t off;
+ int code = yaz_pqf_error (pqf_parser, &pqf_msg, &off);
+ printf("%*s^\n", off+7, "");
+ printf("Prefix query error: %s (code %d)\n", pqf_msg, code);
+ yaz_pqf_destroy (pqf_parser);
+ return -1;
+ }
+ yaz_pqf_destroy (pqf_parser);
}
if (term && *term)
{
printf("Connected to : %s\n",last_open_command);
} else {
if(last_open_command)
- printf("Not Connected to : %s\n",last_open_command);
+ printf("Not connected to : %s\n",last_open_command);
else
- printf("Not Connected : \n");
+ printf("Not connected : \n");
};
if(yazProxy) printf("using proxy : %s\n",yazProxy);
printf("auto_reconnect : %s\n",auto_reconnect?"on":"off");
if (!auth) {
- printf("Authentication : NONE\n");
+ printf("Authentication : none\n");
} else {
switch(auth->which) {
case Z_IdAuthentication_idPass:
printf("Authentication : IdPass\n");
- printf(" Login : %s\n",auth->u.idPass->userId?auth->u.idPass->userId:"");
- printf(" LoginGroup : %s\n",auth->u.idPass->groupId?auth->u.idPass->groupId:"");
- printf(" PassWord : %s\n",auth->u.idPass->password?auth->u.idPass->password:"");
+ printf(" Login User : %s\n",auth->u.idPass->userId?auth->u.idPass->userId:"");
+ printf(" Login Group : %s\n",auth->u.idPass->groupId?auth->u.idPass->groupId:"");
+ printf(" Password : %s\n",auth->u.idPass->password?auth->u.idPass->password:"");
break;
case Z_IdAuthentication_open:
printf("Authentication : psOpen\n");
/* Query options */
printf("CCL file : %s\n",ccl_fields);
- printf("Qurry type : %s\n",query_type_as_string(queryType));
+ printf("Query type : %s\n",query_type_as_string(queryType));
- printf("ElementSet numbering : %s\n",setnumber==-1?"off":"on");
+ printf("Named Result Sets : %s\n",setnumber==-1?"off":"on");
/* piggy back options */
printf("ssub/lslb/mspn : %d/%d/%d\n",smallSetUpperBound,largeSetLowerBound,mediumSetPresentNumber);
/* print present related options */
- printf("format : %s\n",yaz_z3950_oid_value_to_str(recordsyntax,CLASS_RECSYN));
- printf("schema : %s\n",yaz_z3950_oid_value_to_str(schema,CLASS_SCHEMA));
- printf("elements : %s\n",elementSetNames?elementSetNames->u.generic:"");
+ printf("Format : %s\n",yaz_z3950_oid_value_to_str(recordsyntax,CLASS_RECSYN));
+ printf("Schema : %s\n",yaz_z3950_oid_value_to_str(schema,CLASS_SCHEMA));
+ printf("Elements : %s\n",elementSetNames?elementSetNames->u.generic:"");
/* loging options */
- printf("Apdu log : %s\n",apdu_file?"on":"off");
+ printf("APDU log : %s\n",apdu_file?"on":"off");
printf("Record log : %s\n",marcdump?"on":"off");
/* other infos */