+/*
+ * Translate the CQL string client-side into RPN which is passed to
+ * the server. This is useful for server's that don't themselves
+ * support CQL, for which ZOOM_query_cql() is useless. `conn' is used
+ * only as a place to stash diagnostics if compilation fails; if this
+ * information is not needed, a null pointer may be used.
+ */
+ZOOM_API(int)
+ZOOM_query_cql2rpn(ZOOM_query s, const char *str, ZOOM_connection conn)
+{
+ char *rpn;
+ int ret;
+
+ yaz_log(log_details, "%p ZOOM_query_cql2rpn str=%s conn=%p", s, str, conn);
+ if (conn == 0)
+ conn = ZOOM_connection_create(0);
+
+ if ((rpn = cql2pqf(conn, str)) == 0)
+ return -1;
+
+ ret = ZOOM_query_prefix(s, rpn);
+ xfree(rpn);
+ return ret;
+}
+