+static int rpn2cql_attr(cql_transform_t ct,
+ Z_AttributeList *attributes, WRBUF w)
+{
+ const char *relation = cql_lookup_reverse(ct, "relation.", attributes);
+ const char *index = cql_lookup_reverse(ct, "index.", attributes);
+ const char *structure = cql_lookup_reverse(ct, "structure.", attributes);
+ if (index && strcmp(index, "index.cql.serverChoice"))
+ {
+ wrbuf_puts(w, index+6);
+ if (relation)
+ {
+ relation += 9;
+
+ if (!strcmp(relation, "exact"))
+ relation = "==";
+ else if (!strcmp(relation, "eq"))
+ relation = "=";
+ else if (!strcmp(relation, "le"))
+ relation = "<=";
+ else if (!strcmp(relation, "ge"))
+ relation = ">=";
+ wrbuf_puts(w, relation);
+ }
+ else
+ wrbuf_puts(w, "=");
+
+ if (structure)
+ {
+ structure += 10;
+ if (strcmp(structure, "*"))
+ {
+ wrbuf_puts(w, "/");
+ wrbuf_puts(w, structure);
+ wrbuf_puts(w, " ");
+ }
+ }
+ }
+ return 0;
+}
+