From: Adam Dickmeiss Date: Wed, 9 Apr 2014 13:24:17 +0000 (+0200) Subject: allow RPN to CQL conversion with Yaz_cql2rpn class YPP-13 X-Git-Tag: v1.6.0~3 X-Git-Url: http://jsfdemo.indexdata.com/cgi-bin?a=commitdiff_plain;h=3c714ed0d987533fedde0747836ac0f30fdd0b11;p=yazpp-moved-to-github.git allow RPN to CQL conversion with Yaz_cql2rpn class YPP-13 --- diff --git a/include/yazpp/cql2rpn.h b/include/yazpp/cql2rpn.h index 211e3da..6f4d820 100644 --- a/include/yazpp/cql2rpn.h +++ b/include/yazpp/cql2rpn.h @@ -37,6 +37,7 @@ class YAZ_EXPORT Yaz_cql2rpn { bool parse_spec_file(const char *fname, int *error); int query_transform(const char *cql, Z_RPNQuery **rpnquery, ODR o, char **addinfop); + int rpn2cql_transform(Z_RPNQuery *q, WRBUF cql, ODR o, char **addinfop); private: cql_transform_t m_transform; }; diff --git a/src/yaz-cql2rpn.cpp b/src/yaz-cql2rpn.cpp index 7e1900c..d61d34c 100644 --- a/src/yaz-cql2rpn.cpp +++ b/src/yaz-cql2rpn.cpp @@ -11,6 +11,7 @@ #include #include #include +#include using namespace yazpp_1; @@ -40,6 +41,20 @@ bool Yaz_cql2rpn::parse_spec_file(const char *fname, int *error) return m_transform ? true : false; } +int Yaz_cql2rpn::rpn2cql_transform(Z_RPNQuery *q, WRBUF cql, ODR o, + char **addinfop) +{ + int r = cql_transform_rpn2cql_wrbuf(m_transform, cql, q); + *addinfop = 0; + if (r) + { + const char *addinfo = 0; + r = cql_transform_error(m_transform, &addinfo); + *addinfop = odr_strdup_null(o, addinfo); + } + return r; +} + int Yaz_cql2rpn::query_transform(const char *cql_query, Z_RPNQuery **rpnquery, ODR o, char **addinfop)