/*
- * Copyright (c) 1995-2002, Index Data
+ * Copyright (c) 1995-2003, Index Data
* See the file LICENSE for details.
*
- * $Id: client.c,v 1.177 2002-12-16 13:30:41 adam Exp $
+ * $Id: client.c,v 1.182 2003-02-17 21:23:31 adam Exp $
*/
#include <stdio.h>
typedef enum {
QueryType_Prefix,
QueryType_CCL,
- QueryType_CCL2RPN
+ QueryType_CCL2RPN,
+ QueryType_CQL
} QueryType;
static QueryType queryType = QueryType_Prefix;
case QueryType_Prefix: return "prefix (RPN sent to server)";
case QueryType_CCL: return "CCL (CCL sent to server) ";
case QueryType_CCL2RPN: return "CCL -> RPN (RPN sent to server)";
+ case QueryType_CQL: return "CQL (CQL sent to server)";
default:
return "unknown Query type internal yaz-client error";
}
Z_RPNQuery *RPNquery;
Odr_oct ccl_query;
YAZ_PQF_Parser pqf_parser;
+ Z_External *ext;
if (queryType == QueryType_CCL2RPN)
{
query.u.type_1 = RPNquery;
ccl_rpn_delete (rpn);
break;
+ case QueryType_CQL:
+ query.which = Z_Query_type_104;
+ ext = (Z_External *) odr_malloc(out, sizeof(*ext));
+ ext->direct_reference = odr_getoidbystr(out, "1.2.840.10003.16.2");
+ ext->indirect_reference = 0;
+ ext->descriptor = 0;
+ ext->which = Z_External_CQL;
+ ext->u.cql = odr_strdup(out, arg);
+ query.u.type_104 = ext;
+ break;
default:
printf ("Unsupported query type\n");
return 0;
compo.u.complex->generic = (Z_Specification *)
odr_malloc(out, sizeof(*compo.u.complex->generic));
- compo.u.complex->generic->schema = (Odr_oid *)
+ compo.u.complex->generic->which = Z_Schema_oid;
+ compo.u.complex->generic->schema.oid = (Odr_oid *)
odr_oiddup(out, oid_ent_to_oid(&prefschema, oid));
- if (!compo.u.complex->generic->schema)
+ if (!compo.u.complex->generic->schema.oid)
{
/* OID wasn't a schema! Try record syntax instead. */
prefschema.oclass = CLASS_RECSYN;
- compo.u.complex->generic->schema = (Odr_oid *)
+ compo.u.complex->generic->schema.oid = (Odr_oid *)
odr_oiddup(out, oid_ent_to_oid(&prefschema, oid));
}
if (!elementSetNames)
int cmd_format(char *arg)
{
+ oid_value nsyntax;
if (!arg || !*arg)
{
printf("Usage: format <recordsyntax>\n");
return 0;
}
- recordsyntax = oid_getvalbyname (arg);
- if (recordsyntax == VAL_NONE)
+ nsyntax = oid_getvalbyname (arg);
+ if (strcmp(arg, "none") && nsyntax == VAL_NONE)
{
printf ("unknown record syntax\n");
return 0;
}
+ recordsyntax = nsyntax;
return 1;
}
queryType = QueryType_Prefix;
else if (!strcmp (arg, "ccl2rpn") || !strcmp (arg, "cclrpn"))
queryType = QueryType_CCL2RPN;
+ else if (!strcmp(arg, "cql"))
+ queryType = QueryType_CQL;
else
{
printf ("Querytype must be one of:\n");
printf (" prefix - Prefix query\n");
printf (" ccl - CCL query\n");
printf (" ccl2rpn - CCL query converted to RPN\n");
+ printf (" cql - CQL\n");
return 0;
}
return 1;