20 static void pr_n(
void (*pr)(
const char *buf,
void *client_data),
21 const char *buf,
int len,
void *client_data)
28 if (left >=
sizeof(tmp))
30 memcpy(tmp, buf,
sizeof(tmp)-1);
31 tmp[
sizeof(tmp)-1] =
'\0';
32 left = left - (
sizeof(tmp)-1);
36 memcpy(tmp, buf, left);
45 void (*pr)(
const char *buf,
void *client_data),
49 int caseSensitive = 0;
50 const char *missingValue =
"highValue";
51 for (; cn; cn = cn->
u.
st.modifiers)
53 const char *indx = cn->
u.
st.index;
54 if (!strncmp(indx,
"sort.", 5))
56 if (!strcmp(indx,
"ignoreCase"))
58 else if (!strcmp(indx,
"respectCase"))
60 else if (!strcmp(indx,
"ascending"))
62 else if (!strcmp(indx,
"descending"))
64 else if (!strcmp(indx,
"missingOmit"))
65 missingValue =
"omit";
66 else if (!strcmp(indx,
"missingFail"))
67 missingValue =
"abort";
68 else if (!strcmp(indx,
"missingLow"))
69 missingValue =
"lowValue";
70 else if (!strcmp(indx,
"missingHigh"))
71 missingValue =
"highValue";
75 pr(ascending ?
"1" :
"0", client_data);
77 pr(caseSensitive ?
"1" :
"0", client_data);
79 pr(missingValue, client_data);
84 void (*pr)(
const char *buf,
void *client_data),
90 for (; cn; cn = cn->
u.
sort.next)
92 const char *indx = cn->
u.
sort.index;
96 const char *s = strchr(indx,
'.');
100 pr(
",", client_data);
101 pr_n(pr, indx, s - indx, client_data);
105 pr(indx, client_data);
106 pr(
",", client_data);
108 pr(
",", client_data);
113 pr(
" ", client_data);
130 info.
buf[info.
off] =
'\0';
Header with public definitions about CQL.
#define CQL_NODE_SORT
Node type: sortby single spec.
int cql_sortby_to_sortkeys(struct cql_node *cn, void(*pr)(const char *buf, void *client_data), void *client_data)
converts CQL sortby to sortkeys (ala versions 1.1)
static void pr_n(void(*pr)(const char *buf, void *client_data), const char *buf, int len, void *client_data)
static int cql_sort_modifiers(struct cql_node *cn, void(*pr)(const char *buf, void *client_data), void *client_data)
int cql_sortby_to_sortkeys_buf(struct cql_node *cn, char *out, int max)
converts CQL sortby to sortkeys ..
Structure used by cql_buf_write_handler.
struct cql_node::@10::@13 sort
struct cql_node::@10::@11 st
Header for WRBUF (growing buffer)
void cql_buf_write_handler(const char *b, void *client_data)
Handler for cql_buf_write_info.